Rebase. Update expected output to match current output.

This commit is contained in:
Felix S. Klock II 2024-03-13 10:50:17 -04:00
parent ae374cf04a
commit 1ea091a7fc
6 changed files with 67 additions and 99 deletions

View File

@ -10,7 +10,6 @@
static FOO: &&mut u32 = &&mut 42;
//~^ ERROR encountered mutable pointer in final value of static
//~| WARNING this was previously accepted by the compiler
//~| ERROR it is undefined behavior to use this value
static BAR: &mut () = &mut ();
//~^ ERROR encountered mutable pointer in final value of static
@ -29,7 +28,6 @@ unsafe impl Sync for Meh {}
static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
//~^ ERROR encountered mutable pointer in final value of static
//~| WARNING this was previously accepted by the compiler
//~| ERROR it is undefined behavior to use this value
static OH_YES: &mut i32 = &mut 42;
//~^ ERROR encountered mutable pointer in final value of static

View File

@ -12,19 +12,8 @@ note: the lint level is defined here
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/mutable_references.rs:10:1
|
LL | static FOO: &&mut u32 = &&mut 42;
| ^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>: 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: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:15:1
--> $DIR/mutable_references.rs:14:1
|
LL | static BAR: &mut () = &mut ();
| ^^^^^^^^^^^^^^^^^^^
@ -33,7 +22,7 @@ LL | static BAR: &mut () = &mut ();
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:21:1
--> $DIR/mutable_references.rs:20:1
|
LL | static BOO: &mut Foo<()> = &mut Foo(());
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -42,7 +31,7 @@ LL | static BOO: &mut Foo<()> = &mut Foo(());
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:29:1
--> $DIR/mutable_references.rs:28:1
|
LL | static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
| ^^^^^^^^^^^^^^^
@ -50,19 +39,8 @@ LL | static MEH: Meh = Meh { x: &UnsafeCell::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>
error[E0080]: it is undefined behavior to use this value
--> $DIR/mutable_references.rs:29:1
|
LL | static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
| ^^^^^^^^^^^^^^^ 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
}
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:34:1
--> $DIR/mutable_references.rs:32:1
|
LL | static OH_YES: &mut i32 = &mut 42;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -71,7 +49,7 @@ LL | static OH_YES: &mut i32 = &mut 42;
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
error[E0080]: it is undefined behavior to use this value
--> $DIR/mutable_references.rs:34:1
--> $DIR/mutable_references.rs:32:1
|
LL | static OH_YES: &mut i32 = &mut 42;
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
@ -82,7 +60,7 @@ LL | static OH_YES: &mut i32 = &mut 42;
}
error[E0594]: cannot assign to `*OH_YES`, as `OH_YES` is an immutable static item
--> $DIR/mutable_references.rs:43:5
--> $DIR/mutable_references.rs:41:5
|
LL | *OH_YES = 99;
| ^^^^^^^^^^^^ cannot assign
@ -95,27 +73,27 @@ help: skipping check that does not even have a feature gate
LL | static FOO: &&mut u32 = &&mut 42;
| ^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/mutable_references.rs:15:23
--> $DIR/mutable_references.rs:14:23
|
LL | static BAR: &mut () = &mut ();
| ^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/mutable_references.rs:21:28
--> $DIR/mutable_references.rs:20:28
|
LL | static BOO: &mut Foo<()> = &mut Foo(());
| ^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/mutable_references.rs:29:28
--> $DIR/mutable_references.rs:28:28
|
LL | static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
| ^^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/mutable_references.rs:34:27
--> $DIR/mutable_references.rs:32:27
|
LL | static OH_YES: &mut i32 = &mut 42;
| ^^^^^^^
error: aborting due to 9 previous errors; 1 warning emitted
error: aborting due to 7 previous errors; 1 warning emitted
Some errors have detailed explanations: E0080, E0594.
For more information about an error, try `rustc --explain E0080`.
@ -136,7 +114,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:15:1
--> $DIR/mutable_references.rs:14:1
|
LL | static BAR: &mut () = &mut ();
| ^^^^^^^^^^^^^^^^^^^
@ -151,7 +129,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:21:1
--> $DIR/mutable_references.rs:20:1
|
LL | static BOO: &mut Foo<()> = &mut Foo(());
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -166,7 +144,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:29:1
--> $DIR/mutable_references.rs:28:1
|
LL | static MEH: Meh = Meh { x: &UnsafeCell::new(42) };
| ^^^^^^^^^^^^^^^
@ -181,7 +159,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/mutable_references.rs:34:1
--> $DIR/mutable_references.rs:32:1
|
LL | static OH_YES: &mut i32 = &mut 42;
| ^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -12,11 +12,20 @@ note: the lint level is defined here
LL | #![deny(const_eval_mutable_ptr_in_final_value)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0080]: it is undefined behavior to use this value
--> $DIR/static-no-inner-mut.rs:9:1
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:13:1
|
LL | static REF: &AtomicI32 = &AtomicI32::new(42);
| ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.v: encountered `UnsafeCell` in read-only memory
LL | static REFMUT: &mut i32 = &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>
error[E0080]: it is undefined behavior to use this value
--> $DIR/static-no-inner-mut.rs:13:1
|
LL | static REFMUT: &mut i32 = &mut 0;
| ^^^^^^^^^^^^^^^^^^^^^^^ 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: 8, align: 8) {
@ -24,27 +33,7 @@ LL | static REF: &AtomicI32 = &AtomicI32::new(42);
}
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:14:1
|
LL | static REFMUT: &mut i32 = &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>
error[E0080]: it is undefined behavior to use this value
--> $DIR/static-no-inner-mut.rs:14:1
|
LL | static REFMUT: &mut i32 = &mut 0;
| ^^^^^^^^^^^^^^^^^^^^^^^ 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: 8, align: 8) {
╾ALLOC1╼ │ ╾──────╼
}
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:20:1
--> $DIR/static-no-inner-mut.rs:19:1
|
LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -52,19 +41,8 @@ LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
= 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>
error[E0080]: it is undefined behavior to use this value
--> $DIR/static-no-inner-mut.rs:20:1
|
LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
| ^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at .<deref>.v: 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: 8, align: 8) {
╾ALLOC2╼ │ ╾──────╼
}
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:25:1
--> $DIR/static-no-inner-mut.rs:23:1
|
LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -73,18 +51,18 @@ LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
error[E0080]: it is undefined behavior to use this value
--> $DIR/static-no-inner-mut.rs:25:1
--> $DIR/static-no-inner-mut.rs:23:1
|
LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
| ^^^^^^^^^^^^^^^^^^^^^^^^ 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: 8, align: 8) {
╾ALLOC3╼ │ ╾──────╼
╾ALLOC1╼ │ ╾──────╼
}
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:43:1
--> $DIR/static-no-inner-mut.rs:41:1
|
LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -93,7 +71,7 @@ LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:47:1
--> $DIR/static-no-inner-mut.rs:45:1
|
LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -102,7 +80,7 @@ LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *con
= note: for more information, see issue #122153 <https://github.com/rust-lang/rust/issues/122153>
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:51:1
--> $DIR/static-no-inner-mut.rs:49:1
|
LL | static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -118,37 +96,37 @@ help: skipping check that does not even have a feature gate
LL | static REF: &AtomicI32 = &AtomicI32::new(42);
| ^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/static-no-inner-mut.rs:14:27
--> $DIR/static-no-inner-mut.rs:13:27
|
LL | static REFMUT: &mut i32 = &mut 0;
| ^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/static-no-inner-mut.rs:20:56
--> $DIR/static-no-inner-mut.rs:19:56
|
LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
| ^^^^
help: skipping check that does not even have a feature gate
--> $DIR/static-no-inner-mut.rs:25:44
--> $DIR/static-no-inner-mut.rs:23:44
|
LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
| ^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/static-no-inner-mut.rs:43:52
--> $DIR/static-no-inner-mut.rs:41:52
|
LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
| ^^^^^^^^^^^^^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/static-no-inner-mut.rs:47:51
--> $DIR/static-no-inner-mut.rs:45:51
|
LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
| ^^^^^^^
help: skipping check that does not even have a feature gate
--> $DIR/static-no-inner-mut.rs:51:52
--> $DIR/static-no-inner-mut.rs:49:52
|
LL | static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
| ^^^^^^
error: aborting due to 11 previous errors; 1 warning emitted
error: aborting due to 9 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0080`.
Future incompatibility report: Future breakage diagnostic:
@ -168,7 +146,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:14:1
--> $DIR/static-no-inner-mut.rs:13:1
|
LL | static REFMUT: &mut i32 = &mut 0;
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -183,7 +161,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:20:1
--> $DIR/static-no-inner-mut.rs:19:1
|
LL | static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
| ^^^^^^^^^^^^^^^^^^^^^^^
@ -198,7 +176,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:25:1
--> $DIR/static-no-inner-mut.rs:23:1
|
LL | static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
| ^^^^^^^^^^^^^^^^^^^^^^^^
@ -213,7 +191,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:43:1
--> $DIR/static-no-inner-mut.rs:41:1
|
LL | static RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -228,7 +206,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:47:1
--> $DIR/static-no-inner-mut.rs:45:1
|
LL | static RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@ -243,7 +221,7 @@ LL | #![deny(const_eval_mutable_ptr_in_final_value)]
Future breakage diagnostic:
error: encountered mutable pointer in final value of static
--> $DIR/static-no-inner-mut.rs:51:1
--> $DIR/static-no-inner-mut.rs:49:1
|
LL | static RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

View File

@ -9,7 +9,6 @@
static REF: &AtomicI32 = &AtomicI32::new(42);
//~^ ERROR mutable pointer in final value
//~| WARNING this was previously accepted by the compiler
//~| ERROR it is undefined behavior to use this value
static REFMUT: &mut i32 = &mut 0;
//~^ ERROR mutable pointer in final value
@ -20,7 +19,6 @@
static REF2: &AtomicI32 = {let x = AtomicI32::new(42); &{x}};
//~^ ERROR mutable pointer in final value
//~| WARNING this was previously accepted by the compiler
//~| ERROR it is undefined behavior to use this value
static REFMUT2: &mut i32 = {let mut x = 0; &mut {x}};
//~^ ERROR mutable pointer in final value

View File

@ -28,7 +28,8 @@ impl Drop for JsValue {
fn drop(&mut self) {}
}
const UNDEFINED: &JsValue = &JsValue::Undefined;
//~^ERROR: mutable pointer in final value of constant
//~^ WARNING: mutable pointer in final value of constant
//~| WARNING: this was previously accepted by the compiler but is being phased out
// In contrast, this one works since it is being promoted.
const NONE: &'static Option<Cell<i32>> = &None;

View File

@ -12,12 +12,27 @@ error[E0492]: constants cannot refer to interior mutable data
LL | const RAW_SYNC_C: SyncPtr<Cell<i32>> = SyncPtr { x: &Cell::new(42) };
| ^^^^^^^^^^^^^^ this borrow of an interior mutable value may end up in the final value
error: encountered mutable pointer in final value of constant
warning: encountered mutable pointer in final value of constant
--> $DIR/refs-to-cell-in-final.rs:30:1
|
LL | const UNDEFINED: &JsValue = &JsValue::Undefined;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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: `#[warn(const_eval_mutable_ptr_in_final_value)]` on by default
error: aborting due to 3 previous errors
error: aborting due to 2 previous errors; 1 warning emitted
For more information about this error, try `rustc --explain E0492`.
Future incompatibility report: Future breakage diagnostic:
warning: encountered mutable pointer in final value of constant
--> $DIR/refs-to-cell-in-final.rs:30:1
|
LL | const UNDEFINED: &JsValue = &JsValue::Undefined;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= 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: `#[warn(const_eval_mutable_ptr_in_final_value)]` on by default