compiler/rustc_error_codes/src/error_codes/E0060.md MARKDOWN 34 lines View on github.com → Search inside
1External C functions are allowed to be variadic. However, a variadic function2takes a minimum number of arguments. For example, consider C's variadic `printf`3function:45```compile_fail,E00606use std::os::raw::{c_char, c_int};78extern "C" {9    fn printf(_: *const c_char, ...) -> c_int;10}1112unsafe { printf(); } // error!13```1415Using this declaration, it must be called with at least one argument, so16simply calling `printf()` is invalid. But the following uses are allowed:1718```rust,edition202119# use std::os::raw::{c_char, c_int};20# #[cfg_attr(all(windows, target_env = "msvc"),21#            link(name = "legacy_stdio_definitions",22#                 kind = "static", modifiers = "-bundle"))]23# extern "C" { fn printf(_: *const c_char, ...) -> c_int; }24# fn main() {25unsafe {26    printf(c"test\n".as_ptr());2728    printf(c"number = %d\n".as_ptr(), 3);2930    printf(c"%d, %d\n".as_ptr(), 10, 5);31}32# }33```

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.