]> git.lizzy.rs Git - rust.git/blobdiff - tests/ui/union/projection-as-union-type.rs
Auto merge of #106938 - GuillaumeGomez:normalize-projection-field-ty, r=oli-obk
[rust.git] / tests / ui / union / projection-as-union-type.rs
diff --git a/tests/ui/union/projection-as-union-type.rs b/tests/ui/union/projection-as-union-type.rs
new file mode 100644 (file)
index 0000000..143434c
--- /dev/null
@@ -0,0 +1,19 @@
+// Ensures that we can use projections as union field's type.
+// check-pass
+
+#![crate_type = "lib"]
+
+pub trait Identity {
+    type Identity;
+}
+
+impl<T> Identity for T {
+    type Identity = Self;
+}
+
+pub type Foo = u8;
+
+pub union Bar {
+    pub a: <Foo as Identity>::Identity,
+    pub b: u8,
+}