Closed
Description
Overview
Using the unstable c_variadic feature, functions may be variadic as long as they have an extern "C"
ABI. That used to be a reasonable restriction. However, after #74990 , extern "C"
isn't as useful as it used to be. Now, any function that might panic needs to be extern "C-unwind"
. This may not technically be a compiler regression. But it's certainly a regression in functionality. Previously, Mockall was able to mock C variadic functions. Now, it cannot. Would it be possible to relax that restriction?
Example
I tried this code:
#![feature(c_variadic)]
pub extern "C-unwind" fn foo(x: i32, y: i32, ...) -> i32 {
unimplemented!()
}
I expected to see this happen: It should compile ok.
Instead, this happened: It fails with this error:
error: only foreign or `unsafe extern "C"` functions may be C-variadic
Meta
rustc --version --verbose
:
rustc 1.81.0-nightly (c1b336cb6 2024-06-21)
binary: rustc
commit-hash: c1b336cb6b491b3be02cd821774f03af4992f413
commit-date: 2024-06-21
host: x86_64-unknown-freebsd
release: 1.81.0-nightly
LLVM version: 18.1.7