We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents da940eb + 73f258c commit 4556daaCopy full SHA for 4556daa
rust-version
@@ -1 +1 @@
1
-14b15521c52549ebbb113173b4abecd124b5a823
+e83f7563495dbe2629b0cbc738afb0808c4482e1
tests/compile-fail/shim_arg_size.rs
@@ -0,0 +1,17 @@
+#![feature(rustc_private)]
2
+
3
+fn main() {
4
+ extern "C" {
5
+ // Use the wrong type(ie. not the pointer width) for the `size`
6
+ // argument.
7
+ #[cfg(target_pointer_width="64")]
8
+ fn malloc(size: u32) -> *mut std::ffi::c_void;
9
10
+ #[cfg(target_pointer_width="32")]
11
+ fn malloc(size: u16) -> *mut std::ffi::c_void;
12
+ }
13
14
+ unsafe {
15
+ let _p1 = malloc(42); //~ ERROR Undefined Behavior: scalar size mismatch
16
+ };
17
+}
0 commit comments