about summary refs log tree commit diff
path: root/compiler/rustc_codegen_cranelift/src/trap.rs
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-08-24 18:40:58 +0200
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2022-08-24 18:40:58 +0200
commit7b9c8c87819d0d122f56017f5e093ea8c082dc69 (patch)
tree59f1afde620220a353f036efc7b95ea17dab9e67 /compiler/rustc_codegen_cranelift/src/trap.rs
parent4a24f08ba43166cfee86d868b3fe8612aec6faca (diff)
parente9d1a0a7b0b28dd422f1a790ccde532acafbf193 (diff)
downloadrust-7b9c8c87819d0d122f56017f5e093ea8c082dc69.tar.gz
rust-7b9c8c87819d0d122f56017f5e093ea8c082dc69.zip
Merge commit 'e9d1a0a7b0b28dd422f1a790ccde532acafbf193' into sync_cg_clif-2022-08-24
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/trap.rs')
-rw-r--r--compiler/rustc_codegen_cranelift/src/trap.rs25
1 files changed, 1 insertions, 24 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/trap.rs b/compiler/rustc_codegen_cranelift/src/trap.rs
index 923269c4de9..82a2ec57954 100644
--- a/compiler/rustc_codegen_cranelift/src/trap.rs
+++ b/compiler/rustc_codegen_cranelift/src/trap.rs
@@ -25,33 +25,10 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, '_>, msg: &str) {
     fx.bcx.ins().call(puts, &[msg_ptr]);
 }
 
-/// Use this for example when a function call should never return. This will fill the current block,
-/// so you can **not** add instructions to it afterwards.
-///
-/// Trap code: user65535
-pub(crate) fn trap_unreachable(fx: &mut FunctionCx<'_, '_, '_>, msg: impl AsRef<str>) {
-    codegen_print(fx, msg.as_ref());
-    fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
-}
 /// Use this when something is unimplemented, but `libcore` or `libstd` requires it to codegen.
-/// Unlike `trap_unreachable` this will not fill the current block, so you **must** add instructions
-/// to it afterwards.
 ///
 /// Trap code: user65535
 pub(crate) fn trap_unimplemented(fx: &mut FunctionCx<'_, '_, '_>, msg: impl AsRef<str>) {
     codegen_print(fx, msg.as_ref());
-    let true_ = fx.bcx.ins().iconst(types::I32, 1);
-    fx.bcx.ins().trapnz(true_, TrapCode::User(!0));
-}
-
-/// Like `trap_unimplemented` but returns a fake value of the specified type.
-///
-/// Trap code: user65535
-pub(crate) fn trap_unimplemented_ret_value<'tcx>(
-    fx: &mut FunctionCx<'_, '_, 'tcx>,
-    dest_layout: TyAndLayout<'tcx>,
-    msg: impl AsRef<str>,
-) -> CValue<'tcx> {
-    trap_unimplemented(fx, msg);
-    CValue::by_ref(Pointer::const_addr(fx, 0), dest_layout)
+    fx.bcx.ins().trap(TrapCode::User(!0));
 }