1
Fork 0

Move a span_bug under a condition that cx is tainted

Fixes an ICE caused when a with expression is not a struct
This commit is contained in:
Gurinder Singh 2024-07-07 15:44:55 +05:30
parent 5c08cc765a
commit 9da3638c6a
4 changed files with 27 additions and 10 deletions

View file

@ -734,7 +734,9 @@ impl<'tcx, Cx: TypeInformationCtxt<'tcx>, D: Delegate<'tcx>> ExprUseVisitor<'tcx
// struct; however, when EUV is run during typeck, it
// may not. This will generate an error earlier in typeck,
// so we can just ignore it.
span_bug!(with_expr.span, "with expression doesn't evaluate to a struct");
if self.cx.tainted_by_errors().is_ok() {
span_bug!(with_expr.span, "with expression doesn't evaluate to a struct");
}
}
}