]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs
Rollup merge of #105340 - estebank:ice-ice-baby, r=compiler-errors
[rust.git] / compiler / rustc_trait_selection / src / traits / error_reporting / mod.rs
index 12cc72d30c87e09860f7a5a1454b4be6574b9b22..cc61e18743133c94ba0f5951a290937a8516f04d 100644 (file)
@@ -1607,7 +1607,7 @@ fn report_projection_error(
                         | ObligationCauseCode::ObjectCastObligation(..)
                         | ObligationCauseCode::OpaqueType
                 );
-                let expected_ty = data.term.ty().unwrap();
+                let expected_ty = data.term.ty().unwrap_or_else(|| self.tcx.ty_error());
 
                 // constrain inference variables a bit more to nested obligations from normalize so
                 // we can have more helpful errors.