1
Fork 0

Rollup merge of #120616 - fmease:fix-ice-const-eval-fail-undef-field-access, r=compiler-errors

Fix ICE on field access on a tainted type after const-eval failure

Fixes #120615.

r? oli-obk or compiler
This commit is contained in:
Matthias Krüger 2024-02-03 21:29:45 +01:00 committed by GitHub
commit 326839bf7f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 1 deletions

View file

@ -464,7 +464,11 @@ impl<'tcx> Visitor<'tcx> for MarkSymbolVisitor<'tcx> {
self.lookup_and_handle_method(expr.hir_id);
}
hir::ExprKind::Field(ref lhs, ..) => {
self.handle_field_access(lhs, expr.hir_id);
if self.typeck_results().opt_field_index(expr.hir_id).is_some() {
self.handle_field_access(lhs, expr.hir_id);
} else {
self.tcx.dcx().span_delayed_bug(expr.span, "couldn't resolve index for field");
}
}
hir::ExprKind::Struct(qpath, fields, _) => {
let res = self.typeck_results().qpath_res(qpath, expr.hir_id);