我如何才能让 `rustc` 关于 link 反对哪些原生工件的注释消失?

How can I silence `rustc`'s note about which native artifacts to link against?

我有一个项目,其中自动生成 Rust 源文件并将其编译成静态库。我希望 rustc 的输出像往常一样流式传输到 stdout 和 stderr,但我希望不总是发出以下注释:

note: link against the following native artifacts when linking against this static library

note: the order and any duplication can be significant on some platforms, and so may need to be preserved

note: library: System

note: library: resolv

note: library: c

note: library: m

有没有什么方法可以在不让其他人沉默太多的情况下让这个沉默?当我弄清楚如何自动 link 事情时,这个注释对我很有用,但它对我从未真正看到 linking 过程的用户没有用。

在 Rust 1.21 及更早版本中,无法关闭输出。

在 Rust 1.22 中,添加了 --print=native-static-libs 选项。当它不存在时,它输出:

note: This list will not be printed by default. Please add --print native-static-libs if you need this information.

添加该选项将使警告静音。

要在不隐藏任何其他信息的情况下隐藏此信息,请在发布后升级到 Rust 1.23。

https://github.com/rust-lang/rust/pull/43067