Skip to content

Commit cf0a7cf

Browse files
committed
Bless tests.
1 parent 7dcd42d commit cf0a7cf

File tree

56 files changed

+864
-1015
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+864
-1015
lines changed

src/test/ui/const-generics/issues/issue-56445-1.min.stderr

+10-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@ LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
66
|
77
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
88

9-
error: aborting due to previous error
9+
error: `&'static str` is forbidden as the type of a const generic parameter
10+
--> $DIR/issue-56445-1.rs:9:25
11+
|
12+
LL | struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
13+
| ^^^^^^^
14+
|
15+
= note: the only supported types are integers, `bool` and `char`
16+
= help: more complex types are supported with `#![feature(adt_const_params)]`
17+
18+
error: aborting due to 2 previous errors
1019

1120
For more information about this error, try `rustc --explain E0771`.

src/test/ui/const-generics/issues/issue-56445-1.rs

+1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ use std::marker::PhantomData;
88

99
struct Bug<'a, const S: &'a str>(PhantomData<&'a ()>);
1010
//~^ ERROR: use of non-static lifetime `'a` in const generic
11+
//[min]~| ERROR: `&'static str` is forbidden as the type of a const generic parameter
1112

1213
impl Bug<'_, ""> {}

src/test/ui/error-codes/E0261.stderr

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ LL | struct Foo {
1515
| - help: consider introducing lifetime `'a` here: `<'a>`
1616
LL | x: &'a str,
1717
| ^^ undeclared lifetime
18-
|
19-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
2018

2119
error: aborting due to 2 previous errors
2220

src/test/ui/error-codes/E0263.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ error[E0263]: lifetime name `'a` declared twice in the same scope
22
--> $DIR/E0263.rs:1:16
33
|
44
LL | fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) {
5-
| -- ^^ declared twice
5+
| -- ^^ lifetime `'a` already in scope
66
| |
7-
| previous declaration here
7+
| first declared here
88

99
error: aborting due to previous error
1010

src/test/ui/error-codes/E0637.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
1717
| ------- ------- ^^ expected named lifetime parameter
1818
|
1919
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `str1` or `str2`
20-
help: consider introducing a named lifetime parameter
20+
help: consider using the `'_` lifetime
2121
|
22-
LL | fn underscore_lifetime<'a, '_>(str1: &'a str, str2: &'a str) -> &'a str {
23-
| +++ ~~ ~~ ~~
22+
LL | fn underscore_lifetime<'_>(str1: &'_ str, str2: &'_ str) -> &'_ str {
23+
| ~~
2424

2525
error: aborting due to 3 previous errors
2626

src/test/ui/error-codes/E0771.stderr

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
error[E0771]: use of non-static lifetime `'a` in const generic
2+
--> $DIR/E0771.rs:4:41
3+
|
4+
LL | fn function_with_str<'a, const STRING: &'a str>() {}
5+
| ^^
6+
|
7+
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
8+
19
warning: the feature `adt_const_params` is incomplete and may not be safe to use and/or cause compiler crashes
210
--> $DIR/E0771.rs:1:12
311
|
@@ -7,14 +15,6 @@ LL | #![feature(adt_const_params)]
715
= note: `#[warn(incomplete_features)]` on by default
816
= note: see issue #44580 <https://github.com/rust-lang/rust/issues/44580> for more information
917

10-
error[E0771]: use of non-static lifetime `'a` in const generic
11-
--> $DIR/E0771.rs:4:41
12-
|
13-
LL | fn function_with_str<'a, const STRING: &'a str>() {}
14-
| ^^
15-
|
16-
= note: for more information, see issue #74052 <https://github.com/rust-lang/rust/issues/74052>
17-
1818
error: aborting due to previous error; 1 warning emitted
1919

2020
For more information about this error, try `rustc --explain E0771`.

src/test/ui/feature-gates/feature-gate-in_band_lifetimes.stderr

+86-84
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,3 @@
1-
error[E0261]: use of undeclared lifetime name `'a`
2-
--> $DIR/feature-gate-in_band_lifetimes.rs:50:14
3-
|
4-
LL | impl MyTrait<'a> for Y<&'a u8> {
5-
| - ^^ undeclared lifetime
6-
| |
7-
| help: consider introducing lifetime `'a` here: `<'a>`
8-
|
9-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
10-
11-
error[E0261]: use of undeclared lifetime name `'a`
12-
--> $DIR/feature-gate-in_band_lifetimes.rs:50:25
13-
|
14-
LL | impl MyTrait<'a> for Y<&'a u8> {
15-
| - ^^ undeclared lifetime
16-
| |
17-
| help: consider introducing lifetime `'a` here: `<'a>`
18-
|
19-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
20-
21-
error[E0261]: use of undeclared lifetime name `'a`
22-
--> $DIR/feature-gate-in_band_lifetimes.rs:53:31
23-
|
24-
LL | fn my_lifetime(&self) -> &'a u8 { self.0 }
25-
| ^^ undeclared lifetime
26-
|
27-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
28-
help: consider introducing lifetime `'a` here
29-
|
30-
LL | impl<'a> MyTrait<'a> for Y<&'a u8> {
31-
| ++++
32-
help: consider introducing lifetime `'a` here
33-
|
34-
LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 }
35-
| ++++
36-
37-
error[E0261]: use of undeclared lifetime name `'b`
38-
--> $DIR/feature-gate-in_band_lifetimes.rs:55:27
39-
|
40-
LL | fn any_lifetime() -> &'b u8 { &0 }
41-
| ^^ undeclared lifetime
42-
|
43-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
44-
help: consider introducing lifetime `'b` here
45-
|
46-
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
47-
| ++++
48-
help: consider introducing lifetime `'b` here
49-
|
50-
LL | fn any_lifetime<'b>() -> &'b u8 { &0 }
51-
| ++++
52-
53-
error[E0261]: use of undeclared lifetime name `'b`
54-
--> $DIR/feature-gate-in_band_lifetimes.rs:57:27
55-
|
56-
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
57-
| ^^ undeclared lifetime
58-
|
59-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
60-
help: consider introducing lifetime `'b` here
61-
|
62-
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
63-
| ++++
64-
help: consider introducing lifetime `'b` here
65-
|
66-
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
67-
| ++++
68-
69-
error[E0261]: use of undeclared lifetime name `'b`
70-
--> $DIR/feature-gate-in_band_lifetimes.rs:57:40
71-
|
72-
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
73-
| ^^ undeclared lifetime
74-
|
75-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
76-
help: consider introducing lifetime `'b` here
77-
|
78-
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
79-
| ++++
80-
help: consider introducing lifetime `'b` here
81-
|
82-
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
83-
| ++++
84-
851
error[E0261]: use of undeclared lifetime name `'x`
862
--> $DIR/feature-gate-in_band_lifetimes.rs:3:12
873
|
@@ -109,6 +25,8 @@ LL | impl<'a> X<'b> {
10925
| - ^^ undeclared lifetime
11026
| |
11127
| help: consider introducing lifetime `'b` here: `'b,`
28+
|
29+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
11230

11331
error[E0261]: use of undeclared lifetime name `'b`
11432
--> $DIR/feature-gate-in_band_lifetimes.rs:17:27
@@ -226,6 +144,90 @@ help: consider introducing lifetime `'b` here
226144
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8;
227145
| ++++
228146

147+
error[E0261]: use of undeclared lifetime name `'a`
148+
--> $DIR/feature-gate-in_band_lifetimes.rs:50:14
149+
|
150+
LL | impl MyTrait<'a> for Y<&'a u8> {
151+
| - ^^ undeclared lifetime
152+
| |
153+
| help: consider introducing lifetime `'a` here: `<'a>`
154+
|
155+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
156+
157+
error[E0261]: use of undeclared lifetime name `'a`
158+
--> $DIR/feature-gate-in_band_lifetimes.rs:50:25
159+
|
160+
LL | impl MyTrait<'a> for Y<&'a u8> {
161+
| - ^^ undeclared lifetime
162+
| |
163+
| help: consider introducing lifetime `'a` here: `<'a>`
164+
|
165+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
166+
167+
error[E0261]: use of undeclared lifetime name `'a`
168+
--> $DIR/feature-gate-in_band_lifetimes.rs:53:31
169+
|
170+
LL | fn my_lifetime(&self) -> &'a u8 { self.0 }
171+
| ^^ undeclared lifetime
172+
|
173+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
174+
help: consider introducing lifetime `'a` here
175+
|
176+
LL | impl<'a> MyTrait<'a> for Y<&'a u8> {
177+
| ++++
178+
help: consider introducing lifetime `'a` here
179+
|
180+
LL | fn my_lifetime<'a>(&self) -> &'a u8 { self.0 }
181+
| ++++
182+
183+
error[E0261]: use of undeclared lifetime name `'b`
184+
--> $DIR/feature-gate-in_band_lifetimes.rs:55:27
185+
|
186+
LL | fn any_lifetime() -> &'b u8 { &0 }
187+
| ^^ undeclared lifetime
188+
|
189+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
190+
help: consider introducing lifetime `'b` here
191+
|
192+
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
193+
| ++++
194+
help: consider introducing lifetime `'b` here
195+
|
196+
LL | fn any_lifetime<'b>() -> &'b u8 { &0 }
197+
| ++++
198+
199+
error[E0261]: use of undeclared lifetime name `'b`
200+
--> $DIR/feature-gate-in_band_lifetimes.rs:57:27
201+
|
202+
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
203+
| ^^ undeclared lifetime
204+
|
205+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
206+
help: consider introducing lifetime `'b` here
207+
|
208+
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
209+
| ++++
210+
help: consider introducing lifetime `'b` here
211+
|
212+
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
213+
| ++++
214+
215+
error[E0261]: use of undeclared lifetime name `'b`
216+
--> $DIR/feature-gate-in_band_lifetimes.rs:57:40
217+
|
218+
LL | fn borrowed_lifetime(&'b self) -> &'b u8 { &*self.0 }
219+
| ^^ undeclared lifetime
220+
|
221+
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
222+
help: consider introducing lifetime `'b` here
223+
|
224+
LL | impl<'b> MyTrait<'a> for Y<&'a u8> {
225+
| ++++
226+
help: consider introducing lifetime `'b` here
227+
|
228+
LL | fn borrowed_lifetime<'b>(&'b self) -> &'b u8 { &*self.0 }
229+
| ++++
230+
229231
error: aborting due to 17 previous errors
230232

231233
For more information about this error, try `rustc --explain E0261`.

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

+10-3
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@ 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
86
|
7+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
98
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
9+
help: consider introducing lifetime `'x` here
10+
|
11+
LL | fn _f<'x>(arg : Box<dyn for<'a> X<Y<'x> = &'a [u32]>>) {}
12+
| ++++
13+
help: consider making the bound lifetime-generic with a new `'x` lifetime
14+
|
15+
LL | fn _f(arg : Box<dyn for<'x, 'a> X<Y<'x> = &'a [u32]>>) {}
16+
| +++
1017

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

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0261]: use of undeclared lifetime name `'b`
44
LL | + Deref<Target = Self::Item<'b>>;
55
| ^^ undeclared lifetime
66
|
7-
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
7+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
88
help: consider introducing lifetime `'b` here
99
|
1010
LL | trait Iterable<'b> {
@@ -13,6 +13,10 @@ help: consider introducing lifetime `'b` here
1313
|
1414
LL | type Iter<'b, 'a>: Iterator<Item = Self::Item<'a>>
1515
| +++
16+
help: consider making the bound lifetime-generic with a new `'b` lifetime
17+
|
18+
LL | + for<'b> Deref<Target = Self::Item<'b>>;
19+
| +++++++
1620

1721
error[E0261]: use of undeclared lifetime name `'undeclared`
1822
--> $DIR/generic_associated_type_undeclared_lifetimes.rs:11:41

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,23 +1,53 @@
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
86
|
7+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
98
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
9+
help: consider introducing lifetime `'a` here
10+
|
11+
LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {}
12+
| ++++
13+
help: consider making the bound lifetime-generic with a new `'a` lifetime
14+
|
15+
LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {}
16+
| +++++++
1017

1118
error[E0261]: use of undeclared lifetime name `'a`
12-
--> $DIR/issue-67510.rs:7:26
19+
--> $DIR/issue-67510.rs:7:28
1320
|
14-
LL | fn f(x: Box<dyn X<Y<'a>=&'a ()>>) {}
15-
| - ^^ undeclared lifetime
16-
| |
17-
| help: consider introducing lifetime `'a` here: `<'a>`
21+
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
22+
| ^^ undeclared lifetime
1823
|
24+
= note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
1925
= help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
26+
help: consider introducing lifetime `'a` here
27+
|
28+
LL | fn f<'a>(x: Box<dyn X<Y<'a> = &'a ()>>) {}
29+
| ++++
30+
help: consider making the bound lifetime-generic with a new `'a` lifetime
31+
|
32+
LL | fn f(x: Box<dyn for<'a> X<Y<'a> = &'a ()>>) {}
33+
| +++++++
34+
35+
error[E0038]: the trait `X` cannot be made into an object
36+
--> $DIR/issue-67510.rs:7:13
37+
|
38+
LL | fn f(x: Box<dyn X<Y<'a> = &'a ()>>) {}
39+
| ^^^^^^^^^^^^^^^^^^^^^ `X` cannot be made into an object
40+
|
41+
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>
42+
--> $DIR/issue-67510.rs:4:10
43+
|
44+
LL | trait X {
45+
| - this trait cannot be made into an object...
46+
LL | type Y<'a>;
47+
| ^ ...because it contains the generic associated type `Y`
48+
= help: consider moving `Y` to another trait
2049

21-
error: aborting due to 2 previous errors
50+
error: aborting due to 3 previous errors
2251

23-
For more information about this error, try `rustc --explain E0261`.
52+
Some errors have detailed explanations: E0038, E0261.
53+
For more information about an error, try `rustc --explain E0038`.

0 commit comments

Comments
 (0)