Skip to content

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

Closed

Description

@dtolnay
#![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`.

Activity

  1. added
    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.
    on Jun 20, 2018
  2. dtolnay commented on Jun 20, 2018

    @dtolnay
    MemberAuthor

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

  3. GuillaumeGomez commented on Jun 20, 2018

    @GuillaumeGomez
    Member

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

  4. added and removed on Jun 20, 2018
  5. added this to the 1.28 milestone on Jun 20, 2018
  6. QuietMisdreavus commented on Jun 21, 2018

    @QuietMisdreavus
    Contributor

    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?

  7. GuillaumeGomez commented on Jun 21, 2018

    @GuillaumeGomez
    Member

    It requires investigation but I think we can.

  8. marshallpierce commented on Jun 25, 2018

    @marshallpierce

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

  9. GuillaumeGomez commented on Jun 25, 2018

    @GuillaumeGomez
    Member

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

  10. added a commit that references this issue on Jun 30, 2018
  11. added a commit that references this issue on Jul 9, 2018
    bdd185c
  12. ollie27 commented on Jul 21, 2018

    @ollie27
    Contributor

    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.

  13. added a commit that references this issue on Jul 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    T-rustdocRelevant to the rustdoc team, which will review and decide on the PR/issue.regression-from-stable-to-betaPerformance or correctness regression from stable to beta.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions