]> git.lizzy.rs Git - rust.git/commitdiff
Fix shim_arg_size test for 32-bit machines
authorSamrat Man Singh <samratmansingh@gmail.com>
Mon, 27 Apr 2020 04:30:35 +0000 (10:00 +0530)
committerSamrat Man Singh <samratmansingh@gmail.com>
Mon, 27 Apr 2020 04:30:35 +0000 (10:00 +0530)
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 {