Over in #44930, @folkertdev proposed:
We need c_variadics on stable for zlib-rs, so I'm going to try and move this forward. A draft for a modified API is at
https://gist.github.com/folkertdev/47c79e2f5b03f1138db9d53be5e51ed1
Some highlights
VaListImpl is private!
VaList just has a single lifetime parameter now, which makes a lot more sense
- The
VaList::with_copy function and a new va_copy! macro can be used to duplicate a VaList
This all relies on a different desugaring of ..., roughly
fn foo(placeholder: i32, mut args: ...) {
// stuff
}
// --->
fn foo(placeholder: i32) {
let tag = core::mem::MaybeUninit::<VaListImpl>::uninit();
unsafe { core::instrinsics::va_start(tag.as_mut_ptr()) }
let mut args = VaList(tag.assume_init_mut())
// stuff
}
It seems possible to make that work internally.
I think this new API is nicer, because it leaks fewer implementation details. But before we start implementation work, does anyone see issues with this direction?
pinging specifically the c2rust folks @thedataking @ahomescu, you've probably worked with the existing c_variadics most.
Thoughts?
Tracking:
cc @rust-lang/lang
Over in #44930, @folkertdev proposed:
Thoughts?
Tracking:
cc @rust-lang/lang