about summary refs log tree commit diff
path: root/tests
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
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')
-rw-r--r--tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir61
-rw-r--r--tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir59
-rw-r--r--tests/mir-opt/unnamed-fields/field_access.rs56
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.rs7
-rw-r--r--tests/ui/feature-gates/feature-gate-unnamed_fields.stderr38
-rw-r--r--tests/ui/union/unnamed-fields/field_uniqueness_check.rs337
-rw-r--r--tests/ui/union/unnamed-fields/field_uniqueness_check.stderr1734
-rw-r--r--tests/ui/union/unnamed-fields/repr_check.rs69
-rw-r--r--tests/ui/union/unnamed-fields/repr_check.stderr152
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs13
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr54
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.rs13
-rw-r--r--tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr54
13 files changed, 2511 insertions, 136 deletions
diff --git a/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir b/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir
new file mode 100644
index 00000000000..8edc7b5df88
--- /dev/null
+++ b/tests/mir-opt/unnamed-fields/field_access.bar.SimplifyCfg-initial.after.mir
@@ -0,0 +1,61 @@
+// MIR for `bar` after SimplifyCfg-initial
+
+fn bar(_1: Bar) -> () {
+    debug bar => _1;
+    let mut _0: ();
+    let _2: ();
+    let mut _3: u8;
+    let _4: ();
+    let mut _5: i8;
+    let _6: ();
+    let mut _7: bool;
+    let _8: ();
+    let mut _9: [u8; 1];
+    scope 1 {
+    }
+
+    bb0: {
+        StorageLive(_2);
+        StorageLive(_3);
+        _3 = (_1.0: u8);
+        _2 = access::<u8>(move _3) -> [return: bb1, unwind: bb5];
+    }
+
+    bb1: {
+        StorageDead(_3);
+        StorageDead(_2);
+        StorageLive(_4);
+        StorageLive(_5);
+        _5 = ((_1.1: Bar::{anon_adt#0}).0: i8);
+        _4 = access::<i8>(move _5) -> [return: bb2, unwind: bb5];
+    }
+
+    bb2: {
+        StorageDead(_5);
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _7 = ((_1.1: Bar::{anon_adt#0}).1: bool);
+        _6 = access::<bool>(move _7) -> [return: bb3, unwind: bb5];
+    }
+
+    bb3: {
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageLive(_8);
+        StorageLive(_9);
+        _9 = (((_1.2: Bar::{anon_adt#1}).0: Bar::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]);
+        _8 = access::<[u8; 1]>(move _9) -> [return: bb4, unwind: bb5];
+    }
+
+    bb4: {
+        StorageDead(_9);
+        StorageDead(_8);
+        _0 = const ();
+        return;
+    }
+
+    bb5 (cleanup): {
+        resume;
+    }
+}
diff --git a/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir b/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir
new file mode 100644
index 00000000000..d48a969f06e
--- /dev/null
+++ b/tests/mir-opt/unnamed-fields/field_access.foo.SimplifyCfg-initial.after.mir
@@ -0,0 +1,59 @@
+// MIR for `foo` after SimplifyCfg-initial
+
+fn foo(_1: Foo) -> () {
+    debug foo => _1;
+    let mut _0: ();
+    let _2: ();
+    let mut _3: u8;
+    let _4: ();
+    let mut _5: i8;
+    let _6: ();
+    let mut _7: bool;
+    let _8: ();
+    let mut _9: [u8; 1];
+
+    bb0: {
+        StorageLive(_2);
+        StorageLive(_3);
+        _3 = (_1.0: u8);
+        _2 = access::<u8>(move _3) -> [return: bb1, unwind: bb5];
+    }
+
+    bb1: {
+        StorageDead(_3);
+        StorageDead(_2);
+        StorageLive(_4);
+        StorageLive(_5);
+        _5 = ((_1.1: Foo::{anon_adt#0}).0: i8);
+        _4 = access::<i8>(move _5) -> [return: bb2, unwind: bb5];
+    }
+
+    bb2: {
+        StorageDead(_5);
+        StorageDead(_4);
+        StorageLive(_6);
+        StorageLive(_7);
+        _7 = ((_1.1: Foo::{anon_adt#0}).1: bool);
+        _6 = access::<bool>(move _7) -> [return: bb3, unwind: bb5];
+    }
+
+    bb3: {
+        StorageDead(_7);
+        StorageDead(_6);
+        StorageLive(_8);
+        StorageLive(_9);
+        _9 = (((_1.2: Foo::{anon_adt#1}).0: Foo::{anon_adt#1}::{anon_adt#0}).0: [u8; 1]);
+        _8 = access::<[u8; 1]>(move _9) -> [return: bb4, unwind: bb5];
+    }
+
+    bb4: {
+        StorageDead(_9);
+        StorageDead(_8);
+        _0 = const ();
+        return;
+    }
+
+    bb5 (cleanup): {
+        resume;
+    }
+}
diff --git a/tests/mir-opt/unnamed-fields/field_access.rs b/tests/mir-opt/unnamed-fields/field_access.rs
new file mode 100644
index 00000000000..3d33ca26875
--- /dev/null
+++ b/tests/mir-opt/unnamed-fields/field_access.rs
@@ -0,0 +1,56 @@
+// skip-filecheck
+// EMIT_MIR field_access.foo.SimplifyCfg-initial.after.mir
+// EMIT_MIR field_access.bar.SimplifyCfg-initial.after.mir
+
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+#[repr(C)]
+struct Foo {
+    a: u8,
+    _: struct {
+        b: i8,
+        c: bool,
+    },
+    _: struct {
+        _: struct {
+            d: [u8; 1],
+        }
+    }
+}
+
+#[repr(C)]
+union Bar {
+    a: u8,
+    _: union {
+        b: i8,
+        c: bool,
+    },
+    _: union {
+        _: union {
+            d: [u8; 1],
+        }
+    }
+}
+
+
+fn access<T>(_: T) {}
+
+fn foo(foo: Foo) {
+    access(foo.a);
+    access(foo.b);
+    access(foo.c);
+    access(foo.d);
+}
+
+fn bar(bar: Bar) {
+    unsafe {
+        access(bar.a);
+        access(bar.b);
+        access(bar.c);
+        access(bar.d);
+    }
+}
+
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.rs b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
index 4bbd0c83bfb..302a9bbeb45 100644
--- a/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
+++ b/tests/ui/feature-gates/feature-gate-unnamed_fields.rs
@@ -1,24 +1,27 @@
+#[repr(C)]
 struct Foo {
     foo: u8,
     _: union { //~ ERROR unnamed fields are not yet fully implemented [E0658]
     //~^ ERROR unnamed fields are not yet fully implemented [E0658]
-    //~| ERROR anonymous unions are unimplemented
         bar: u8,
         baz: u16
     }
 }
 
+#[repr(C)]
 union Bar {
     foobar: u8,
     _: struct { //~ ERROR unnamed fields are not yet fully implemented [E0658]
     //~^ ERROR unnamed fields are not yet fully implemented [E0658]
-    //~| ERROR anonymous structs are unimplemented
         foobaz: u8,
         barbaz: u16
     }
 }
 
+#[repr(C)]
 struct S;
+
+#[repr(C)]
 struct Baz {
     _: S //~ ERROR unnamed fields are not yet fully implemented [E0658]
 }
diff --git a/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
index 82f08912bc8..bc9e95bab98 100644
--- a/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
+++ b/tests/ui/feature-gates/feature-gate-unnamed_fields.stderr
@@ -1,5 +1,5 @@
 error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:3:5
+  --> $DIR/feature-gate-unnamed_fields.rs:4:5
    |
 LL |     _: union {
    |     ^
@@ -9,12 +9,11 @@ LL |     _: union {
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:3:8
+  --> $DIR/feature-gate-unnamed_fields.rs:4:8
    |
 LL |       _: union {
    |  ________^
 LL | |
-LL | |
 LL | |         bar: u8,
 LL | |         baz: u16
 LL | |     }
@@ -25,7 +24,7 @@ LL | |     }
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:13:5
+  --> $DIR/feature-gate-unnamed_fields.rs:14:5
    |
 LL |     _: struct {
    |     ^
@@ -35,12 +34,11 @@ LL |     _: struct {
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:13:8
+  --> $DIR/feature-gate-unnamed_fields.rs:14:8
    |
 LL |       _: struct {
    |  ________^
 LL | |
-LL | |
 LL | |         foobaz: u8,
 LL | |         barbaz: u16
 LL | |     }
@@ -51,7 +49,7 @@ LL | |     }
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
 error[E0658]: unnamed fields are not yet fully implemented
-  --> $DIR/feature-gate-unnamed_fields.rs:23:5
+  --> $DIR/feature-gate-unnamed_fields.rs:26:5
    |
 LL |     _: S
    |     ^
@@ -60,30 +58,6 @@ LL |     _: S
    = help: add `#![feature(unnamed_fields)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
 
-error: anonymous unions are unimplemented
-  --> $DIR/feature-gate-unnamed_fields.rs:3:8
-   |
-LL |       _: union {
-   |  ________^
-LL | |
-LL | |
-LL | |         bar: u8,
-LL | |         baz: u16
-LL | |     }
-   | |_____^
-
-error: anonymous structs are unimplemented
-  --> $DIR/feature-gate-unnamed_fields.rs:13:8
-   |
-LL |       _: struct {
-   |  ________^
-LL | |
-LL | |
-LL | |         foobaz: u8,
-LL | |         barbaz: u16
-LL | |     }
-   | |_____^
-
-error: aborting due to 7 previous errors
+error: aborting due to 5 previous errors
 
 For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/union/unnamed-fields/field_uniqueness_check.rs b/tests/ui/union/unnamed-fields/field_uniqueness_check.rs
new file mode 100644
index 00000000000..ddb951aa06c
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/field_uniqueness_check.rs
@@ -0,0 +1,337 @@
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+struct Foo {
+    a: u8,
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+struct Bar {
+    _: union {
+        a: u8,
+    },
+}
+
+
+// duplicated with a normal field
+#[derive(Clone, Copy)]
+#[repr(C)]
+union A {
+    // referent field
+    a: u8,
+
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared [E0124]
+    // nested field
+    _: struct {
+        a: u8, //~ ERROR field `a` is already declared [E0124]
+        a: u8, //~ ERROR field `a` is already declared [E0124]
+    },
+    // more nested field
+    _: union {
+        _: struct {
+            a: u8, //~ ERROR field `a` is already declared [E0124]
+        },
+    },
+    // nested field in a named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: struct {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+// duplicated with a nested field
+#[derive(Clone, Copy)]
+#[repr(C)]
+struct B {
+    _: union {
+        // referent field
+        a: u8,
+
+        // normal field (within the same anonymous adt)
+        a: u8, //~ ERROR field `a` is already declared [E0124]
+        // nested field (within the same anonymous adt)
+        _: struct {
+            a: u8, //~ ERROR field `a` is already declared [E0124]
+        },
+        // more nested field (within the same anonymous adt)
+        _: union {
+            _: struct {
+                a: u8, //~ ERROR field `a` is already declared [E0124]
+            },
+        },
+        // nested field in a named adt (within the same anonymous adt)
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+        // nested field in a named adt in an anoymous adt (within the same anonymous adt)
+        _: struct {
+            _: Foo, //~ ERROR field `a` is already declared
+            _: Bar, //~ ERROR field `a` is already declared
+        },
+    },
+
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared [E0124]
+    // nested field
+    _: struct {
+        a: u8, //~ ERROR field `a` is already declared [E0124]
+    },
+    // more nested field
+    _: union {
+        _: struct {
+            a: u8, //~ ERROR field `a` is already declared [E0124]
+        },
+    },
+    // nested field in a named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: struct {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+// duplicated with a more nested field
+#[derive(Clone, Copy)]
+#[repr(C)]
+union C {
+    _: struct {
+        _: union {
+            // referent field
+            a: u8,
+
+            // normal field (within the same anonymous adt)
+            a: u8, //~ ERROR field `a` is already declared [E0124]
+            // nested field (within the same anonymous adt)
+            _: struct {
+                a: u8, //~ ERROR field `a` is already declared [E0124]
+            },
+            // more nested field (within the same anonymous adt)
+            _: union {
+                _: struct {
+                    a: u8, //~ ERROR field `a` is already declared [E0124]
+                },
+            },
+            // nested field in a named adt (within the same anonymous adt)
+            _: Foo, //~ ERROR field `a` is already declared
+            _: Bar, //~ ERROR field `a` is already declared
+            // nested field in a named adt in an anoymous adt (within the same anonymous adt)
+            _: struct {
+                _: Foo, //~ ERROR field `a` is already declared
+                _: Bar, //~ ERROR field `a` is already declared
+            },
+        },
+
+        // normal field (within the direct outer anonymous adt)
+        a: u8, //~ ERROR field `a` is already declared [E0124]
+        // nested field (within the direct outer anonymous adt)
+        _: struct {
+            a: u8, //~ ERROR field `a` is already declared [E0124]
+        },
+        // more nested field (within the direct outer anonymous adt)
+        _: union {
+            _: struct {
+                a: u8, //~ ERROR field `a` is already declared [E0124]
+            },
+        },
+        // nested field in a named adt (within the direct outer anonymous adt)
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+        // nested field in a named adt in an anoymous adt (within the direct outer anonymous adt)
+        _: struct {
+            _: Foo, //~ ERROR field `a` is already declared
+            _: Bar, //~ ERROR field `a` is already declared
+        },
+    },
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared [E0124]
+    // nested field
+    _: union {
+        a: u8, //~ ERROR field `a` is already declared [E0124]
+    },
+    // more nested field
+    _: struct {
+        _: union {
+            a: u8, //~ ERROR field `a` is already declared [E0124]
+        },
+    },
+    // nested field in a named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: union {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+// duplicated with a nested field in a named adt
+#[derive(Clone, Copy)]
+#[repr(C)]
+struct D {
+    // referent field `a`
+    _: Foo,
+
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared
+    // nested field
+    _: union {
+        a: u8, //~ ERROR field `a` is already declared
+    },
+    // more nested field
+    _: struct {
+        _: union {
+            a: u8, //~ ERROR field `a` is already declared
+        },
+    },
+    // nested field in another named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: union {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+// duplicated with a nested field in a nested field of a named adt
+#[derive(Clone, Copy)]
+#[repr(C)]
+union D2 {
+    // referent field `a`
+    _: Bar,
+
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared
+    // nested field
+    _: union {
+        a: u8, //~ ERROR field `a` is already declared
+    },
+    // more nested field
+    _: struct {
+        _: union {
+            a: u8, //~ ERROR field `a` is already declared
+        },
+    },
+    // nested field in another named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: union {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+// duplicated with a nested field in a named adt in an anonymous adt
+#[derive(Clone, Copy)]
+#[repr(C)]
+struct E {
+    _: struct {
+        // referent field `a`
+        _: Foo,
+
+        // normal field (within the same anonymous adt)
+        a: u8, //~ ERROR field `a` is already declared
+        // nested field (within the same anonymous adt)
+        _: struct {
+            a: u8, //~ ERROR field `a` is already declared
+        },
+        // more nested field (within the same anonymous adt)
+        _: union {
+            _: struct {
+                a: u8, //~ ERROR field `a` is already declared
+            },
+        },
+        // nested field in a named adt (within the same anonymous adt)
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+        // nested field in a named adt in an anoymous adt (within the same anonymous adt)
+        _: struct {
+            _: Foo, //~ ERROR field `a` is already declared
+            _: Bar, //~ ERROR field `a` is already declared
+        },
+    },
+
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared
+    // nested field
+    _: union {
+        a: u8, //~ ERROR field `a` is already declared
+    },
+    // more nested field
+    _: struct {
+        _: union {
+            a: u8, //~ ERROR field `a` is already declared
+        },
+    },
+    // nested field in another named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: union {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+// duplicated with a nested field in a named adt in an anonymous adt
+#[repr(C)]
+#[derive(Clone, Copy)]
+union E2 {
+    _: struct {
+        // referent field `a`
+        _: Bar,
+
+        // normal field (within the same anonymous adt)
+        a: u8, //~ ERROR field `a` is already declared
+        // nested field (within the same anonymous adt)
+        _: struct {
+            a: u8, //~ ERROR field `a` is already declared
+        },
+        // more nested field (within the same anonymous adt)
+        _: union {
+            _: struct {
+                a: u8, //~ ERROR field `a` is already declared
+            },
+        },
+        // nested field in a named adt (within the same anonymous adt)
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+        // nested field in a named adt in an anoymous adt (within the same anonymous adt)
+        _: struct {
+            _: Foo, //~ ERROR field `a` is already declared
+            _: Bar, //~ ERROR field `a` is already declared
+        },
+    },
+
+    // normal field
+    a: u8, //~ ERROR field `a` is already declared
+    // nested field
+    _: union {
+        a: u8, //~ ERROR field `a` is already declared
+    },
+    // more nested field
+    _: struct {
+        _: union {
+            a: u8, //~ ERROR field `a` is already declared
+        },
+    },
+    // nested field in another named adt
+    _: Foo, //~ ERROR field `a` is already declared
+    _: Bar, //~ ERROR field `a` is already declared
+    // nested field in a named adt in an anoymous adt
+    _: union {
+        _: Foo, //~ ERROR field `a` is already declared
+        _: Bar, //~ ERROR field `a` is already declared
+    },
+}
+
+fn main() {}
diff --git a/tests/ui/union/unnamed-fields/field_uniqueness_check.stderr b/tests/ui/union/unnamed-fields/field_uniqueness_check.stderr
new file mode 100644
index 00000000000..11978386843
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/field_uniqueness_check.stderr
@@ -0,0 +1,1734 @@
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:27:5
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:30:9
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:31:9
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:36:13
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:40:5
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:40:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:41:5
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:41:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:44:9
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:44:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:45:9
+   |
+LL |     a: u8,
+   |     ----- `a` first declared here
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:45:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:58:9
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:61:13
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:66:17
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |                 a: u8,
+   |                 ^^^^^ field already declared
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:70:9
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:70:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:71:9
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:71:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:74:13
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |             _: Foo,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:74:13
+   |
+LL |             _: Foo,
+   |             ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:75:13
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |             _: Bar,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:75:13
+   |
+LL |             _: Bar,
+   |             ^^^^^^
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:80:5
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:83:9
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:88:13
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:92:5
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:92:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:93:5
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:93:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:96:9
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:96:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:97:9
+   |
+LL |         a: u8,
+   |         ----- `a` first declared here
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:97:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:111:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:114:17
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |                 a: u8,
+   |                 ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:119:21
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |                     a: u8,
+   |                     ^^^^^ field already declared
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:123:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             _: Foo,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:123:13
+   |
+LL |             _: Foo,
+   |             ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:124:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             _: Bar,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:124:13
+   |
+LL |             _: Bar,
+   |             ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:127:17
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |                 _: Foo,
+   |                 ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:127:17
+   |
+LL |                 _: Foo,
+   |                 ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:128:17
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |                 _: Bar,
+   |                 ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:128:17
+   |
+LL |                 _: Bar,
+   |                 ^^^^^^
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:133:9
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:136:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:141:17
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |                 a: u8,
+   |                 ^^^^^ field already declared
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:145:9
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:145:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:146:9
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:146:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:149:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             _: Foo,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:149:13
+   |
+LL |             _: Foo,
+   |             ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:150:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             _: Bar,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:150:13
+   |
+LL |             _: Bar,
+   |             ^^^^^^
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:154:5
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:157:9
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+
+error[E0124]: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:162:13
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:166:5
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:166:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:167:5
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:167:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:170:9
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:170:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:171:9
+   |
+LL |             a: u8,
+   |             ----- `a` first declared here
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:171:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:183:5
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:186:9
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:191:13
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:195:5
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:195:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:196:5
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:196:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:199:9
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:199:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:200:9
+   |
+LL |     _: Foo,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:200:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:180:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:212:5
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:215:9
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:220:13
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:224:5
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:224:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:225:5
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:225:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:228:9
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:228:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:229:9
+   |
+LL |     _: Bar,
+   |     ------ `a` first declared here in this unnamed field
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:229:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:209:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:242:9
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:245:13
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:250:17
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |                 a: u8,
+   |                 ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:254:9
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:254:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:255:9
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:255:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:258:13
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             _: Foo,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:258:13
+   |
+LL |             _: Foo,
+   |             ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:259:13
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             _: Bar,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:259:13
+   |
+LL |             _: Bar,
+   |             ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:264:5
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:267:9
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:272:13
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:276:5
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:276:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:277:5
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:277:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:280:9
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:280:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:281:9
+   |
+LL |         _: Foo,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:281:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:239:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:294:9
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:297:13
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:302:17
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |                 a: u8,
+   |                 ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:306:9
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:306:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:307:9
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:307:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:310:13
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             _: Foo,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:310:13
+   |
+LL |             _: Foo,
+   |             ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:311:13
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             _: Bar,
+   |             ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:311:13
+   |
+LL |             _: Bar,
+   |             ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:316:5
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |     a: u8,
+   |     ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:319:9
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         a: u8,
+   |         ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:324:13
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |             a: u8,
+   |             ^^^^^ field already declared
+   |
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:328:5
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |     _: Foo,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:328:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:329:5
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |     _: Bar,
+   |     ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:329:5
+   |
+LL |     _: Bar,
+   |     ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:332:9
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Foo,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:7:5
+   |
+LL |     a: u8,
+   |     ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:332:9
+   |
+LL |         _: Foo,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: field `a` is already declared
+  --> $DIR/field_uniqueness_check.rs:333:9
+   |
+LL |         _: Bar,
+   |         ------ `a` first declared here in this unnamed field
+...
+LL |         _: Bar,
+   |         ^^^^^^ field `a` declared in this unnamed field
+   |
+note: field `a` declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:333:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+note: field `a` first declared here
+  --> $DIR/field_uniqueness_check.rs:14:9
+   |
+LL |         a: u8,
+   |         ^^^^^
+help: fields from the type of this unnamed field are considered fields of the outer type
+  --> $DIR/field_uniqueness_check.rs:291:9
+   |
+LL |         _: Bar,
+   |         ^^^^^^
+
+error: aborting due to 85 previous errors
+
+For more information about this error, try `rustc --explain E0124`.
diff --git a/tests/ui/union/unnamed-fields/repr_check.rs b/tests/ui/union/unnamed-fields/repr_check.rs
new file mode 100644
index 00000000000..b50b54b20af
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/repr_check.rs
@@ -0,0 +1,69 @@
+#![allow(incomplete_features)]
+#![feature(unnamed_fields)]
+
+struct A { //~ ERROR struct with unnamed fields must have `#[repr(C)]` representation
+           //~^ NOTE struct `A` defined here
+    _: struct { //~ NOTE unnamed field defined here
+        a: i32,
+    },
+    _: struct { //~ NOTE unnamed field defined here
+        _: struct {
+            b: i32,
+        },
+    },
+}
+
+union B { //~ ERROR union with unnamed fields must have `#[repr(C)]` representation
+          //~^ NOTE union `B` defined here
+    _: union { //~ NOTE unnamed field defined here
+        a: i32,
+    },
+    _: union { //~ NOTE unnamed field defined here
+        _: union {
+            b: i32,
+        },
+    },
+}
+
+#[derive(Clone, Copy)]
+#[repr(C)]
+struct Foo {}
+
+#[derive(Clone, Copy)]
+struct Bar {}
+//~^ `Bar` defined here
+//~| `Bar` defined here
+//~| `Bar` defined here
+//~| `Bar` defined here
+
+struct C { //~ ERROR struct with unnamed fields must have `#[repr(C)]` representation
+           //~^ NOTE struct `C` defined here
+    _: Foo, //~ NOTE unnamed field defined here
+}
+
+union D { //~ ERROR union with unnamed fields must have `#[repr(C)]` representation
+          //~^ NOTE union `D` defined here
+    _: Foo, //~ NOTE unnamed field defined here
+}
+
+#[repr(C)]
+struct E {
+    _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
+            //~^ NOTE unnamed field defined here
+    _: struct {
+        _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
+                //~^ NOTE unnamed field defined here
+    },
+}
+
+#[repr(C)]
+union F {
+    _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
+            //~^ NOTE unnamed field defined here
+    _: union {
+        _: Bar, //~ ERROR named type of unnamed field must have `#[repr(C)]` representation
+                //~^ NOTE unnamed field defined here
+    },
+}
+
+fn main() {}
diff --git a/tests/ui/union/unnamed-fields/repr_check.stderr b/tests/ui/union/unnamed-fields/repr_check.stderr
new file mode 100644
index 00000000000..324968b1264
--- /dev/null
+++ b/tests/ui/union/unnamed-fields/repr_check.stderr
@@ -0,0 +1,152 @@
+error: struct with unnamed fields must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:4:1
+   |
+LL | struct A {
+   | ^^^^^^^^ struct `A` defined here
+   |
+note: unnamed field defined here
+  --> $DIR/repr_check.rs:6:5
+   |
+LL | /     _: struct {
+LL | |         a: i32,
+LL | |     },
+   | |_____^
+note: unnamed field defined here
+  --> $DIR/repr_check.rs:9:5
+   |
+LL | /     _: struct {
+LL | |         _: struct {
+LL | |             b: i32,
+LL | |         },
+LL | |     },
+   | |_____^
+help: add `#[repr(C)]` to this struct
+   |
+LL + #[repr(C)]
+LL | struct A {
+   |
+
+error: union with unnamed fields must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:16:1
+   |
+LL | union B {
+   | ^^^^^^^ union `B` defined here
+   |
+note: unnamed field defined here
+  --> $DIR/repr_check.rs:18:5
+   |
+LL | /     _: union {
+LL | |         a: i32,
+LL | |     },
+   | |_____^
+note: unnamed field defined here
+  --> $DIR/repr_check.rs:21:5
+   |
+LL | /     _: union {
+LL | |         _: union {
+LL | |             b: i32,
+LL | |         },
+LL | |     },
+   | |_____^
+help: add `#[repr(C)]` to this union
+   |
+LL + #[repr(C)]
+LL | union B {
+   |
+
+error: struct with unnamed fields must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:39:1
+   |
+LL | struct C {
+   | ^^^^^^^^ struct `C` defined here
+   |
+note: unnamed field defined here
+  --> $DIR/repr_check.rs:41:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+help: add `#[repr(C)]` to this struct
+   |
+LL + #[repr(C)]
+LL | struct C {
+   |
+
+error: union with unnamed fields must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:44:1
+   |
+LL | union D {
+   | ^^^^^^^ union `D` defined here
+   |
+note: unnamed field defined here
+  --> $DIR/repr_check.rs:46:5
+   |
+LL |     _: Foo,
+   |     ^^^^^^
+help: add `#[repr(C)]` to this union
+   |
+LL + #[repr(C)]
+LL | union D {
+   |
+
+error: named type of unnamed field must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:51:5
+   |
+LL | struct Bar {}
+   | ---------- `Bar` defined here
+...
+LL |     _: Bar,
+   |     ^^^^^^ unnamed field defined here
+   |
+help: add `#[repr(C)]` to this struct
+   |
+LL + #[repr(C)]
+LL | struct Bar {}
+   |
+
+error: named type of unnamed field must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:54:9
+   |
+LL | struct Bar {}
+   | ---------- `Bar` defined here
+...
+LL |         _: Bar,
+   |         ^^^^^^ unnamed field defined here
+   |
+help: add `#[repr(C)]` to this struct
+   |
+LL + #[repr(C)]
+LL | struct Bar {}
+   |
+
+error: named type of unnamed field must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:61:5
+   |
+LL | struct Bar {}
+   | ---------- `Bar` defined here
+...
+LL |     _: Bar,
+   |     ^^^^^^ unnamed field defined here
+   |
+help: add `#[repr(C)]` to this struct
+   |
+LL + #[repr(C)]
+LL | struct Bar {}
+   |
+
+error: named type of unnamed field must have `#[repr(C)]` representation
+  --> $DIR/repr_check.rs:64:9
+   |
+LL | struct Bar {}
+   | ---------- `Bar` defined here
+...
+LL |         _: Bar,
+   |         ^^^^^^ unnamed field defined here
+   |
+help: add `#[repr(C)]` to this struct
+   |
+LL + #[repr(C)]
+LL | struct Bar {}
+   |
+
+error: aborting due to 8 previous errors
+
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
index 192bbba5a5b..03545ed7b18 100644
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.rs
@@ -2,10 +2,8 @@
 #![feature(unnamed_fields)]
 
 struct F {
-    field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
-    //~^ ERROR anonymous structs are unimplemented
-    _: struct { field: u8 },
-    //~^ ERROR anonymous structs are unimplemented
+    field1: struct { field2: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+    _: struct { field3: u8 },
 }
 
 struct G {
@@ -13,10 +11,8 @@ struct G {
 }
 
 union H {
-    field: struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
-    //~^ ERROR anonymous structs are unimplemented
-    _: struct { field: u8 },
-    //~^ ERROR anonymous structs are unimplemented
+    field1: struct { field2: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
+    _: struct { field3: u8 },
 }
 
 union I {
@@ -27,7 +23,6 @@ enum K {
     M {
         _ : struct { field: u8 }, //~ ERROR anonymous structs are not allowed outside of unnamed struct or union fields
         //~^ ERROR unnamed fields are not allowed outside of structs or unions
-        //~| ERROR anonymous structs are unimplemented
     },
     N {
         _ : u8, //~ ERROR unnamed fields are not allowed outside of structs or unions
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
index fd731766c01..3b3890af771 100644
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_structs.stderr
@@ -1,29 +1,29 @@
 error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_structs.rs:5:12
+  --> $DIR/restrict_anonymous_structs.rs:5:13
    |
-LL |     field: struct { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+LL |     field1: struct { field2: u8 },
+   |             ^^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
 
 error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_structs.rs:12:5
+  --> $DIR/restrict_anonymous_structs.rs:10:5
    |
 LL |     _: (u8, u8),
    |     ^  -------- not a struct or union
 
 error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_structs.rs:16:12
+  --> $DIR/restrict_anonymous_structs.rs:14:13
    |
-LL |     field: struct { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
+LL |     field1: struct { field2: u8 },
+   |             ^^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
 
 error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_structs.rs:23:5
+  --> $DIR/restrict_anonymous_structs.rs:19:5
    |
 LL |     _: (u8, u8),
    |     ^  -------- not a struct or union
 
 error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_structs.rs:28:9
+  --> $DIR/restrict_anonymous_structs.rs:24:9
    |
 LL |         _ : struct { field: u8 },
    |         -^^^^^^^^^^^^^^^^^^^^^^^
@@ -31,48 +31,18 @@ LL |         _ : struct { field: u8 },
    |         unnamed field declared here
 
 error: anonymous structs are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_structs.rs:28:13
+  --> $DIR/restrict_anonymous_structs.rs:24:13
    |
 LL |         _ : struct { field: u8 },
    |             ^^^^^^^^^^^^^^^^^^^^ anonymous struct declared here
 
 error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_structs.rs:33:9
+  --> $DIR/restrict_anonymous_structs.rs:28:9
    |
 LL |         _ : u8,
    |         -^^^^^
    |         |
    |         unnamed field declared here
 
-error: anonymous structs are unimplemented
-  --> $DIR/restrict_anonymous_structs.rs:5:12
-   |
-LL |     field: struct { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^^
-
-error: anonymous structs are unimplemented
-  --> $DIR/restrict_anonymous_structs.rs:7:8
-   |
-LL |     _: struct { field: u8 },
-   |        ^^^^^^^^^^^^^^^^^^^^
-
-error: anonymous structs are unimplemented
-  --> $DIR/restrict_anonymous_structs.rs:16:12
-   |
-LL |     field: struct { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^^
-
-error: anonymous structs are unimplemented
-  --> $DIR/restrict_anonymous_structs.rs:18:8
-   |
-LL |     _: struct { field: u8 },
-   |        ^^^^^^^^^^^^^^^^^^^^
-
-error: anonymous structs are unimplemented
-  --> $DIR/restrict_anonymous_structs.rs:28:13
-   |
-LL |         _ : struct { field: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 12 previous errors
+error: aborting due to 7 previous errors
 
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
diff --git a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
index c65cad775a9..f8679aad2d7 100644
--- a/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
+++ b/tests/ui/union/unnamed-fields/restrict_anonymous_unions.stderr
@@ -1,29 +1,29 @@
 error: anonymous unions are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_unions.rs:5:12
+  --> $DIR/restrict_anonymous_unions.rs:5:13
    |
-LL |     field: union { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+LL |     field1: union { field2: u8 },
+   |             ^^^^^^^^^^^^^^^^^^^^ anonymous union declared here
 
 error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_unions.rs:12:5
+  --> $DIR/restrict_anonymous_unions.rs:10:5
    |
 LL |     _: (u8, u8),
    |     ^  -------- not a struct or union
 
 error: anonymous unions are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_unions.rs:16:12
+  --> $DIR/restrict_anonymous_unions.rs:14:13
    |
-LL |     field: union { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
+LL |     field1: union { field2: u8 },
+   |             ^^^^^^^^^^^^^^^^^^^^ anonymous union declared here
 
 error: unnamed fields can only have struct or union types
-  --> $DIR/restrict_anonymous_unions.rs:23:5
+  --> $DIR/restrict_anonymous_unions.rs:19:5
    |
 LL |     _: (u8, u8),
    |     ^  -------- not a struct or union
 
 error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_unions.rs:28:9
+  --> $DIR/restrict_anonymous_unions.rs:24:9
    |
 LL |         _ : union { field: u8 },
    |         -^^^^^^^^^^^^^^^^^^^^^^
@@ -31,48 +31,18 @@ LL |         _ : union { field: u8 },
    |         unnamed field declared here
 
 error: anonymous unions are not allowed outside of unnamed struct or union fields
-  --> $DIR/restrict_anonymous_unions.rs:28:13
+  --> $DIR/restrict_anonymous_unions.rs:24:13
    |
 LL |         _ : union { field: u8 },
    |             ^^^^^^^^^^^^^^^^^^^ anonymous union declared here
 
 error: unnamed fields are not allowed outside of structs or unions
-  --> $DIR/restrict_anonymous_unions.rs:33:9
+  --> $DIR/restrict_anonymous_unions.rs:28:9
    |
 LL |         _ : u8,
    |         -^^^^^
    |         |
    |         unnamed field declared here
 
-error: anonymous unions are unimplemented
-  --> $DIR/restrict_anonymous_unions.rs:5:12
-   |
-LL |     field: union { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^
-
-error: anonymous unions are unimplemented
-  --> $DIR/restrict_anonymous_unions.rs:7:8
-   |
-LL |     _: union { field: u8 },
-   |        ^^^^^^^^^^^^^^^^^^^
-
-error: anonymous unions are unimplemented
-  --> $DIR/restrict_anonymous_unions.rs:16:12
-   |
-LL |     field: union { field: u8 },
-   |            ^^^^^^^^^^^^^^^^^^^
-
-error: anonymous unions are unimplemented
-  --> $DIR/restrict_anonymous_unions.rs:18:8
-   |
-LL |     _: union { field: u8 },
-   |        ^^^^^^^^^^^^^^^^^^^
-
-error: anonymous unions are unimplemented
-  --> $DIR/restrict_anonymous_unions.rs:28:13
-   |
-LL |         _ : union { field: u8 },
-   |             ^^^^^^^^^^^^^^^^^^^
-
-error: aborting due to 12 previous errors
+error: aborting due to 7 previous errors