]> 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 e5e8a532ed9814492ed47e04b12d72ea89bf4eb8..316a26781dab49b55936a02ea9ddab31d460eaad 100644 (file)
@@ -7,7 +7,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
             "puts",
             Linkage::Import,
             &Signature {
-                call_conv: crate::default_call_conv(fx.tcx.sess),
+                call_conv: CallConv::triple_default(fx.triple()),
                 params: vec![AbiParam::new(pointer_ty(fx.tcx))],
                 returns: vec![],
             },
@@ -36,7 +36,7 @@ fn codegen_print(fx: &mut FunctionCx<'_, '_, impl cranelift_module::Backend>, ms
     // Ignore DuplicateDefinition error, as the data will be the same
     let _ = fx.module.define_data(msg_id, &data_ctx);
 
-    let local_msg_id = fx.module.declare_data_in_func(msg_id, &mut fx.bcx.func);
+    let local_msg_id = fx.module.declare_data_in_func(msg_id, fx.bcx.func);
     #[cfg(debug_assertions)]
     {
         fx.add_entity_comment(local_msg_id, msg);
@@ -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)
 }