about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2017-02-02 13:57:08 +0100
committerEmilio Cobos Álvarez <emilio@crisal.io>2017-02-03 22:00:40 +0100
commite866d07f55b1b3ed6e37625ef35f61ac5c10f40e (patch)
tree58b80df01d64c2d1114691c2d93b9ec5ba53ec5a /src/test/compile-fail
parentaed6410a7b0f15dc68536e0735787436526ba395 (diff)
lint/ctypes: Don't warn on non-unsized structs with PhantomData.
Fixes #34798
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/lint-ctypes.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/compile-fail/lint-ctypes.rs b/src/test/compile-fail/lint-ctypes.rs
index ccc25b58228..608b1eb0872 100644
--- a/src/test/compile-fail/lint-ctypes.rs
+++ b/src/test/compile-fail/lint-ctypes.rs
@@ -29,6 +29,9 @@ pub type RustBadRet = extern fn() -> Box<u32>;
 pub type CVoidRet = ();
 pub struct Foo;
 
+#[repr(C)]
+pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData<i32>);
+
 extern {
     pub fn ptr_type1(size: *const Foo); //~ ERROR: found struct without
     pub fn ptr_type2(size: *const Foo); //~ ERROR: found struct without
@@ -40,6 +43,9 @@ extern {
     pub fn tuple_type(p: (i32, i32)); //~ ERROR found Rust tuple type
     pub fn tuple_type2(p: I32Pair); //~ ERROR found Rust tuple type
     pub fn zero_size(p: ZeroSize); //~ ERROR found zero-size struct
+    pub fn zero_size_phantom(p: ZeroSizeWithPhantomData); //~ ERROR found zero-sized type
+    pub fn zero_size_phantom_toplevel()
+        -> ::std::marker::PhantomData<bool>; //~ ERROR: found zero-sized type
     pub fn fn_type(p: RustFn); //~ ERROR found function pointer with Rust
     pub fn fn_type2(p: fn()); //~ ERROR found function pointer with Rust
     pub fn fn_contained(p: RustBadRet); //~ ERROR: found struct without