Skip to content

Commit 1b446cd

Browse files
committed
replace miri_start_panic intrinsic by 'extern fn'
1 parent 2bbfa02 commit 1b446cd

File tree

5 files changed

+6
-21
lines changed

5 files changed

+6
-21
lines changed

src/libcore/intrinsics.rs

-8
Original file line numberDiff line numberDiff line change
@@ -1947,14 +1947,6 @@ extern "rust-intrinsic" {
19471947
#[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")]
19481948
pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize;
19491949

1950-
/// Internal hook used by Miri to implement unwinding.
1951-
/// ICEs when encountered during non-Miri codegen.
1952-
///
1953-
/// The `payload` ptr here will be exactly the one `do_catch` gets passed by `try`.
1954-
///
1955-
/// Perma-unstable: do not use.
1956-
pub fn miri_start_panic(payload: *mut u8) -> !;
1957-
19581950
/// Internal placeholder for injecting code coverage counters when the "instrument-coverage"
19591951
/// option is enabled. The placeholder is replaced with `llvm.instrprof.increment` during code
19601952
/// generation.

src/libpanic_unwind/miri.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ use core::any::Any;
66
// Must be pointer-sized.
77
type Payload = Box<Box<dyn Any + Send>>;
88

9+
extern "Rust" {
10+
/// Miri-provided extern function to begin unwinding.
11+
fn miri_start_panic(payload: *mut u8) -> !;
12+
}
13+
914
pub unsafe fn panic(payload: Box<dyn Any + Send>) -> u32 {
1015
// The payload we pass to `miri_start_panic` will be exactly the argument we get
1116
// in `cleanup` below. So we just box it up once, to get something pointer-sized.
1217
let payload_box: Payload = Box::new(payload);
13-
core::intrinsics::miri_start_panic(Box::into_raw(payload_box) as *mut u8)
18+
miri_start_panic(Box::into_raw(payload_box) as *mut u8)
1419
}
1520

1621
pub unsafe fn cleanup(payload_box: *mut u8) -> Box<dyn Any + Send> {

src/librustc_codegen_ssa/mir/block.rs

-5
Original file line numberDiff line numberDiff line change
@@ -606,11 +606,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
606606
return;
607607
}
608608

609-
// For normal codegen, this Miri-specific intrinsic should never occur.
610-
if intrinsic == Some(sym::miri_start_panic) {
611-
bug!("`miri_start_panic` should never end up in compiled code");
612-
}
613-
614609
if self.codegen_panic_intrinsic(
615610
&helper,
616611
&mut bx,

src/librustc_span/symbol.rs

-1
Original file line numberDiff line numberDiff line change
@@ -677,7 +677,6 @@ symbols! {
677677
minnumf32,
678678
minnumf64,
679679
mips_target_feature,
680-
miri_start_panic,
681680
mmx_target_feature,
682681
module,
683682
module_path,

src/librustc_typeck/check/intrinsic.rs

-6
Original file line numberDiff line numberDiff line change
@@ -379,12 +379,6 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) {
379379

380380
sym::nontemporal_store => (1, vec![tcx.mk_mut_ptr(param(0)), param(0)], tcx.mk_unit()),
381381

382-
sym::miri_start_panic => {
383-
// FIXME - the relevant types aren't lang items,
384-
// so it's not trivial to check this
385-
return;
386-
}
387-
388382
sym::count_code_region => {
389383
(0, vec![tcx.types.u64, tcx.types.u32, tcx.types.u32, tcx.types.u32], tcx.mk_unit())
390384
}

0 commit comments

Comments
 (0)