1
Fork 0

Rollup merge of #105267 - compiler-errors:issue-104613, r=oli-obk

Don't ICE in ExprUseVisitor on FRU for non-existent struct

Fixes #104613
Fixes #105202
This commit is contained in:
Matthias Krüger 2022-12-07 15:39:06 +01:00 committed by GitHub
commit 3bcfa4c459
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 85 additions and 19 deletions

View file

@ -704,7 +704,7 @@ impl<'tcx> Cx<'tcx> {
hir::ExprKind::Field(ref source, ..) => ExprKind::Field {
lhs: self.mirror_expr(source),
variant_index: VariantIdx::new(0),
name: Field::new(tcx.field_index(expr.hir_id, self.typeck_results)),
name: Field::new(self.typeck_results.field_index(expr.hir_id)),
},
hir::ExprKind::Cast(ref source, ref cast_ty) => {
// Check for a user-given type annotation on this `cast`
@ -1079,7 +1079,7 @@ impl<'tcx> Cx<'tcx> {
fields
.iter()
.map(|field| FieldExpr {
name: Field::new(self.tcx.field_index(field.hir_id, self.typeck_results)),
name: Field::new(self.typeck_results.field_index(field.hir_id)),
expr: self.mirror_expr(field.expr),
})
.collect()

View file

@ -321,7 +321,7 @@ impl<'a, 'tcx> PatCtxt<'a, 'tcx> {
let subpatterns = fields
.iter()
.map(|field| FieldPat {
field: Field::new(self.tcx.field_index(field.hir_id, self.typeck_results)),
field: Field::new(self.typeck_results.field_index(field.hir_id)),
pattern: self.lower_pattern(&field.pat),
})
.collect();