Rust 1.58 continues efforts to get more friendly, kernel initiative progresses

Rust 1.54

Rust 1.58 has recently been pushed into the open, and though most changes can be found in the project’s compiler this time around, the programming language itself also gained a few enhancements meant to make the project a bit easier to get into.

Since macros for text formatting are among the first things developers new to Rust face, the Rust team decided to simplify using them by introducing implicit named arguments with the release. The change is meant to help write more concise code and improve code readability by letting users add {ident} into a format string for argument capture.

The language team went on to cull and modify the rules for when a generic struct implements Unsize, a trait used for the conversion from sized types into types whose size is only known at runtime. Beginning with the 1.58 release, Unsize is implemented when “the tail field depends on at least one type or const parameter not used in any other field”, “the target struct can be created from the source by replacing only the parameters only found in the last struct field” and “the tail field implements Unsize from source to target”.

Another adjustment means that once developers have converted a safe reference into a raw pointer, they can now be turned back into a safe reference. Speaking of safety, since some Rust developers found that std::process::Command’s behaviour of searching the current directory for executables could be used to intercept processes, the search strategy has been modified to address this vulnerability with the new release.

Looking into Rust’s standard library, most functions now sport a #[must_use] annotation which produces a warning should their return value be ignored. There’s also an implementation of Termination for Result<Infallible, E> included for programs who never return from main, and paths are automatically canonicalised on Windows, should an operation support such a thing.

The Rust compiler seems to have received the most changes with the release. Amongst other things, it learned how to work with LLVM control flow integrity and the LLVM coverage mapping format v5 and v6, for instance. The tool now also continues compilation after throwing a lint error, displays more helpful error messages, provides an option to strip release binaries from debug symbols, and shows LLVM optimisation remarks, should the corresponding feature be enabled.

Rust’s package manager Cargo meanwhile comes fitted with a new metadata field for the minimally supported Rust version, which should be useful for passing this information on to other tools, and a --message-format option for the install command. Under the hood, curl has been updated to 7.80 to make sure support for OpenSSL 3 is solid. 

After 11.5 years in the open, interest in Rust seems solid, with StackOverflow users naming it as their most loved language for six years in a row and the Linux kernel team investigating ways to support it as a second language. The latest patch series to make the latter happen just landed this morning and includes support for Rust 1.58, automatic detection of suitable Rust toolchains, and various build system and documentation improvements.

The next two Rust releases are hoped to advance the Google-backed Rust for Linux endeavours even further, since some sought-after features are currently on track for stabilisation in v1.59 and 1.60. Interested parties can track the project’s progress via GitHub or the associated mailing list.