-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-c_variadic`#![feature(c_variadic)]``#![feature(c_variadic)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team
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:
- Continuing bikeshed on the
...syntax. - 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
Resolved questions:
- "When implementing this feature, we will need to determine whether the compiler
can provide an appropriate lifetime that prevents aVaListfrom outliving its
corresponding variadic function." - Ensure that even when this gets stabilized for regular functions, it is still rejected on
const fn.
Implementation history
va_arg codegen
- codegen: Fix va_list - aarch64 iOS/Windows #56599
- Properly define va_arg and va_list for aarch64-apple-darwin #78126
- implement
va_argfor x86_64 systemv #141538 - implement
va_argforpowerpc#141622 - use custom types to clarify arguments to
emit_ptr_va_arg#141623 - match clang's
va_argassembly on arm targets #144549
VaList and its layout
- libcore: Add VaList and variadic arg handling intrinsics #49878
- tests: Simplify VaList run-make test #56396
- VaList::copy should not require a mutable ref #57311
- Support defining C compatible variadic functions #57760
- core: ensure VaList passes improper_ctypes lint #58938
- Fix segfaults in release build C-variadic fns #58985
- ffi: rename VaList::copy to VaList::with_copy #59371
- Refactor C FFI variadics to more closely match their C counterparts, and add Clone implementation #59625
- Make VaListImpl<'f> invariant over the 'f lifetime #62639
- Fix intra-docs link in core::ffi::VaList #77784
- Give VaList its own home #126921
c_variadic: makeVaListabi-compatible with C #141980
other
- Allow "C-unwind" fn to have C variadics #126843
- core: VaArgSafe is an unsafe trait #126927
- use
cfg_select!to select the rightVaListImpldefinition #141361 c_variadic: Add future-incompatibility warning for...arguments without a pattern outside ofexternblocks #143619- Add
#[rustc_pass_indirectly_in_non_rustic_abis]#144529 - improve c-variadic error reporting #146165
- Improve C-variadic error messages: part 2 #146342
- c-variadic: allow c-variadic inherent and trait methods #146434
- document
core::ffi::VaArgSafe#146521 - implement
feature(c_variadic_naked_functions)#148770 - c-variadic: bpf and spirv do not support c-variadic definitions #149557
c-variadic adjacent
tcyrus, alex, demurgos, grihabor, ctaggart and 51 moree-ivkov, Dushistov, kamulos, lvyitian, bjoernager and 2 moretyped-sigterm and ari-at-backboneDCNick3, joseluis and flaribbit
Metadata
Metadata
Assignees
Labels
A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)B-RFC-approvedBlocker: Approved by a merged RFC but not yet implemented.Blocker: Approved by a merged RFC but not yet implemented.B-unstableBlocker: Implemented in the nightly compiler and unstable.Blocker: Implemented in the nightly compiler and unstable.C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCF-c_variadic`#![feature(c_variadic)]``#![feature(c_variadic)]`S-tracking-ready-to-stabilizeStatus: This is ready to stabilize; it may need a stabilization report and a PRStatus: This is ready to stabilize; it may need a stabilization report and a PRT-langRelevant to the language teamRelevant to the language team