diff options
| author | Ralf Jung <post@ralfj.de> | 2020-07-23 13:07:21 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-07-23 13:15:50 +0200 |
| commit | 1b446cdbf03d26f31f6113a4ccb2e011f3a9abf1 (patch) | |
| tree | 3c75314247bf55308b87e067b3f061c8c00c1518 /src | |
| parent | 2bbfa02b1b15974d5772b520aa027bf79f8c248e (diff) | |
| download | rust-1b446cdbf03d26f31f6113a4ccb2e011f3a9abf1.tar.gz rust-1b446cdbf03d26f31f6113a4ccb2e011f3a9abf1.zip | |
replace miri_start_panic intrinsic by 'extern fn'
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/intrinsics.rs | 8 | ||||
| -rw-r--r-- | src/libpanic_unwind/miri.rs | 7 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/mir/block.rs | 5 | ||||
| -rw-r--r-- | src/librustc_span/symbol.rs | 1 | ||||
| -rw-r--r-- | src/librustc_typeck/check/intrinsic.rs | 6 |
5 files changed, 6 insertions, 21 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 1af4f1009d1..71780361d29 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -1947,14 +1947,6 @@ extern "rust-intrinsic" { #[rustc_const_unstable(feature = "const_ptr_offset_from", issue = "41079")] pub fn ptr_offset_from<T>(ptr: *const T, base: *const T) -> isize; - /// Internal hook used by Miri to implement unwinding. - /// ICEs when encountered during non-Miri codegen. - /// - /// The `payload` ptr here will be exactly the one `do_catch` gets passed by `try`. - /// - /// Perma-unstable: do not use. - pub fn miri_start_panic(payload: *mut u8) -> !; - /// Internal placeholder for injecting code coverage counters when the "instrument-coverage" /// option is enabled. The placeholder is replaced with `llvm.instrprof.increment` during code /// generation. diff --git a/src/libpanic_unwind/miri.rs b/src/libpanic_unwind/miri.rs index 9d92b2b2f32..d941b73b5fa 100644 --- a/src/libpanic_unwind/miri.rs +++ b/src/libpanic_unwind/miri.rs @@ -6,11 +6,16 @@ use core::any::Any; // Must be pointer-sized. type Payload = Box<Box<dyn Any + Send>>; +extern "Rust" { + /// Miri-provided extern function to begin unwinding. + fn miri_start_panic(payload: *mut u8) -> !; +} + pub unsafe fn panic(payload: Box<dyn Any + Send>) -> u32 { // The payload we pass to `miri_start_panic` will be exactly the argument we get // in `cleanup` below. So we just box it up once, to get something pointer-sized. let payload_box: Payload = Box::new(payload); - core::intrinsics::miri_start_panic(Box::into_raw(payload_box) as *mut u8) + miri_start_panic(Box::into_raw(payload_box) as *mut u8) } pub unsafe fn cleanup(payload_box: *mut u8) -> Box<dyn Any + Send> { diff --git a/src/librustc_codegen_ssa/mir/block.rs b/src/librustc_codegen_ssa/mir/block.rs index e1de9677f80..f9e1094ff73 100644 --- a/src/librustc_codegen_ssa/mir/block.rs +++ b/src/librustc_codegen_ssa/mir/block.rs @@ -606,11 +606,6 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> { return; } - // For normal codegen, this Miri-specific intrinsic should never occur. - if intrinsic == Some(sym::miri_start_panic) { - bug!("`miri_start_panic` should never end up in compiled code"); - } - if self.codegen_panic_intrinsic( &helper, &mut bx, diff --git a/src/librustc_span/symbol.rs b/src/librustc_span/symbol.rs index 22a5115c7f5..dadf040304d 100644 --- a/src/librustc_span/symbol.rs +++ b/src/librustc_span/symbol.rs @@ -677,7 +677,6 @@ symbols! { minnumf32, minnumf64, mips_target_feature, - miri_start_panic, mmx_target_feature, module, module_path, diff --git a/src/librustc_typeck/check/intrinsic.rs b/src/librustc_typeck/check/intrinsic.rs index a09edf575c8..dc2172650e5 100644 --- a/src/librustc_typeck/check/intrinsic.rs +++ b/src/librustc_typeck/check/intrinsic.rs @@ -379,12 +379,6 @@ pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem<'_>) { sym::nontemporal_store => (1, vec![tcx.mk_mut_ptr(param(0)), param(0)], tcx.mk_unit()), - sym::miri_start_panic => { - // FIXME - the relevant types aren't lang items, - // so it's not trivial to check this - return; - } - sym::count_code_region => { (0, vec![tcx.types.u64, tcx.types.u32, tcx.types.u32, tcx.types.u32], tcx.mk_unit()) } |
