Skip to content

Commit 9d9fb63

Browse files
authored
Unrolled build for rust-lang#122286
Rollup merge of rust-lang#122286 - RalfJung:resolve, r=compiler-errors use Instance::expect_resolve() instead of unwraping Instance::resolve()
2 parents 3b1717c + aa9145e commit 9d9fb63

File tree

6 files changed

+20
-33
lines changed

6 files changed

+20
-33
lines changed

compiler/rustc_codegen_cranelift/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

compiler/rustc_codegen_gcc/src/context.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -473,14 +473,12 @@ impl<'gcc, 'tcx> MiscMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
473473
let tcx = self.tcx;
474474
let func = match tcx.lang_items().eh_personality() {
475475
Some(def_id) if !wants_msvc_seh(self.sess()) => {
476-
let instance = ty::Instance::resolve(
476+
let instance = ty::Instance::expect_resolve(
477477
tcx,
478478
ty::ParamEnv::reveal_all(),
479479
def_id,
480480
ty::List::empty(),
481-
)
482-
.unwrap()
483-
.unwrap();
481+
);
484482

485483
let symbol_name = tcx.symbol_name(instance).name;
486484
let fn_abi = self.fn_abi_of_instance(instance, ty::List::empty());

compiler/rustc_codegen_llvm/src/context.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -558,11 +558,12 @@ impl<'ll, 'tcx> MiscMethods<'tcx> for CodegenCx<'ll, 'tcx> {
558558

559559
let tcx = self.tcx;
560560
let llfn = match tcx.lang_items().eh_personality() {
561-
Some(def_id) if name.is_none() => self.get_fn_addr(
562-
ty::Instance::resolve(tcx, ty::ParamEnv::reveal_all(), def_id, ty::List::empty())
563-
.unwrap()
564-
.unwrap(),
565-
),
561+
Some(def_id) if name.is_none() => self.get_fn_addr(ty::Instance::expect_resolve(
562+
tcx,
563+
ty::ParamEnv::reveal_all(),
564+
def_id,
565+
ty::List::empty(),
566+
)),
566567
_ => {
567568
let name = name.unwrap_or("rust_eh_personality");
568569
if let Some(llfn) = self.get_declared_value(name) {

compiler/rustc_codegen_ssa/src/base.rs

+6-10
Original file line numberDiff line numberDiff line change
@@ -467,16 +467,12 @@ pub fn maybe_create_entry_wrapper<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
467467

468468
let (start_fn, start_ty, args) = if let EntryFnType::Main { sigpipe } = entry_type {
469469
let start_def_id = cx.tcx().require_lang_item(LangItem::Start, None);
470-
let start_fn = cx.get_fn_addr(
471-
ty::Instance::resolve(
472-
cx.tcx(),
473-
ty::ParamEnv::reveal_all(),
474-
start_def_id,
475-
cx.tcx().mk_args(&[main_ret_ty.into()]),
476-
)
477-
.unwrap()
478-
.unwrap(),
479-
);
470+
let start_fn = cx.get_fn_addr(ty::Instance::expect_resolve(
471+
cx.tcx(),
472+
ty::ParamEnv::reveal_all(),
473+
start_def_id,
474+
cx.tcx().mk_args(&[main_ret_ty.into()]),
475+
));
480476

481477
let i8_ty = cx.type_i8();
482478
let arg_sigpipe = bx.const_u8(sigpipe);

compiler/rustc_const_eval/src/const_eval/machine.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,12 @@ impl<'mir, 'tcx: 'mir> CompileTimeEvalContext<'mir, 'tcx> {
243243
} else if Some(def_id) == self.tcx.lang_items().panic_fmt() {
244244
// For panic_fmt, call const_panic_fmt instead.
245245
let const_def_id = self.tcx.require_lang_item(LangItem::ConstPanicFmt, None);
246-
let new_instance = ty::Instance::resolve(
246+
let new_instance = ty::Instance::expect_resolve(
247247
*self.tcx,
248248
ty::ParamEnv::reveal_all(),
249249
const_def_id,
250250
instance.args,
251-
)
252-
.unwrap()
253-
.unwrap();
251+
);
254252

255253
return Ok(Some(new_instance));
256254
} else if Some(def_id) == self.tcx.lang_items().align_offset_fn() {

compiler/rustc_monomorphize/src/collector.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -1339,14 +1339,12 @@ impl<'v> RootCollector<'_, 'v> {
13391339
main_ret_ty.no_bound_vars().unwrap(),
13401340
);
13411341

1342-
let start_instance = Instance::resolve(
1342+
let start_instance = Instance::expect_resolve(
13431343
self.tcx,
13441344
ty::ParamEnv::reveal_all(),
13451345
start_def_id,
13461346
self.tcx.mk_args(&[main_ret_ty.into()]),
1347-
)
1348-
.unwrap()
1349-
.unwrap();
1347+
);
13501348

13511349
self.output.push(create_fn_mono_item(self.tcx, start_instance, DUMMY_SP));
13521350
}

0 commit comments

Comments
 (0)