1 #![feature(generators)]
2 #![feature(auto_traits)]
3 #![feature(negative_impls)]
11 struct A<'a, 'b>(&'a mut bool, &'b mut bool, No);
13 impl<'a, 'b: 'a> Foo for A<'a, 'b> {}
15 struct OnlyFooIfStaticRef(No);
16 impl Foo for &'static OnlyFooIfStaticRef {}
18 struct OnlyFooIfRef(No);
19 impl<'a> Foo for &'a OnlyFooIfRef {}
21 fn assert_foo<T: Foo>(f: T) {}
24 // Make sure 'static is erased for generator interiors so we can't match it in trait selection
25 let x: &'static _ = &OnlyFooIfStaticRef(No);
32 //~^ ERROR implementation of `Foo` is not general enough
33 //~| ERROR implementation of `Foo` is not general enough
35 // Allow impls which matches any lifetime
36 let x = &OnlyFooIfRef(No);
42 assert_foo(gen); // ok
44 // Disallow impls which relates lifetimes in the generator interior
46 let a = A(&mut true, &mut true, No);
51 //~^ ERROR not general enough
52 //~| ERROR not general enough