Urgent.News

What's breaking now, across thousands of outlets.

Tech

Announcing Rust 1.99.0

The Rust team has unveiled Rust version 1.99.0, a programming language designed to enable the creation of dependable and efficient software. If an earlier Rust version is already installed via rustup, users can obtain 1.99.0 by running a specific command. If rustup has not been installed yet, it can be acquired from the relevant page on the official website.

For those keen on contributing to the development process, they may opt to update locally to either the beta channel (rustup default beta) or the nightly channel (rustup default nightly). Any bugs encountered should be reported immediately.

Rust 1.99.0 introduces stability for defining C-ABI variadic functions with C and C-unwind ABIs. Variadic functions, defined in this manner, utilize a variable argument list (...) and can accept any number of arguments. While Rust has been able to call externally-defined variadic functions (such as libc::printf), with Rust 1.99, such functions can now be created within Rust itself.

The type of (...) is VaList, which is ABI-compatible with the C va_list type across all supported targets. The VaArgSafe trait guards what types can be read from a VaList. Further details regarding C-variadic functions can be found in the Reference.

In addition, this release stabilizes support for defining naked variadic functions with non-C ABIs, which must be implemented using inline assembly. The safety criteria for obtaining the size and alignment of raw pointers to both Sized (trivially safe, already feasible on stable) and non-Sized types have also been finalized. While there are no changes to language semantics in Rust 1.99, the documentation for Box::leak has been revised to discourage practices that later deallocate the allocated memory.

This is due to potential interactions with future compiler optimizations and is particularly pertinent to the upcoming stabilization of custom allocators. Instead, Box::into_non_null is recommended as a safer alternative. This guidance extends to other leak functions within the standard library.

The collective efforts of numerous individuals have culminated in the release of Rust 1.99.0. The Rust team extends its gratitude to all contributors.

Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at blog.rust-lang.org →

More in Tech

useRef Hook in React

useRef is a React Hook that is used to store a value that persists between renders without causing the component to re-render when the value changes.

More from Thursday 1 October →