Trending: On-device modelsSearch
iHeartGeek
iTECH

Rust 1.99.0 stabilises C variadics and raw-pointer layout

The Rust Release Team has shipped version 1.99.0, stabilising C-ABI variadic functions, layout queries on raw pointers and seventeen standard-library additions.

Official Rust programming language artwork, showing the orange Rust gear logo on a dark background

Rust 1.99.0 is out. The Rust Release Team published the new stable version on 1 October, and it arrives the usual way: anyone with rustup can pick it up by running rustup update stable, and the full notes sit alongside the release. The headline item is one the language has been circling for years.

C variadics, finally writable in Rust

Rust has always been able to call variadic C functions such as libc's printf. Defining one was the missing half. Version 1.99.0 stabilises declaring variadic functions with the C and C-unwind ABIs, so a function taking an unspecified argument list can now be written in Rust and called from C. The argument list is typed as VaList, which is ABI-compatible with C's va_list across targets, and the types that may be read back out of it are gated behind the VaArgSafe trait.

The same release stabilises naked variadic functions with ABIs other than C, which have to be written with inline assembly. Anyone writing bindings, shims or low-level glue will recognise both of these as the kind of gap that ends up filled by a build script and a shrug.

Sizing raw pointers, and a warning about Box::leak

The second change settles the safety rules around asking a raw pointer how big and how aligned the value behind it is. Three functions become stable: Layout::for_value_raw, mem::size_of_val_raw and mem::align_of_val_raw. For sized types the answer was already available and trivially safe; for unsized types it now has defined requirements rather than folklore.

The release also updates the documentation for Box::leak to recommend against patterns that later deallocate the leaked memory. The team found such code interacts badly with current and future compiler optimisations, and it becomes especially awkward with custom allocators on the way. Box::into_non_null and Box::into_raw are the suggested alternatives, and the same guidance covers the standard library's other leak functions.

Seventeen additions to the standard library

The stabilised API list is long and unusually practical. IntoIterator now covers Box<[T; N]> by value, by reference and by mutable reference, so a boxed array can be looped over directly. VecDeque gains retain_back, Box gains into_non_null and from_non_null, and Vec gains into_parts and from_parts for splitting a vector into its pointer, length and capacity and rebuilding it. Strings get String::from_utf8_lossy_owned and FromUtf8Error::into_utf8_lossy, both aimed at avoiding an extra copy when invalid bytes have to be replaced.

Smaller entries round the list out: FusedIterator for StepBy, and std::fs::set_times with a nofollow variant for changing a file's timestamps without following symlinks. The release notes point to the separate changelogs for Cargo and Clippy, which carry their own fixes.

Our opinion

Variadics are the sort of feature nobody asks for until they are writing a binding and discover they must drop into C to define one function. Shipping it in stable Rust closes a hole that has quietly kept small amounts of unsafe C in otherwise Rust projects for a decade, and the VaArgSafe gate is the right shape for the problem: express the constraint, then let the compiler hold the line instead of documenting it and hoping. The Box::leak note is the more interesting half of the release, because it is a correction rather than an addition. Telling people their working code rests on an assumption the optimiser does not share is an unglamorous thing to publish, and it is exactly the work that keeps a language trustworthy.