Skip to content

Commit 49a6c23

Browse files
committed
remove deprecated options
1 parent 58e7b8f commit 49a6c23

11 files changed

+11
-354
lines changed

README.md

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -329,17 +329,6 @@ The remaining flags are for advanced use only, and more likely to change or be r
329329
Some of these are **unsound**, which means they can lead
330330
to Miri failing to detect cases of undefined behavior in a program.
331331

332-
* `-Zmiri-allow-uninit-numbers` disables the check to ensure that number types (integer and float
333-
types) always hold initialized data. (They must still be initialized when any actual operation,
334-
such as arithmetic, is performed.) Using this flag is **unsound** and
335-
[deprecated](https://github.com/rust-lang/miri/issues/2187). This has no effect when
336-
`-Zmiri-disable-validation` is present.
337-
* `-Zmiri-allow-ptr-int-transmute` makes Miri more accepting of transmutation between pointers and
338-
integers via `mem::transmute` or union/pointer type punning. This has two effects: it disables the
339-
check against integers storing a pointer (i.e., data with provenance), thus allowing
340-
pointer-to-integer transmutation, and it treats integer-to-pointer transmutation as equivalent to
341-
a cast. Implies `-Zmiri-permissive-provenance`. Using this flag is **unsound** and
342-
[deprecated](https://github.com/rust-lang/miri/issues/2188).
343332
* `-Zmiri-disable-abi-check` disables checking [function ABI]. Using this flag
344333
is **unsound**.
345334
* `-Zmiri-disable-alignment-check` disables checking pointer alignment, so you

src/bin/miri.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -328,19 +328,6 @@ fn main() {
328328
"WARNING: the flag `-Zmiri-check-number-validity` no longer has any effect \
329329
since it is now enabled by default"
330330
);
331-
} else if arg == "-Zmiri-allow-uninit-numbers" {
332-
eprintln!(
333-
"WARNING: `-Zmiri-allow-uninit-numbers` is deprecated and planned to be removed. \
334-
Please let us know at <https://github.com/rust-lang/miri/issues/2187> if you rely on this flag."
335-
);
336-
miri_config.allow_uninit_numbers = true;
337-
} else if arg == "-Zmiri-allow-ptr-int-transmute" {
338-
eprintln!(
339-
"WARNING: `-Zmiri-allow-ptr-int-transmute` is deprecated and planned to be removed. \
340-
Please let us know at <https://github.com/rust-lang/miri/issues/2188> if you rely on this flag."
341-
);
342-
miri_config.allow_ptr_int_transmute = true;
343-
miri_config.provenance_mode = ProvenanceMode::Permissive;
344331
} else if arg == "-Zmiri-disable-abi-check" {
345332
miri_config.check_abi = false;
346333
} else if arg == "-Zmiri-disable-isolation" {
@@ -378,7 +365,6 @@ fn main() {
378365
eprintln!("WARNING: `-Zmiri-tag-raw-pointers` has no effect; it is enabled by default");
379366
} else if arg == "-Zmiri-strict-provenance" {
380367
miri_config.provenance_mode = ProvenanceMode::Strict;
381-
miri_config.allow_ptr_int_transmute = false;
382368
} else if arg == "-Zmiri-permissive-provenance" {
383369
miri_config.provenance_mode = ProvenanceMode::Permissive;
384370
} else if arg == "-Zmiri-mute-stdout-stderr" {

src/eval.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,6 @@ pub struct MiriConfig {
7777
pub stacked_borrows: bool,
7878
/// Controls alignment checking.
7979
pub check_alignment: AlignmentCheck,
80-
/// Controls integer and float validity initialization checking.
81-
pub allow_uninit_numbers: bool,
82-
/// Controls how we treat ptr2int and int2ptr transmutes.
83-
pub allow_ptr_int_transmute: bool,
8480
/// Controls function [ABI](Abi) checking.
8581
pub check_abi: bool,
8682
/// Action for an op requiring communication with the host.
@@ -134,8 +130,6 @@ impl Default for MiriConfig {
134130
validate: true,
135131
stacked_borrows: true,
136132
check_alignment: AlignmentCheck::Int,
137-
allow_uninit_numbers: false,
138-
allow_ptr_int_transmute: false,
139133
check_abi: true,
140134
isolated_op: IsolatedOp::Reject(RejectOpWith::Abort),
141135
ignore_leaks: false,

src/intptrcast.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,13 @@ impl<'mir, 'tcx> GlobalStateInner {
107107
}
108108

109109
pub fn ptr_from_addr_transmute(
110-
ecx: &MiriEvalContext<'mir, 'tcx>,
110+
_ecx: &MiriEvalContext<'mir, 'tcx>,
111111
addr: u64,
112112
) -> Pointer<Option<Tag>> {
113113
trace!("Transmuting {:#x} to a pointer", addr);
114114

115-
let provenance = if ecx.machine.allow_ptr_int_transmute {
116-
// When we allow transmutes, treat them like casts: generating a wildcard pointer.
117-
Some(Tag::Wildcard)
118-
} else {
119-
// Usually, we consider transmuted pointers to be "invalid" (`None` provenance).
120-
None
121-
};
122-
Pointer::new(provenance, Size::from_bytes(addr))
115+
// We consider transmuted pointers to be "invalid" (`None` provenance).
116+
Pointer::new(None, Size::from_bytes(addr))
123117
}
124118

125119
pub fn ptr_from_addr_cast(

src/machine.rs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -260,13 +260,6 @@ pub struct Evaluator<'mir, 'tcx> {
260260
/// Whether to enforce the validity invariant.
261261
pub(crate) validate: bool,
262262

263-
/// Whether to allow uninitialized numbers (integers and floats).
264-
pub(crate) allow_uninit_numbers: bool,
265-
266-
/// Whether to allow ptr2int transmutes, and whether to allow *dereferencing* the result of an
267-
/// int2ptr transmute.
268-
pub(crate) allow_ptr_int_transmute: bool,
269-
270263
/// Whether to enforce [ABI](Abi) of function calls.
271264
pub(crate) enforce_abi: bool,
272265

@@ -373,8 +366,6 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
373366
tls: TlsData::default(),
374367
isolated_op: config.isolated_op,
375368
validate: config.validate,
376-
allow_uninit_numbers: config.allow_uninit_numbers,
377-
allow_ptr_int_transmute: config.allow_ptr_int_transmute,
378369
enforce_abi: config.check_abi,
379370
file_handler: FileHandler::new(config.mute_stdout_stderr),
380371
dir_handler: Default::default(),
@@ -527,13 +518,13 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
527518
}
528519

529520
#[inline(always)]
530-
fn enforce_number_init(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
531-
!ecx.machine.allow_uninit_numbers
521+
fn enforce_number_init(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
522+
true
532523
}
533524

534525
#[inline(always)]
535-
fn enforce_number_no_provenance(ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
536-
!ecx.machine.allow_ptr_int_transmute
526+
fn enforce_number_no_provenance(_ecx: &MiriEvalContext<'mir, 'tcx>) -> bool {
527+
true
537528
}
538529

539530
#[inline(always)]

0 commit comments

Comments
 (0)