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

Cargo doc regression in crates that include #![deny(unused_imports)] #51661

Closed
dtolnay opened this issue Jun 20, 2018 · 7 comments
Closed

Cargo doc regression in crates that include #![deny(unused_imports)] #51661

dtolnay opened this issue Jun 20, 2018 · 7 comments
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Milestone

Comments

@dtolnay
Copy link
Member

dtolnay commented Jun 20, 2018

#![deny(unused_imports)]

use std::fs::File;

pub fn f() {
    let _: File;
}

cargo doc of the above lib.rs works up through cargo +nightly-2018-06-17 doc. As of cargo +nightly-2018-06-18 doc it fails with:

$ cargo +nightly-2018-06-18 doc
 Documenting unused-imports v0.0.0
error: unused import: `std::fs::File`
 --> src/lib.rs:3:5
  |
3 | use std::fs::File;
  |     ^^^^^^^^^^^^^
  |
note: lint level defined here
 --> src/lib.rs:1:9
  |
1 | #![deny(unused_imports)]
  |         ^^^^^^^^^^^^^^

error: Compilation failed, aborting rustdoc

error: Could not document `unused-imports`.
@dtolnay dtolnay added T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 20, 2018
@dtolnay
Copy link
Member Author

dtolnay commented Jun 20, 2018

That commit range: ae46aef...86a8f1a. Mentioning @QuietMisdreavus and @GuillaumeGomez who were touching librustdoc in that range and @petrochenkov who reviewed #51425.

@GuillaumeGomez
Copy link
Member

The problem is a bit complex (to say the least)...

@pietroalbini pietroalbini added regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Jun 20, 2018
@pietroalbini pietroalbini added this to the 1.28 milestone Jun 20, 2018
@QuietMisdreavus
Copy link
Member

The problem was the introduction of the intra_doc_links_resolution_failure lint, which caused rustdoc to stop capping lints:

lint_cap: Some(lint::Forbid),

The sample in this issue (and the regression in winapi in #51689) both explicitly deny the lint, despite us allowing it in rustdoc ahead of time. We need a way to disable this lint (and potentially any others that are affected by everybody-loops?) when rustdoc is running. Alternately, some kind of "porous lint cap" that still lets us fire the intra-doc-links lint? Is that possible with the current system?

@GuillaumeGomez
Copy link
Member

It requires investigation but I think we can.

@marshallpierce
Copy link

unused_extern_crates causes a similar problem (see marshallpierce/rust-base64#64). Same root cause, or should I open a separate issue?

@GuillaumeGomez
Copy link
Member

No, it's the same source. I know what the problem is, just need to fix it when I have time.

@ollie27
Copy link
Member

ollie27 commented Jul 21, 2018

I don't think we can consider this fixed yet. I get the impression from #51956 that the only lints that rustdoc is supposed to emit are missing_docs and intra_link_resolution_failure but some other lints like the following still trigger:

#![deny(non_upper_case_globals)]

pub const foo: u8 = 0;
error: constant `foo` should have an upper case name such as `FOO`
 --> a.rs:3:1
  |
3 | pub const foo: u8 = 0;
  | ^^^^^^^^^^^^^^^^^^^^^^
  |
note: lint level defined here
 --> a.rs:1:9
  |
1 | #![deny(non_upper_case_globals)]
  |         ^^^^^^^^^^^^^^^^^^^^^^

error: Compilation failed, aborting rustdoc

On 1.27 stable that would document without any issues.

bors added a commit that referenced this issue Jul 28, 2018
[beta] Disable lints in rustdoc

The lint handling in rustdoc 1.28 is still incomplete so I think it would be best to disable it for the stable release. The main thing that's missing is that cargo doesn't cap lints for dependencies. This was fixed in master by #52354 and rust-lang/cargo#5765 but they haven't been backported. Additionally rustdoc is still emitting lints that are not on its whitelist #51661 (comment).

cc. @rust-lang/rustdoc
moshg pushed a commit to moshg/rust-std-ja that referenced this issue Apr 4, 2020
[beta] Disable lints in rustdoc

The lint handling in rustdoc 1.28 is still incomplete so I think it would be best to disable it for the stable release. The main thing that's missing is that cargo doesn't cap lints for dependencies. This was fixed in master by #52354 and rust-lang/cargo#5765 but they haven't been backported. Additionally rustdoc is still emitting lints that are not on its whitelist rust-lang/rust#51661 (comment).

cc. @rust-lang/rustdoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regression-from-stable-to-beta Performance or correctness regression from stable to beta. 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

6 participants