BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Rust 1.60 Released with LLVM-Native Code Coverage Along with Rust 2024 Roadmap

Rust 1.60 Released with LLVM-Native Code Coverage Along with Rust 2024 Roadmap

This item in japanese

Rust 1.60 stabilizes source-based code coverage using LLVM native instrumentation, re-enables incremental compilation by default, and enforces Instant monotonicity guarantees. Additionally, the Rust team has formalized its roadmap for Rust evolution until 2024.

Prior to version 1.60, the Rust compiler provided support for code coverage using a GCC-compatible, gcov-based coverage implementation. Now Rust is additionally able to leverage LLVM's native coverage instrumentation, which promises to be more efficient and precise, says the Rust team.

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

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 measurement of a monotonically non-decreasing clock. Under very specific conditions, mostly related to hardware, virtualization, or OS bugs, monotonicity guarantees could fail and lead to a panic in older versions of Rust. Rust 1.60 introduces a workaround to handle those rare cases where earlier and laster instants could be swapped, basically by saturating to zero those calls that could result in a negative time.

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

The Rust Language Roadmap 2024 aims to clarify how Rust is expected to evolve in the next few years and to help new contributors to find ways to contribute. The roadmap is comprised of three key themes, namely flattening the learning curve, help users help each other, and help Rust to scale.

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

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

This does not rule out though many people experiencing a hard time trying to learn Rust, often related to small details and language idiosyncrasies that the compiler requires to master. Accordingly, one major goal for 2024 is reducing that kind of overhead, specifically in the areas of async and embedded Rust, and making it easier for programmers to focus on their domain problems.

Under the heading of "helping users help each other", the language team understands a number of provisions aimed to empower library creators and remove constraints that reduce their opportunities of helping their users. This in particular will include making it easier to add new features to libraries in a controlled way, providing richer abstractions, extending the possibility authors have to tailor error messages, and improving interoperability.

Last but not least, the language team will also focus on how to make the language grow further:

To ship Rust 2024 and make Rust all that 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 through delegation, empowering developers to own and drive the work that they are passionate about.

To this aim, Rust 2024 will make it easier to understand what the status of things that are in development is, to improve the ownership system and communication, and to refine their internal processes and tools.

About the Author

Rate this Article

Adoption
Style

BT