You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're running cargo test for many Rust crates we package in Fedora Linux to ensure they work in our environment and on all CPU architectures that we support. We define RUSTFLAGS="--cap-lints=warn" (among other things) to avoid crates starting to fail to build due to things like #![deny(warnings)] with newer Rust versions that add new lints.
Passing "--cap-lints=warn" with RUSTFLAGS works fine for normal library code and test code, but it doesn't get applied to rustdoc when it checks / compiles doctests, and this often causes problems because many crates use #![deny(warnings)] for their doctests / example code in doc comments.
I tried defining RUSTDOCFLAGS="--cap-lints=warn" in addition to having this flag already present in RUSTFLAGS, it didn't change the behaviour. I tried adding a build.rustdocflags = "--cap-lints=warn" setting to .cargo/config, and it didn't change anything either.
It appears that cargo test --doc isn't passing either RUSTFLAGS or RUSTDOCFLAGS to rustdoc correctly.
Good test cases might be the rand_core or pyo3 crates, which fail to build doctests with latest Rust stable due to deny(warnings).
Cargo basically passes the user-provided flags as-is to rustc/rustdoc, so I wonder if rustdoc hijacks lint-level flags for something special. Needs some investigations...
We're running
cargo test
for many Rust crates we package in Fedora Linux to ensure they work in our environment and on all CPU architectures that we support. We defineRUSTFLAGS="--cap-lints=warn"
(among other things) to avoid crates starting to fail to build due to things like#![deny(warnings)]
with newer Rust versions that add new lints.Passing "--cap-lints=warn" with RUSTFLAGS works fine for normal library code and test code, but it doesn't get applied to rustdoc when it checks / compiles doctests, and this often causes problems because many crates use
#![deny(warnings)]
for their doctests / example code in doc comments.I tried defining
RUSTDOCFLAGS="--cap-lints=warn"
in addition to having this flag already present in RUSTFLAGS, it didn't change the behaviour. I tried adding abuild.rustdocflags = "--cap-lints=warn"
setting to.cargo/config
, and it didn't change anything either.It appears that
cargo test --doc
isn't passing either RUSTFLAGS or RUSTDOCFLAGS to rustdoc correctly.Good test cases might be the rand_core or pyo3 crates, which fail to build doctests with latest Rust stable due to
deny(warnings)
.Originally filed here:
rust-lang/rust#123424
The text was updated successfully, but these errors were encountered: