Rust 1.60 released with native LLVM code coverage along with Rust 2024 roadmap

Rust 1.60 stabilizes source code coverage using native LLVM instrumentation, re-enables default incremental compilation, and enforces Instant guarantees of monotony. Additionally, the Rust team has formalized their roadmap for Evolution of rust until 2024.

Prior to version 1.60, the Rust compiler supported code coverage using a GCC-compatible coverage implementation based on gcov. Now Rust is also able to take advantage of LLVM’s native hedging instrumentationwhich promises to be more efficient and more precise, specifies the Rust team.

This new feature is enabled using the -C instrument_coverage option, which injects calls to LLVM llvm.instrprof.increment intrinsic to functions and branches to increment profiling counters when a conditional section of code is executed; moreover, it embeds specific information in the data section of each library and analyzed binary. The resulting binary can then be executed to produce a default.profraw file, which can be processed using llvm-profdata race:

rustup component add llvm-tools-preview
$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata merge -sparse default.profraw -o default.profdata
$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-cov show -Xdemangler=rustfilt target/debug/coverage-testing 
    -instr-profile=default.profdata 
    -show-line-counts-or-regions 
    -show-instantiations

Rust Instant provides a measure of a non-decreasing monotonic clock. Under very specific conditions, mostly related to hardware, virtualization, or operating system bugs, monotonicity guarantees could fail and cause panic in older versions of Rust. Rust 1.60 introduces a workaround to handle the rare cases where previous and last times could be swapped, essentially zeroing out calls that could result in negative time.

As mentioned, Rust 1.60 also re-enables incremental compilation by default, which was disabled in Rust 1.59 due to a bug which could cause deserialization errors.

The Rust 2024 language roadmap aims to clarify how Rust should evolve over the next few years and help new contributors find ways to contribute. The roadmap includes three key themes, namely flattening the learning curve, helping users help each other, and helping Rust scale.

According to the team, Rust has become considerably easier to use since its introduction in 2015:

Companies that build large teams of Rust users report that the typical onboarding time for a Rust engineer is around 3-6 months. Once people learn Rust, they generally love it.

This does not exclude that many people have difficulty learning Rust, often due to small details and language idiosyncrasies that the compiler must master. As a result, one of the main goals for 2024 is to reduce this kind of overhead, especially in the areas of asynchronous and embedded Rust, and make it easier for programmers to focus on their domain issues.

Under the heading “Helping Users Help Each Other”, the Language Team includes a number of provisions aimed at empowering library creators and removing constraints that reduce their ability to help their users. This will include making it easier to add new functionality to libraries in a controlled manner, providing richer abstractions, expanding the ability for authors to customize error messages, and improving interoperability.

Finally, the language team will also focus on how to evolve the language:

To ship Rust 2024 and make Rust all it can be, we need a system that makes it easy for people to find out what’s going on and how they can help. We want to scale our language development by delegation, empowering developers to own and drive the work they’re passionate about.

To this end, Rust 2024 will make it easier to understand the state of things in development, improve the ownership system and communication, and refine their internal processes and tools.

Comments are closed.