Rust Adds Source-based Code Coverage
Written by Kay Ewbank   
Tuesday, 21 June 2022

Rust 1.61 has been released with improvements including custom exit codes from main, along with source-based code coverage. Rust is now safeguarded by the Rust Foundation, a cross-industry body aimed at supporting the language and its developers.

Rust is popular for situations including being embedded in other languages, writing programs with specific space and time requirements, and writing low-level code.



Support for LLVM-based coverage instrumentation has been stabilized in rustc. This means that the Rust compiler now includes two code coverage implementations - a GCC-compatible, gcov-based coverage implementation, enabled with -Z profile, which derives coverage data based on DebugInfo; and the new source-based code coverage implementation, enabled with -C instrument-coverage, which uses LLVM's native, efficient coverage instrumentation to generate very precise coverage data.

Rust now has better support for Cargo features and how they interact with optional dependencies with the addition of namespaced dependencies and weak dependency features. Namespaced features can be used to explicitly refer to an optional dependency without implicitly exposing it as a feature, while weak dependency features means developers can enable a feature on an optional dependency only if some other feature has enabled the optional dependency.

Release 1.61 also adds the ability to have custom exit codes from main. This improves the ability added in Rust 1.26 to return a success or failure result from Main. These alternate return types have until now been unified by an unstable Termination trait. In this release, the Termination trait is stable, along with a more general ExitCode type that wraps platform-specific return types.

Several incremental features have been stabilized in this release to enable more functionality in const functions, including basic handling of fn pointers and the ability to write trait bounds on generic parameters to const fn.

Rust 1.61 is available now..



More Information

Rust Website

Related Articles

Rust Lang Releases 2024 Roadmap

Rust 1.50 Improves Array Indexing

Rust Team Announces Rust Foundation

Rust Survey 2020

Rust Fast And Safe


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Suspended For Claiming AI Is Sentient

Can a large language model be sentient? This is a news item that has been doing the rounds and just about everyone has some comment to make about it.  But who better to comment than a man accused [ ... ]

Videos From Inaugural Computer History Conference

The First International Research Conference on the History of Computing, dubbed Computing's Woodstock, gathered together a global elite of computer pioneers. It took place in June 1976 and now the Com [ ... ]

More News





or email your comment to:

Last Updated ( Tuesday, 21 June 2022 )