about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2022-12-12 08:21:32 +0100
committerGitHub <noreply@github.com>2022-12-12 08:21:32 +0100
commit5877a3fce1b75badccaa18d03165baa8495434a0 (patch)
treee5ffa229880127c455b87430ff3a5bc6af03a292 /compiler/rustc_codegen_ssa/src
parent139ff9d6e80754f10d28f81def5a874ce8b8f654 (diff)
parentbc293ed53e9a747b12e03eee43df96d47e362bd2 (diff)
downloadrust-5877a3fce1b75badccaa18d03165baa8495434a0.tar.gz
rust-5877a3fce1b75badccaa18d03165baa8495434a0.zip
Rollup merge of #105569 - compiler-errors:resolve-bug-better, r=TaKO8Ki
`bug!` with a better error message for failing `Instance::resolve`

Better ICE message when `.unwrap().unwrap()` fails.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src')
-rw-r--r--compiler/rustc_codegen_ssa/src/mir/block.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_ssa/src/mir/block.rs b/compiler/rustc_codegen_ssa/src/mir/block.rs
index f3f5ddb52d6..831956cb2be 100644
--- a/compiler/rustc_codegen_ssa/src/mir/block.rs
+++ b/compiler/rustc_codegen_ssa/src/mir/block.rs
@@ -751,10 +751,13 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
         let (instance, mut llfn) = match *callee.layout.ty.kind() {
             ty::FnDef(def_id, substs) => (
                 Some(
-                    ty::Instance::resolve(bx.tcx(), ty::ParamEnv::reveal_all(), def_id, substs)
-                        .unwrap()
-                        .unwrap()
-                        .polymorphize(bx.tcx()),
+                    ty::Instance::expect_resolve(
+                        bx.tcx(),
+                        ty::ParamEnv::reveal_all(),
+                        def_id,
+                        substs,
+                    )
+                    .polymorphize(bx.tcx()),
                 ),
                 None,
             ),