Rust 1.60.0 稳定版发布,增量编译恢复默认开启

Rust 1.60.0 稳定版已正式发布

主要新变化

增量编译恢复默认开启

1.60 版本重新启用了增量编译。Rust 团队继续致力于修复增量编译中的错误,目前还没有发现会导致大范围破坏的问题,因此重新启用了增量编译。此外,编译器团队正在继续研究长期策略,以避免未来出现这类问题。

基于源的代码覆盖率

rustc 中对基于 LLVM 的覆盖率分析的支持已到达稳定状态,现在可使用-Cinstrument-coverage来重新构建代码,例如:

RUSTFLAGS="-C instrument-coverage" cargo build

之后,开发者可以运行生成的二进制文件,它将在当前目录下产生一个default.profraw文件(路径和文件名可以被环境变量覆盖,详见文档)。

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

cargo --timings

Cargo 使用--timings flag收集构建信息的功能已到达稳定状态。

$ cargo build --timings
   Compiling hello-world v0.1.0 (hello-world)
      Timing report saved to target/cargo-timings/cargo-timing-20220318T174818Z.html
    Finished dev [unoptimized + debuginfo] target(s) in 0.98s

面向 Cargo 的新语法

此版本引入了两项新的变更以改进对 Cargo 的支持,以及它们如何与可选依赖项交互:

  • 命名空间依赖项 (Namespaced dependencies)
  • 弱依赖项 (weak dependency)

稳定的 API 列表

部分方法和 trait 实现已稳定化,点此查看详情

下载地址:https://github.com/rust-lang/rust/releases/tag/1.60.0

猜你喜欢

转载自www.oschina.net/news/190169/rust-1-60-0-released