remove no longer needed feature flags
This commit is contained in:
parent
e2c99f0deb
commit
9273962aef
@ -1,5 +1,5 @@
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
#![feature(const_mut_refs, box_syntax)]
|
||||
#![feature(box_syntax)]
|
||||
#![allow(const_err)]
|
||||
|
||||
use std::mem::ManuallyDrop;
|
||||
@ -11,4 +11,7 @@ static TEST_BAD: &mut i32 = {
|
||||
//~^ WARN skipping const check
|
||||
//~| ERROR could not evaluate static initializer
|
||||
//~| NOTE heap allocations
|
||||
//~| WARN skipping const checks
|
||||
//~| WARN skipping const checks
|
||||
//~| WARN skipping const checks
|
||||
};
|
||||
|
@ -4,12 +4,30 @@ warning: skipping const checks
|
||||
LL | &mut *(box 0)
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/box.rs:10:16
|
||||
|
|
||||
LL | &mut *(box 0)
|
||||
| ^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/box.rs:10:5
|
||||
|
|
||||
LL | &mut *(box 0)
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/box.rs:10:5
|
||||
|
|
||||
LL | &mut *(box 0)
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
error[E0080]: could not evaluate static initializer
|
||||
--> $DIR/box.rs:10:11
|
||||
|
|
||||
LL | &mut *(box 0)
|
||||
| ^^^^^^^ "heap allocations via `box` keyword" needs an rfc before being allowed inside constants
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
error: aborting due to previous error; 4 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -2,8 +2,6 @@
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
#![allow(const_err)]
|
||||
|
||||
#![feature(const_raw_ptr_deref)]
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
@ -21,6 +19,7 @@ const READ_INTERIOR_MUT: usize = {
|
||||
static FOO: AtomicUsize = AtomicUsize::new(0);
|
||||
unsafe { *(&FOO as *const _ as *const usize) }
|
||||
//~^ WARN skipping const checks
|
||||
//~| WARN skipping const checks
|
||||
};
|
||||
|
||||
static mut MUTABLE: u32 = 0;
|
||||
|
@ -1,51 +1,57 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static.rs:15:5
|
||||
--> $DIR/const_refers_to_static.rs:13:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static.rs:15:5
|
||||
--> $DIR/const_refers_to_static.rs:13:5
|
||||
|
|
||||
LL | FOO.fetch_add(1, Ordering::Relaxed)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static.rs:22:17
|
||||
--> $DIR/const_refers_to_static.rs:20:17
|
||||
|
|
||||
LL | unsafe { *(&FOO as *const _ as *const usize) }
|
||||
| ^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static.rs:27:32
|
||||
--> $DIR/const_refers_to_static.rs:20:14
|
||||
|
|
||||
LL | unsafe { *(&FOO as *const _ as *const usize) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static.rs:26:32
|
||||
|
|
||||
LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static.rs:27:32
|
||||
--> $DIR/const_refers_to_static.rs:26:32
|
||||
|
|
||||
LL | const READ_MUT: u32 = unsafe { MUTABLE };
|
||||
| ^^^^^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/const_refers_to_static.rs:32:5
|
||||
--> $DIR/const_refers_to_static.rs:31:5
|
||||
|
|
||||
LL | MUTATE_INTERIOR_MUT;
|
||||
| ^^^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/const_refers_to_static.rs:34:5
|
||||
--> $DIR/const_refers_to_static.rs:33:5
|
||||
|
|
||||
LL | READ_INTERIOR_MUT;
|
||||
| ^^^^^^^^^^^^^^^^^ referenced constant has errors
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/const_refers_to_static.rs:36:5
|
||||
--> $DIR/const_refers_to_static.rs:35:5
|
||||
|
|
||||
LL | READ_MUT;
|
||||
| ^^^^^^^^ referenced constant has errors
|
||||
|
||||
error: aborting due to 3 previous errors; 5 warnings emitted
|
||||
error: aborting due to 3 previous errors; 6 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -1,8 +1,6 @@
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
#![allow(const_err)]
|
||||
|
||||
#![feature(const_raw_ptr_deref)]
|
||||
|
||||
use std::sync::atomic::AtomicUsize;
|
||||
use std::sync::atomic::Ordering;
|
||||
|
||||
@ -15,6 +13,7 @@ const REF_INTERIOR_MUT: &usize = { //~ ERROR undefined behavior to use this valu
|
||||
static FOO: AtomicUsize = AtomicUsize::new(0);
|
||||
unsafe { &*(&FOO as *const _ as *const usize) }
|
||||
//~^ WARN skipping const checks
|
||||
//~| WARN skipping const checks
|
||||
};
|
||||
|
||||
// ok some day perhaps
|
||||
|
@ -1,23 +1,29 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static2.rs:16:18
|
||||
--> $DIR/const_refers_to_static2.rs:14:18
|
||||
|
|
||||
LL | unsafe { &*(&FOO as *const _ as *const usize) }
|
||||
| ^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static2.rs:25:6
|
||||
--> $DIR/const_refers_to_static2.rs:14:14
|
||||
|
|
||||
LL | unsafe { &*(&FOO as *const _ as *const usize) }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static2.rs:24:6
|
||||
|
|
||||
LL | &FOO
|
||||
| ^^^
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static2.rs:12:1
|
||||
--> $DIR/const_refers_to_static2.rs:10:1
|
||||
|
|
||||
LL | / const REF_INTERIOR_MUT: &usize = {
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | static FOO: AtomicUsize = AtomicUsize::new(0);
|
||||
LL | | unsafe { &*(&FOO as *const _ as *const usize) }
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |__^ type validation failed: encountered a reference pointing to a static variable
|
||||
@ -25,7 +31,7 @@ LL | | };
|
||||
= 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.
|
||||
|
||||
error[E0080]: it is undefined behavior to use this value
|
||||
--> $DIR/const_refers_to_static2.rs:21:1
|
||||
--> $DIR/const_refers_to_static2.rs:20:1
|
||||
|
|
||||
LL | / const READ_IMMUT: &usize = {
|
||||
LL | |
|
||||
@ -38,6 +44,6 @@ LL | | };
|
||||
|
|
||||
= 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.
|
||||
|
||||
error: aborting due to 2 previous errors; 2 warnings emitted
|
||||
error: aborting due to 2 previous errors; 3 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -2,7 +2,7 @@
|
||||
// aux-build:static_cross_crate.rs
|
||||
#![allow(const_err)]
|
||||
|
||||
#![feature(exclusive_range_pattern, half_open_range_patterns, const_if_match, const_panic)]
|
||||
#![feature(exclusive_range_pattern, half_open_range_patterns, const_if_match)]
|
||||
|
||||
extern crate static_cross_crate;
|
||||
|
||||
@ -34,6 +34,7 @@ const U8_MUT2: &u8 = { //~ NOTE
|
||||
const U8_MUT3: &u8 = { //~ NOTE
|
||||
unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
|
||||
//~^ WARN skipping const checks
|
||||
//~| WARN skipping const checks
|
||||
//~| WARN [const_err]
|
||||
//~| NOTE constant accesses static
|
||||
};
|
||||
|
@ -18,7 +18,7 @@ LL | | };
|
||||
= 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.
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:43:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:44:9
|
||||
|
|
||||
LL | SLICE_MUT => true,
|
||||
| ^^^^^^^^^
|
||||
@ -43,7 +43,7 @@ LL | | };
|
||||
= 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.
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:51:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:52:9
|
||||
|
|
||||
LL | U8_MUT => true,
|
||||
| ^^^^^^
|
||||
@ -73,7 +73,7 @@ LL | #[warn(const_err)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:61:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:62:9
|
||||
|
|
||||
LL | U8_MUT2 => true,
|
||||
| ^^^^^^^
|
||||
@ -84,6 +84,14 @@ warning: skipping const checks
|
||||
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:35:77
|
||||
|
|
||||
LL | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None => panic!() } }
|
||||
| ^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
warning: any use of this value will cause an error
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:35:51
|
||||
|
|
||||
@ -93,6 +101,7 @@ LL | | unsafe { match static_cross_crate::OPT_ZERO { Some(ref u) => u, None
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |__-
|
||||
|
|
||||
@ -103,11 +112,11 @@ LL | #[warn(const_err)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: could not evaluate constant pattern
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:68:9
|
||||
--> $DIR/const_refers_to_static_cross_crate.rs:69:9
|
||||
|
|
||||
LL | U8_MUT3 => true,
|
||||
| ^^^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors; 6 warnings emitted
|
||||
error: aborting due to 6 previous errors; 7 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0080`.
|
||||
|
@ -1,8 +1,6 @@
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
// normalize-stderr-test "alloc[0-9]+" -> "allocN"
|
||||
|
||||
#![feature(const_raw_ptr_deref)]
|
||||
#![feature(const_mut_refs)]
|
||||
#![deny(const_err)] // The `allow` variant is tested by `mutable_const2`.
|
||||
//~^ NOTE lint level
|
||||
// Here we check that even though `MUTABLE_BEHIND_RAW` is created from a mutable
|
||||
@ -20,6 +18,8 @@ const MUTATING_BEHIND_RAW: () = { //~ NOTE
|
||||
unsafe {
|
||||
*MUTABLE_BEHIND_RAW = 99 //~ ERROR any use of this value will cause an error
|
||||
//~^ NOTE: which is read-only
|
||||
//~| WARN skipping const checks
|
||||
//~| WARN skipping const checks
|
||||
// FIXME would be good to match more of the error message here, but looks like we
|
||||
// normalize *after* checking the annoations here.
|
||||
}
|
||||
|
@ -1,11 +1,23 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_const.rs:15:38
|
||||
--> $DIR/mutable_const.rs:13:38
|
||||
|
|
||||
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_const.rs:19:9
|
||||
|
|
||||
LL | *MUTABLE_BEHIND_RAW = 99
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_const.rs:19:9
|
||||
|
|
||||
LL | *MUTABLE_BEHIND_RAW = 99
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: any use of this value will cause an error
|
||||
--> $DIR/mutable_const.rs:21:9
|
||||
--> $DIR/mutable_const.rs:19:9
|
||||
|
|
||||
LL | / const MUTATING_BEHIND_RAW: () = {
|
||||
LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
|
||||
@ -18,10 +30,10 @@ LL | | };
|
||||
| |__-
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/mutable_const.rs:6:9
|
||||
--> $DIR/mutable_const.rs:4:9
|
||||
|
|
||||
LL | #![deny(const_err)] // The `allow` variant is tested by `mutable_const2`.
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
error: aborting due to previous error; 3 warnings emitted
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
// normalize-stderr-test "note: compiler flags: .*" -> "note: compiler flags: FLAGS"
|
||||
// normalize-stderr-test "interpret/intern.rs:[0-9]+:[0-9]+" -> "interpret/intern.rs:LL:CC"
|
||||
|
||||
#![feature(const_raw_ptr_deref)]
|
||||
#![feature(const_mut_refs)]
|
||||
#![allow(const_err)]
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
|
@ -1,5 +1,5 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_const2.rs:15:38
|
||||
--> $DIR/mutable_const2.rs:13:38
|
||||
|
|
||||
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
@ -7,7 +7,7 @@ LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *m
|
||||
warning: 1 warning emitted
|
||||
|
||||
error: internal compiler error: mutable allocation in constant
|
||||
--> $DIR/mutable_const2.rs:15:1
|
||||
--> $DIR/mutable_const2.rs:13:1
|
||||
|
|
||||
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -1,5 +1,4 @@
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
#![feature(const_mut_refs)]
|
||||
#![allow(const_err)]
|
||||
|
||||
use std::cell::UnsafeCell;
|
||||
@ -8,15 +7,18 @@ use std::cell::UnsafeCell;
|
||||
|
||||
// this is fine because is not possible to mutate through an immutable reference.
|
||||
static FOO: &&mut u32 = &&mut 42;
|
||||
//~^ WARN skipping const checks
|
||||
|
||||
// this is fine because accessing an immutable static `BAR` is equivalent to accessing `*&BAR`
|
||||
// which puts the mutable reference behind an immutable one.
|
||||
static BAR: &mut () = &mut ();
|
||||
//~^ WARN skipping const checks
|
||||
|
||||
struct Foo<T>(T);
|
||||
|
||||
// this is fine for the same reason as `BAR`.
|
||||
static BOO: &mut Foo<()> = &mut Foo(());
|
||||
//~^ WARN skipping const checks
|
||||
|
||||
struct Meh {
|
||||
x: &'static UnsafeCell<i32>,
|
||||
@ -31,6 +33,7 @@ static MEH: Meh = Meh {
|
||||
|
||||
// this is fine for the same reason as `BAR`.
|
||||
static OH_YES: &mut i32 = &mut 42;
|
||||
//~^ WARN skipping const checks
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
|
@ -1,15 +1,39 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:28:8
|
||||
--> $DIR/mutable_references.rs:9:26
|
||||
|
|
||||
LL | static FOO: &&mut u32 = &&mut 42;
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:14:23
|
||||
|
|
||||
LL | static BAR: &mut () = &mut ();
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:20:28
|
||||
|
|
||||
LL | static BOO: &mut Foo<()> = &mut Foo(());
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:30:8
|
||||
|
|
||||
LL | x: &UnsafeCell::new(42),
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:35:27
|
||||
|
|
||||
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:39:5
|
||||
--> $DIR/mutable_references.rs:42:5
|
||||
|
|
||||
LL | *OH_YES = 99;
|
||||
| ^^^^^^^^^^^^ cannot assign
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
error: aborting due to previous error; 5 warnings emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0594`.
|
||||
|
@ -1,9 +1,9 @@
|
||||
// run-pass
|
||||
// compile-flags: -Zunleash-the-miri-inside-of-you
|
||||
#![feature(const_mut_refs)]
|
||||
#![allow(const_err)]
|
||||
|
||||
static OH_YES: &mut i32 = &mut 42;
|
||||
//~^ WARN skipping const checks
|
||||
|
||||
fn main() {
|
||||
// Make sure `OH_YES` can be read.
|
||||
|
@ -0,0 +1,8 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/read_from_static.rs:5:27
|
||||
|
|
||||
LL | static OH_YES: &mut i32 = &mut 42;
|
||||
| ^^^^^^^
|
||||
|
||||
warning: 1 warning emitted
|
||||
|
Loading…
x
Reference in New Issue
Block a user