11//@ edition:2021
22// gate-test-anonymous_lifetime_in_impl_trait
3+
34// Verify the behaviour of `feature(anonymous_lifetime_in_impl_trait)`.
45
56mod elided {
67 fn f ( _: impl Iterator < Item = & ( ) > ) { }
7- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
88
99 fn g ( mut x : impl Iterator < Item = & ( ) > ) -> Option < & ( ) > { x. next ( ) }
10- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
10+ //~^ ERROR lifetime may not live long
1111 //~| ERROR missing lifetime specifier
1212
1313 // Anonymous lifetimes in async fn are already allowed.
@@ -17,16 +17,15 @@ mod elided {
1717 // Anonymous lifetimes in async fn are already allowed.
1818 // But that lifetime does not participate in resolution.
1919 async fn i ( mut x : impl Iterator < Item = & ( ) > ) -> Option < & ( ) > { x. next ( ) }
20- //~^ ERROR missing lifetime specifier
21- //~| ERROR lifetime may not live long enough
20+ //~^ ERROR lifetime may not live long
21+ //~| ERROR missing lifetime specifier
2222}
2323
2424mod underscore {
2525 fn f ( _: impl Iterator < Item = & ' _ ( ) > ) { }
26- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
2726
2827 fn g ( mut x : impl Iterator < Item = & ' _ ( ) > ) -> Option < & ' _ ( ) > { x. next ( ) }
29- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
28+ //~^ ERROR lifetime may not live long
3029 //~| ERROR missing lifetime specifier
3130
3231 // Anonymous lifetimes in async fn are already allowed.
@@ -36,29 +35,27 @@ mod underscore {
3635 // Anonymous lifetimes in async fn are already allowed.
3736 // But that lifetime does not participate in resolution.
3837 async fn i ( mut x : impl Iterator < Item = & ' _ ( ) > ) -> Option < & ' _ ( ) > { x. next ( ) }
39- //~^ ERROR missing lifetime specifier
40- //~| ERROR lifetime may not live long enough
38+ //~^ ERROR lifetime may not live long
39+ //~| ERROR missing lifetime specifier
4140}
4241
4342mod alone_in_path {
4443 trait Foo < ' a > { fn next ( & mut self ) -> Option < & ' a ( ) > ; }
4544
4645 fn f ( _: impl Foo ) { }
47- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
4846
4947 fn g ( mut x : impl Foo ) -> Option < & ( ) > { x. next ( ) }
50- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
48+ //~^ ERROR lifetime may not live long
5149 //~| ERROR missing lifetime specifier
5250}
5351
5452mod in_path {
5553 trait Foo < ' a , T > { fn next ( & mut self ) -> Option < & ' a T > ; }
5654
5755 fn f ( _: impl Foo < ( ) > ) { }
58- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
5956
6057 fn g ( mut x : impl Foo < ( ) > ) -> Option < & ( ) > { x. next ( ) }
61- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
58+ //~^ ERROR lifetime may not live long
6259 //~| ERROR missing lifetime specifier
6360}
6461
0 commit comments