]> git.lizzy.rs Git - rust.git/blobdiff - tests/compile-fail/shim_arg_size.rs
Fix shim_arg_size test for 32-bit machines
[rust.git] / tests / compile-fail / shim_arg_size.rs
index 38b5475b9f7ea26ee2bcbb3a7aae8ae3a3883333..a31461fdbf48dd9acb6f88f56d6ed3f25b9edb88 100644 (file)
@@ -5,7 +5,13 @@
 // error-pattern: scalar size mismatch
 fn main() {
     extern "C" {
+        // Use the wrong type(ie. not the pointer width) for the `size`
+        // argument.
+        #[cfg(target_pointer_width="64")]
         fn malloc(size: u32) -> *mut std::ffi::c_void;
+
+        #[cfg(target_pointer_width="32")]
+        fn malloc(size: u16) -> *mut std::ffi::c_void;
     }
 
     unsafe {