Skip to content

Commit e1b639a

Browse files
committed
Auto merge of #1085 - RalfJung:panic-runtime, r=RalfJung
avoid injected_panic_runtime which is going away Thanks @petrochenkov for suggesting this!
2 parents 59eee1a + 4a4886c commit e1b639a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/shims/foreign_items.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ pub trait EvalContextExt<'mir, 'tcx: 'mir>: crate::MiriEvalContextExt<'mir, 'tcx
135135
// Normally, this will be either `libpanic_unwind` or `libpanic_abort`, but it could
136136
// also be a custom user-provided implementation via `#![feature(panic_runtime)]`
137137
"__rust_start_panic" => {
138-
let panic_runtime = tcx.crate_name(tcx.injected_panic_runtime().expect("No panic runtime found!"));
138+
// FIXME we might want to cache this... but it's not really performance-critical.
139+
let panic_runtime = tcx.crates().iter()
140+
.find(|cnum| tcx.is_panic_runtime(**cnum))
141+
.expect("No panic runtime found!");
142+
let panic_runtime = tcx.crate_name(*panic_runtime);
139143
let start_panic_instance = this.resolve_path(&[&*panic_runtime.as_str(), "__rust_start_panic"])?;
140144
return Ok(Some(this.load_mir(start_panic_instance.def, None)?));
141145
}

0 commit comments

Comments
 (0)