diff --git a/tests/compile-fail/check_arg_count.rs b/tests/compile-fail/check_arg_count.rs deleted file mode 100644 index 0cc6dcb9a98d..000000000000 --- a/tests/compile-fail/check_arg_count.rs +++ /dev/null @@ -1,8 +0,0 @@ -#![feature(core_intrinsics)] - -use std::intrinsics; - -fn main() { - unsafe { intrinsics::forget(); } //~ ERROR this function takes 1 argument but 0 arguments were supplied - unsafe { intrinsics::forget(1, 2); } //~ ERROR this function takes 1 argument but 2 arguments were supplied -} diff --git a/tests/compile-fail/check_arg_count_too_few_args.rs b/tests/compile-fail/check_arg_count_too_few_args.rs new file mode 100644 index 000000000000..c6c19e042dd4 --- /dev/null +++ b/tests/compile-fail/check_arg_count_too_few_args.rs @@ -0,0 +1,12 @@ +#![feature(core_intrinsics)] +#![feature(rustc_private)] + +fn main() { + extern "C" { + fn malloc() -> *mut std::ffi::c_void; + } + + unsafe { + let _ = malloc(); //~ ERROR Undefined Behavior: incorrect number of arguments: got 0, expected 1 + }; +} diff --git a/tests/compile-fail/check_arg_count_too_many_args.rs b/tests/compile-fail/check_arg_count_too_many_args.rs new file mode 100644 index 000000000000..cca03e53ec10 --- /dev/null +++ b/tests/compile-fail/check_arg_count_too_many_args.rs @@ -0,0 +1,12 @@ +#![feature(core_intrinsics)] +#![feature(rustc_private)] + +fn main() { + extern "C" { + fn malloc(_: i32, _: i32) -> *mut std::ffi::c_void; + } + + unsafe { + let _ = malloc(1, 2); //~ ERROR Undefined Behavior: incorrect number of arguments: got 2, expected 1 + }; +}