Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 14913e9

Browse files
committed
deprecate -Zmiri-allow-uninit-numbers and -Zmiri-allow-ptr-int-transmute
1 parent 3361eab commit 14913e9

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,13 +304,15 @@ to Miri failing to detect cases of undefined behavior in a program.
304304

305305
* `-Zmiri-allow-uninit-numbers` disables the check to ensure that number types (integer and float
306306
types) always hold initialized data. (They must still be initialized when any actual operation,
307-
such as arithmetic, is performed.) Using this flag is **unsound**. This has no effect when
307+
such as arithmetic, is performed.) Using this flag is **unsound** and
308+
[deprecated](https://github.com/rust-lang/miri/issues/2187). This has no effect when
308309
`-Zmiri-disable-validation` is present.
309310
* `-Zmiri-allow-ptr-int-transmute` makes Miri more accepting of transmutation between pointers and
310311
integers via `mem::transmute` or union/pointer type punning. This has two effects: it disables the
311312
check against integers storing a pointer (i.e., data with provenance), thus allowing
312313
pointer-to-integer transmutation, and it treats integer-to-pointer transmutation as equivalent to
313-
a cast. Using this flag is **unsound**.
314+
a cast. Using this flag is **unsound** and
315+
[deprecated](https://github.com/rust-lang/miri/issues/2188).
314316
* `-Zmiri-disable-abi-check` disables checking [function ABI]. Using this flag
315317
is **unsound**.
316318
* `-Zmiri-disable-alignment-check` disables checking pointer alignment, so you

src/bin/miri.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,16 @@ fn main() {
328328
since it is now enabled by default"
329329
);
330330
} else if arg == "-Zmiri-allow-uninit-numbers" {
331+
eprintln!(
332+
"WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. \
333+
Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag."
334+
);
331335
miri_config.allow_uninit_numbers = true;
332336
} else if arg == "-Zmiri-allow-ptr-int-transmute" {
337+
eprintln!(
338+
"WARNING: `-Zmiri-allow-ptr-int-transmute` is deprecated and planned to be removed. \
339+
Please let us know at <https://github.com/rust-lang/miri/issues/2188> if you rely on this flag."
340+
);
333341
miri_config.allow_ptr_int_transmute = true;
334342
} else if arg == "-Zmiri-disable-abi-check" {
335343
miri_config.check_abi = false;

tests/fail/validity/invalid_enum_tag_256variants_uninit.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag.
12
error: Undefined Behavior: type validation failed at .<enum-tag>: encountered uninitialized bytes, but expected a valid enum tag
23
--> $DIR/invalid_enum_tag_256variants_uninit.rs:LL:CC
34
|

tests/pass/move-uninit-primval.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag.

0 commit comments

Comments
 (0)