From da86c81e39ff27925e7052e1cc612414c7eeb244 Mon Sep 17 00:00:00 2001 From: Samrat Man Singh Date: Mon, 27 Apr 2020 09:35:19 +0530 Subject: [PATCH] Add test to verify arg size mismatch throws UB Also: bump up `rust-version` --- rust-version | 2 +- tests/compile-fail/shim_arg_size.rs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 tests/compile-fail/shim_arg_size.rs diff --git a/rust-version b/rust-version index 8ed0e6ba353..53979b82cf8 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -14b15521c52549ebbb113173b4abecd124b5a823 +e83f7563495dbe2629b0cbc738afb0808c4482e1 diff --git a/tests/compile-fail/shim_arg_size.rs b/tests/compile-fail/shim_arg_size.rs new file mode 100644 index 00000000000..38b5475b9f7 --- /dev/null +++ b/tests/compile-fail/shim_arg_size.rs @@ -0,0 +1,15 @@ +#![feature(rustc_private)] + +extern crate libc; + +// error-pattern: scalar size mismatch +fn main() { + extern "C" { + fn malloc(size: u32) -> *mut std::ffi::c_void; + } + + unsafe { + let p1 = malloc(42); + libc::free(p1); + }; +}