about summary refs log tree commit diff
path: root/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-12 14:51:15 +0000
committerbors <bors@rust-lang.org>2024-02-12 14:51:15 +0000
commitbdc15928c8119a86d15e2946cb54851264607842 (patch)
treed5b51d8a541e073ba30e0d8c5803760cfdb73608 /tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
parented195328689e052b5270b25d0e410b491914fc71 (diff)
parent0dbd6e9572c7c2bac7922116d6cd9357177ccbc9 (diff)
downloadrust-bdc15928c8119a86d15e2946cb54851264607842.tar.gz
rust-bdc15928c8119a86d15e2946cb54851264607842.zip
Auto merge of #115367 - frank-king:feature/unnamed-fields-hir, r=davidtwco
Lowering unnamed fields and anonymous adt

This implements #49804.

Goals:
- [x] lowering anonymous ADTs from AST to HIR
- [x] generating definitions of anonymous ADTs
- [x] uniqueness check of the unnamed fields
- [x] field projection of anonymous ADTs
- [x] `#[repr(C)]` check of the anonymous ADTs

Non-Goals (will be in the next PRs)
- capturing generic params for the anonymous ADTs from the parent ADT
- pattern matching of anonymous ADTs
- structural expressions of anonymous ADTs
- rustdoc support of anonymous ADTs
Diffstat (limited to 'tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs')
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs13
1 files changed, 4 insertions, 9 deletions
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
index c69266089bb..9ffe71b28c2 100644
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs
@@ -2,10 +2,8 @@
 #![feature(unnamed_fields)]
 
 struct F {
-    field: union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
-    //~^ ERROR anonymous unions are unimplemented
-    _: union { field: u8 },
-    //~^ ERROR anonymous unions are unimplemented
+    field1: union { field2: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+    _: union { field3: u8 },
 }
 
 struct G {
@@ -13,10 +11,8 @@ struct G {
 }
 
 union H {
-    field: union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
-    //~^ ERROR anonymous unions are unimplemented
-    _: union { field: u8 },
-    //~^ ERROR anonymous unions are unimplemented
+    field1: union { field2: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
+    _: union { field3: u8 },
 }
 
 union I {
@@ -27,7 +23,6 @@ enum K {
     M {
         _ : union { field: u8 }, //~ ERROR anonymous unions are not allowed outside of unnamed struct or union fields
         //~^ ERROR unnamed fields are not allowed outside of structs or unions
-        //~| ERROR anonymous unions are unimplemented
     },
     N {
         _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions