The Rust team has released Rust 1.99.0, introducing the ability to define C-ABI variadic functions directly within the language. While previous releases only allowed calling external C variadics, the 1.99.0 update enables developers to implement functions accepting arbitrary argument lists using the "C" and "C-unwind" ABIs. Existing installations can be upgraded to the new stable version using rustup.
Native C-ABI Variadic Function Definitions
Writing C-variadic functions in Rust relies on the VaList type, which maintains binary interface compatibility with C's va_list across target architectures. Argument extraction is governed by the VaArgSafe trait to control which types can be safely read from the argument list. The release also stabilizes support for defining naked variadic functions with non-"C" ABIs when implemented using inline assembly.
Pointer Layout APIs and Memory Guidance Updates
Rust 1.99.0 formalizes safety requirements for retrieving size and alignment data from raw pointers, extending functionality across both sized and dynamically sized types through three newly stabilized functions. Additionally, the release updates standard library documentation to discourage round-trip unleaking patterns following a Box::leak call.
The documentation update highlights that re-allocating or deallocating memory previously marked as leaked can lead to problematic interactions with compiler optimizations, particularly alongside upcoming custom allocator support. Developers are advised to use Box::into_non_null as a preferred alternative when working with managed pointer conversions.
AI-generated editorial illustration; not a documentary photograph.
Source: Announcing Rust 1.99.0

Leave a Reply