Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14b15521c52549ebbb113173b4abecd124b5a823
e83f7563495dbe2629b0cbc738afb0808c4482e1
21 changes: 21 additions & 0 deletions tests/compile-fail/shim_arg_size.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#![feature(rustc_private)]

extern crate libc;

// 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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

size: u16

How about size: u64? These cases test data_size < target_size, whereas we should test data_size != target_size.

}

unsafe {
let p1 = malloc(42);
libc::free(p1);
};
}