I can’t get the following to compile — the compiler won’t resolve `rng.gen()`

to bool in the first use. Interestingly if the `where`

bound is removed the compiler *can* resolve this use of *gen*, but obviously the second use is invalid without the `where`

bound.

```
/// Uniform value distribution
pub struct Uniform;
/// A random number generator.
pub trait Rng {
fn gen<T>(&mut self) -> T where Self: Sized, Uniform: Distribution<T> {
Uniform.sample(self)
}
}
/// Types (distributions) that can be used to create a random instance of `T`.
pub trait Distribution<T> {
/// Generate a random value of `T`, using `rng` as the
/// source of randomness.
fn sample<R: Rng>(&self, rng: &mut R) -> T;
}
impl Distribution<bool> for Uniform {
fn sample<R: Rng>(&self, rng: &mut R) -> bool {
// omitted for brevity
unimplemented!()
}
}
impl<T> Distribution<Option<T>> for Uniform where Uniform: Distribution<T> {
fn sample<R: Rng>(&self, rng: &mut R) -> Option<T> {
// Compiler can't resolve T==bool here, unless the
// Uniform: Distribution<T> constraint is removed
// (in which case the second use of gen() fails).
if rng.gen() {
Some(rng.gen())
} else {
None
}
}
}
```