2 // ignore-compare-mode-nll
3 //[nll] compile-flags: -Z borrowck=mir
5 // Test a case where you have an impl of `Foo<X>` for all `X` that
6 // is being applied to `for<'a> Foo<&'a mut X>`. Issue #19730.
9 fn foo(&self, x: X) { }
13 where T : for<'a> Foo<&'a isize>
17 // AnyInt implements Foo<&'a isize> for any 'a, so it is a match.
19 impl<'a> Foo<&'a isize> for AnyInt { }
24 // StaticInt only implements Foo<&'static isize>, so it is an error.
26 impl Foo<&'static isize> for StaticInt { }
28 want_hrtb::<StaticInt>() //~ ERROR
31 // AnyInt implements Foo<&'a isize> for any 'a, so it is a match.
32 impl<'a> Foo<&'a isize> for &'a u32 { }
34 want_hrtb::<&'a u32>()
36 //[nll]~^^ ERROR lifetime may not live long enough
37 //[nll]~| ERROR implementation of `Foo` is not general enough