error[E0282]: type annotations needed --> $DIR/method-resolution4.rs:13:9 | LL | foo(false).next().unwrap(); | ^^^^^^^^^^ cannot infer type error[E0308]: mismatched types --> $DIR/method-resolution4.rs:16:5 | LL | fn foo(b: bool) -> impl Iterator { | ------------------------ the expected opaque type ... LL | std::iter::empty() | ^^^^^^^^^^^^^^^^^^ types differ | = note: expected opaque type `impl Iterator` found struct `std::iter::Empty<_>` error: aborting due to 2 previous errors Some errors have detailed explanations: E0282, E0308. For more information about an error, try `rustc --explain E0282`.