1
Fork 0

Rollup merge of #105340 - estebank:ice-ice-baby, r=compiler-errors

Avoid ICE by accounting for missing type

Fix #105330
This commit is contained in:
Matthias Krüger 2022-12-06 13:27:45 +01:00 committed by GitHub
commit 07fd8089a4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 131 additions and 1 deletions

View file

@ -1607,7 +1607,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
| 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.