From f741f2cc714b90a224f0b8739c6d57107bf372cc Mon Sep 17 00:00:00 2001 From: Chase Albert Date: Mon, 4 May 2020 23:22:00 -0400 Subject: [PATCH] Correct the test. --- tests/compile-fail/check_arg_count.rs | 8 -------- tests/compile-fail/check_arg_count_too_few_args.rs | 12 ++++++++++++ tests/compile-fail/check_arg_count_too_many_args.rs | 12 ++++++++++++ 3 files changed, 24 insertions(+), 8 deletions(-) delete mode 100644 tests/compile-fail/check_arg_count.rs create mode 100644 tests/compile-fail/check_arg_count_too_few_args.rs create mode 100644 tests/compile-fail/check_arg_count_too_many_args.rs 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 + }; +}