about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2020-06-12 16:14:05 +0100
committerDavid Wood <david@davidtw.co>2020-06-19 11:16:16 +0100
commita730d888aee99f9a556dae799deadacb83c34d0e (patch)
treeb222233424e47cec2374b29d4cace7e875772b72 /src/test/ui
parent0cccaa0a27499f742ed4dbf4b5d09beee08eb2d6 (diff)
ty: simplify `transparent_newtype_field`
This commit removes the normalization from `transparent_newtype_field` -
turns out it wasn't necessary and that makes it a bunch simpler -
particularly when handling projections.

Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/lint/lint-ctypes-73249-4.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/lint/lint-ctypes-73249-4.rs b/src/test/ui/lint/lint-ctypes-73249-4.rs
new file mode 100644
index 00000000000..6c72bd691b1
--- /dev/null
+++ b/src/test/ui/lint/lint-ctypes-73249-4.rs
@@ -0,0 +1,24 @@
+// check-pass
+#![deny(improper_ctypes)]
+
+use std::marker::PhantomData;
+
+trait Foo {
+    type Assoc;
+}
+
+impl Foo for () {
+    type Assoc = PhantomData<()>;
+}
+
+#[repr(transparent)]
+struct Wow<T> where T: Foo<Assoc = PhantomData<T>> {
+    x: <T as Foo>::Assoc,
+    v: u32,
+}
+
+extern "C" {
+    fn test(v: Wow<()>);
+}
+
+fn main() {}