]> git.lizzy.rs Git - rust.git/commitdiff
Fix trap_unreachable_ret_value
authorbjorn3 <bjorn3@users.noreply.github.com>
Thu, 30 Apr 2020 18:54:04 +0000 (20:54 +0200)
committerbjorn3 <bjorn3@users.noreply.github.com>
Tue, 30 Jun 2020 16:52:32 +0000 (18:52 +0200)
src/trap.rs

index bf644cd5f2f16a2b3fc73a941d89bbc7fc8f42b5..4b7f64ce0a91138e4d1a312d9a4d61e44e397ab6 100644 (file)
@@ -56,7 +56,9 @@ pub(crate) fn trap_unreachable_ret_value<'tcx>(
     dest_layout: TyAndLayout<'tcx>,
     msg: impl AsRef<str>,
 ) -> CValue<'tcx> {
     dest_layout: TyAndLayout<'tcx>,
     msg: impl AsRef<str>,
 ) -> CValue<'tcx> {
-    trap_unreachable(fx, msg);
+    codegen_print(fx, msg.as_ref());
+    let true_ = fx.bcx.ins().iconst(types::I32, 1);
+    fx.bcx.ins().trapnz(true_, TrapCode::UnreachableCodeReached);
     CValue::by_ref(Pointer::const_addr(fx, 0), dest_layout)
 }
 
     CValue::by_ref(Pointer::const_addr(fx, 0), dest_layout)
 }