Skip to content

Commit 5a16a25

Browse files
committed
Update const fn tests
1 parent 703540d commit 5a16a25

14 files changed

+202
-65
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
error: heap allocations are not allowed in const fn
1+
error[E0723]: heap allocations are not allowed in const fn (see issue #57563)
22
--> $DIR/bad_const_fn_body_ice.rs:2:5
33
|
44
LL | vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn
55
| ^^^^^^^^^^^^^
66
|
7+
= help: add #![feature(const_fn)] to the crate attributes to enable
78
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
89

910
error: aborting due to previous error
1011

12+
For more information about this error, try `rustc --explain E0723`.
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,43 @@
1-
error: unsizing casts are not allowed in const fn
1+
error[E0723]: unsizing casts are not allowed in const fn (see issue #57563)
22
--> $DIR/cast_errors.rs:3:41
33
|
44
LL | const fn unsize(x: &[u8; 3]) -> &[u8] { x }
55
| ^
6+
|
7+
= help: add #![feature(const_fn)] to the crate attributes to enable
68

7-
error: function pointers in const fn are unstable
9+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
810
--> $DIR/cast_errors.rs:5:23
911
|
1012
LL | const fn closure() -> fn() { || {} }
1113
| ^^^^
14+
|
15+
= help: add #![feature(const_fn)] to the crate attributes to enable
1216

13-
error: function pointers in const fn are unstable
17+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
1418
--> $DIR/cast_errors.rs:8:5
1519
|
1620
LL | (|| {}) as fn();
1721
| ^^^^^^^^^^^^^^^
22+
|
23+
= help: add #![feature(const_fn)] to the crate attributes to enable
1824

19-
error: function pointers in const fn are unstable
25+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
2026
--> $DIR/cast_errors.rs:11:28
2127
|
2228
LL | const fn reify(f: fn()) -> unsafe fn() { f }
2329
| ^^^^^^^^^^^
30+
|
31+
= help: add #![feature(const_fn)] to the crate attributes to enable
2432

25-
error: function pointers in const fn are unstable
33+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
2634
--> $DIR/cast_errors.rs:13:21
2735
|
2836
LL | const fn reify2() { main as unsafe fn(); }
2937
| ^^^^^^^^^^^^^^^^^^^
38+
|
39+
= help: add #![feature(const_fn)] to the crate attributes to enable
3040

3141
error: aborting due to 5 previous errors
3242

43+
For more information about this error, try `rustc --explain E0723`.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
error: function pointers in const fn are unstable
1+
error[E0723]: function pointers in const fn are unstable (see issue #57563)
22
--> $DIR/cmp_fn_pointers.rs:1:14
33
|
44
LL | const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable
55
| ^
6+
|
7+
= help: add #![feature(const_fn)] to the crate attributes to enable
68

79
error: aborting due to previous error
810

11+
For more information about this error, try `rustc --explain E0723`.
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
error: loops are not allowed in const fn
1+
error[E0723]: loops are not allowed in const fn (see issue #57563)
22
--> $DIR/loop_ice.rs:2:5
33
|
44
LL | loop {} //~ ERROR loops are not allowed in const fn
55
| ^^^^^^^
6+
|
7+
= help: add #![feature(const_fn)] to the crate attributes to enable
68

79
error: aborting due to previous error
810

11+
For more information about this error, try `rustc --explain E0723`.

0 commit comments

Comments
 (0)