Open
Listed in
Description
This is a tracking issue for the RFC "Support defining C-compatible variadic functions in Rust" (rust-lang/rfcs#2137).
Steps:
- Implement the RFC (PR Support defining C compatible variadic functions #57760)Adjust documentation (see instructions on forge)Stabilization PR (see instructions on forge)
Unresolved questions:
- "When implementing this feature, we will need to determine whether the compiler
can provide an appropriate lifetime that prevents aVaList
from outliving its
corresponding variadic function." - Continuing bikeshed on the
...
syntax. - Ensure that even when this gets stabilized for regular functions, it is still rejected on
const fn
. - What even is the semantics of this? What exactly is allowed and disallowed? Would be good to have a Miri implementation.
- borrowck problems: Poor interaction between NLL-borrowck, async, and c_variadic's
...
desugaring (VaListImpl<'_>
) #125431 - What exactly are the ABI requirements around variadic calls? What are the ABI compatibility rules? Do we have to be concerned about LLVM target features affecting variadic ABI?
- Soundness bug: Varargs are completely unchecked if passed as generics #61275
VaList<'_>
does not carry its ABI in its type #141618
Metadata
Metadata
Assignees
Labels
Area: Foreign function interface (FFI)Blocker: Approved by a merged RFC but not yet implemented.Blocker: Implemented in the nightly compiler and unstable.Category: An issue tracking the progress of sth. like the implementation of an RFC`#![feature(c_variadic)]`Status: This is ready to stabilize; it may need a stabilization report and a PRRelevant to the language team
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
plietar commentedon Sep 29, 2017
I'd like to work on this, I already have some prototype
aturon commentedon Sep 29, 2017
Awesome @plietar! It'd probably be good to bring this up in the "middle-end" compiler working group channel, which would also be a good place to get any help you might need.
joshtriplett commentedon Nov 23, 2017
@plietar How goes the implementation? I remember you showing a mostly complete prototype on IRC.
...
arg #48154thedataking commentedon Feb 14, 2018
@plietar any news to share? This is a blocker for teams working on C to Rust transpilers, so this addition would be very welcome. (I'm part of one such team).
plietar commentedon Feb 22, 2018
Hey,
Sorry I've been busy and then forgot about this. I'll get my prototype back in shape, hopefully by this weekend.
harpocrates commentedon Mar 16, 2018
@plietar Any update on this? Do you have a WIP branch I can check out to try / fiddle with this?
dlrobertson commentedon Mar 20, 2018
Looks like I'm a little late to the party 😄 ... sorry about that
A few questions:
How would functions that use a
va_list
multiple times work without the ability to explicitly useva_start
andva_end
? Are they expected to use copy? E.g.execl
typically loops through the arguments to to getargc
, creats a arrayargv
of sizeargc
, loops through the list again populatingargv
, and finally callexecv
.The structure of a
va_list
varies greatly between the architectures. The intrinsic functions work with the architecture specific structure bitcast to ani8*
, but AFAIK we'll still need to define the structure. Which architectures will be expected to be supported in the first iteration? Or am I mistaken that we'll have to define the structure?@plietar if you don't have the time to work on this any more or if there is any way I could help out, I'd be more than happy to do so. I haven't worked on rustc much, but I'd be happy to help however I can with the implementation of this.
nikomatsakis commentedon Mar 20, 2018
@dlrobertson
Seems likely that @plietar doesn't have much time, though they can speak for themselves.
I've not really looked closely at what would be needed to implement this, but if you need any help, please ping me, or reach out on gitter/IRC.
242 remaining items