1 #![feature(generic_associated_types)]
2 
3 trait Fun {
4     type F<'a>: ?Sized;
5 
identity<'a>(t: &'a Self::F<'a>) -> &'a Self::F<'a>6     fn identity<'a>(t: &'a Self::F<'a>) -> &'a Self::F<'a> { t }
7 }
8 
9 impl <T> Fun for T {
10     type F<'a> = [u8];
11 }
12 
bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(_ : Box<T>) -> &'static T::F<'a>13 fn bug<'a, T: ?Sized + Fun<F<'a> = [u8]>>(_ : Box<T>) -> &'static T::F<'a> {
14     let a = [0; 1];
15     let _x = T::identity(&a);
16       //~^ ERROR: `a` does not live long enough
17     todo!()
18 }
19 
20 
main()21 fn main() {
22     let x = 10;
23 
24     bug(Box::new(x));
25 }
26