]> git.proxmox.com Git - rustc.git/blame - src/test/ui/type-alias-impl-trait/assoc-type-lifetime-unconstrained.rs
New upstream version 1.56.0~beta.4+dfsg1
[rustc.git] / src / test / ui / type-alias-impl-trait / assoc-type-lifetime-unconstrained.rs
CommitLineData
74b04a01
XL
1// Tests that we don't allow unconstrained lifetime parameters in impls when
2// the lifetime is used in an associated opaque type.
3
94222f64 4#![feature(type_alias_impl_trait)]
74b04a01
XL
5
6trait UnwrapItemsExt {
7 type Iter;
8 fn unwrap_items(self) -> Self::Iter;
9}
10
11struct MyStruct {}
12
13trait MyTrait<'a> {}
14
15impl<'a> MyTrait<'a> for MyStruct {}
16
17impl<'a, I> UnwrapItemsExt for I {
18 //~^ ERROR the lifetime parameter `'a` is not constrained
19 type Iter = impl MyTrait<'a>;
20
21 fn unwrap_items(self) -> Self::Iter {
22 MyStruct {}
23 }
24}
25
26fn main() {}