Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

capping lints does not work for rustdoc #66623

Closed
kentfredric opened this issue Nov 22, 2019 · 4 comments
Closed

capping lints does not work for rustdoc #66623

kentfredric opened this issue Nov 22, 2019 · 4 comments
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.

Comments

@kentfredric
Copy link

As I mentioned in #66622 , there's a fun thing that happens:

--cap-lints warn can be over-ridden, apparently by attributes in macros, when run under rustdoc, which pretty much defeats the points of --cap-lints

With rand 0.5.6:

RUSTFLAGS="--cap-lints warn" cargo test --doc  --verbose
... 
 test src/prng/chacha.rs - prng::chacha::ChaChaRng::new_unseeded (line 115) ... ok
test src/prelude.rs - prelude (line 17) ... ok
test src/rngs/jitter.rs - rngs::jitter::JitterRng (line 72) ... FAILED
test src/lib.rs - sample (line 1020) ... ok
test src/rngs/adapter/read.rs - rngs::adapter::read::ReadRng (line 35) ... ok
test src/rngs/jitter.rs - rngs::jitter::JitterRng::new_with_timer (line 318) ... ok
...
failures:

---- src/rngs/jitter.rs - rngs::jitter::JitterRng (line 72) stdout ----
error: trait objects without an explicit `dyn` are deprecated
  --> src/rngs/jitter.rs:79:33
   |
10 | fn try_main() -> Result<(), Box<Error>> {
   |                                 ^^^^^ help: use `dyn`: `dyn Error`
   |
note: lint level defined here
  --> src/rngs/jitter.rs:71:9
   |
2  | #![deny(warnings)]
   |         ^^^^^^^^
   = note: `#[deny(bare_trait_objects)]` implied by `#[deny(warnings)]`

error: aborting due to previous error

It seems that, this line, in src/lib.rs takes precedence over lint-capping :(

#![doc(test(attr(allow(unused_variables), deny(warnings))))]
@jonas-schievink jonas-schievink added A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Nov 22, 2019
@kentfredric
Copy link
Author

To add insult to injury, I've discovered this also happens for lints that are defaulted on, as demonstrated by byteorder 0.5.3

running 6 tests
test src/lib.rs - ByteOrder (line 114) ... FAILED
test src/lib.rs - ByteOrder (line 104) ... ok
test src/lib.rs -  (line 15) ... ok
test src/lib.rs -  (line 28) ... ok
test src/new.rs - new::ReadBytesExt (line 15) ... ok
test src/new.rs - new::WriteBytesExt (line 143) ... ok

failures:

---- src/lib.rs - ByteOrder (line 114) stdout ----
error: literal out of range for `i16`
 --> src/lib.rs:118:33
  |
7 | BigEndian::write_i16(&mut buf, -50_000);
  |                                 ^^^^^^
  |
  = note: `#[deny(overflowing_literals)]` on by default

error: literal out of range for `i16`
 --> src/lib.rs:119:13
  |
8 | assert_eq!(-50_000, BigEndian::read_i16(&buf));
  |             ^^^^^^

error: aborting due to 2 previous errors

Couldn't compile the test.

failures:
    src/lib.rs - ByteOrder (line 114)

test result: FAILED. 5 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out

Nothing I can do to resolve this other than patching the source. ( this issue is fixed in newer byteorders, but due to some deep dependency chain, the old byteorder is still required, and so as a linux vendor, we desire tests to run, but this failure isn't a useful one )

@jyn514
Copy link
Member

jyn514 commented Aug 27, 2020

Duplicate of #67533 - cap-lints is currently ignored for doctests.

@jyn514 jyn514 closed this as completed Aug 27, 2020
@kentfredric
Copy link
Author

Technically I think the other bug is the dupe, being newer, but not sure what standard conventions for this are on github

@jyn514
Copy link
Member

jyn514 commented Aug 28, 2020

Ah well, you're right and I just happened to see the other first 😆 feel free to comment there if it's missing info you had here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lints Area: Lints (warnings about flaws in source code) such as unused_mut. C-bug Category: This is a bug. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants