Skip to content

Commit bdcb628

Browse files
committed
bless tests
1 parent c8b7220 commit bdcb628

30 files changed

+192
-22
lines changed

tests/ui/async-await/issues/issue-63388-1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ trait Foo {}
99
impl Xyz {
1010
async fn do_sth<'a>(
1111
&'a self, foo: &dyn Foo
12-
) -> &dyn Foo
12+
) -> &dyn Foo //~ WARNING elided lifetime has a name
1313
{
1414
//~^ ERROR explicit lifetime required in the type of `foo` [E0621]
1515
foo

tests/ui/async-await/issues/issue-63388-1.stderr

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/issue-63388-1.rs:12:10
3+
|
4+
LL | async fn do_sth<'a>(
5+
| -- lifetime `'a` declared here
6+
LL | &'a self, foo: &dyn Foo
7+
LL | ) -> &dyn Foo
8+
| ^ this elided lifetime gets resolved as `'a`
9+
|
10+
= note: `#[warn(elided_named_lifetimes)]` on by default
11+
112
error[E0621]: explicit lifetime required in the type of `foo`
213
--> $DIR/issue-63388-1.rs:13:5
314
|
@@ -10,6 +21,6 @@ LL | | foo
1021
LL | | }
1122
| |_____^ lifetime `'a` required
1223

13-
error: aborting due to 1 previous error
24+
error: aborting due to 1 previous error; 1 warning emitted
1425

1526
For more information about this error, try `rustc --explain E0621`.

tests/ui/consts/min_const_fn/min_const_fn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ impl<T> Foo<T> {
4444
impl<'a, T> Foo<T> {
4545
const fn new_lt(t: T) -> Self { Foo(t) }
4646
const fn into_inner_lt(self) -> T { self.0 } //~ destructor of
47-
const fn get_lt(&'a self) -> &T { &self.0 }
48-
const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
47+
const fn get_lt(&'a self) -> &T { &self.0 } //~ WARNING elided lifetime has a name
48+
const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } //~ WARNING elided lifetime has a name
4949
//~^ mutable references
5050
//~| mutable references
5151
//~| mutable references

tests/ui/consts/min_const_fn/min_const_fn.stderr

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/min_const_fn.rs:47:34
3+
|
4+
LL | impl<'a, T> Foo<T> {
5+
| -- lifetime `'a` declared here
6+
...
7+
LL | const fn get_lt(&'a self) -> &T { &self.0 }
8+
| ^ this elided lifetime gets resolved as `'a`
9+
|
10+
= note: `#[warn(elided_named_lifetimes)]` on by default
11+
12+
warning: elided lifetime has a name
13+
--> $DIR/min_const_fn.rs:48:42
14+
|
15+
LL | impl<'a, T> Foo<T> {
16+
| -- lifetime `'a` declared here
17+
...
18+
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
19+
| ^ this elided lifetime gets resolved as `'a`
20+
121
error[E0493]: destructor of `Foo<T>` cannot be evaluated at compile-time
222
--> $DIR/min_const_fn.rs:37:25
323
|
@@ -228,7 +248,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {}
228248
| |
229249
| the destructor for this type cannot be evaluated in constant functions
230250

231-
error: aborting due to 24 previous errors
251+
error: aborting due to 24 previous errors; 2 warnings emitted
232252

233253
Some errors have detailed explanations: E0493, E0658.
234254
For more information about an error, try `rustc --explain E0493`.

tests/ui/generics/generic-no-mangle.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ run-rustfix
2-
#![allow(dead_code)]
2+
#![allow(dead_code, elided_named_lifetimes)]
33
#![deny(no_mangle_generic_items)]
44

55
pub fn foo<T>() {} //~ ERROR functions generic over types or consts must be mangled

tests/ui/generics/generic-no-mangle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@ run-rustfix
2-
#![allow(dead_code)]
2+
#![allow(dead_code, elided_named_lifetimes)]
33
#![deny(no_mangle_generic_items)]
44

55
#[no_mangle]

tests/ui/impl-trait/impl-fn-hrtb-bounds.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fn b() -> impl for<'a> Fn(&'a u8) -> (impl Debug + 'a) {
1313

1414
fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
1515
//~^ ERROR `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
16+
//~| WARNING elided lifetime has a name
1617
|x| x
1718
}
1819

tests/ui/impl-trait/impl-fn-hrtb-bounds.stderr

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0106]: missing lifetime specifier
2-
--> $DIR/impl-fn-hrtb-bounds.rs:19:38
2+
--> $DIR/impl-fn-hrtb-bounds.rs:20:38
33
|
44
LL | fn d() -> impl Fn() -> (impl Debug + '_) {
55
| ^^ expected named lifetime parameter
@@ -10,6 +10,14 @@ help: consider using the `'static` lifetime, but this is uncommon unless you're
1010
LL | fn d() -> impl Fn() -> (impl Debug + 'static) {
1111
| ~~~~~~~
1212

13+
warning: elided lifetime has a name
14+
--> $DIR/impl-fn-hrtb-bounds.rs:14:52
15+
|
16+
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
17+
| -- lifetime `'a` declared here ^^ this elided lifetime gets resolved as `'a`
18+
|
19+
= note: `#[warn(elided_named_lifetimes)]` on by default
20+
1321
error[E0657]: `impl Trait` cannot capture higher-ranked lifetime from outer `impl Trait`
1422
--> $DIR/impl-fn-hrtb-bounds.rs:4:41
1523
|
@@ -46,7 +54,7 @@ note: lifetime declared here
4654
LL | fn c() -> impl for<'a> Fn(&'a u8) -> (impl Debug + '_) {
4755
| ^^
4856

49-
error: aborting due to 4 previous errors
57+
error: aborting due to 4 previous errors; 1 warning emitted
5058

5159
Some errors have detailed explanations: E0106, E0657.
5260
For more information about an error, try `rustc --explain E0106`.

tests/ui/impl-trait/impl-fn-predefined-lifetimes.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use std::fmt::Debug;
33

44
fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
55
//~^ ERROR cannot resolve opaque type
6+
//~| WARNING elided lifetime has a name
67
|x| x
78
//~^ ERROR expected generic lifetime parameter, found `'_`
89
}
Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/impl-fn-predefined-lifetimes.rs:4:48
3+
|
4+
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
5+
| -- lifetime `'a` declared here ^^ this elided lifetime gets resolved as `'a`
6+
|
7+
= note: `#[warn(elided_named_lifetimes)]` on by default
8+
19
error[E0792]: expected generic lifetime parameter, found `'_`
2-
--> $DIR/impl-fn-predefined-lifetimes.rs:6:9
10+
--> $DIR/impl-fn-predefined-lifetimes.rs:7:9
311
|
412
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
513
| -- this generic parameter must be used with a generic lifetime parameter
6-
LL |
14+
...
715
LL | |x| x
816
| ^
917

@@ -13,7 +21,7 @@ error[E0720]: cannot resolve opaque type
1321
LL | fn a<'a>() -> impl Fn(&'a u8) -> (impl Debug + '_) {
1422
| ^^^^^^^^^^^^^^^ cannot resolve opaque type
1523

16-
error: aborting due to 2 previous errors
24+
error: aborting due to 2 previous errors; 1 warning emitted
1725

1826
Some errors have detailed explanations: E0720, E0792.
1927
For more information about an error, try `rustc --explain E0720`.

tests/ui/impl-trait/rpit-assoc-pair-with-lifetime.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//@ check-pass
22

33
pub fn iter<'a>(v: Vec<(u32, &'a u32)>) -> impl DoubleEndedIterator<Item = (u32, &u32)> {
4+
//~^ WARNING elided lifetime has a name
45
v.into_iter()
56
}
67

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/rpit-assoc-pair-with-lifetime.rs:3:82
3+
|
4+
LL | pub fn iter<'a>(v: Vec<(u32, &'a u32)>) -> impl DoubleEndedIterator<Item = (u32, &u32)> {
5+
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
6+
|
7+
= note: `#[warn(elided_named_lifetimes)]` on by default
8+
9+
warning: 1 warning emitted
10+

tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ fn l<'a>(_: &'a str, _: &'a str) -> &str { "" }
4747

4848
// This is ok because both `'a` are for the same parameter.
4949
fn m<'a>(_: &'a Foo<'a>) -> &str { "" }
50+
//~^ WARNING elided lifetime has a name
5051

5152
fn main() {}

tests/ui/lifetimes/lifetime-elision-return-type-requires-explicit-lifetime.stderr

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ help: consider using the `'a` lifetime
105105
LL | fn l<'a>(_: &'a str, _: &'a str) -> &'a str { "" }
106106
| ++
107107

108-
error: aborting due to 7 previous errors
108+
warning: elided lifetime has a name
109+
--> $DIR/lifetime-elision-return-type-requires-explicit-lifetime.rs:49:29
110+
|
111+
LL | fn m<'a>(_: &'a Foo<'a>) -> &str { "" }
112+
| -- ^ this elided lifetime gets resolved as `'a`
113+
| |
114+
| lifetime `'a` declared here
115+
|
116+
= note: `#[warn(elided_named_lifetimes)]` on by default
117+
118+
error: aborting due to 7 previous errors; 1 warning emitted
109119

110120
For more information about this error, try `rustc --explain E0106`.

tests/ui/lifetimes/lifetime-errors/ex1-return-one-existing-name-if-else-using-impl-3.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ struct Foo {
44

55
impl Foo {
66
fn foo<'a>(&'a self, x: &i32) -> &i32 {
7+
//~^ WARNING elided lifetime has a name
78

89
if true { &self.field } else { x } //~ ERROR explicit lifetime
910

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:6:36
3+
|
4+
LL | fn foo<'a>(&'a self, x: &i32) -> &i32 {
5+
| -- ^ this elided lifetime gets resolved as `'a`
6+
| |
7+
| lifetime `'a` declared here
8+
|
9+
= note: `#[warn(elided_named_lifetimes)]` on by default
10+
111
error[E0621]: explicit lifetime required in the type of `x`
2-
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:8:36
12+
--> $DIR/ex1-return-one-existing-name-if-else-using-impl-3.rs:9:36
313
|
414
LL | fn foo<'a>(&'a self, x: &i32) -> &i32 {
515
| ---- help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
6-
LL |
16+
...
717
LL | if true { &self.field } else { x }
818
| ^ lifetime `'a` required
919

10-
error: aborting due to 1 previous error
20+
error: aborting due to 1 previous error; 1 warning emitted
1121

1222
For more information about this error, try `rustc --explain E0621`.

tests/ui/object-lifetime/object-lifetime-default-elision.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ fn load1(ss: &dyn SomeTrait) -> &dyn SomeTrait {
4646
}
4747

4848
fn load2<'a>(ss: &'a dyn SomeTrait) -> &dyn SomeTrait {
49+
//~^ WARNING elided lifetime has a name
50+
4951
// Same as `load1` but with an explicit name thrown in for fun.
5052

5153
ss

tests/ui/object-lifetime/object-lifetime-default-elision.stderr

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/object-lifetime-default-elision.rs:48:40
3+
|
4+
LL | fn load2<'a>(ss: &'a dyn SomeTrait) -> &dyn SomeTrait {
5+
| -- ^ this elided lifetime gets resolved as `'a`
6+
| |
7+
| lifetime `'a` declared here
8+
|
9+
= note: `#[warn(elided_named_lifetimes)]` on by default
10+
111
error: lifetime may not live long enough
2-
--> $DIR/object-lifetime-default-elision.rs:71:5
12+
--> $DIR/object-lifetime-default-elision.rs:73:5
313
|
414
LL | fn load3<'a,'b>(ss: &'a dyn SomeTrait) -> &'b dyn SomeTrait {
515
| -- -- lifetime `'b` defined here
@@ -11,5 +21,5 @@ LL | ss
1121
|
1222
= help: consider adding the following bound: `'a: 'b`
1323

14-
error: aborting due to 1 previous error
24+
error: aborting due to 1 previous error; 1 warning emitted
1525

tests/ui/self/elision/ignore-non-reference-lifetimes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,11 @@ struct Foo<'a>(&'a str);
44

55
impl<'b> Foo<'b> {
66
fn a<'a>(self: Self, a: &'a str) -> &str {
7+
//~^ WARNING elided lifetime has a name
78
a
89
}
910
fn b<'a>(self: Foo<'b>, a: &'a str) -> &str {
11+
//~^ WARNING elided lifetime has a name
1012
a
1113
}
1214
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/ignore-non-reference-lifetimes.rs:6:41
3+
|
4+
LL | fn a<'a>(self: Self, a: &'a str) -> &str {
5+
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
6+
|
7+
= note: `#[warn(elided_named_lifetimes)]` on by default
8+
9+
warning: elided lifetime has a name
10+
--> $DIR/ignore-non-reference-lifetimes.rs:10:44
11+
|
12+
LL | fn b<'a>(self: Foo<'b>, a: &'a str) -> &str {
13+
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
14+
15+
warning: 2 warnings emitted
16+

tests/ui/self/elision/lt-ref-self-async.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ edition:2018
22
//@ run-rustfix
3-
#![allow(non_snake_case, dead_code)]
3+
#![allow(non_snake_case, dead_code, elided_named_lifetimes)]
44

55
use std::pin::Pin;
66

tests/ui/self/elision/lt-ref-self-async.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ edition:2018
22
//@ run-rustfix
3-
#![allow(non_snake_case, dead_code)]
3+
#![allow(non_snake_case, dead_code, elided_named_lifetimes)]
44

55
use std::pin::Pin;
66

tests/ui/self/self_lifetime-async.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
struct Foo<'a>(&'a ());
55
impl<'a> Foo<'a> {
66
async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
7+
//~^ WARNING elided lifetime has a name
78
}
89

910
type Alias = Foo<'static>;
1011
impl Alias {
1112
async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
13+
//~^ WARNING elided lifetime has a name
1214
}
1315

1416
fn main() {}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/self_lifetime-async.rs:6:44
3+
|
4+
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
5+
| -- ^ this elided lifetime gets resolved as `'b`
6+
| |
7+
| lifetime `'b` declared here
8+
|
9+
= note: `#[warn(elided_named_lifetimes)]` on by default
10+
11+
warning: elided lifetime has a name
12+
--> $DIR/self_lifetime-async.rs:12:52
13+
|
14+
LL | async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
15+
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
16+
17+
warning: 2 warnings emitted
18+

tests/ui/self/self_lifetime.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
struct Foo<'a>(&'a ());
66
impl<'a> Foo<'a> {
77
fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
8+
//~^ WARNING elided lifetime has a name
89
}
910

1011
type Alias = Foo<'static>;
1112
impl Alias {
1213
fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
14+
//~^ WARNING elided lifetime has a name
1315
}
1416

1517
fn main() {}

tests/ui/self/self_lifetime.stderr

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
warning: elided lifetime has a name
2+
--> $DIR/self_lifetime.rs:7:38
3+
|
4+
LL | fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
5+
| -- ^ this elided lifetime gets resolved as `'b`
6+
| |
7+
| lifetime `'b` declared here
8+
|
9+
= note: `#[warn(elided_named_lifetimes)]` on by default
10+
11+
warning: elided lifetime has a name
12+
--> $DIR/self_lifetime.rs:13:46
13+
|
14+
LL | fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
15+
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
16+
17+
warning: 2 warnings emitted
18+

tests/ui/suggestions/impl-trait-missing-lifetime-gated.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ mod in_path {
6464

6565
// This must not err, as the `&` actually resolves to `'a`.
6666
fn resolved_anonymous<'a, T: 'a>(f: impl Fn(&'a str) -> &T) {
67+
//~^ WARNING elided lifetime has a name
6768
f("f");
6869
}
6970

0 commit comments

Comments
 (0)