1 // Test for a less than ideal interaction of implied bounds and normalization.
6 impl<T: 'static> Tr for T {
10 // `<&'a u8 as Tr>::Ty` should cause an error because `&'a u8: Tr` doesn't hold for
11 // all possible 'a. However, we consider normalized types for implied bounds.
13 // We normalize this projection to `&'static &'a u8` and add a nested `&'a u8: 'static`
14 // bound. This bound is then proven using the implied bounds for `&'static &'a u8` which
15 // we only get by normalizing in the first place.
16 fn test<'a>(x: &'a u8, _wf: <&'a u8 as Tr>::Ty) -> &'static u8 { x }
19 // This works as we have 'static references due to promotion.
20 let _: &'static u8 = test(&3, &&3);
21 // This causes an error because the projection requires 'a to be 'static.
22 // It would be unsound if this compiled.
24 let _: &'static u8 = test(&x, &&3);
25 //~^ ERROR `x` does not live long enough