1
Fork 0

use Instance::expect_resolve() instead of unwraping Instance::resolve()

This commit is contained in:
Ralf Jung 2024-03-10 11:49:27 +01:00
parent ef862a707b
commit 01affeb53a

View file

@ -115,14 +115,12 @@ pub(crate) fn maybe_create_entry_wrapper(
termination_trait, termination_trait,
) )
.unwrap(); .unwrap();
let report = Instance::resolve( let report = Instance::expect_resolve(
tcx, tcx,
ParamEnv::reveal_all(), ParamEnv::reveal_all(),
report.def_id, report.def_id,
tcx.mk_args(&[GenericArg::from(main_ret_ty)]), tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
) )
.unwrap()
.unwrap()
.polymorphize(tcx); .polymorphize(tcx);
let report_name = tcx.symbol_name(report).name; let report_name = tcx.symbol_name(report).name;
@ -142,14 +140,12 @@ pub(crate) fn maybe_create_entry_wrapper(
} }
} else if is_main_fn { } else if is_main_fn {
let start_def_id = tcx.require_lang_item(LangItem::Start, None); let start_def_id = tcx.require_lang_item(LangItem::Start, None);
let start_instance = Instance::resolve( let start_instance = Instance::expect_resolve(
tcx, tcx,
ParamEnv::reveal_all(), ParamEnv::reveal_all(),
start_def_id, start_def_id,
tcx.mk_args(&[main_ret_ty.into()]), tcx.mk_args(&[main_ret_ty.into()]),
) )
.unwrap()
.unwrap()
.polymorphize(tcx); .polymorphize(tcx);
let start_func_id = import_function(tcx, m, start_instance); let start_func_id = import_function(tcx, m, start_instance);