diff options
| author | Frank King <frankking1729@gmail.com> | 2024-01-04 21:53:06 +0800 |
|---|---|---|
| committer | Frank King <frankking1729@gmail.com> | 2024-02-12 12:47:23 +0800 |
| commit | 879a1e571305a0fb35ef6cc4297f9230fca95be5 (patch) | |
| tree | 232e06c6b3eefcc81f10f825a430f04a7325c498 /compiler/rustc_parse/src/parser | |
| parent | 084ce5bdb5f7dc1c725f6770a8de281165ba3b0a (diff) | |
| download | rust-879a1e571305a0fb35ef6cc4297f9230fca95be5.tar.gz rust-879a1e571305a0fb35ef6cc4297f9230fca95be5.zip | |
Lower anonymous structs or unions to HIR
Diffstat (limited to 'compiler/rustc_parse/src/parser')
| -rw-r--r-- | compiler/rustc_parse/src/parser/ty.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_parse/src/parser/ty.rs b/compiler/rustc_parse/src/parser/ty.rs index 5fe54a536a7..157fb9e505a 100644 --- a/compiler/rustc_parse/src/parser/ty.rs +++ b/compiler/rustc_parse/src/parser/ty.rs @@ -396,8 +396,9 @@ impl<'a> Parser<'a> { self.parse_record_struct_body(if is_union { "union" } else { "struct" }, lo, false)?; let span = lo.to(self.prev_token.span); self.sess.gated_spans.gate(sym::unnamed_fields, span); - // These can be rejected during AST validation in `deny_anon_struct_or_union`. - let kind = if is_union { TyKind::AnonUnion(fields) } else { TyKind::AnonStruct(fields) }; + let id = ast::DUMMY_NODE_ID; + let kind = + if is_union { TyKind::AnonUnion(id, fields) } else { TyKind::AnonStruct(id, fields) }; Ok(self.mk_ty(span, kind)) } |
