]> git.lizzy.rs Git - rust.git/blob - src/test/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs
Loop over all opaque types instead of looking at just the first one with the same...
[rust.git] / src / test / ui / type-alias-impl-trait / assoc-type-lifetime-unconstrained.rs
1 // Tests that we don't allow unconstrained lifetime parameters in impls when
2 // the lifetime is used in an associated opaque type.
3
4 // revisions: min_tait full_tait
5 #![feature(min_type_alias_impl_trait)]
6 #![cfg_attr(full_tait, feature(type_alias_impl_trait))]
7 //[full_tait]~^ WARN incomplete
8
9 trait UnwrapItemsExt {
10     type Iter;
11     fn unwrap_items(self) -> Self::Iter;
12 }
13
14 struct MyStruct {}
15
16 trait MyTrait<'a> {}
17
18 impl<'a> MyTrait<'a> for MyStruct {}
19
20 impl<'a, I> UnwrapItemsExt for I {
21     //~^ ERROR the lifetime parameter `'a` is not constrained
22     type Iter = impl MyTrait<'a>;
23
24     fn unwrap_items(self) -> Self::Iter {
25         MyStruct {}
26     }
27 }
28
29 fn main() {}