]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/issue-74684-1.rs
Rollup merge of #94019 - hermitcore:target, r=Mark-Simulacrum
[rust.git] / src / test / ui / generic-associated-types / issue-74684-1.rs
1 #![feature(generic_associated_types)]
2
3 trait Fun {
4     type F<'a>: ?Sized;
5
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
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
21 fn main() {
22     let x = 10;
23
24     bug(Box::new(x));
25 }