1 // Test that we handle the case when a local variable is borrowed for `'static`
2 // due to an outlives constraint involving a region in an incompatible universe
4 pub trait Outlives<'this> {}
6 impl<'this, T> Outlives<'this> for T where T: 'this {}
11 impl<'a, T: 'a> Reference for &'a T {
12 type AssociatedType = &'a ();
15 fn assert_static_via_hrtb<G>(_: G) where for<'a> G: Outlives<'a> {}
17 fn assert_static_via_hrtb_with_assoc_type<T>(_: &'_ T)
19 for<'a> &'a T: Reference<AssociatedType = &'a ()>,
24 assert_static_via_hrtb(&local); //~ ERROR `local` does not live long enough
25 assert_static_via_hrtb_with_assoc_type(&&local); //~ ERROR `local` does not live long enough