]> git.lizzy.rs Git - rust.git/blob - src/test/ui/generic-associated-types/gat-in-trait-path.rs
Auto merge of #99612 - yanchen4791:issue-95079-fix, r=compiler-errors
[rust.git] / src / test / ui / generic-associated-types / gat-in-trait-path.rs
1 // revisions: base extended
2 //[base] check-fail
3 //[extended] check-pass
4
5 #![feature(generic_associated_types)]
6 #![feature(associated_type_defaults)]
7 #![cfg_attr(extended, feature(generic_associated_types_extended))]
8 #![cfg_attr(extended, allow(incomplete_features))]
9
10 trait Foo {
11     type A<'a> where Self: 'a;
12 }
13
14 struct Fooy;
15
16 impl Foo for Fooy {
17     type A<'a> = &'a ();
18 }
19
20 #[derive(Clone)]
21 struct Fooer<T>(T);
22
23 impl<T> Foo for Fooer<T> {
24     type A<'x> = &'x () where T: 'x;
25 }
26
27 fn f(_arg : Box<dyn for<'a> Foo<A<'a> = &'a ()>>) {}
28 //[base]~^ the trait `Foo` cannot be made into an object
29
30
31 fn main() {
32   let foo = Fooer(5);
33   f(Box::new(foo));
34 }