Skip to content

Commit 93ac5bc

Browse files
committed
Update tests
1 parent bb8c991 commit 93ac5bc

18 files changed

+291
-157
lines changed

src/test/ui/consts/min_const_fn/min_const_fn.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,9 @@ impl<T: Sync + Sized> Foo<T> {
123123
}
124124

125125
struct AlanTuring<T>(T);
126-
const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
127-
//~^ ERROR `impl Trait` in const fn is unstable
128126
const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
129127
//~^ ERROR trait bounds other than `Sized`
130128
const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
131-
const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
132129
const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
133130
const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
134131
//~^ ERROR trait bounds other than `Sized`

src/test/ui/consts/min_const_fn/min_const_fn.stderr

Lines changed: 8 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,8 @@ LL | impl<T: Sync + Sized> Foo<T> {
214214
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
215215
= help: add `#![feature(const_fn)]` to the crate attributes to enable
216216

217-
error[E0723]: `impl Trait` in const fn is unstable
218-
--> $DIR/min_const_fn.rs:126:24
219-
|
220-
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> { AlanTuring(0) }
221-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
222-
|
223-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
224-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
225-
226217
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
227-
--> $DIR/min_const_fn.rs:128:34
218+
--> $DIR/min_const_fn.rs:126:34
228219
|
229220
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
230221
| ^^^^^^^^^^^^^^^^^^^^
@@ -233,25 +224,16 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
233224
= help: add `#![feature(const_fn)]` to the crate attributes to enable
234225

235226
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
236-
--> $DIR/min_const_fn.rs:130:22
227+
--> $DIR/min_const_fn.rs:128:22
237228
|
238229
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
239230
| ^^^^^^^^^^^^^^^^^^^^
240231
|
241232
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
242233
= help: add `#![feature(const_fn)]` to the crate attributes to enable
243234

244-
error[E0723]: `impl Trait` in const fn is unstable
245-
--> $DIR/min_const_fn.rs:131:23
246-
|
247-
LL | const fn no_rpit() -> impl std::fmt::Debug {}
248-
| ^^^^^^^^^^^^^^^^^^^^
249-
|
250-
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
251-
= help: add `#![feature(const_fn)]` to the crate attributes to enable
252-
253235
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
254-
--> $DIR/min_const_fn.rs:132:23
236+
--> $DIR/min_const_fn.rs:129:23
255237
|
256238
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
257239
| ^^
@@ -260,7 +242,7 @@ LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
260242
= help: add `#![feature(const_fn)]` to the crate attributes to enable
261243

262244
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
263-
--> $DIR/min_const_fn.rs:133:32
245+
--> $DIR/min_const_fn.rs:130:32
264246
|
265247
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
266248
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -269,7 +251,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
269251
= help: add `#![feature(const_fn)]` to the crate attributes to enable
270252

271253
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
272-
--> $DIR/min_const_fn.rs:138:41
254+
--> $DIR/min_const_fn.rs:135:41
273255
|
274256
LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
275257
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -278,7 +260,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1
278260
= help: add `#![feature(const_fn)]` to the crate attributes to enable
279261

280262
error[E0723]: function pointers in const fn are unstable
281-
--> $DIR/min_const_fn.rs:141:21
263+
--> $DIR/min_const_fn.rs:138:21
282264
|
283265
LL | const fn no_fn_ptrs(_x: fn()) {}
284266
| ^^
@@ -287,15 +269,15 @@ LL | const fn no_fn_ptrs(_x: fn()) {}
287269
= help: add `#![feature(const_fn)]` to the crate attributes to enable
288270

289271
error[E0723]: function pointers in const fn are unstable
290-
--> $DIR/min_const_fn.rs:143:27
272+
--> $DIR/min_const_fn.rs:140:27
291273
|
292274
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
293275
| ^^^^
294276
|
295277
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
296278
= help: add `#![feature(const_fn)]` to the crate attributes to enable
297279

298-
error: aborting due to 34 previous errors
280+
error: aborting due to 32 previous errors
299281

300282
Some errors have detailed explanations: E0493, E0723.
301283
For more information about an error, try `rustc --explain E0493`.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
struct AlanTuring<T>(T);
2+
const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> {
3+
//~^ ERROR `impl Trait` in const fn is unstable
4+
AlanTuring(0)
5+
}
6+
7+
const fn no_rpit() -> impl std::fmt::Debug {} //~ ERROR `impl Trait` in const fn is unstable
8+
9+
fn main() {}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
error[E0723]: `impl Trait` in const fn is unstable
2+
--> $DIR/min_const_fn_impl_trait.rs:2:24
3+
|
4+
LL | const fn no_rpit2() -> AlanTuring<impl std::fmt::Debug> {
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
8+
= help: add `#![feature(const_fn)]` to the crate attributes to enable
9+
10+
error[E0723]: `impl Trait` in const fn is unstable
11+
--> $DIR/min_const_fn_impl_trait.rs:7:23
12+
|
13+
LL | const fn no_rpit() -> impl std::fmt::Debug {}
14+
| ^^^^^^^^^^^^^^^^^^^^
15+
|
16+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
17+
= help: add `#![feature(const_fn)]` to the crate attributes to enable
18+
19+
error: aborting due to 2 previous errors
20+
21+
For more information about this error, try `rustc --explain E0723`.
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
trait Trait<'a, 'b> { }
1+
trait Trait<'a, 'b> {}
22
impl<T> Trait<'_, '_> for T {}
33

44
fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
55
//~^ ERROR ambiguous lifetime bound
6+
//~| ERROR ambiguous lifetime bound
67
(x, y)
78
}
89

9-
fn main() { }
10+
fn main() {}

src/test/ui/feature-gates/feature-gate-member-constraints.stderr

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,13 @@ LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
66
|
77
= help: add #![feature(member_constraints)] to the crate attributes to enable
88

9-
error: aborting due to previous error
9+
error: ambiguous lifetime bound in `impl Trait`
10+
--> $DIR/feature-gate-member-constraints.rs:4:43
11+
|
12+
LL | fn foo<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Trait<'a, 'b> {
13+
| ^^^^^^^^^^^^^^^^^^ the elided lifetimes here do not outlive one another
14+
|
15+
= help: add #![feature(member_constraints)] to the crate attributes to enable
16+
17+
error: aborting due to 2 previous errors
1018

src/test/ui/impl-trait/auto-trait-leak.stderr

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,34 @@ error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0`
44
LL | fn cycle1() -> impl Clone {
55
| ^^^^^^^^^^
66
|
7+
note: ...which requires borrow-checking `cycle1`...
8+
--> $DIR/auto-trait-leak.rs:12:1
9+
|
10+
LL | fn cycle1() -> impl Clone {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
12+
note: ...which requires processing `cycle1`...
13+
--> $DIR/auto-trait-leak.rs:12:1
14+
|
15+
LL | fn cycle1() -> impl Clone {
16+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
717
note: ...which requires processing `cycle1`...
818
--> $DIR/auto-trait-leak.rs:12:1
919
|
20+
LL | fn cycle1() -> impl Clone {
21+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
22+
note: ...which requires unsafety-checking `cycle1`...
23+
--> $DIR/auto-trait-leak.rs:12:1
24+
|
25+
LL | fn cycle1() -> impl Clone {
26+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
27+
note: ...which requires building MIR for...
28+
--> $DIR/auto-trait-leak.rs:12:1
29+
|
30+
LL | fn cycle1() -> impl Clone {
31+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
32+
note: ...which requires type-checking `cycle1`...
33+
--> $DIR/auto-trait-leak.rs:12:1
34+
|
1035
LL | fn cycle1() -> impl Clone {
1136
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1237
= note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
@@ -15,9 +40,34 @@ note: ...which requires processing `cycle2::{{opaque}}#0`...
1540
|
1641
LL | fn cycle2() -> impl Clone {
1742
| ^^^^^^^^^^
43+
note: ...which requires borrow-checking `cycle2`...
44+
--> $DIR/auto-trait-leak.rs:21:1
45+
|
46+
LL | fn cycle2() -> impl Clone {
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
1848
note: ...which requires processing `cycle2`...
1949
--> $DIR/auto-trait-leak.rs:22:1
2050
|
51+
LL | fn cycle2() -> impl Clone {
52+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
53+
note: ...which requires processing `cycle2`...
54+
--> $DIR/auto-trait-leak.rs:21:1
55+
|
56+
LL | fn cycle2() -> impl Clone {
57+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
58+
note: ...which requires unsafety-checking `cycle2`...
59+
--> $DIR/auto-trait-leak.rs:21:1
60+
|
61+
LL | fn cycle2() -> impl Clone {
62+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
63+
note: ...which requires building MIR for...
64+
--> $DIR/auto-trait-leak.rs:21:1
65+
|
66+
LL | fn cycle2() -> impl Clone {
67+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
68+
note: ...which requires type-checking `cycle2`...
69+
--> $DIR/auto-trait-leak.rs:21:1
70+
|
2171
LL | fn cycle2() -> impl Clone {
2272
| ^^^^^^^^^^^^^^^^^^^^^^^^^
2373
= note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
@@ -40,9 +90,34 @@ error[E0391]: cycle detected when processing `cycle1::{{opaque}}#0`
4090
LL | fn cycle1() -> impl Clone {
4191
| ^^^^^^^^^^
4292
|
93+
note: ...which requires borrow-checking `cycle1`...
94+
--> $DIR/auto-trait-leak.rs:12:1
95+
|
96+
LL | fn cycle1() -> impl Clone {
97+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
98+
note: ...which requires processing `cycle1`...
99+
--> $DIR/auto-trait-leak.rs:12:1
100+
|
101+
LL | fn cycle1() -> impl Clone {
102+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
43103
note: ...which requires processing `cycle1`...
44104
--> $DIR/auto-trait-leak.rs:12:1
45105
|
106+
LL | fn cycle1() -> impl Clone {
107+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
108+
note: ...which requires unsafety-checking `cycle1`...
109+
--> $DIR/auto-trait-leak.rs:12:1
110+
|
111+
LL | fn cycle1() -> impl Clone {
112+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
113+
note: ...which requires building MIR for...
114+
--> $DIR/auto-trait-leak.rs:12:1
115+
|
116+
LL | fn cycle1() -> impl Clone {
117+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
118+
note: ...which requires type-checking `cycle1`...
119+
--> $DIR/auto-trait-leak.rs:12:1
120+
|
46121
LL | fn cycle1() -> impl Clone {
47122
| ^^^^^^^^^^^^^^^^^^^^^^^^^
48123
= note: ...which requires evaluating trait selection obligation `impl std::clone::Clone: std::marker::Send`...
@@ -51,6 +126,11 @@ note: ...which requires processing `cycle2::{{opaque}}#0`...
51126
|
52127
LL | fn cycle2() -> impl Clone {
53128
| ^^^^^^^^^^
129+
note: ...which requires borrow-checking `cycle2`...
130+
--> $DIR/auto-trait-leak.rs:21:1
131+
|
132+
LL | fn cycle2() -> impl Clone {
133+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
54134
note: ...which requires processing `cycle2`...
55135
--> $DIR/auto-trait-leak.rs:22:1
56136
|
@@ -89,6 +169,26 @@ LL | fn cycle2() -> impl Clone {
89169
note: ...which requires processing `cycle2`...
90170
--> $DIR/auto-trait-leak.rs:22:1
91171
|
172+
LL | fn cycle2() -> impl Clone {
173+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
174+
note: ...which requires processing `cycle2`...
175+
--> $DIR/auto-trait-leak.rs:21:1
176+
|
177+
LL | fn cycle2() -> impl Clone {
178+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
179+
note: ...which requires unsafety-checking `cycle2`...
180+
--> $DIR/auto-trait-leak.rs:21:1
181+
|
182+
LL | fn cycle2() -> impl Clone {
183+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
184+
note: ...which requires building MIR for...
185+
--> $DIR/auto-trait-leak.rs:21:1
186+
|
187+
LL | fn cycle2() -> impl Clone {
188+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
189+
note: ...which requires type-checking `cycle2`...
190+
--> $DIR/auto-trait-leak.rs:21:1
191+
|
92192
LL | fn cycle2() -> impl Clone {
93193
| ^^^^^^^^^^^^^^^^^^^^^^^^^
94194
= note: ...which again requires processing `cycle1::{{opaque}}#0`, completing the cycle

src/test/ui/impl-trait/recursive-impl-trait-type-direct.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
// Test that an `impl Trait` type that expands to itself is an error.
22

3-
fn test() -> impl Sized { //~ ERROR E0720
3+
#![allow(unconditional_recursion)]
4+
5+
fn test() -> impl Sized {
6+
//~^ ERROR E0720
47
test()
58
}
69

src/test/ui/impl-trait/recursive-impl-trait-type-direct.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0720]: opaque type expands to a recursive type
2-
--> $DIR/recursive-impl-trait-type-direct.rs:3:14
2+
--> $DIR/recursive-impl-trait-type-direct.rs:5:14
33
|
44
LL | fn test() -> impl Sized {
55
| ^^^^^^^^^^ expands to a recursive type

0 commit comments

Comments
 (0)