Question about Trait Bounds (from Rust for Rustaceans)

15 points YasoloX

In Rust for Rustaceans' section about Trait Bounds on page 31 in the last 5 lines it says:

For example, if your method wants to construct a HashMap<K, V, S> whose keys are some generic type T and whose value is a usize, instead of writing the bounds like where T: Hash + Eq, S: BuildHasher + Default, you could write where HashMap<T, usize, S>: FromIterator.

While I can confirm that where T: Hash + Eq, S: BuildHasher + Default does work. The alternative where HashMap<T, usize, S>: FromIterator does not work for me as you can see here. I don't think the author Jon Gjengset (I love this guy) is wrong as it would have been resolved in the errata.

  1. How do I apply the where HashMap<...> clause correctly without using the bounds?
  2. Why is the generic <T> of FromIterator missing?