about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-02-09 07:08:19 +0000
committerbors <bors@rust-lang.org>2023-02-09 07:08:19 +0000
commitc40919b7a75f93ed7ef040361e82c656d246d41e (patch)
tree377924acdd0e3fabb3894b64f426b51acf650e77 /compiler/rustc_hir_analysis/src
parente7acd078f443156b95cee11759a735db1cfc796e (diff)
parent6c63b9497dfcd546199db03174ac11866bf3bfb8 (diff)
downloadrust-c40919b7a75f93ed7ef040361e82c656d246d41e.tar.gz
rust-c40919b7a75f93ed7ef040361e82c656d246d41e.zip
Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obk
Add missing normalization for union fields types

Overshadows https://github.com/rust-lang/rust/pull/106808.
From the experiment https://github.com/rust-lang/rust/pull/103985.

In short, it allows to use projections as a type for union's fields.

cc `@compiler-errors`
r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_hir_analysis/src')
-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 47eace961be..5e3601efbbe 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) {