-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Orion Gonzalez
committed
Nov 27, 2024
1 parent
d83e320
commit c40651c
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// https://github.com/rust-lang/rust/issues/69232 | ||
|
||
extern "C" { | ||
fn foo(x: usize, ...); | ||
} | ||
|
||
fn test() -> u8 { | ||
127 | ||
} | ||
|
||
fn main() { | ||
unsafe { foo(1, test) }; //~ ERROR can't pass a function item to a variadic function | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0617]: can't pass a function item to a variadic function | ||
--> $DIR/issue-69232.rs:12:21 | ||
| | ||
LL | unsafe { foo(1, test) }; | ||
| ^^^^ help: use a function pointer instead: `&test` | ||
| | ||
= help: a function item is zero-sized and needs to be casted into a pointer-sized function pointer to be used in FFI | ||
= note: for more information on function items, visit https://doc.rust-lang.org/reference/types/function-item.html | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0617`. |