Skip to content

Commit ca57bad

Browse files
committed
Bless tests.
1 parent fc9f255 commit ca57bad

24 files changed

+527
-158
lines changed

src/test/ui/generic-associated-types/gat-in-trait-path-undeclared-lifetime.stderr

+11-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ error[E0261]: use of undeclared lifetime name `'x`
22
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:35
33
|
44
LL | fn _f(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
5-
| - ^^ undeclared lifetime
6-
| |
7-
| help: consider introducing lifetime `'x` here: `<'x>`
5+
| ^^ undeclared lifetime
6+
|
7+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
8+
help: consider making the bound lifetime-generic with a new `'x` lifetime
9+
|
10+
LL | fn _f(arg : Box<dyn for<'x, 'a> X<Y<'x> = &'a [u32]>>) {}
11+
| +++
12+
help: consider introducing lifetime `'x` here
13+
|
14+
LL | fn _f<'x>(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
15+
| ++++
816

917
error[E0582]: binding for associated type `Y` references lifetime `'a`, which does not appear in the trait input types
1018
--> $DIR/gat-in-trait-path-undeclared-lifetime.rs:8:33

src/test/ui/generic-associated-types/generic_associated_type_undeclared_lifetimes.stderr

+12-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@ error[E0261]: use of undeclared lifetime name `'b`
44
LL | + Deref<Target = Self::Item<'b>>;
55
| ^^ undeclared lifetime
66
|
7-
help: consider introducing lifetime `'b` here
7+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
8+
help: consider making the bound lifetime-generic with a new `'b` lifetime
89
|
9-
LL | trait Iterable<'b> {
10-
| ++++
10+
LL | + for<'b> Deref<Target = Self::Item<'b>>;
11+
| +++++++
1112
help: consider introducing lifetime `'b` here
1213
|
1314
LL | type Iter<'b, 'a>: Iterator<Item = Self::Item<'a>>
1415
| +++
16+
help: consider introducing lifetime `'b` here
17+
|
18+
LL | trait Iterable<'b> {
19+
| ++++
1520

1621
error[E0261]: use of undeclared lifetime name `'undeclared`
1722
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:41
@@ -21,12 +26,12 @@ LL | fn iter<'a>(&'a self) -> Self::Iter<'undeclared>;
2126
|
2227
help: consider introducing lifetime `'undeclared` here
2328
|
24-
LL | trait Iterable<'undeclared> {
25-
| +++++++++++++
26-
help: consider introducing lifetime `'undeclared` here
27-
|
2829
LL | fn iter<'undeclared, 'a>(&'a self) -> Self::Iter<'undeclared>;
2930
| ++++++++++++
31+
help: consider introducing lifetime `'undeclared` here
32+
|
33+
LL | trait Iterable<'undeclared> {
34+
| +++++++++++++
3035

3136
error: aborting due to 2 previous errors
3237

src/test/ui/generic-associated-types/issue-67510.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ trait X {
44
type Y<'a>;
55
}
66

7-
fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
8-
//~^ ERROR: use of undeclared lifetime name `'a`
9-
//~| ERROR: use of undeclared lifetime name `'a`
10-
7+
fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
8+
//~^ ERROR: use of undeclared lifetime name `'a`
9+
//~| ERROR: use of undeclared lifetime name `'a`
10+
//~| ERROR: the trait `X` cannot be made into an object [E0038]
1111

1212
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,50 @@
11
error[E0261]: use of undeclared lifetime name `'a`
22
--> $DIR/issue-67510.rs:7:21
33
|
4-
LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
5-
| - ^^ undeclared lifetime
6-
| |
7-
| help: consider introducing lifetime `'a` here: `<'a>`
4+
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
5+
| ^^ undeclared lifetime
6+
|
7+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
8+
help: consider making the bound lifetime-generic with a new `'a` lifetime
9+
|
10+
LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {}
11+
| +++++++
12+
help: consider introducing lifetime `'a` here
13+
|
14+
LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {}
15+
| ++++
816

917
error[E0261]: use of undeclared lifetime name `'a`
10-
--> $DIR/issue-67510.rs:7:26
18+
--> $DIR/issue-67510.rs:7:28
19+
|
20+
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
21+
| ^^ undeclared lifetime
22+
|
23+
help: consider making the bound lifetime-generic with a new `'a` lifetime
24+
|
25+
LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {}
26+
| +++++++
27+
help: consider introducing lifetime `'a` here
28+
|
29+
LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {}
30+
| ++++
31+
32+
error[E0038]: the trait `X` cannot be made into an object
33+
--> $DIR/issue-67510.rs:7:13
34+
|
35+
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
36+
| ^^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
37+
|
38+
note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
39+
--> $DIR/issue-67510.rs:4:10
1140
|
12-
LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
13-
| - ^^ undeclared lifetime
14-
| |
15-
| help: consider introducing lifetime `'a` here: `<'a>`
41+
LL | trait X {
42+
| - this trait cannot be made into an object...
43+
LL | type Y<'a>;
44+
| ^ ...because it contains the generic associated type `Y`
45+
= help: consider moving `Y` to another trait
1646

17-
error: aborting due to 2 previous errors
47+
error: aborting due to 3 previous errors
1848

19-
For more information about this error, try `rustc --explain E0261`.
49+
Some errors have detailed explanations: E0038, E0261.
50+
For more information about an error, try `rustc --explain E0038`.

src/test/ui/generic-associated-types/issue-70304.rs

+3-10
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,10 @@ impl Document for DocumentImpl {
1212
type Cursor<'a> = DocCursorImpl<'a>;
1313

1414
fn cursor(&self) -> Self::Cursor<'_> {
15-
DocCursorImpl {
16-
document: &self,
17-
}
15+
DocCursorImpl { document: &self }
1816
}
1917
}
2018

21-
2219
trait DocCursor<'a> {}
2320

2421
struct DocCursorImpl<'a> {
@@ -35,7 +32,6 @@ where
3532
_phantom: std::marker::PhantomData<&'d ()>,
3633
}
3734

38-
3935
impl<'d, Cursor> Lexer<'d, Cursor>
4036
where
4137
Cursor: DocCursor<'d>,
@@ -44,15 +40,12 @@ where
4440
where
4541
Doc: Document<Cursor<'d> = Cursor>,
4642
{
47-
Lexer {
48-
cursor: document.cursor(),
49-
_phantom: std::marker::PhantomData,
50-
}
43+
Lexer { cursor: document.cursor(), _phantom: std::marker::PhantomData }
5144
}
5245
}
5346

5447
fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> {
55-
//~^ ERROR: missing lifetime specifier
48+
//~^ ERROR: missing lifetime specifier
5649
DocumentImpl {}
5750
}
5851

src/test/ui/generic-associated-types/issue-70304.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0106]: missing lifetime specifier
2-
--> $DIR/issue-70304.rs:54:41
2+
--> $DIR/issue-70304.rs:47:41
33
|
44
LL | fn create_doc() -> impl Document<Cursor<'_> = DocCursorImpl<'_>> {
55
| ^^ expected named lifetime parameter

src/test/ui/generics/generic-extern-lifetime.stderr

+15-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ error[E0261]: use of undeclared lifetime name `'a`
22
--> $DIR/generic-extern-lifetime.rs:6:26
33
|
44
LL | pub fn life2<'b>(x: &'a i32, y: &'b i32);
5-
| ^^ undeclared lifetime
5+
| - ^^ undeclared lifetime
6+
| |
7+
| help: consider introducing lifetime `'a` here: `'a,`
68

79
error[E0261]: use of undeclared lifetime name `'a`
810
--> $DIR/generic-extern-lifetime.rs:8:37
@@ -13,20 +15,27 @@ LL | pub fn life4<'b>(x: for<'c> fn(&'a i32));
1315
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
1416
help: consider making the type lifetime-generic with a new `'a` lifetime
1517
|
16-
LL | pub fn life4<'b>(x: for<'c, 'a> fn(&'a i32));
17-
| ++++
18+
LL | pub fn life4<'b>(x: for<'a, 'c> fn(&'a i32));
19+
| +++
20+
help: consider introducing lifetime `'a` here
21+
|
22+
LL | pub fn life4<'a, 'b>(x: for<'c> fn(&'a i32));
23+
| +++
1824

1925
error[E0261]: use of undeclared lifetime name `'a`
2026
--> $DIR/generic-extern-lifetime.rs:11:39
2127
|
2228
LL | pub fn life7<'b>() -> for<'c> fn(&'a i32);
2329
| ^^ undeclared lifetime
2430
|
25-
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
2631
help: consider making the type lifetime-generic with a new `'a` lifetime
2732
|
28-
LL | pub fn life7<'b>() -> for<'c, 'a> fn(&'a i32);
29-
| ++++
33+
LL | pub fn life7<'b>() -> for<'a, 'c> fn(&'a i32);
34+
| +++
35+
help: consider introducing lifetime `'a` here
36+
|
37+
LL | pub fn life7<'a, 'b>() -> for<'c> fn(&'a i32);
38+
| +++
3039

3140
error: aborting due to 3 previous errors
3241

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#![allow(warnings)]
22

3-
trait MyTrait<'a> { }
3+
trait MyTrait<'a> {}
44

5-
impl MyTrait for u32 {
6-
//~^ ERROR implicit elided lifetime not allowed here
7-
}
5+
impl MyTrait for u32 {}
6+
//~^ ERROR implicit elided lifetime not allowed here
87

98
fn main() {}

src/test/ui/impl-header-lifetime-elision/trait-elided.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error[E0726]: implicit elided lifetime not allowed here
22
--> $DIR/trait-elided.rs:5:6
33
|
4-
LL | impl MyTrait for u32 {
4+
LL | impl MyTrait for u32 {}
55
| ^^^^^^^- help: indicate the anonymous lifetime: `<'_>`
66
|
77
= note: assuming a `'static` lifetime...

src/test/ui/issues/issue-10412.rs

+11-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1-
trait Serializable<'self, T> { //~ ERROR lifetimes cannot use keyword names
2-
fn serialize(val : &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
3-
fn deserialize(repr : &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
1+
trait Serializable<'self, T> {
2+
//~^ ERROR lifetimes cannot use keyword names
3+
fn serialize(val: &'self T) -> Vec<u8>; //~ ERROR lifetimes cannot use keyword names
4+
fn deserialize(repr: &[u8]) -> &'self T; //~ ERROR lifetimes cannot use keyword names
45
}
56

6-
impl<'self> Serializable<str> for &'self str { //~ ERROR lifetimes cannot use keyword names
7+
impl<'self> Serializable<str> for &'self str {
78
//~^ ERROR lifetimes cannot use keyword names
9+
//~| ERROR lifetimes cannot use keyword names
810
//~| ERROR implicit elided lifetime not allowed here
9-
//~| ERROR the size for values of type `str` cannot be known at compilation time
10-
fn serialize(val : &'self str) -> Vec<u8> { //~ ERROR lifetimes cannot use keyword names
11+
//~| ERROR the size for values of type `str` cannot be known at compilation time [E0277]
12+
fn serialize(val: &'self str) -> Vec<u8> {
13+
//~^ ERROR lifetimes cannot use keyword names
1114
vec![1]
1215
}
13-
fn deserialize(repr: &[u8]) -> &'self str { //~ ERROR lifetimes cannot use keyword names
16+
fn deserialize(repr: &[u8]) -> &'self str {
17+
//~^ ERROR lifetimes cannot use keyword names
1418
"hi"
1519
}
1620
}

src/test/ui/issues/issue-10412.stderr

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,51 +5,51 @@ LL | trait Serializable<'self, T> {
55
| ^^^^^
66

77
error: lifetimes cannot use keyword names
8-
--> $DIR/issue-10412.rs:2:25
8+
--> $DIR/issue-10412.rs:3:24
99
|
10-
LL | fn serialize(val : &'self T) -> Vec<u8>;
11-
| ^^^^^
10+
LL | fn serialize(val: &'self T) -> Vec<u8>;
11+
| ^^^^^
1212

1313
error: lifetimes cannot use keyword names
14-
--> $DIR/issue-10412.rs:3:38
14+
--> $DIR/issue-10412.rs:4:37
1515
|
16-
LL | fn deserialize(repr : &[u8]) -> &'self T;
17-
| ^^^^^
16+
LL | fn deserialize(repr: &[u8]) -> &'self T;
17+
| ^^^^^
1818

1919
error: lifetimes cannot use keyword names
20-
--> $DIR/issue-10412.rs:6:6
20+
--> $DIR/issue-10412.rs:7:6
2121
|
2222
LL | impl<'self> Serializable<str> for &'self str {
2323
| ^^^^^
2424

2525
error: lifetimes cannot use keyword names
26-
--> $DIR/issue-10412.rs:6:36
26+
--> $DIR/issue-10412.rs:7:36
2727
|
2828
LL | impl<'self> Serializable<str> for &'self str {
2929
| ^^^^^
3030

3131
error: lifetimes cannot use keyword names
32-
--> $DIR/issue-10412.rs:10:25
32+
--> $DIR/issue-10412.rs:12:24
3333
|
34-
LL | fn serialize(val : &'self str) -> Vec<u8> {
35-
| ^^^^^
34+
LL | fn serialize(val: &'self str) -> Vec<u8> {
35+
| ^^^^^
3636

3737
error: lifetimes cannot use keyword names
38-
--> $DIR/issue-10412.rs:13:37
38+
--> $DIR/issue-10412.rs:16:37
3939
|
4040
LL | fn deserialize(repr: &[u8]) -> &'self str {
4141
| ^^^^^
4242

4343
error[E0726]: implicit elided lifetime not allowed here
44-
--> $DIR/issue-10412.rs:6:13
44+
--> $DIR/issue-10412.rs:7:13
4545
|
4646
LL | impl<'self> Serializable<str> for &'self str {
4747
| ^^^^^^^^^^^^^^^^^ help: indicate the anonymous lifetime: `Serializable<'_, str>`
4848
|
4949
= note: assuming a `'static` lifetime...
5050

5151
error[E0277]: the size for values of type `str` cannot be known at compilation time
52-
--> $DIR/issue-10412.rs:6:13
52+
--> $DIR/issue-10412.rs:7:13
5353
|
5454
LL | impl<'self> Serializable<str> for &'self str {
5555
| ^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time

src/test/ui/lifetimes/undeclared-lifetime-used-in-debug-macro-issue-70152.stderr

+6-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ LL | a: &'b str,
99
error[E0261]: use of undeclared lifetime name `'b`
1010
--> $DIR/undeclared-lifetime-used-in-debug-macro-issue-70152.rs:3:9
1111
|
12+
LL | #[derive(Eq, PartialEq)]
13+
| -- lifetime `'b` is missing in item created through this procedural macro
1214
LL | struct Test {
1315
| - help: consider introducing lifetime `'b` here: `<'b>`
1416
LL | a: &'b str,
@@ -22,12 +24,12 @@ LL | fn foo(&'b self) {}
2224
|
2325
help: consider introducing lifetime `'b` here
2426
|
25-
LL | impl<'b> T for Test {
26-
| ++++
27-
help: consider introducing lifetime `'b` here
28-
|
2927
LL | fn foo<'b>(&'b self) {}
3028
| ++++
29+
help: consider introducing lifetime `'b` here
30+
|
31+
LL | impl<'b> T for Test {
32+
| ++++
3133

3234
error: aborting due to 3 previous errors
3335

Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
fn main() {
2-
0.clone::<'a>(); //~ ERROR use of undeclared lifetime name `'a`
2+
0.clone::<'a>();
3+
//~^ ERROR use of undeclared lifetime name `'a`
4+
//~| WARN cannot specify lifetime arguments explicitly if late bound
5+
//~| WARN this was previously accepted by the compiler
36
}

0 commit comments

Comments
 (0)