]> git.lizzy.rs Git - rust.git/blobdiff - src/trap.rs
Rustup to rustc 1.42.0-nightly (3ebcfa145 2020-01-12)
[rust.git] / src / trap.rs
index 0ff9d39d78a2e7548e1ee778fefaddac109215aa..316a26781dab49b55936a02ea9ddab31d460eaad 100644 (file)
@@ -7,7 +7,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
             "puts",
             Linkage::Import,
             &Signature {
-                call_conv: CallConv::SystemV,
+                call_conv: CallConv::triple_default(fx.triple()),
                 params: vec![AbiParam::new(pointer_ty(fx.tcx))],
                 returns: vec![],
             },
@@ -26,7 +26,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
     let msg_id = fx
         .module
         .declare_data(
-            &(symbol_name.as_str().to_string() + msg),
+            &(symbol_name.name.as_str().to_string() + msg),
             Linkage::Local,
             false,
             None,
@@ -91,19 +91,5 @@ pub fn trap_unreachable_ret_value<'tcx>(
     msg: impl AsRef<str>,
 ) -> CValue<'tcx> {
     trap_unimplemented(fx, msg);
-    let zero = fx.bcx.ins().iconst(fx.pointer_type, 0);
-    CValue::by_ref(zero, dest_layout)
-}
-
-/// Like `trap_unreachable` but returns a fake place for the specified type.
-///
-/// Trap code: user65535
-pub fn trap_unreachable_ret_place<'tcx>(
-    fx: &mut FunctionCx<'_, 'tcx, impl cranelift_module::Backend>,
-    dest_layout: TyLayout<'tcx>,
-    msg: impl AsRef<str>,
-) -> CPlace<'tcx> {
-    trap_unimplemented(fx, msg);
-    let zero = fx.bcx.ins().iconst(fx.pointer_type, 0);
-    CPlace::for_addr(zero, dest_layout)
+    CValue::by_ref(Pointer::const_addr(fx, 0), dest_layout)
 }