error[E0191]: the value of the associated type `Item` in `Iterator` must be specified --> $DIR/trait-hidden-method.rs:6:33 | LL | Box::new(1..=10) as Box | ^^^^^^^^ help: specify the associated type: `Iterator` error[E0271]: expected `Box` to be an iterator that yields `u32`, but it yields `::Item` --> $DIR/trait-hidden-method.rs:3:32 | LL | pub fn i_can_has_iterator() -> impl Iterator { | ^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found associated type ... LL | Box::new(1..=10) as Box | ------------------------------------- return type was inferred to be `Box` here | = note: expected type `u32` found associated type `::Item` = help: consider constraining the associated type `::Item` to `u32` = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html error: aborting due to 2 previous errors Some errors have detailed explanations: E0191, E0271. For more information about an error, try `rustc --explain E0191`.