about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGuillaume Gomez <guillaume.gomez@huawei.com>2023-01-16 15:18:14 +0100
committerGuillaume Gomez <guillaume.gomez@huawei.com>2023-01-16 15:18:14 +0100
commit921efd2e67076dca999129f85659a5f1a6b21212 (patch)
tree7ead377edee868611cee123f52789b969fe524a0
parent5376670323d14870be7d90b585735354674aa4cc (diff)
downloadrust-921efd2e67076dca999129f85659a5f1a6b21212.tar.gz
rust-921efd2e67076dca999129f85659a5f1a6b21212.zip
Add missing normalization for union fields types
-rw-r--r--compiler/rustc_hir_analysis/src/check/check.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_hir_analysis/src/check/check.rs b/compiler/rustc_hir_analysis/src/check/check.rs
index 43795cfba3f..248ff1d4cb5 100644
--- a/compiler/rustc_hir_analysis/src/check/check.rs
+++ b/compiler/rustc_hir_analysis/src/check/check.rs
@@ -121,7 +121,7 @@ fn check_union_fields(tcx: TyCtxt<'_>, span: Span, item_def_id: LocalDefId) -> b
 
         let param_env = tcx.param_env(item_def_id);
         for field in &def.non_enum_variant().fields {
-            let field_ty = field.ty(tcx, substs);
+            let field_ty = tcx.normalize_erasing_regions(param_env, field.ty(tcx, substs));
 
             if !allowed_union_field(field_ty, tcx, param_env) {
                 let (field_span, ty_span) = match tcx.hir().get_if_local(field.did) {