blob: 90e7850cad51e446ca2005b10f69dbf0cbf828ef (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
//! The recursive method call yields the opaque type. The
//! `next` method call then constrains the hidden type to `&mut _`
//! because `next` takes `&mut self`. We never resolve the inference
//! variable, but get a type mismatch when comparing `&mut _` with
//! `std::iter::Empty`.
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@[current] check-pass
fn foo(b: bool) -> impl Iterator<Item = ()> {
if b {
foo(false).next().unwrap();
//[next]~^ ERROR type annotations needed
}
std::iter::empty()
}
fn main() {}
|