Skip to content

Commit 9e2688c

Browse files
committed
remove -Zmiri-panic-on-unsupported flag
1 parent 7e21dce commit 9e2688c

File tree

7 files changed

+2
-42
lines changed

7 files changed

+2
-42
lines changed

src/tools/miri/README.md

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,6 @@ to Miri failing to detect cases of undefined behavior in a program.
392392
but reports to the program that it did actually write. This is useful when you
393393
are not interested in the actual program's output, but only want to see Miri's
394394
errors and warnings.
395-
* `-Zmiri-panic-on-unsupported` will make some forms of unsupported functionality,
396-
such as FFI and unsupported syscalls, panic within the context of the emulated
397-
application instead of raising an error within the context of Miri (and halting
398-
execution). Note that code might not expect these operations to ever panic, so
399-
this flag can lead to strange (mis)behavior.
400395
* `-Zmiri-recursive-validation` is a *highly experimental* flag that makes validity checking
401396
recurse below references.
402397
* `-Zmiri-retag-fields[=<all|none|scalar>]` controls when Stacked Borrows retagging recurses into

src/tools/miri/src/bin/miri.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,6 @@ fn main() {
530530
} else if arg == "-Zmiri-ignore-leaks" {
531531
miri_config.ignore_leaks = true;
532532
miri_config.collect_leak_backtraces = false;
533-
} else if arg == "-Zmiri-panic-on-unsupported" {
534-
miri_config.panic_on_unsupported = true;
535533
} else if arg == "-Zmiri-strict-provenance" {
536534
miri_config.provenance_mode = ProvenanceMode::Strict;
537535
} else if arg == "-Zmiri-permissive-provenance" {

src/tools/miri/src/eval.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,6 @@ pub struct MiriConfig {
129129
/// If `Some`, enable the `measureme` profiler, writing results to a file
130130
/// with the specified prefix.
131131
pub measureme_out: Option<String>,
132-
/// Panic when unsupported functionality is encountered.
133-
pub panic_on_unsupported: bool,
134132
/// Which style to use for printing backtraces.
135133
pub backtrace_style: BacktraceStyle,
136134
/// Which provenance to use for int2ptr casts
@@ -183,7 +181,6 @@ impl Default for MiriConfig {
183181
track_outdated_loads: false,
184182
cmpxchg_weak_failure_rate: 0.8, // 80%
185183
measureme_out: None,
186-
panic_on_unsupported: false,
187184
backtrace_style: BacktraceStyle::Short,
188185
provenance_mode: ProvenanceMode::Default,
189186
mute_stdout_stderr: false,

src/tools/miri/src/machine.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -496,11 +496,6 @@ pub struct MiriMachine<'tcx> {
496496
/// `None` means no `Instance` exported under the given name is found.
497497
pub(crate) exported_symbols_cache: FxHashMap<Symbol, Option<Instance<'tcx>>>,
498498

499-
/// Whether to raise a panic in the context of the evaluated process when unsupported
500-
/// functionality is encountered. If `false`, an error is propagated in the Miri application context
501-
/// instead (default behavior)
502-
pub(crate) panic_on_unsupported: bool,
503-
504499
/// Equivalent setting as RUST_BACKTRACE on encountering an error.
505500
pub(crate) backtrace_style: BacktraceStyle,
506501

@@ -667,7 +662,6 @@ impl<'tcx> MiriMachine<'tcx> {
667662
profiler,
668663
string_cache: Default::default(),
669664
exported_symbols_cache: FxHashMap::default(),
670-
panic_on_unsupported: config.panic_on_unsupported,
671665
backtrace_style: config.backtrace_style,
672666
local_crates,
673667
extern_statics: FxHashMap::default(),
@@ -807,7 +801,6 @@ impl VisitProvenance for MiriMachine<'_> {
807801
profiler: _,
808802
string_cache: _,
809803
exported_symbols_cache: _,
810-
panic_on_unsupported: _,
811804
backtrace_style: _,
812805
local_crates: _,
813806
rng: _,

src/tools/miri/src/shims/foreign_items.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,10 @@ pub trait EvalContextExt<'tcx>: crate::MiriInterpCxExt<'tcx> {
8383
return interp_ok(Some(body));
8484
}
8585

86-
let error_msg = format!(
86+
throw_machine_stop!(TerminationInfo::UnsupportedForeignItem(format!(
8787
"can't call foreign function `{link_name}` on OS `{os}`",
8888
os = this.tcx.sess.target.os,
89-
);
90-
if this.machine.panic_on_unsupported {
91-
// message is slightly different here to make automated analysis easier
92-
let error_msg = format!("unsupported Miri functionality: {error_msg}");
93-
this.start_panic(error_msg.as_ref(), mir::UnwindAction::Continue)?;
94-
} else {
95-
throw_machine_stop!(TerminationInfo::UnsupportedForeignItem(error_msg));
96-
}
89+
)));
9790
}
9891
}
9992

src/tools/miri/tests/panic/unsupported_foreign_function.rs

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/tools/miri/tests/panic/unsupported_foreign_function.stderr

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)