From 9b0c997abe2f3327870f3235dbe424b62ff94915 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 24 Dec 2024 08:45:15 +0100 Subject: [PATCH] we generally make later flags overwrite earlier flags, so remove some logic guarding just against that --- README.md | 4 +++- src/bin/miri.rs | 17 ----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index b4be061f49..9042c5da57 100644 --- a/README.md +++ b/README.md @@ -294,9 +294,10 @@ environment variable. We first document the most relevant and most commonly used will always fail and `0.0` means it will never fail. Note that setting it to `1.0` will likely cause hangs, since it means programs using `compare_exchange_weak` cannot make progress. -* `-Zmiri-disable-isolation` disables host isolation. As a consequence, +* `-Zmiri-disable-isolation` disables host isolation. As a consequence, the program has access to host resources such as environment variables, file systems, and randomness. + This overwrites a previous `-Zmiri-isolation-error`. * `-Zmiri-disable-leak-backtraces` disables backtraces reports for memory leaks. By default, a backtrace is captured for every allocation when it is created, just in case it leaks. This incurs some memory overhead to store data that is almost never used. This flag is implied by @@ -317,6 +318,7 @@ environment variable. We first document the most relevant and most commonly used execution with a "permission denied" error being returned to the program. `warn` prints a full backtrace each time that happens; `warn-nobacktrace` is less verbose and shown at most once per operation. `hide` hides the warning entirely. + This overwrites a previous `-Zmiri-disable-isolation`. * `-Zmiri-many-seeds=[]..` runs the program multiple times with different seeds for Miri's RNG. With different seeds, Miri will make different choices to resolve non-determinism such as the order in which concurrent threads are scheduled, or the exact addresses assigned to allocations. diff --git a/src/bin/miri.rs b/src/bin/miri.rs index c3ba52b181..8832016d0f 100644 --- a/src/bin/miri.rs +++ b/src/bin/miri.rs @@ -514,8 +514,6 @@ fn main() { let mut rustc_args = vec![]; let mut after_dashdash = false; - // If user has explicitly enabled/disabled isolation - let mut isolation_enabled: Option = None; // Note that we require values to be given with `=`, not with a space. // This matches how rustc parses `-Z`. @@ -550,13 +548,6 @@ fn main() { } else if arg == "-Zmiri-symbolic-alignment-check" { miri_config.check_alignment = miri::AlignmentCheck::Symbolic; } else if arg == "-Zmiri-disable-isolation" { - if matches!(isolation_enabled, Some(true)) { - show_error!( - "-Zmiri-disable-isolation cannot be used along with -Zmiri-isolation-error" - ); - } else { - isolation_enabled = Some(false); - } miri_config.isolated_op = miri::IsolatedOp::Allow; } else if arg == "-Zmiri-disable-leak-backtraces" { miri_config.collect_leak_backtraces = false; @@ -565,14 +556,6 @@ fn main() { } else if arg == "-Zmiri-track-weak-memory-loads" { miri_config.track_outdated_loads = true; } else if let Some(param) = arg.strip_prefix("-Zmiri-isolation-error=") { - if matches!(isolation_enabled, Some(false)) { - show_error!( - "-Zmiri-isolation-error cannot be used along with -Zmiri-disable-isolation" - ); - } else { - isolation_enabled = Some(true); - } - miri_config.isolated_op = match param { "abort" => miri::IsolatedOp::Reject(miri::RejectOpWith::Abort), "hide" => miri::IsolatedOp::Reject(miri::RejectOpWith::NoWarning),