2024-03-08 14:13:57 -05:00
error[E0080]: it is undefined behavior to use this value
--> $DIR/mutable_references_err.rs:18:1
|
LL | const MUH: Meh = Meh {
| ^^^^^^^^^^^^^^ constructing invalid value at .x.<deref>: encountered `UnsafeCell` in read-only memory
|
= 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
2024-02-29 08:15:22 +01:00
error[E0080]: it is undefined behavior to use this value
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:29:1
2024-03-08 14:13:57 -05:00
|
LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.<dyn-downcast>.x: encountered `UnsafeCell` in read-only memory
|
= 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:34:1
2024-02-29 08:15:22 +01:00
|
LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
| ^^^^^^^^^^^^^^^^^^^^^^ 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:38:1
2024-02-29 08:15:22 +01:00
|
2024-03-08 14:13:57 -05:00
LL | const BLUNT: &mut i32 = &mut 42;
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
|
= 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:43:1
2024-03-08 14:13:57 -05:00
|
2024-02-29 08:15:22 +01:00
LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
|
= 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
error[E0080]: it is undefined behavior to use this value
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:50:1
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 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: $SIZE, align: $ALIGN) {
HEX_DUMP
}
note: erroneous constant encountered
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:52:34
2024-02-29 08:15:22 +01:00
|
LL | const READS_FROM_MUTABLE: i32 = *POINTS_TO_MUTABLE1;
| ^^^^^^^^^^^^^^^^^^
error[E0080]: evaluation of constant value failed
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:54:43
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF };
| ^^^^^^^^^^^^^ constant accesses mutable global memory
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:58:1
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-08 14:13:57 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
2024-03-26 09:46:30 +00:00
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-02-29 08:15:22 +01:00
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:62:1
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-08 14:13:57 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
2024-02-29 08:15:22 +01:00
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:66:1
2024-02-29 08:15:22 +01:00
|
LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-08 14:13:57 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
2024-02-29 08:15:22 +01:00
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:79:1
2024-02-29 08:15:22 +01:00
|
LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-08 14:13:57 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
2024-02-29 08:15:22 +01:00
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:83:1
2024-02-29 08:15:22 +01:00
|
LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-08 14:13:57 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
2024-02-29 08:15:22 +01:00
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:87:1
2024-02-29 08:15:22 +01:00
|
LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-03-08 14:13:57 -05:00
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
2024-02-29 08:15:22 +01:00
warning: skipping const checks
|
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:20:8
2024-02-29 08:15:22 +01:00
|
LL | x: &UnsafeCell::new(42),
| ^^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:29:27
2024-02-29 08:15:22 +01:00
|
LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: skipping check for `const_refs_to_static` feature
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:34:40
2024-02-29 08:15:22 +01:00
|
LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
| ^^^
help: skipping check for `const_mut_refs` feature
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:34:35
2024-02-29 08:15:22 +01:00
|
LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
| ^^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:38:25
2024-02-29 08:15:22 +01:00
|
LL | const BLUNT: &mut i32 = &mut 42;
| ^^^^^^^
help: skipping check for `const_mut_refs` feature
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:43:49
2024-02-29 08:15:22 +01:00
|
LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: skipping check for `const_mut_refs` feature
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:43:49
2024-02-29 08:15:22 +01:00
|
LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: skipping check for `const_refs_to_static` feature
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:50:44
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
| ^^^^^^^
help: skipping check for `const_refs_to_static` feature
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:54:45
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF };
| ^^^^^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:58:45
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
| ^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:62:46
2024-02-29 08:15:22 +01:00
|
LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
| ^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:66:47
2024-02-29 08:15:22 +01:00
|
LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
| ^^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:79:51
2024-02-29 08:15:22 +01:00
|
LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
| ^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:83:49
2024-02-29 08:15:22 +01:00
|
LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
| ^^^^^^^
help: skipping check that does not even have a feature gate
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:87:51
2024-02-29 08:15:22 +01:00
|
LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
| ^^^^^^
2024-03-26 09:46:30 +00:00
error: aborting due to 13 previous errors; 1 warning emitted
2024-02-29 08:15:22 +01:00
For more information about this error, try `rustc --explain E0080`.
2024-03-08 14:13:57 -05:00
Future incompatibility report: Future breakage diagnostic:
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:58:1
2024-03-08 14:13:57 -05:00
|
LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:62:1
2024-03-08 14:13:57 -05:00
|
LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:66:1
2024-03-08 14:13:57 -05:00
|
LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:79:1
2024-03-08 14:13:57 -05:00
|
LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:83:1
2024-03-08 14:13:57 -05:00
|
LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Future breakage diagnostic:
error: encountered mutable pointer in final value of constant
2024-03-26 09:46:30 +00:00
--> $DIR/mutable_references_err.rs:87:1
2024-03-08 14:13:57 -05:00
|
LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
note: the lint level is defined here
--> $DIR/mutable_references_err.rs:5:9
|
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^