Fix tests broken by more consistent miri unleashed warnings
This commit is contained in:
parent
c990243922
commit
670c84dde3
@ -1,146 +1,20 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:25:5
|
||||
--> $DIR/const_fn_ptr.rs:12:5
|
||||
|
|
||||
LL | assert_eq!(Y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
LL | X(x)
|
||||
| ^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:25:5
|
||||
--> $DIR/const_fn_ptr.rs:16:5
|
||||
|
|
||||
LL | assert_eq!(Y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
LL | X_const(x)
|
||||
| ^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:25:5
|
||||
--> $DIR/const_fn_ptr.rs:20:5
|
||||
|
|
||||
LL | assert_eq!(Y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:27:5
|
||||
|
|
||||
LL | assert_eq!(y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:27:5
|
||||
|
|
||||
LL | assert_eq!(y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:27:5
|
||||
|
|
||||
LL | assert_eq!(y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:29:5
|
||||
|
|
||||
LL | assert_eq!(y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:29:5
|
||||
|
|
||||
LL | assert_eq!(y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:29:5
|
||||
|
|
||||
LL | assert_eq!(y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:32:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:32:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:32:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:34:5
|
||||
|
|
||||
LL | assert_eq!(z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:34:5
|
||||
|
|
||||
LL | assert_eq!(z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:34:5
|
||||
|
|
||||
LL | assert_eq!(z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:36:5
|
||||
|
|
||||
LL | assert_eq!(z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:36:5
|
||||
|
|
||||
LL | assert_eq!(z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr.rs:36:5
|
||||
|
|
||||
LL | assert_eq!(z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
LL | x(y)
|
||||
| ^^^^
|
||||
|
||||
warning: constant `X_const` should have an upper case name
|
||||
--> $DIR/const_fn_ptr.rs:9:7
|
||||
|
@ -8,6 +8,7 @@ const X: fn(usize) -> usize = double;
|
||||
|
||||
const fn bar(x: usize) -> usize {
|
||||
X(x) // FIXME: this should error someday
|
||||
//~^ WARN: skipping const checks
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
6
src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr
Normal file
6
src/test/ui/consts/const-eval/const_fn_ptr_fail.stderr
Normal file
@ -0,0 +1,6 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail.rs:10:5
|
||||
|
|
||||
LL | X(x) // FIXME: this should error someday
|
||||
| ^^^^
|
||||
|
@ -6,7 +6,7 @@ fn double(x: usize) -> usize { x * 2 }
|
||||
const X: fn(usize) -> usize = double;
|
||||
|
||||
const fn bar(x: fn(usize) -> usize, y: usize) -> usize {
|
||||
x(y)
|
||||
x(y) //~ WARN skipping const checks
|
||||
}
|
||||
|
||||
const Y: usize = bar(X, 2); // FIXME: should fail to typeck someday
|
||||
@ -15,12 +15,6 @@ const Z: usize = bar(double, 2); // FIXME: should fail to typeck someday
|
||||
fn main() {
|
||||
assert_eq!(Y, 4);
|
||||
//~^ ERROR evaluation of constant expression failed
|
||||
//~^^ WARN skipping const checks
|
||||
//~^^^ WARN skipping const checks
|
||||
//~^^^^ WARN skipping const checks
|
||||
assert_eq!(Z, 4);
|
||||
//~^ ERROR evaluation of constant expression failed
|
||||
//~^^ WARN skipping const checks
|
||||
//~^^^ WARN skipping const checks
|
||||
//~^^^^ WARN skipping const checks
|
||||
}
|
||||
|
@ -1,50 +1,8 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail2.rs:16:5
|
||||
--> $DIR/const_fn_ptr_fail2.rs:9:5
|
||||
|
|
||||
LL | assert_eq!(Y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail2.rs:16:5
|
||||
|
|
||||
LL | assert_eq!(Y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail2.rs:16:5
|
||||
|
|
||||
LL | assert_eq!(Y, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail2.rs:21:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail2.rs:21:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/const_fn_ptr_fail2.rs:21:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
LL | x(y)
|
||||
| ^^^^
|
||||
|
||||
error[E0080]: evaluation of constant expression failed
|
||||
--> $DIR/const_fn_ptr_fail2.rs:16:5
|
||||
@ -57,7 +15,7 @@ LL | assert_eq!(Y, 4);
|
||||
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
error[E0080]: evaluation of constant expression failed
|
||||
--> $DIR/const_fn_ptr_fail2.rs:21:5
|
||||
--> $DIR/const_fn_ptr_fail2.rs:18:5
|
||||
|
|
||||
LL | assert_eq!(Z, 4);
|
||||
| ^^^^^^^^^^^-^^^^^
|
||||
|
@ -1,8 +1,8 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/assoc_const.rs:12:31
|
||||
--> $DIR/assoc_const.rs:12:20
|
||||
|
|
||||
LL | const F: u32 = (U::X, 42).1;
|
||||
| ^
|
||||
| ^^^^^^^^^^
|
||||
|
||||
error[E0080]: erroneous constant used
|
||||
--> $DIR/assoc_const.rs:29:13
|
||||
|
@ -22,51 +22,3 @@ warning: skipping const checks
|
||||
LL | if let E1::V2 { .. } = (E1::V1 { f: true }) {
|
||||
| ^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/enum_discriminants.rs:108:5
|
||||
|
|
||||
LL | assert_eq!(OVERFLOW, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/enum_discriminants.rs:108:5
|
||||
|
|
||||
LL | assert_eq!(OVERFLOW, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/enum_discriminants.rs:108:5
|
||||
|
|
||||
LL | assert_eq!(OVERFLOW, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/enum_discriminants.rs:109:5
|
||||
|
|
||||
LL | assert_eq!(MORE_OVERFLOW, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/enum_discriminants.rs:109:5
|
||||
|
|
||||
LL | assert_eq!(MORE_OVERFLOW, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/enum_discriminants.rs:109:5
|
||||
|
|
||||
LL | assert_eq!(MORE_OVERFLOW, 0);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: this warning originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
|
||||
|
||||
|
@ -7,6 +7,7 @@ use std::cell::UnsafeCell;
|
||||
|
||||
// make sure we do not just intern this as mutable
|
||||
const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
|
||||
//~^ WARN: skipping const checks
|
||||
|
||||
const MUTATING_BEHIND_RAW: () = {
|
||||
// Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
|
||||
|
@ -1,11 +1,17 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_const.rs:14:9
|
||||
--> $DIR/mutable_const.rs:9:38
|
||||
|
|
||||
LL | const MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_const.rs:15:9
|
||||
|
|
||||
LL | *MUTABLE_BEHIND_RAW = 99
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: any use of this value will cause an error
|
||||
--> $DIR/mutable_const.rs:14:9
|
||||
--> $DIR/mutable_const.rs:15:9
|
||||
|
|
||||
LL | / const MUTATING_BEHIND_RAW: () = {
|
||||
LL | | // Test that `MUTABLE_BEHIND_RAW` is actually immutable, by doing this at const time.
|
||||
|
@ -6,12 +6,16 @@ use std::cell::UnsafeCell;
|
||||
// a test demonstrating what things we could allow with a smarter const qualification
|
||||
|
||||
static FOO: &&mut u32 = &&mut 42;
|
||||
//~^ WARN: skipping const checks
|
||||
//~| WARN: skipping const checks
|
||||
|
||||
static BAR: &mut () = &mut ();
|
||||
//~^ WARN: skipping const checks
|
||||
|
||||
struct Foo<T>(T);
|
||||
|
||||
static BOO: &mut Foo<()> = &mut Foo(());
|
||||
//~^ WARN: skipping const checks
|
||||
|
||||
struct Meh {
|
||||
x: &'static UnsafeCell<i32>,
|
||||
@ -21,9 +25,11 @@ unsafe impl Sync for Meh {}
|
||||
|
||||
static MEH: Meh = Meh {
|
||||
x: &UnsafeCell::new(42),
|
||||
//~^ WARN: skipping const checks
|
||||
};
|
||||
|
||||
static OH_YES: &mut i32 = &mut 42;
|
||||
//~^ WARN: skipping const checks
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
|
@ -1,5 +1,41 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:8:26
|
||||
|
|
||||
LL | static FOO: &&mut u32 = &&mut 42;
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:8:25
|
||||
|
|
||||
LL | static FOO: &&mut u32 = &&mut 42;
|
||||
| ^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:12:23
|
||||
|
|
||||
LL | static BAR: &mut () = &mut ();
|
||||
| ^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:17:28
|
||||
|
|
||||
LL | static BOO: &mut Foo<()> = &mut Foo(());
|
||||
| ^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:27:8
|
||||
|
|
||||
LL | x: &UnsafeCell::new(42),
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references.rs:31: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:32:5
|
||||
--> $DIR/mutable_references.rs:38:5
|
||||
|
|
||||
LL | *OH_YES = 99;
|
||||
| ^^^^^^^^^^^^ cannot assign
|
||||
|
@ -19,7 +19,7 @@ unsafe impl Sync for Meh {}
|
||||
|
||||
// the following will never be ok!
|
||||
const MUH: Meh = Meh {
|
||||
x: &UnsafeCell::new(42),
|
||||
x: &UnsafeCell::new(42), //~ WARN: skipping const checks
|
||||
};
|
||||
|
||||
fn main() {
|
||||
|
@ -1,3 +1,9 @@
|
||||
warning: skipping const checks
|
||||
--> $DIR/mutable_references_ice.rs:22:8
|
||||
|
|
||||
LL | x: &UnsafeCell::new(42),
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
thread 'rustc' panicked at 'assertion failed: `(left != right)`
|
||||
left: `Const`,
|
||||
right: `Const`: UnsafeCells are not allowed behind references in constants. This should have been prevented statically by const qualification. If this were allowed one would be able to change a constant at one use site and other use sites could observe that mutation.', src/librustc_mir/interpret/intern.rs:LL:CC
|
||||
|
Loading…
x
Reference in New Issue
Block a user