use tcx.require_lang_item() instead
This commit is contained in:
parent
d735aa6810
commit
cf00142b4d
@ -119,17 +119,10 @@ fn hash_stable(&self, _: &mut HCX, _: &mut StableHasher) {
|
||||
pub fn build_langcall<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
bx: &Bx,
|
||||
span: Option<Span>,
|
||||
msg: &str,
|
||||
li: LangItem,
|
||||
) -> (Bx::FnAbiOfResult, Bx::Value) {
|
||||
let tcx = bx.tcx();
|
||||
let def_id = tcx.lang_items().require(li).unwrap_or_else(|s| {
|
||||
let msg = format!("{} {}", msg, s);
|
||||
match span {
|
||||
Some(span) => tcx.sess.span_fatal(span, &msg),
|
||||
None => tcx.sess.fatal(&msg),
|
||||
}
|
||||
});
|
||||
let def_id = tcx.require_lang_item(li, span);
|
||||
let instance = ty::Instance::mono(tcx, def_id);
|
||||
(bx.fn_abi_of_instance(instance, ty::List::empty()), bx.get_fn_addr(instance))
|
||||
}
|
||||
|
@ -489,7 +489,7 @@ fn codegen_assert_terminator(
|
||||
}
|
||||
};
|
||||
|
||||
let (fn_abi, llfn) = common::build_langcall(&bx, Some(span), "", lang_item);
|
||||
let (fn_abi, llfn) = common::build_langcall(&bx, Some(span), lang_item);
|
||||
|
||||
// Codegen the actual panic invoke/call.
|
||||
helper.do_call(self, &mut bx, fn_abi, llfn, &args, None, cleanup);
|
||||
@ -505,7 +505,7 @@ fn codegen_abort_terminator(
|
||||
self.set_debug_loc(&mut bx, terminator.source_info);
|
||||
|
||||
// Obtain the panic entry point.
|
||||
let (fn_abi, llfn) = common::build_langcall(&bx, Some(span), "", LangItem::PanicNoUnwind);
|
||||
let (fn_abi, llfn) = common::build_langcall(&bx, Some(span), LangItem::PanicNoUnwind);
|
||||
|
||||
// Codegen the actual panic invoke/call.
|
||||
helper.do_call(self, &mut bx, fn_abi, llfn, &[], None, None);
|
||||
@ -567,7 +567,7 @@ enum AssertIntrinsic {
|
||||
|
||||
// Obtain the panic entry point.
|
||||
let (fn_abi, llfn) =
|
||||
common::build_langcall(bx, Some(source_info.span), "", LangItem::Panic);
|
||||
common::build_langcall(bx, Some(source_info.span), LangItem::Panic);
|
||||
|
||||
// Codegen the actual panic invoke/call.
|
||||
helper.do_call(
|
||||
@ -1429,7 +1429,7 @@ fn double_unwind_guard(&mut self) -> Bx::BasicBlock {
|
||||
let llretty = self.landing_pad_type();
|
||||
bx.cleanup_landing_pad(llretty, llpersonality);
|
||||
|
||||
let (fn_abi, fn_ptr) = common::build_langcall(&bx, None, "", LangItem::PanicNoUnwind);
|
||||
let (fn_abi, fn_ptr) = common::build_langcall(&bx, None, LangItem::PanicNoUnwind);
|
||||
let fn_ty = bx.fn_decl_backend_type(&fn_abi);
|
||||
|
||||
let llret = bx.call(fn_ty, fn_ptr, &[], None);
|
||||
|
Loading…
Reference in New Issue
Block a user