Skip to content

Commit 21b05e7

Browse files
committed
Auto merge of #2975 - RalfJung:flags, r=RalfJung
remove compile-flags that are no longer needed We stopped running fail-tests with optimizations a while ago, so we don't need to explicitly set the opt-level to 0 any more.
2 parents 01c842a + b88bcda commit 21b05e7

15 files changed

+10
-37
lines changed

src/tools/miri/tests/fail/dangling_pointers/dangling_zst_deref.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Make sure we find these even with many checks disabled.
2-
// Some optimizations remove ZST accesses, thus masking this UB.
3-
//@compile-flags: -Zmir-opt-level=0 -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
2+
//@compile-flags: -Zmiri-disable-alignment-check -Zmiri-disable-stacked-borrows -Zmiri-disable-validation
43

54
fn main() {
65
let p = {

src/tools/miri/tests/fail/dangling_pointers/dyn_size.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// should find the bug even without these, but gets masked by optimizations
2-
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows -Zmir-opt-level=0
1+
// should find the bug even without these
2+
//@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows
33

44
struct SliceWithHead(u8, [u8]);
55

src/tools/miri/tests/fail/dangling_pointers/maybe_null_pointer_deref_zst.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Some optimizations remove ZST accesses, thus masking this UB.
2-
//@compile-flags: -Zmir-opt-level=0
3-
41
fn main() {
52
// This pointer *could* be NULL so we cannot load from it, not even at ZST
63
let ptr = (&0u8 as *const u8).wrapping_sub(0x800) as *const ();

src/tools/miri/tests/fail/dangling_pointers/maybe_null_pointer_write_zst.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Some optimizations remove ZST accesses, thus masking this UB.
2-
//@compile-flags: -Zmir-opt-level=0
3-
41
fn main() {
52
// This pointer *could* be NULL so we cannot load from it, not even at ZST.
63
// Not using the () type here, as writes of that type do not even have MIR generated.

src/tools/miri/tests/fail/dangling_pointers/null_pointer_deref_zst.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Some optimizations remove ZST accesses, thus masking this UB.
2-
//@compile-flags: -Zmir-opt-level=0
3-
41
#[allow(deref_nullptr)]
52
fn main() {
63
let x: () = unsafe { *std::ptr::null() }; //~ ERROR: dereferencing pointer failed: null pointer is a dangling pointer

src/tools/miri/tests/fail/dangling_pointers/null_pointer_write_zst.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Some optimizations remove ZST accesses, thus masking this UB.
2-
//@compile-flags: -Zmir-opt-level=0
3-
41
#[allow(deref_nullptr)]
52
fn main() {
63
// Not using the () type here, as writes of that type do not even have MIR generated.

src/tools/miri/tests/fail/dangling_pointers/stack_temporary.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// This should fail even without validation, but some MIR opts mask the error
2-
//@compile-flags: -Zmiri-disable-validation -Zmir-opt-level=0
1+
// This should fail even without validation
2+
//@compile-flags: -Zmiri-disable-validation
33

44
unsafe fn make_ref<'a>(x: *mut i32) -> &'a mut i32 {
55
&mut *x

src/tools/miri/tests/fail/dangling_pointers/storage_dead_dangling.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// This should fail even without validation, but some MIR opts mask the error
2-
//@compile-flags: -Zmiri-disable-validation -Zmir-opt-level=0 -Zmiri-permissive-provenance
1+
// This should fail even without validation
2+
//@compile-flags: -Zmiri-disable-validation -Zmiri-permissive-provenance
33

44
static mut LEAK: usize = 0;
55

src/tools/miri/tests/fail/data_race/read_write_race_stack.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
//@compile-flags: -Zmir-opt-level=0 -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
2-
3-
// Note: mir-opt-level set to 0 to prevent the read of stack_var in thread 1
4-
// from being optimized away and preventing the detection of the data-race.
1+
//@compile-flags: -Zmiri-disable-weak-memory-emulation -Zmiri-preemption-rate=0 -Zmiri-disable-stacked-borrows
52

63
use std::ptr::null_mut;
74
use std::sync::atomic::{AtomicPtr, Ordering};

src/tools/miri/tests/fail/erroneous_const.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! Make sure we detect erroneous constants post-monomorphization even when they are unused.
22
//! (https://github.com/rust-lang/miri/issues/1382)
3-
// Inlining changes the error location
4-
//@compile-flags: -Zmir-opt-level=0
53
#![feature(never_type)]
64

75
struct PrintName<T>(T);

src/tools/miri/tests/fail/unaligned_pointers/dyn_alignment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// should find the bug even without, but gets masked by optimizations
2-
//@compile-flags: -Zmiri-disable-stacked-borrows -Zmir-opt-level=0 -Cdebug-assertions=no
2+
//@compile-flags: -Zmiri-disable-stacked-borrows -Cdebug-assertions=no
33
//@normalize-stderr-test: "but found [0-9]+" -> "but found $$ALIGN"
44

55
#[repr(align(256))]

src/tools/miri/tests/fail/unaligned_pointers/unaligned_ptr_zst.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// This should fail even without validation
2-
// Some optimizations remove ZST accesses, thus masking this UB.
3-
//@compile-flags: -Zmir-opt-level=0 -Zmiri-disable-validation -Cdebug-assertions=no
2+
//@compile-flags: -Zmiri-disable-validation -Cdebug-assertions=no
43

54
fn main() {
65
// Try many times as this might work by chance.

src/tools/miri/tests/fail/validity/nonzero.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
// gets masked by optimizations
2-
//@compile-flags: -Zmir-opt-level=0
31
#![feature(rustc_attrs)]
42
#![allow(unused_attributes)]
53

src/tools/miri/tests/fail/zst2.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Some optimizations remove ZST accesses, thus masking this UB.
2-
//@compile-flags: -Zmir-opt-level=0
3-
41
fn main() {
52
// Not using the () type here, as writes of that type do not even have MIR generated.
63
// Also not assigning directly as that's array initialization, not assignment.

src/tools/miri/tests/fail/zst3.rs

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// Some optimizations remove ZST accesses, thus masking this UB.
2-
//@compile-flags: -Zmir-opt-level=0
3-
41
fn main() {
52
// Not using the () type here, as writes of that type do not even have MIR generated.
63
// Also not assigning directly as that's array initialization, not assignment.

0 commit comments

Comments
 (0)