From 14913e993b9415c3f12159aaa387ed3931a30e73 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 6 Jun 2022 11:45:41 -0400 Subject: [PATCH] deprecate -Zmiri-allow-uninit-numbers and -Zmiri-allow-ptr-int-transmute --- README.md | 6 ++++-- src/bin/miri.rs | 8 ++++++++ .../validity/invalid_enum_tag_256variants_uninit.stderr | 1 + tests/pass/move-uninit-primval.stderr | 1 + tests/pass/uninit_number_ignored.stderr | 1 + 5 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tests/pass/move-uninit-primval.stderr create mode 100644 tests/pass/uninit_number_ignored.stderr diff --git a/README.md b/README.md index a55ebcb125b..63990985ba4 100644 --- a/README.md +++ b/README.md @@ -304,13 +304,15 @@ to Miri failing to detect cases of undefined behavior in a program. * `-Zmiri-allow-uninit-numbers` disables the check to ensure that number types (integer and float types) always hold initialized data. (They must still be initialized when any actual operation, - such as arithmetic, is performed.) Using this flag is **unsound**. This has no effect when + such as arithmetic, is performed.) Using this flag is **unsound** and + [deprecated](https://github.com/rust-lang/miri/issues/2187). This has no effect when `-Zmiri-disable-validation` is present. * `-Zmiri-allow-ptr-int-transmute` makes Miri more accepting of transmutation between pointers and integers via `mem::transmute` or union/pointer type punning. This has two effects: it disables the check against integers storing a pointer (i.e., data with provenance), thus allowing pointer-to-integer transmutation, and it treats integer-to-pointer transmutation as equivalent to - a cast. Using this flag is **unsound**. + a cast. Using this flag is **unsound** and + [deprecated](https://github.com/rust-lang/miri/issues/2188). * `-Zmiri-disable-abi-check` disables checking [function ABI]. Using this flag is **unsound**. * `-Zmiri-disable-alignment-check` disables checking pointer alignment, so you diff --git a/src/bin/miri.rs b/src/bin/miri.rs index e3f38956dae..efb300a8baf 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -328,8 +328,16 @@ fn main() { since it is now enabled by default" ); } else if arg == "-Zmiri-allow-uninit-numbers" { + eprintln!( + "WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. \ + Please let us know at if you rely on this flag." + ); miri_config.allow_uninit_numbers = true; } else if arg == "-Zmiri-allow-ptr-int-transmute" { + eprintln!( + "WARNING: `-Zmiri-allow-ptr-int-transmute` is deprecated and planned to be removed. \ + Please let us know at if you rely on this flag." + ); miri_config.allow_ptr_int_transmute = true; } else if arg == "-Zmiri-disable-abi-check" { miri_config.check_abi = false; diff --git a/tests/fail/validity/invalid_enum_tag_256variants_uninit.stderr b/tests/fail/validity/invalid_enum_tag_256variants_uninit.stderr index 1a6039c477d..0e924bb741a 100644 --- a/tests/fail/validity/invalid_enum_tag_256variants_uninit.stderr +++ b/tests/fail/validity/invalid_enum_tag_256variants_uninit.stderr @@ -1,3 +1,4 @@ +WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at if you rely on this flag. error: Undefined Behavior: type validation failed at .: encountered uninitialized bytes, but expected a valid enum tag --> $DIR/invalid_enum_tag_256variants_uninit.rs:LL:CC | diff --git a/tests/pass/move-uninit-primval.stderr b/tests/pass/move-uninit-primval.stderr new file mode 100644 index 00000000000..d9f2331fe7f --- /dev/null +++ b/tests/pass/move-uninit-primval.stderr @@ -0,0 +1 @@ +WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at if you rely on this flag. diff --git a/tests/pass/uninit_number_ignored.stderr b/tests/pass/uninit_number_ignored.stderr new file mode 100644 index 00000000000..d9f2331fe7f --- /dev/null +++ b/tests/pass/uninit_number_ignored.stderr @@ -0,0 +1 @@ +WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at if you rely on this flag.