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 InformationRelated ArticlesRust Lang Releases 2024 Roadmap Rust 1.50 Improves Array Indexing Rust Team Announces Rust Foundation 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.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Tuesday, 21 June 2022 ) |