1
1
//@ edition:2021
2
2
// gate-test-anonymous_lifetime_in_impl_trait
3
+
3
4
// Verify the behaviour of `feature(anonymous_lifetime_in_impl_trait)`.
4
5
5
6
mod elided {
6
7
fn f ( _: impl Iterator < Item = & ( ) > ) { }
7
- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
8
8
9
9
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
11
11
//~| ERROR missing lifetime specifier
12
12
13
13
// Anonymous lifetimes in async fn are already allowed.
@@ -17,16 +17,15 @@ mod elided {
17
17
// Anonymous lifetimes in async fn are already allowed.
18
18
// But that lifetime does not participate in resolution.
19
19
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
22
22
}
23
23
24
24
mod underscore {
25
25
fn f ( _: impl Iterator < Item = & ' _ ( ) > ) { }
26
- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
27
26
28
27
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
30
29
//~| ERROR missing lifetime specifier
31
30
32
31
// Anonymous lifetimes in async fn are already allowed.
@@ -36,29 +35,27 @@ mod underscore {
36
35
// Anonymous lifetimes in async fn are already allowed.
37
36
// But that lifetime does not participate in resolution.
38
37
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
41
40
}
42
41
43
42
mod alone_in_path {
44
43
trait Foo < ' a > { fn next ( & mut self ) -> Option < & ' a ( ) > ; }
45
44
46
45
fn f ( _: impl Foo ) { }
47
- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
48
46
49
47
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
51
49
//~| ERROR missing lifetime specifier
52
50
}
53
51
54
52
mod in_path {
55
53
trait Foo < ' a , T > { fn next ( & mut self ) -> Option < & ' a T > ; }
56
54
57
55
fn f ( _: impl Foo < ( ) > ) { }
58
- //~^ ERROR anonymous lifetimes in `impl Trait` are unstable
59
56
60
57
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
62
59
//~| ERROR missing lifetime specifier
63
60
}
64
61
0 commit comments