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