Skip to content

Commit 01affeb

Browse files
committed
use Instance::expect_resolve() instead of unwraping Instance::resolve()
1 parent ef862a7 commit 01affeb

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/main_shim.rs

+2-6
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,12 @@ pub(crate) fn maybe_create_entry_wrapper(
115115
termination_trait,
116116
)
117117
.unwrap();
118-
let report = Instance::resolve(
118+
let report = Instance::expect_resolve(
119119
tcx,
120120
ParamEnv::reveal_all(),
121121
report.def_id,
122122
tcx.mk_args(&[GenericArg::from(main_ret_ty)]),
123123
)
124-
.unwrap()
125-
.unwrap()
126124
.polymorphize(tcx);
127125

128126
let report_name = tcx.symbol_name(report).name;
@@ -142,14 +140,12 @@ pub(crate) fn maybe_create_entry_wrapper(
142140
}
143141
} else if is_main_fn {
144142
let start_def_id = tcx.require_lang_item(LangItem::Start, None);
145-
let start_instance = Instance::resolve(
143+
let start_instance = Instance::expect_resolve(
146144
tcx,
147145
ParamEnv::reveal_all(),
148146
start_def_id,
149147
tcx.mk_args(&[main_ret_ty.into()]),
150148
)
151-
.unwrap()
152-
.unwrap()
153149
.polymorphize(tcx);
154150
let start_func_id = import_function(tcx, m, start_instance);
155151

0 commit comments

Comments
 (0)