mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
use Instance::expect_resolve() instead of unwraping Instance::resolve()
This commit is contained in:
parent
094a6204f5
commit
aa9145e6ea
@ -115,14 +115,12 @@ pub(crate) fn maybe_create_entry_wrapper(
|
||||
termination_trait,
|
||||
)
|
||||
.unwrap();
|
||||
let report = Instance::resolve(
|
||||
let report = Instance::expect_resolve(
|
||||
tcx,
|
||||
ParamEnv::reveal_all(),
|
||||
report.def_id,
|
||||
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.polymorphize(tcx);
|
||||
|
||||
let report_name = tcx.symbol_name(report).name;
|
||||
@ -142,14 +140,12 @@ pub(crate) fn maybe_create_entry_wrapper(
|
||||
}
|
||||
} else if is_main_fn {
|
||||
let start_def_id = tcx.require_lang_item(LangItem::Start, None);
|
||||
let start_instance = Instance::resolve(
|
||||
let start_instance = Instance::expect_resolve(
|
||||
tcx,
|
||||
ParamEnv::reveal_all(),
|
||||
start_def_id,
|
||||
tcx.mk_args(&[main_ret_ty.into()]),
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
.polymorphize(tcx);
|
||||
let start_func_id = import_function(tcx, m, start_instance);
|
||||
|
||||
|
@ -473,14 +473,12 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
|
||||
let tcx = self.tcx;
|
||||
let func = match tcx.lang_items().eh_personality() {
|
||||
Some(def_id) if !wants_msvc_seh(self.sess()) => {
|
||||
let instance = ty::Instance::resolve(
|
||||
let instance = ty::Instance::expect_resolve(
|
||||
tcx,
|
||||
ty::ParamEnv::reveal_all(),
|
||||
def_id,
|
||||
ty::List::empty(),
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
);
|
||||
|
||||
let symbol_name = tcx.symbol_name(instance).name;
|
||||
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());
|
||||
|
@ -558,11 +558,12 @@ impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
|
||||
|
||||
let tcx = self.tcx;
|
||||
let llfn = match tcx.lang_items().eh_personality() {
|
||||
Some(def_id) if name.is_none() => self.get_fn_addr(
|
||||
ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, ty::List::empty())
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
),
|
||||
Some(def_id) if name.is_none() => self.get_fn_addr(ty::Instance::expect_resolve(
|
||||
tcx,
|
||||
ty::ParamEnv::reveal_all(),
|
||||
def_id,
|
||||
ty::List::empty(),
|
||||
)),
|
||||
_ => {
|
||||
let name = name.unwrap_or("rust_eh_personality");
|
||||
if let Some(llfn) = self.get_declared_value(name) {
|
||||
|
@ -467,16 +467,12 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
|
||||
|
||||
let (start_fn, start_ty, args) = if let EntryFnType::Main { sigpipe } = entry_type {
|
||||
let start_def_id = cx.tcx().require_lang_item(LangItem::Start, None);
|
||||
let start_fn = cx.get_fn_addr(
|
||||
ty::Instance::resolve(
|
||||
cx.tcx(),
|
||||
ty::ParamEnv::reveal_all(),
|
||||
start_def_id,
|
||||
cx.tcx().mk_args(&[main_ret_ty.into()]),
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap(),
|
||||
);
|
||||
let start_fn = cx.get_fn_addr(ty::Instance::expect_resolve(
|
||||
cx.tcx(),
|
||||
ty::ParamEnv::reveal_all(),
|
||||
start_def_id,
|
||||
cx.tcx().mk_args(&[main_ret_ty.into()]),
|
||||
));
|
||||
|
||||
let i8_ty = cx.type_i8();
|
||||
let arg_sigpipe = bx.const_u8(sigpipe);
|
||||
|
@ -243,14 +243,12 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
|
||||
} else if Some(def_id) == self.tcx.lang_items().panic_fmt() {
|
||||
// For panic_fmt, call const_panic_fmt instead.
|
||||
let const_def_id = self.tcx.require_lang_item(LangItem::ConstPanicFmt, None);
|
||||
let new_instance = ty::Instance::resolve(
|
||||
let new_instance = ty::Instance::expect_resolve(
|
||||
*self.tcx,
|
||||
ty::ParamEnv::reveal_all(),
|
||||
const_def_id,
|
||||
instance.args,
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
);
|
||||
|
||||
return Ok(Some(new_instance));
|
||||
} else if Some(def_id) == self.tcx.lang_items().align_offset_fn() {
|
||||
|
@ -1339,14 +1339,12 @@ impl<'v> RootCollector<'_, 'v> {
|
||||
main_ret_ty.no_bound_vars().unwrap(),
|
||||
);
|
||||
|
||||
let start_instance = Instance::resolve(
|
||||
let start_instance = Instance::expect_resolve(
|
||||
self.tcx,
|
||||
ty::ParamEnv::reveal_all(),
|
||||
start_def_id,
|
||||
self.tcx.mk_args(&[main_ret_ty.into()]),
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
);
|
||||
|
||||
self.output.push(create_fn_mono_item(self.tcx, start_instance, DUMMY_SP));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user