-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 28, 2024
1 parent
b36dcc1
commit 1e4817c
Showing
7 changed files
with
51 additions
and
9 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
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,16 @@ | ||
error[E0617]: can't pass a function item to a variadic function | ||
--> $DIR/fn-item-diagnostic-issue-69232.rs:12:21 | ||
| | ||
LL | unsafe { foo(1, test) }; | ||
| ^^^^ | ||
| | ||
= help: a function item is zero-sized and needs to be cast into a 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 | ||
help: use a function pointer instead | ||
| | ||
LL | unsafe { foo(1, test as fn() -> u8) }; | ||
| +++++++++++++ | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0617`. |
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
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
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
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