Skip to content

Commit

Permalink
Bless test
Browse files Browse the repository at this point in the history
  • Loading branch information
tiif committed Jan 29, 2025
1 parent a25a4ef commit 910f1a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions tests/fail/shims/non_vararg_signature_mismatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ extern "C" {

fn main() {
let c_path = CString::new(OsStr::new("./text").as_bytes()).expect("CString::new failed");
let _fd = unsafe { open(c_path.as_ptr(), /* value does not matter */ 0) };
//~^ ERROR: calling a variadic function with a non-variadic caller-side signature
let _fd = unsafe {
open(c_path.as_ptr(), /* value does not matter */ 0)
//~^ ERROR: calling a variadic function with a non-variadic caller-side signature
};
}
4 changes: 2 additions & 2 deletions tests/fail/shims/non_vararg_signature_mismatch.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: calling a variadic function with a non-variadic caller-side signature
--> tests/fail/shims/non_vararg_signature_mismatch.rs:LL:CC
|
LL | let _fd = unsafe { open(c_path.as_ptr(), 2) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ calling a variadic function with a non-variadic caller-side signature
LL | open(c_path.as_ptr(), /* value does not matter */ 0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ calling a variadic function with a non-variadic caller-side signature
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down
6 changes: 4 additions & 2 deletions tests/fail/shims/wrong_fixed_arg_count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ extern "C" {

fn main() {
let c_path = CString::new(OsStr::new("./text").as_bytes()).expect("CString::new failed");
let _fd = unsafe { open(c_path.as_ptr(), /* value does not matter */ 0) };
//~^ ERROR: incorrect number of fixed arguments for variadic function
let _fd = unsafe {
open(c_path.as_ptr(), /* value does not matter */ 0)
//~^ ERROR: incorrect number of fixed arguments for variadic function
};
}
4 changes: 2 additions & 2 deletions tests/fail/shims/wrong_fixed_arg_count.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
error: Undefined Behavior: incorrect number of fixed arguments for variadic function `open`: got 1, expected 2
--> tests/fail/shims/wrong_fixed_arg_count.rs:LL:CC
|
LL | let _fd = unsafe { open(c_path.as_ptr(), 2) };
| ^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of fixed arguments for variadic function `open`: got 1, expected 2
LL | open(c_path.as_ptr(), /* value does not matter */ 0)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ incorrect number of fixed arguments for variadic function `open`: got 1, expected 2
|
= help: this indicates a bug in the program: it performed an invalid operation, and caused Undefined Behavior
= help: see https://doc.rust-lang.org/nightly/reference/behavior-considered-undefined.html for further information
Expand Down

0 comments on commit 910f1a4

Please sign in to comment.