diff options
| author | Ben Kimock <kimockb@gmail.com> | 2023-04-10 07:52:36 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2023-04-10 07:56:31 -0400 |
| commit | 73702d5e39e812d2e9ad22221462c266c963dd43 (patch) | |
| tree | 07dc10ebd53eb23ed6d232fc23008fe9cbf45664 | |
| parent | 6efdf4d1309f8047bc439a4810888c715e2df480 (diff) | |
| download | rust-73702d5e39e812d2e9ad22221462c266c963dd43.tar.gz rust-73702d5e39e812d2e9ad22221462c266c963dd43.zip | |
Turn off the alignment check pass, remove the panic test for it
The panic test is now counted as an error test; we encounter a Terminate terminator, and emit an interpreter error, as opposed to just terminating due to a panic. So this test should have broken with https://github.com/rust-lang/rust/pull/102906 but wasn't because the Miri test suite is currently broken in rust-lang/rust: https://github.com/rust-lang/rust/issues/110102
| -rw-r--r-- | src/tools/miri/src/lib.rs | 3 | ||||
| -rw-r--r-- | src/tools/miri/tests/panic/alignment-assertion.rs | 9 | ||||
| -rw-r--r-- | src/tools/miri/tests/panic/alignment-assertion.stderr | 2 |
3 files changed, 3 insertions, 11 deletions
diff --git a/src/tools/miri/src/lib.rs b/src/tools/miri/src/lib.rs index 94be8bb9d3d..5c8aba6d441 100644 --- a/src/tools/miri/src/lib.rs +++ b/src/tools/miri/src/lib.rs @@ -124,10 +124,13 @@ pub use crate::tag_gc::{EvalContextExt as _, VisitTags}; /// Insert rustc arguments at the beginning of the argument list that Miri wants to be /// set per default, for maximal validation power. +/// Also disable the MIR pass that inserts an alignment check on every pointer dereference. Miri +/// does that too, and with a better error message. pub const MIRI_DEFAULT_ARGS: &[&str] = &[ "--cfg=miri", "-Zalways-encode-mir", "-Zextra-const-ub-checks", "-Zmir-emit-retag", "-Zmir-opt-level=0", + "-Zmir-enable-passes=-CheckAlignment", ]; diff --git a/src/tools/miri/tests/panic/alignment-assertion.rs b/src/tools/miri/tests/panic/alignment-assertion.rs deleted file mode 100644 index 68aa19a88db..00000000000 --- a/src/tools/miri/tests/panic/alignment-assertion.rs +++ /dev/null @@ -1,9 +0,0 @@ -//@compile-flags: -Zmiri-disable-alignment-check -Cdebug-assertions=yes - -fn main() { - let mut x = [0u32; 2]; - let ptr: *mut u8 = x.as_mut_ptr().cast::<u8>(); - unsafe { - *(ptr.add(1).cast::<u32>()) = 42; - } -} diff --git a/src/tools/miri/tests/panic/alignment-assertion.stderr b/src/tools/miri/tests/panic/alignment-assertion.stderr deleted file mode 100644 index 26cf51b0cd2..00000000000 --- a/src/tools/miri/tests/panic/alignment-assertion.stderr +++ /dev/null @@ -1,2 +0,0 @@ -thread 'main' panicked at 'misaligned pointer dereference: address must be a multiple of 0x4 but is $HEX', $DIR/alignment-assertion.rs:LL:CC -note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace |
