未来不兼容报告
Cargo 会检查所有依赖项中是否存在未来不兼容的警告。这些警告是指未来可能变成硬性错误的更改,导致依赖项在未来版本的 rustc 中停止构建。如果发现任何警告,将显示一个小通知,指示发现了警告,并提供有关如何显示完整报告的说明。
例如,你可能会在构建结束时看到类似这样的内容
warning: the following packages contain code that will be rejected by a future
version of Rust: rental v0.5.5
note: to see what the problems were, use the option `--future-incompat-report`,
or run `cargo report future-incompatibilities --id 1`
可以使用 cargo report future-incompatibilities --id ID
命令显示完整报告,或者使用 --future-incompat-report
标志再次运行构建。然后,开发人员应将其依赖项更新到已修复问题的版本,或者与依赖项的开发人员合作以帮助解决问题。
配置
可以通过 .cargo/config.toml
中的 [future-incompat-report]
部分配置此功能。目前,支持的选项有
[future-incompat-report]
frequency = "always"
频率支持的值为 "always"
和 "never"
,它们控制是否在 cargo build
/ cargo check
结束时打印消息。