Bless output

This commit is contained in:
Dylan MacKenzie 2020-09-29 18:32:38 -07:00
parent 37f37dc5ba
commit 879d3794d3
10 changed files with 96 additions and 16 deletions

View File

@ -1,5 +1,5 @@
error[E0658]: mutation through a reference is not allowed in statics
--> $DIR/mod-static-with-const-fn.rs:15:5
--> $DIR/mod-static-with-const-fn.rs:16:5
|
LL | *FOO.0.get() = 5;
| ^^^^^^^^^^^^^^^^

View File

@ -3,6 +3,7 @@
const extern fn unsize(x: &[u8; 3]) -> &[u8] { x }
const unsafe extern "C" fn closure() -> fn() { || {} }
//~^ ERROR function pointer
//~| ERROR function pointer cast
const unsafe extern fn use_float() { 1.0 + 1.0; }
//~^ ERROR floating point arithmetic
const extern "C" fn ptr_cast(val: *const u8) { val as usize; }

View File

@ -1,4 +1,13 @@
error[E0658]: function pointers cannot appear in constant functions
--> $DIR/const-extern-fn-min-const-fn.rs:4:41
|
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
| ^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/const-extern-fn-min-const-fn.rs:4:48
|
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
@ -8,7 +17,7 @@ LL | const unsafe extern "C" fn closure() -> fn() { || {} }
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: floating point arithmetic is not allowed in constant functions
--> $DIR/const-extern-fn-min-const-fn.rs:6:38
--> $DIR/const-extern-fn-min-const-fn.rs:7:38
|
LL | const unsafe extern fn use_float() { 1.0 + 1.0; }
| ^^^^^^^^^
@ -17,7 +26,7 @@ LL | const unsafe extern fn use_float() { 1.0 + 1.0; }
= help: add `#![feature(const_fn_floating_point_arithmetic)]` to the crate attributes to enable
error[E0658]: casting pointers to integers in constant functions is unstable
--> $DIR/const-extern-fn-min-const-fn.rs:8:48
--> $DIR/const-extern-fn-min-const-fn.rs:9:48
|
LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
| ^^^^^^^^^^^^
@ -25,6 +34,6 @@ LL | const extern "C" fn ptr_cast(val: *const u8) { val as usize; }
= note: see issue #51910 <https://github.com/rust-lang/rust/issues/51910> for more information
= help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable
error: aborting due to 3 previous errors
error: aborting due to 4 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -3,11 +3,15 @@ fn main() {}
const fn unsize(x: &[u8; 3]) -> &[u8] { x }
const fn closure() -> fn() { || {} }
//~^ ERROR function pointer
//~| ERROR function pointer cast
const fn closure2() {
(|| {}) as fn();
//~^ ERROR function pointer
}
const fn reify(f: fn()) -> unsafe fn() { f }
//~^ ERROR function pointer
//~| ERROR function pointer
//~| ERROR function pointer cast
const fn reify2() { main as unsafe fn(); }
//~^ ERROR function pointer
//~| ERROR function pointer cast

View File

@ -1,4 +1,13 @@
error[E0658]: function pointers cannot appear in constant functions
--> $DIR/cast_errors.rs:4:23
|
LL | const fn closure() -> fn() { || {} }
| ^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/cast_errors.rs:4:30
|
LL | const fn closure() -> fn() { || {} }
@ -7,17 +16,17 @@ LL | const fn closure() -> fn() { || {} }
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointers cannot appear in constant functions
--> $DIR/cast_errors.rs:7:5
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/cast_errors.rs:8:5
|
LL | (|| {}) as fn();
| ^^^^^^^^^^^^^^^
| ^^^^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointers cannot appear in constant functions
--> $DIR/cast_errors.rs:10:16
--> $DIR/cast_errors.rs:11:16
|
LL | const fn reify(f: fn()) -> unsafe fn() { f }
| ^
@ -26,14 +35,41 @@ LL | const fn reify(f: fn()) -> unsafe fn() { f }
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointers cannot appear in constant functions
--> $DIR/cast_errors.rs:12:21
--> $DIR/cast_errors.rs:11:28
|
LL | const fn reify2() { main as unsafe fn(); }
| ^^^^^^^^^^^^^^^^^^^
LL | const fn reify(f: fn()) -> unsafe fn() { f }
| ^^^^^^^^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error: aborting due to 4 previous errors
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/cast_errors.rs:11:42
|
LL | const fn reify(f: fn()) -> unsafe fn() { f }
| ^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/cast_errors.rs:15:21
|
LL | const fn reify2() { main as unsafe fn(); }
| ^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/cast_errors.rs:15:21
|
LL | const fn reify2() { main as unsafe fn(); }
| ^^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -1,5 +1,8 @@
const fn cmp(x: fn(), y: fn()) -> bool { //~ ERROR function pointer
const fn cmp(x: fn(), y: fn()) -> bool {
//~^ ERROR function pointer
//~| ERROR function pointer
unsafe { x == y }
//~^ ERROR pointers cannot be reliably compared
}
fn main() {}

View File

@ -7,6 +7,23 @@ LL | const fn cmp(x: fn(), y: fn()) -> bool {
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error: aborting due to previous error
error[E0658]: function pointers cannot appear in constant functions
--> $DIR/cmp_fn_pointers.rs:1:23
|
LL | const fn cmp(x: fn(), y: fn()) -> bool {
| ^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error: pointers cannot be reliably compared during const eval.
--> $DIR/cmp_fn_pointers.rs:4:14
|
LL | unsafe { x == y }
| ^^^^^^
|
= note: see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0658`.

View File

@ -139,3 +139,4 @@ const fn no_fn_ptrs(_x: fn()) {}
//~^ ERROR function pointer
const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
//~^ ERROR function pointer
//~| ERROR function pointer cast

View File

@ -299,7 +299,16 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error: aborting due to 34 previous errors
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/min_const_fn.rs:140:46
|
LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo }
| ^^^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error: aborting due to 35 previous errors
Some errors have detailed explanations: E0013, E0493, E0658, E0723.
For more information about an error, try `rustc --explain E0013`.

View File

@ -7,7 +7,7 @@ LL | x.0.field;
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
error[E0658]: function pointers cannot appear in constant functions
error[E0658]: function pointer casts are not allowed in constant functions
--> $DIR/min_const_fn_fn_ptr.rs:16:59
|
LL | const fn no_inner_dyn_trait_ret() -> Hide { Hide(HasPtr { field }) }