Skip to content

Commit 8757d86

Browse files
committed
Auto merge of rust-lang#2350 - RalfJung:remove-deprecated, r=oli-obk
remove deprecated options These have been deprecated a month ago and nobody said they need them. Is that enough time? We can also let this PR sit a little. Cc rust-lang/miri#2187 rust-lang/miri#2188 (keeping them open to track removing their supporting infrastructure in the core interpreter)
2 parents 9edbf36 + 49a6c23 commit 8757d86

11 files changed

+11
-354
lines changed

README.md

-11
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

-14
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

-6
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

+3-9
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

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

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

@@ -372,8 +365,6 @@ impl<'mir, 'tcx> Evaluator<'mir, 'tcx> {
372365
tls: TlsData::default(),
373366
isolated_op: config.isolated_op,
374367
validate: config.validate,
375-
allow_uninit_numbers: config.allow_uninit_numbers,
376-
allow_ptr_int_transmute: config.allow_ptr_int_transmute,
377368
enforce_abi: config.check_abi,
378369
file_handler: FileHandler::new(config.mute_stdout_stderr),
379370
dir_handler: Default::default(),
@@ -526,13 +517,13 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'mir, 'tcx> {
526517
}
527518

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

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

538529
#[inline(always)]

0 commit comments

Comments
 (0)