remove stderr-per-bitwidth from some tests
This commit is contained in:
parent
0702701297
commit
f68e79dcac
15 changed files with 53 additions and 311 deletions
|
@ -1,52 +0,0 @@
|
|||
warning: the type `!` does not permit zero-initialization
|
||||
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
||||
|
|
||||
LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
|
||||
|
|
||||
= note: the `!` type has no valid value
|
||||
= note: `#[warn(invalid_value)]` on by default
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
||||
|
|
||||
LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
|
||||
|
|
||||
note: inside `foo`
|
||||
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
||||
|
|
||||
LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: inside `FOO`
|
||||
--> $DIR/validate_uninhabited_zsts.rs:19:33
|
||||
|
|
||||
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
|
||||
| ^^^^^
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/validate_uninhabited_zsts.rs:21:42
|
||||
|
|
||||
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type `Void`
|
||||
|
||||
warning: the type `empty::Empty` does not permit zero-initialization
|
||||
--> $DIR/validate_uninhabited_zsts.rs:21:42
|
||||
|
|
||||
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
|
||||
|
|
||||
note: in this struct field
|
||||
--> $DIR/validate_uninhabited_zsts.rs:16:22
|
||||
|
|
||||
LL | pub struct Empty(Void);
|
||||
| ^^^^
|
||||
note: enums with no inhabited variants have no valid value
|
||||
--> $DIR/validate_uninhabited_zsts.rs:13:5
|
||||
|
|
||||
LL | enum Void {}
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 2 previous errors; 2 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
|
@ -1,5 +1,3 @@
|
|||
// stderr-per-bitwidth
|
||||
|
||||
const fn foo() -> ! {
|
||||
unsafe { std::mem::transmute(()) }
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
warning: the type `!` does not permit zero-initialization
|
||||
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
||||
--> $DIR/validate_uninhabited_zsts.rs:2:14
|
||||
|
|
||||
LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
|
||||
|
@ -8,41 +8,41 @@ LL | unsafe { std::mem::transmute(()) }
|
|||
= note: `#[warn(invalid_value)]` on by default
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
||||
--> $DIR/validate_uninhabited_zsts.rs:2:14
|
||||
|
|
||||
LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered a value of the never type `!`
|
||||
|
|
||||
note: inside `foo`
|
||||
--> $DIR/validate_uninhabited_zsts.rs:4:14
|
||||
--> $DIR/validate_uninhabited_zsts.rs:2:14
|
||||
|
|
||||
LL | unsafe { std::mem::transmute(()) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
note: inside `FOO`
|
||||
--> $DIR/validate_uninhabited_zsts.rs:19:33
|
||||
--> $DIR/validate_uninhabited_zsts.rs:17:33
|
||||
|
|
||||
LL | const FOO: [empty::Empty; 3] = [foo(); 3];
|
||||
| ^^^^^
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/validate_uninhabited_zsts.rs:21:42
|
||||
--> $DIR/validate_uninhabited_zsts.rs:19:42
|
||||
|
|
||||
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .0: encountered a value of uninhabited type `Void`
|
||||
|
||||
warning: the type `empty::Empty` does not permit zero-initialization
|
||||
--> $DIR/validate_uninhabited_zsts.rs:21:42
|
||||
--> $DIR/validate_uninhabited_zsts.rs:19:42
|
||||
|
|
||||
LL | const BAR: [empty::Empty; 3] = [unsafe { std::mem::transmute(()) }; 3];
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ this code causes undefined behavior when executed
|
||||
|
|
||||
note: in this struct field
|
||||
--> $DIR/validate_uninhabited_zsts.rs:16:22
|
||||
--> $DIR/validate_uninhabited_zsts.rs:14:22
|
||||
|
|
||||
LL | pub struct Empty(Void);
|
||||
| ^^^^
|
||||
note: enums with no inhabited variants have no valid value
|
||||
--> $DIR/validate_uninhabited_zsts.rs:13:5
|
||||
--> $DIR/validate_uninhabited_zsts.rs:11:5
|
||||
|
|
||||
LL | enum Void {}
|
||||
| ^^^^^^^^^
|
|
@ -1,26 +0,0 @@
|
|||
error[E0764]: mutable references are not allowed in the final value of constants
|
||||
--> $DIR/issue-76510.rs:5:29
|
||||
|
|
||||
LL | const S: &'static mut str = &mut " hello ";
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0658]: mutation through a reference is not allowed in constants
|
||||
--> $DIR/issue-76510.rs:5:29
|
||||
|
|
||||
LL | const S: &'static mut str = &mut " hello ";
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0596]: cannot borrow data in a `&` reference as mutable
|
||||
--> $DIR/issue-76510.rs:5:29
|
||||
|
|
||||
LL | const S: &'static mut str = &mut " hello ";
|
||||
| ^^^^^^^^^^^^^^ cannot borrow as mutable
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0596, E0658, E0764.
|
||||
For more information about an error, try `rustc --explain E0596`.
|
|
@ -1,5 +1,3 @@
|
|||
// stderr-per-bitwidth
|
||||
|
||||
use std::mem::{transmute, ManuallyDrop};
|
||||
|
||||
const S: &'static mut str = &mut " hello ";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
error[E0764]: mutable references are not allowed in the final value of constants
|
||||
--> $DIR/issue-76510.rs:5:29
|
||||
--> $DIR/issue-76510.rs:3:29
|
||||
|
|
||||
LL | const S: &'static mut str = &mut " hello ";
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
||||
error[E0658]: mutation through a reference is not allowed in constants
|
||||
--> $DIR/issue-76510.rs:5:29
|
||||
--> $DIR/issue-76510.rs:3:29
|
||||
|
|
||||
LL | const S: &'static mut str = &mut " hello ";
|
||||
| ^^^^^^^^^^^^^^
|
||||
|
@ -15,7 +15,7 @@ LL | const S: &'static mut str = &mut " hello ";
|
|||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0596]: cannot borrow data in a `&` reference as mutable
|
||||
--> $DIR/issue-76510.rs:5:29
|
||||
--> $DIR/issue-76510.rs:3:29
|
||||
|
|
||||
LL | const S: &'static mut str = &mut " hello ";
|
||||
| ^^^^^^^^^^^^^^ cannot borrow as mutable
|
|
@ -1,25 +0,0 @@
|
|||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:16:1
|
||||
|
|
||||
LL | const A: Option<&mut i32> = helper();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾ALLOC0╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:18:1
|
||||
|
|
||||
LL | static A_STATIC: Option<&mut i32> = helper();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾ALLOC0╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
|
@ -1,4 +1,5 @@
|
|||
// stderr-per-bitwidth
|
||||
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
|
||||
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
|
||||
#![feature(const_mut_refs, const_refs_to_static)]
|
||||
#![feature(raw_ref_op)]
|
||||
|
||||
|
|
|
@ -1,23 +1,23 @@
|
|||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:16:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:17:1
|
||||
|
|
||||
LL | const A: Option<&mut i32> = helper();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾ALLOC0╼ │ ╾──╼
|
||||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
||||
HEX_DUMP
|
||||
}
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:18:1
|
||||
--> $DIR/mut_ref_in_final_dynamic_check.rs:19:1
|
||||
|
|
||||
LL | static A_STATIC: Option<&mut i32> = helper();
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<enum-variant(Some)>.0: encountered mutable reference in a `const` or `static`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾ALLOC0╼ │ ╾──╼
|
||||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
||||
HEX_DUMP
|
||||
}
|
||||
|
||||
error: aborting due to 2 previous errors
|
|
@ -1,65 +0,0 @@
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static.rs:9:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static.rs:14:14
|
||||
|
|
||||
LL | unsafe { *(&FOO as *const _ as *const usize) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses mutable global memory
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static.rs:18:32
|
||||
|
|
||||
LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
||||
| ^^^^^^^ constant accesses mutable global memory
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static.rs:21:1
|
||||
|
|
||||
LL | const REF_INTERIOR_MUT: &usize = {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾ALLOC0<imm>╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
warning: skipping const checks
|
||||
|
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:9:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^
|
||||
help: skipping check that does not even have a feature gate
|
||||
--> $DIR/const_refers_to_static.rs:9:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:14:17
|
||||
|
|
||||
LL | unsafe { *(&FOO as *const _ as *const usize) }
|
||||
| ^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:18:32
|
||||
|
|
||||
LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
||||
| ^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:24:18
|
||||
|
|
||||
LL | unsafe { &*(&FOO as *const _ as *const usize) }
|
||||
| ^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:29:25
|
||||
|
|
||||
LL | const REF_IMMUT: &u8 = &MY_STATIC;
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
|
@ -1,5 +1,6 @@
|
|||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
// stderr-per-bitwidth
|
||||
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
|
||||
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
|
|
@ -1,61 +1,61 @@
|
|||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static.rs:9:5
|
||||
--> $DIR/const_refers_to_static.rs:10:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling non-const function `AtomicUsize::fetch_add`
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static.rs:14:14
|
||||
--> $DIR/const_refers_to_static.rs:15:14
|
||||
|
|
||||
LL | unsafe { *(&FOO as *const _ as *const usize) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses mutable global memory
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static.rs:18:32
|
||||
--> $DIR/const_refers_to_static.rs:19:32
|
||||
|
|
||||
LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
||||
| ^^^^^^^ constant accesses mutable global memory
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static.rs:21:1
|
||||
--> $DIR/const_refers_to_static.rs:22:1
|
||||
|
|
||||
LL | const REF_INTERIOR_MUT: &usize = {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾ALLOC0<imm>╼ │ ╾──╼
|
||||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
||||
HEX_DUMP
|
||||
}
|
||||
|
||||
warning: skipping const checks
|
||||
|
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:9:5
|
||||
--> $DIR/const_refers_to_static.rs:10:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^
|
||||
help: skipping check that does not even have a feature gate
|
||||
--> $DIR/const_refers_to_static.rs:9:5
|
||||
--> $DIR/const_refers_to_static.rs:10:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:14:17
|
||||
--> $DIR/const_refers_to_static.rs:15:17
|
||||
|
|
||||
LL | unsafe { *(&FOO as *const _ as *const usize) }
|
||||
| ^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:18:32
|
||||
--> $DIR/const_refers_to_static.rs:19:32
|
||||
|
|
||||
LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
||||
| ^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:24:18
|
||||
--> $DIR/const_refers_to_static.rs:25:18
|
||||
|
|
||||
LL | unsafe { &*(&FOO as *const _ as *const usize) }
|
||||
| ^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static.rs:29:25
|
||||
--> $DIR/const_refers_to_static.rs:30:25
|
||||
|
|
||||
LL | const REF_IMMUT: &u8 = &MY_STATIC;
|
||||
| ^^^^^^^^^
|
|
@ -1,89 +0,0 @@
|
|||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:11:1
|
||||
|
|
||||
LL | const SLICE_MUT: &[u8; 1] = {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾ALLOC0<imm>╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:39:9
|
||||
|
|
||||
LL | SLICE_MUT => true,
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:16:1
|
||||
|
|
||||
LL | const U8_MUT: &u8 = {
|
||||
| ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾ALLOC0<imm>╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:47:9
|
||||
|
|
||||
LL | U8_MUT => true,
|
||||
| ^^^^^^
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:22:1
|
||||
|
|
||||
LL | const U8_MUT2: &u8 = {
|
||||
| ^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 8, align: 8) {
|
||||
╾ALLOC0<imm>╼ │ ╾──────╼
|
||||
}
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:57:9
|
||||
|
|
||||
LL | U8_MUT2 => true,
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:28:15
|
||||
|
|
||||
LL | match static_cross_crate::OPT_ZERO {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses mutable global memory
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:64:9
|
||||
|
|
||||
LL | U8_MUT3 => true,
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
|
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:13:15
|
||||
|
|
||||
LL | unsafe { &static_cross_crate::ZERO }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:18:15
|
||||
|
|
||||
LL | unsafe { &static_cross_crate::ZERO[0] }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:24:17
|
||||
|
|
||||
LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:28:15
|
||||
|
|
||||
LL | match static_cross_crate::OPT_ZERO {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 8 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
|
@ -1,6 +1,7 @@
|
|||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
// aux-build:static_cross_crate.rs
|
||||
// stderr-per-bitwidth
|
||||
// normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
|
||||
// normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
|
||||
#![feature(exclusive_range_pattern, half_open_range_patterns_in_slices)]
|
||||
#![allow(static_mut_ref)]
|
||||
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:11:1
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:12:1
|
||||
|
|
||||
LL | const SLICE_MUT: &[u8; 1] = {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾ALLOC0<imm>╼ │ ╾──╼
|
||||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
||||
HEX_DUMP
|
||||
}
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:39:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:40:9
|
||||
|
|
||||
LL | SLICE_MUT => true,
|
||||
| ^^^^^^^^^
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:16:1
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:17:1
|
||||
|
|
||||
LL | const U8_MUT: &u8 = {
|
||||
| ^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾ALLOC0<imm>╼ │ ╾──╼
|
||||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
||||
HEX_DUMP
|
||||
}
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:47:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:48:9
|
||||
|
|
||||
LL | U8_MUT => true,
|
||||
| ^^^^^^
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:22:1
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:23:1
|
||||
|
|
||||
LL | const U8_MUT2: &u8 = {
|
||||
| ^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
|
||||
|
|
||||
= note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
|
||||
= note: the raw bytes of the constant (size: 4, align: 4) {
|
||||
╾ALLOC0<imm>╼ │ ╾──╼
|
||||
= note: the raw bytes of the constant (size: $SIZE, align: $ALIGN) {
|
||||
HEX_DUMP
|
||||
}
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:57:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:58:9
|
||||
|
|
||||
LL | U8_MUT2 => true,
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:28:15
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:29:15
|
||||
|
|
||||
LL | match static_cross_crate::OPT_ZERO {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constant accesses mutable global memory
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:64:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:65:9
|
||||
|
|
||||
LL | U8_MUT3 => true,
|
||||
| ^^^^^^^
|
||||
|
@ -64,22 +64,22 @@ LL | U8_MUT3 => true,
|
|||
warning: skipping const checks
|
||||
|
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:13:15
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:14:15
|
||||
|
|
||||
LL | unsafe { &static_cross_crate::ZERO }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:18:15
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:19:15
|
||||
|
|
||||
LL | unsafe { &static_cross_crate::ZERO[0] }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:24:17
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:25:17
|
||||
|
|
||||
LL | unsafe { &(*static_cross_crate::ZERO_REF)[0] }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
help: skipping check for `const_refs_to_static` feature
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:28:15
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:29:15
|
||||
|
|
||||
LL | match static_cross_crate::OPT_ZERO {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
Loading…
Add table
Reference in a new issue