Skip to content

Commit

Permalink
Update const fn tests
Browse files Browse the repository at this point in the history
  • Loading branch information
varkor committed Feb 14, 2019
1 parent 2c339ae commit feb3408
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 65 deletions.
4 changes: 3 additions & 1 deletion src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
error: heap allocations are not allowed in const fn
error[E0723]: heap allocations are not allowed in const fn (see issue #57563)
--> $DIR/bad_const_fn_body_ice.rs:2:5
|
LL | vec![1, 2, 3] //~ ERROR heap allocations are not allowed in const fn
| ^^^^^^^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)

error: aborting due to previous error

For more information about this error, try `rustc --explain E0723`.
21 changes: 16 additions & 5 deletions src/test/ui/consts/min_const_fn/cast_errors.stderr
Original file line number Diff line number Diff line change
@@ -1,32 +1,43 @@
error: unsizing casts are not allowed in const fn
error[E0723]: unsizing casts are not allowed in const fn (see issue #57563)
--> $DIR/cast_errors.rs:3:41
|
LL | const fn unsize(x: &[u8; 3]) -> &[u8] { x }
| ^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

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

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

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

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

error: aborting due to 5 previous errors

For more information about this error, try `rustc --explain E0723`.
5 changes: 4 additions & 1 deletion src/test/ui/consts/min_const_fn/cmp_fn_pointers.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
error: function pointers in const fn are unstable
error[E0723]: function pointers in const fn are unstable (see issue #57563)
--> $DIR/cmp_fn_pointers.rs:1:14
|
LL | const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointers in const fn are unstable
| ^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: aborting due to previous error

For more information about this error, try `rustc --explain E0723`.
5 changes: 4 additions & 1 deletion src/test/ui/consts/min_const_fn/loop_ice.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
error: loops are not allowed in const fn
error[E0723]: loops are not allowed in const fn (see issue #57563)
--> $DIR/loop_ice.rs:2:5
|
LL | loop {} //~ ERROR loops are not allowed in const fn
| ^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: aborting due to previous error

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

0 comments on commit feb3408

Please sign in to comment.