diff options
| author | SparrowLii <liyuan179@huawei.com> | 2022-04-28 20:18:01 +0800 |
|---|---|---|
| committer | SparrowLii <liyuan179@huawei.com> | 2022-04-28 20:18:01 +0800 |
| commit | cf00142b4db822735b31392ded7c039844411a74 (patch) | |
| tree | 2a579fa45f9c55928cce8fd8b17cb7e1f63fa888 /compiler/rustc_codegen_ssa/src/common.rs | |
| parent | d735aa68107bbe4d617903f221088eeef92ee223 (diff) | |
| download | rust-cf00142b4db822735b31392ded7c039844411a74.tar.gz rust-cf00142b4db822735b31392ded7c039844411a74.zip | |
use tcx.require_lang_item() instead
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/common.rs')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/common.rs | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/compiler/rustc_codegen_ssa/src/common.rs b/compiler/rustc_codegen_ssa/src/common.rs index 94c63b98ff9..1574b30497b 100644 --- a/compiler/rustc_codegen_ssa/src/common.rs +++ b/compiler/rustc_codegen_ssa/src/common.rs @@ -119,17 +119,10 @@ mod temp_stable_hash_impls { 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)) } |
