Rust 1.59 serves devs inline assembly and automatic debuginfo-shaving

Rust Foundation

Rust 1.59 has landed, providing developers with more stability, a way to create smaller binaries, and support for inline assembly — maybe not what everyone was hoping for, but the year is still young and plans to address some major pain points in 2022 are on the table.

The latest version of the Mozilla-initiated programming language includes a way for developers to specify default values for the const generics of generic types. It also simplifies writing Rust code a little by allowing type parameters to be interleaved with const parameters. Users who found their binaries to be more on the heavy side, meanwhile, don’t have to strip them from unnecessary debug information by hand anymore and can just add 

strip = "debuginfo"

to their Cargo.toml. The tool will then get rid of debuginfo automatically during the linking process. 

To turn Rust into an option for a broader audience, Rust 1.59 learned to work with the assembly language a bit better. Developers in need of low-level execution control or access to specific machine instructions can now use new macros asm! and global_asm! to embed handwritten assembly code in the generator’s compiler output for x86 and x86-64, Arm, AArch64, and RISC-V targets.

The Rust team also worked on consistency and added the option to use tuple, slice, and struct patterns as the left-hand side of an assignment in the same way let bindings allow. Incremental compilation is turned off by default in Rust 1.59 to mitigate the effects of a bug that can lead to deserialization errors. A fix is planned to be available in six weeks’ time.

The list of stabilised methods and trait implementations included in the release contains std::thread::available_parallelism, iter::zip, ops::ControlFlow::is_break/is_continue, Result::copied/cloned, arch::asm!, and TryFrom<&'_ mut [T]> for [T; N].

To get an idea of what’s next for the programming language, users can check a recent blog post by Rust’s compiler team, in which it shared its plans for the year and beyond. Initiatives are largely centred around debugging and performance, so things that seem to be on the minds of most Rust users if the freshly dropped user survey results are any indication. 

Amongst other things, the team looks to systematically investigate all soundness issues in Rust, and move the asynchronicity initiatives on traits and crashdump dissection forward. Diving into these is hoped to improve the language’s reliability and expressiveness, and help with debugging. 

Since the latter keeps coming up, it is also tackled in its own initiative and will receive its own working group soon. Once installed, the group is meant to come up with a prioritised list of issues to fix and check what debugger users are missing when working with Rust code at the moment. Sub-items on the group’s agenda for now are higher debuginfo quality, better integration with trace-based debuggers, and support for split debuginfo.

The next year will also see a bit of what the team calls librarification, meaning the compiler code will continue to be broken into smaller, decoupled parts which can be used as libraries and developed on their own time schedules. On the more aspirational side of things, the team is investigating parallel compilation outside LLVM invocations to improve performance, as well as ways to speed up incremental compilation and reduce redundancies when doing multi-crate builds.

Other than that Rust programmers can expect a bit of change from the rust-analyzer project becoming part of the Rust organisation. The project contains a new implementation of Rust’s Language Server Protocol, which is hoped to become “the officially recommended language server for Rust in the near future” after some technical work.