about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa
diff options
context:
space:
mode:
authorMichael Goulet <michael@errs.io>2022-12-11 19:46:58 +0000
committerMichael Goulet <michael@errs.io>2022-12-11 19:48:24 +0000
commitbc293ed53e9a747b12e03eee43df96d47e362bd2 (patch)
tree1a7ddff1ed774da43bad99f0bfda6bbf67213d47 /compiler/rustc_codegen_ssa
parentd137783642b0b98eda2796dc66bffc2b089a8327 (diff)
downloadrust-bc293ed53e9a747b12e03eee43df96d47e362bd2.tar.gz
rust-bc293ed53e9a747b12e03eee43df96d47e362bd2.zip
bug! with a better error message for failing Instance::resolve
Diffstat (limited to 'compiler/rustc_codegen_ssa')
-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,
             ),