Skip to content

Commit 4bbc79c

Browse files
Bless tests
1 parent e02ea83 commit 4bbc79c

File tree

4 files changed

+55
-15
lines changed

4 files changed

+55
-15
lines changed

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

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,15 +125,21 @@ impl<T: Sync + Sized> Foo<T> {
125125
struct AlanTuring<T>(T);
126126
const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
127127
//~^ ERROR trait bounds other than `Sized`
128-
const fn no_apit(_x: impl std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
129-
const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} //~ ERROR trait bounds other than `Sized`
128+
//~| ERROR destructor
129+
const fn no_apit(_x: impl std::fmt::Debug) {}
130+
//~^ ERROR trait bounds other than `Sized`
131+
//~| ERROR destructor
132+
const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
133+
//~^ ERROR trait bounds other than `Sized`
130134
const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
131135
//~^ ERROR trait bounds other than `Sized`
136+
//~| ERROR unsizing cast
137+
//~| ERROR unsizing cast
132138

133139
const fn no_unsafe() { unsafe {} }
134140

135141
const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
136-
//~^ ERROR trait bounds other than `Sized`
142+
//~^ ERROR unsizing cast
137143

138144
const fn no_fn_ptrs(_x: fn()) {}
139145
//~^ ERROR function pointer

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

Lines changed: 44 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,17 +245,33 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
245245
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
246246
= help: add `#![feature(const_fn)]` to the crate attributes to enable
247247

248+
error[E0493]: destructors cannot be evaluated at compile-time
249+
--> $DIR/min_const_fn.rs:126:19
250+
|
251+
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
252+
| ^^ - value is dropped here
253+
| |
254+
| constant functions cannot evaluate destructors
255+
248256
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
249-
--> $DIR/min_const_fn.rs:128:22
257+
--> $DIR/min_const_fn.rs:129:22
250258
|
251259
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
252260
| ^^^^^^^^^^^^^^^^^^^^
253261
|
254262
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
255263
= help: add `#![feature(const_fn)]` to the crate attributes to enable
256264

265+
error[E0493]: destructors cannot be evaluated at compile-time
266+
--> $DIR/min_const_fn.rs:129:18
267+
|
268+
LL | const fn no_apit(_x: impl std::fmt::Debug) {}
269+
| ^^ - value is dropped here
270+
| |
271+
| constant functions cannot evaluate destructors
272+
257273
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
258-
--> $DIR/min_const_fn.rs:129:23
274+
--> $DIR/min_const_fn.rs:132:23
259275
|
260276
LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
261277
| ^^
@@ -264,25 +280,43 @@ LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {}
264280
= help: add `#![feature(const_fn)]` to the crate attributes to enable
265281

266282
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
267-
--> $DIR/min_const_fn.rs:130:63
283+
--> $DIR/min_const_fn.rs:134:32
284+
|
285+
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
286+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
287+
|
288+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
289+
= help: add `#![feature(const_fn)]` to the crate attributes to enable
290+
291+
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
292+
--> $DIR/min_const_fn.rs:134:63
268293
|
269294
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
270295
| ^^^
271296
|
272297
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
273298
= help: add `#![feature(const_fn)]` to the crate attributes to enable
274299

275-
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
276-
--> $DIR/min_const_fn.rs:135:41
300+
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
301+
--> $DIR/min_const_fn.rs:134:63
302+
|
303+
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
304+
| ^^^
305+
|
306+
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
307+
= help: add `#![feature(const_fn)]` to the crate attributes to enable
308+
309+
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
310+
--> $DIR/min_const_fn.rs:141:42
277311
|
278312
LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 }
279-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
313+
| ^^^
280314
|
281315
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
282316
= help: add `#![feature(const_fn)]` to the crate attributes to enable
283317

284318
error[E0658]: function pointers cannot appear in constant functions
285-
--> $DIR/min_const_fn.rs:138:21
319+
--> $DIR/min_const_fn.rs:144:21
286320
|
287321
LL | const fn no_fn_ptrs(_x: fn()) {}
288322
| ^^
@@ -291,7 +325,7 @@ LL | const fn no_fn_ptrs(_x: fn()) {}
291325
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
292326

293327
error[E0658]: function pointers cannot appear in constant functions
294-
--> $DIR/min_const_fn.rs:140:27
328+
--> $DIR/min_const_fn.rs:146:27
295329
|
296330
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
297331
| ^^^^
@@ -300,15 +334,15 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
300334
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
301335

302336
error[E0658]: function pointer casts are not allowed in constant functions
303-
--> $DIR/min_const_fn.rs:140:46
337+
--> $DIR/min_const_fn.rs:146:46
304338
|
305339
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
306340
| ^^^
307341
|
308342
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
309343
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
310344

311-
error: aborting due to 35 previous errors
345+
error: aborting due to 39 previous errors
312346

313347
Some errors have detailed explanations: E0013, E0493, E0658, E0723.
314348
For more information about an error, try `rustc --explain E0013`.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ const fn no_inner_dyn_trait2(x: Hide) {
1010
//~^ ERROR trait bounds other than `Sized`
1111
}
1212
const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }
13-
//~^ ERROR trait bounds other than `Sized`
13+
//~^ ERROR unsizing cast
1414

1515
fn main() {}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | x.0.field;
77
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
88
= help: add `#![feature(const_fn)]` to the crate attributes to enable
99

10-
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
10+
error[E0723]: unsizing casts to types besides slices are not allowed in const fn
1111
--> $DIR/min_const_fn_dyn.rs:12:66
1212
|
1313
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasDyn { field: &0 }) }

0 commit comments

Comments
 (0)