Series: The Rust Annals

Vol. I Issue 94 nlopes.dev

Announcing Rust 1.93.0

Rust 1.93 updates bundled musl to improve DNS reliability for statically linked Linux binaries, permits Rust global allocators to use thread-local facilities without re-entrancy concerns, and makes conditional inline assembly less repetitive by allowing cfg attributes on individual statements. It also stabilizes APIs for working with initialized storage, raw collection parts, slices, integers, deques, durations, character encodings, and formatting.

Bundled musl 1.2.5 improves DNS handling but removes legacy symbols

All *-linux-musl targets now ship with musl 1.2.5. This primarily affects static musl builds for x86_64, aarch64, and powerpc64le, which previously bundled musl 1.2.3.

The primary motivation is to receive major improvements to musl’s DNS resolver introduced in 1.2.4 and bug fixes added in 1.2.5. For statically linked musl targets, this should make portable Linux binaries that perform networking more reliable, particularly with large DNS records and recursive nameservers.

The update also brings a breaking change: musl 1.2.4 removed several legacy compatibility symbols used by the Rust libc crate. The corresponding fix shipped in libc 0.2.146 in June 2023, two and a half years before this release; the Rust project believes it has propagated widely enough to proceed with the target update. The earlier announcement has further details.

Conditional inline assembly no longer requires duplicate blocks

Previously, conditionally including individual parts of inline assembly required repeating the full asm! block with and without those parts. Rust 1.93 allows cfg attributes on individual statements within asm!, global_asm!, and naked_asm! blocks.

asm!( // or global_asm! or naked_asm!
    "nop",
    #[cfg(target_feature = "sse2")]
    "nop",
    // ...
    #[cfg(target_feature = "sse2")]
    a = const 123, // only used on sse2
);

Rust global allocators can use thread-local facilities

Rust 1.93 adjusts standard-library internals so global allocators written in Rust can use thread_local! and std::thread::current without re-entrancy concerns, by using the system allocator instead. The global allocator documentation provides details.

Standard-library stabilization expands storage, collection, numeric, and formatting operations

The stabilized library surface includes operations for assuming or writing initialized slices, decomposing String and Vec into raw parts, unchecked integer negation and shifts, viewing slices as arrays, conditionally removing deque elements, constructing durations from u128 nanoseconds, querying maximum UTF-8 and UTF-16 character lengths, and producing formatting implementations from a function.

Reproduced from the Rust blog under its publication licence. Typeset in Literata.