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

Deny rustc::internal lints for rustdoc and clippy #80573

Merged
merged 2 commits into from
Jan 22, 2021

Conversation

jyn514
Copy link
Member

@jyn514 jyn514 commented Jan 1, 2021

  • Fix rustc::internal lints for rustdoc
  • Deny internal lints only for rustdoc and clippy (previously the lints were ignored for clippy because -Zunstable-options didn't get passed)

@jyn514 jyn514 added C-cleanup Category: PRs that clean code up or issues documenting cleanup. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 1, 2021
@rust-highfive

This comment has been minimized.

@rust-highfive
Copy link
Collaborator

r? @ollie27

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 1, 2021
@jyn514
Copy link
Member Author

jyn514 commented Jan 1, 2021

r? @GuillaumeGomez

@jyn514 jyn514 changed the title Fix rustc::internal lints on rustdoc Deny rustc::internal lints for tools Jan 1, 2021
@jyn514
Copy link
Member Author

jyn514 commented Jan 1, 2021

r? @Mark-Simulacrum

I changed this to be more general and deny the lints right away - I can split it into two PRs if you like.

@jyn514 jyn514 added A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jan 1, 2021
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
    Checking cargo_metadata v0.12.0
    Checking rustfix v0.5.1
    Checking rustc-workspace-hack v1.0.0 (/checkout/src/tools/rustc-workspace-hack)
    Checking clippy_lints v0.0.212 (/checkout/src/tools/clippy/clippy_lints)
error: Prefer FxHashMap over HashMap, it has better performance
   |
36 |     use std::collections::HashMap;
36 |     use std::collections::HashMap;
   |                           ^^^^^^^ help: use: `FxHashMap`
   |
   = note: `-D rustc::default-hash-types` implied by `-D warnings`
   = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

error: Prefer FxHashMap over HashMap, it has better performance
   |
   |
39 |     let mut crates: HashMap<&str, PathBuf> = HashMap::with_capacity(CRATES.len());
   |                     ^^^^^^^ help: use: `FxHashMap`
   |
   = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

error: Prefer FxHashMap over HashMap, it has better performance
   |
   |
39 |     let mut crates: HashMap<&str, PathBuf> = HashMap::with_capacity(CRATES.len());
   |                                              ^^^^^^^ help: use: `FxHashMap`
   |
   = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary
error: aborting due to 3 previous errors

error: could not compile `clippy`


To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "i686-pc-windows-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/tools/clippy/Cargo.toml" "--features" "rustc-workspace-hack/all-static" "--all-targets" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu --all-targets
Build completed unsuccessfully in 0:03:12

@jyn514
Copy link
Member Author

jyn514 commented Jan 1, 2021

Hmm, this errors out in clippy/tests/compile-test.rs because it uses HashMap instead of FxHashMap. But that's not right, because compiletest is a bootstrap tool and doesn't depend on rustc_data_structures. I think I need to find a way to only do this for regular code and not tests? It sounds difficult to do that without special casing clippy though, I can imagine wanting these lints for rustc unit tests.

@jyn514 jyn514 added the T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. label Jan 1, 2021
@flip1995
Copy link
Member

flip1995 commented Jan 2, 2021

I'm good with adding #![allow(rustc::internal)] to clippys compile-test.rs file.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
   Compiling serde_json v1.0.59
    Checking fnv v1.0.7
error[E0463]: can't find crate for `core`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `lazy_static`
error: could not compile `lazy_static`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `core`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: build failed
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "i686-pc-windows-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/bootstrap/Cargo.toml" "--all-targets" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu --all-targets
Build completed unsuccessfully in 0:03:00

@jyn514
Copy link
Member Author

jyn514 commented Jan 2, 2021

The failure seems spurious, not sure why it wouldn't have libstd for other targets installed.

@rust-log-analyzer
Copy link
Collaborator

The job mingw-check failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
configure: rust.channel         := nightly
configure: rust.debug-assertions := True
configure: llvm.assertions      := True
configure: dist.missing-tools   := True
configure: build.configure-args := ['--enable-sccache', '--disable-manage-submodu ...
configure: writing `config.toml` in current directory
configure: 
configure: run `python /checkout/x.py --help`
configure: 
---
    Checking fnv v1.0.7
   Compiling serde_json v1.0.59
error[E0463]: can't find crate for `core`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `core`
error[E0463]: can't find crate for `core`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `lazy_static`
error: could not compile `lazy_static`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `std`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error[E0463]: can't find crate for `std`
error[E0463]: can't find crate for `std`
  |
  = note: the `i686-pc-windows-gnu` target may not be installed
error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: build failed
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "check" "--target" "i686-pc-windows-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/bootstrap/Cargo.toml" "--all-targets" "--message-format" "json-render-diagnostics"
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap check --target=i686-pc-windows-gnu --host=i686-pc-windows-gnu --all-targets
Build completed unsuccessfully in 0:02:40

@jyn514
Copy link
Member Author

jyn514 commented Jan 2, 2021

Hmm, it seems this affects rustfmt too.

warning: Prefer FxHashMap over HashMap, it has better performance
  --> src/tools/rustfmt/src/lib.rs:12:23
   |
12 | use std::collections::HashMap;
   |                       ^^^^^^^ help: use: `FxHashMap`
   |
   = note: `-W rustc::default-hash-types` implied by `-W rustc::internal`
   = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashSet over HashSet, it has better performance
 --> src/tools/rustfmt/src/config/options.rs:1:34
  |
1 | use std::collections::{hash_set, HashSet};
  |                                  ^^^^^^^ help: use: `FxHashSet`
  |
  = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

warning: Prefer FxHashSet over HashSet, it has better performance
   --> src/tools/rustfmt/src/config/options.rs:282:15
    |
282 |     path_set: HashSet<PathBuf>,
    |               ^^^^^^^ help: use: `FxHashSet`
    |
    = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

warning: Prefer FxHashSet over HashSet, it has better performance
   --> src/tools/rustfmt/src/config/options.rs:322:26
    |
322 |             type Value = HashSet<PathBuf>;
    |                          ^^^^^^^ help: use: `FxHashSet`
    |
    = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

warning: Prefer FxHashSet over HashSet, it has better performance
   --> src/tools/rustfmt/src/config/options.rs:332:36
    |
332 |                 let mut path_set = HashSet::new();
    |                                    ^^^^^^^ help: use: `FxHashSet`
    |
    = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
 --> src/tools/rustfmt/src/config/file_lines.rs:4:23
  |
4 | use std::collections::HashMap;
  |                       ^^^^^^^ help: use: `FxHashMap`
  |
  = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/config/file_lines.rs:157:29
    |
157 | pub struct FileLines(Option<HashMap<FileName, Vec<Range>>>);
    |                             ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/config/file_lines.rs:176:34
    |
176 | fn normalize_ranges(ranges: &mut HashMap<FileName, Vec<Range>>) {
    |                                  ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/config/file_lines.rs:208:36
    |
208 |     pub fn from_ranges(mut ranges: HashMap<FileName, Vec<Range>>) -> FileLines {
    |                                    ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/config/file_lines.rs:215:35
    |
215 |         Files(self.0.as_ref().map(HashMap::keys))
    |                                   ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/config/file_lines.rs:305:21
    |
305 |         let mut m = HashMap::new();
    |                     ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
 --> src/tools/rustfmt/src/formatting.rs:3:23
  |
3 | use std::collections::HashMap;
  |                       ^^^^^^^ help: use: `FxHashMap`
  |
  = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/formatting.rs:313:34
    |
313 | pub(crate) type FormatErrorMap = HashMap<FileName, Vec<FormattingError>>;
    |                                  ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
  --> src/tools/rustfmt/src/macros.rs:12:23
   |
12 | use std::collections::HashMap;
   |                       ^^^^^^^ help: use: `FxHashMap`
   |
   = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/macros.rs:576:15
    |
576 |     map: &mut HashMap<String, String>,
    |               ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/macros.rs:595:50
    |
595 | fn replace_names(input: &str) -> Option<(String, HashMap<String, String>)> {
    |                                                  ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/macros.rs:598:22
    |
598 |     let mut substs = HashMap::new();
    |                      ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/lib.rs:188:45
    |
188 |             internal: Rc::new(RefCell::new((HashMap::new(), ReportedErrors::default()))),
    |                                             ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: 18 warnings emitted

error: Prefer FxHashSet over HashSet, it has better performance
  --> src/tools/rustfmt/src/format-diff/main.rs:15:23
   |
15 | use std::collections::HashSet;
   |                       ^^^^^^^ help: use: `FxHashSet`
   |
note: the lint level is defined here
  --> src/tools/rustfmt/src/format-diff/main.rs:5:9
   |
5  | #![deny(warnings)]
   |         ^^^^^^^^
   = note: `#[deny(rustc::default_hash_types)]` implied by `#[deny(warnings)]`
   = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

error: Prefer FxHashSet over HashSet, it has better performance
  --> src/tools/rustfmt/src/format-diff/main.rs:88:24
   |
88 | fn run_rustfmt(files: &HashSet<String>, ranges: &[Range]) -> Result<(), FormatDiffError> {
   |                        ^^^^^^^ help: use: `FxHashSet`
   |
   = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

error: Prefer FxHashSet over HashSet, it has better performance
   --> src/tools/rustfmt/src/format-diff/main.rs:125:14
    |
125 | ) -> Result<(HashSet<String>, Vec<Range>), FormatDiffError>
    |              ^^^^^^^ help: use: `FxHashSet`
    |
    = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

error: Prefer FxHashSet over HashSet, it has better performance
   --> src/tools/rustfmt/src/format-diff/main.rs:138:21
    |
138 |     let mut files = HashSet::new();
    |                     ^^^^^^^ help: use: `FxHashSet`
    |
    = note: a `use rustc_data_structures::fx::FxHashSet` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
 --> src/tools/rustfmt/src/bin/main.rs:8:23
  |
8 | use std::collections::HashMap;
  |                       ^^^^^^^ help: use: `FxHashMap`
  |
  = note: `-W rustc::default-hash-types` implied by `-W rustc::internal`
  = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/bin/main.rs:505:20
    |
505 |     inline_config: HashMap<String, String>,
    |                    ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

warning: Prefer FxHashMap over HashMap, it has better performance
   --> src/tools/rustfmt/src/bin/main.rs:586:31
    |
586 |             .collect::<Result<HashMap<_, _>, _>>()?;
    |                               ^^^^^^^ help: use: `FxHashMap`
    |
    = note: a `use rustc_data_structures::fx::FxHashMap` may be necessary

error: aborting due to 4 previous errors

error: could not compile `rustfmt-nightly`

@calebcartwright how do you feel about fixing those lints for rustfmt? Or would you prefer I ignore them?

@calebcartwright
Copy link
Member

@calebcartwright how do you feel about fixing those lints for rustfmt? Or would you prefer I ignore them?

Admittedly haven't read the full thread/linked issues, but I feel like rustfmt should be ignored/excluded from this.

Although we periodically run clippy and selectively apply fixes, it's not really part of our inner dev loop and not a fixed gate, and I don't foresee that changing any time soon. If we were to include the internal lints against rustfmt here then we'll inevitably end up in a scenario where we don't find out about a lint failure til an attempted submod bump which would then require a restart of our upgrade dance.

Also, since rustfmt utilizes the rustc internals via the auto publish crates, I really don't want to increase our dependence on said internals unless absolutely necessary or unless the benefits significantly outweigh the drawbacks. Retroactively dealing with breaking rustc internal changes in rustfmt is already painful enough, and that pain gets exacerbated the more we couple ourselves to those internals.

@flip1995
Copy link
Member

flip1995 commented Jan 2, 2021

I think it would be best to make internal lints opt-in rather than opt-out, if that's somehow possible.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-tools failed! Check out the build log: (web) (plain)

Click to see the possible cause of the failure (guessed by this bot)
  SCCACHE_BUCKET: rust-lang-ci-sccache2
  TOOLSTATE_REPO: https://github.com/rust-lang-nursery/rust-toolstate
  CACHE_DOMAIN: ci-caches.rust-lang.org
  EXTRA_VARIABLES: {
 "CI_ONLY_WHEN_SUBMODULES_CHANGED": 1
##[endgroup]
adding extra environment variable CI_ONLY_WHEN_SUBMODULES_CHANGED
linux builder detected, using docker to run the build
##[group]Run src/ci/scripts/should-skip-this.sh
---
  CACHE_DOMAIN: ci-caches.rust-lang.org
  CI_ONLY_WHEN_SUBMODULES_CHANGED: 1
  IMAGE: x86_64-gnu-tools
##[endgroup]
Executing the job since clippy subtree was updated
with:
  github_token: ***
  check_every_seconds: 60
env:
---
   Compiling memchr v2.3.3
   Compiling serde_json v1.0.59
   Compiling itoa v0.4.6
   Compiling pulldown-cmark v0.8.0
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
error: aborting due to previous error
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error: could not compile `unicode-xid`
To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: aborting due to previous error

---
   Compiling smallvec v1.4.2
   Compiling if_chain v1.0.0
   Compiling ryu v1.0.5
   Compiling bitflags v1.2.1
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
For more information about this error, try `rustc --explain E0602`.
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`
error: could not compile `matches`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
warning: build failed, waiting for other jobs to finish...
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
For more information about this error, try `rustc --explain E0602`.
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`

error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
error: aborting due to previous error
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
error[E0602]: unknown lint: `rustc::internals`
  |
  = note: requested on the command line with `-W rustc::internals`
error: aborting due to previous error

For more information about this error, try `rustc --explain E0602`.
error: aborting due to previous error
---
For more information about this error, try `rustc --explain E0602`.
error: build failed
command did not execute successfully: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo" "build" "--target" "x86_64-unknown-linux-gnu" "-Zbinary-dep-depinfo" "-j" "16" "--release" "--locked" "--color" "always" "--manifest-path" "/checkout/src/tools/clippy/Cargo.toml" "--features" "rustc-workspace-hack/all-static" "--message-format" "json-render-diagnostics"
expected success, got: exit code: 101
thread 'main' panicked at 'in-tree tool', src/bootstrap/test.rs:532:14
failed to run: /checkout/obj/build/bootstrap/debug/bootstrap test --stage 2 src/tools/clippy
Build completed unsuccessfully in 0:00:03

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2021
@Mark-Simulacrum
Copy link
Member

It looks like CI is currently failing. Since unlike rustc, rustdoc and clippy are both currently just one crate (and we don't need to lint their dependencies) maybe just easier to directly add the two attributes to their lib.rs?

@jyn514
Copy link
Member Author

jyn514 commented Jan 9, 2021

It looks like CI is currently failing. Since unlike rustc, rustdoc and clippy are both currently just one crate (and we don't need to lint their dependencies) maybe just easier to directly add the two attributes to their lib.rs?

Hmm, that will work now, but will break after #80524, which was the original motivation. I'll see if I can improve #80524 not to need bootstrap changes, since I agree #![deny(rustc::internal)] is probably a better approach in general.

@Mark-Simulacrum
Copy link
Member

Mark-Simulacrum commented Jan 10, 2021

Hm I admit I haven't followed that PR closely, if this helps it somehow I can take a look.

Note you want to use warn, not deny - we deny warnings in bootstrap and that should include these lints, right?

@jyn514
Copy link
Member Author

jyn514 commented Jan 22, 2021

Alright, this is finally working. It

  • denies internal lints only for rustdoc and clippy (previously the lints were ignored for clippy because -Zunstable-options didn't get passed)
  • fixes the internal lints for rustdoc

@jyn514 jyn514 changed the title Deny rustc::internal lints for tools Deny rustc::internal lints for rustdoc and clippy Jan 22, 2021
@jyn514 jyn514 added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 22, 2021
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@GuillaumeGomez
Copy link
Member

Thanks!

@bors: r+

@flip1995
Copy link
Member

@GuillaumeGomez bors doesn't react to commands in review comments, only in normal comments.

@GuillaumeGomez
Copy link
Member

It was a normal comment. I didn't post a review comment. But let's try again.

@bors: r+

@bors
Copy link
Contributor

bors commented Jan 22, 2021

📌 Commit 0797ffe has been approved by GuillaumeGomez

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 22, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 22, 2021
Rollup of 10 pull requests

Successful merges:

 - rust-lang#80573 (Deny rustc::internal lints for rustdoc and clippy)
 - rust-lang#81173 (Expand docs on Iterator::intersperse)
 - rust-lang#81194 (Stabilize std::panic::panic_any.)
 - rust-lang#81202 (Don't prefix 0x for each segments in `dbg!(Ipv6)`)
 - rust-lang#81225 (Make 'docs' nullable in rustdoc-json output)
 - rust-lang#81227 (Remove doctree::StructType)
 - rust-lang#81233 (Document why not use concat! in dbg! macro)
 - rust-lang#81236 (Gracefully handle loop labels missing leading `'` in different positions)
 - rust-lang#81241 (Turn alloc's force_expr macro into a regular macro_rules.)
 - rust-lang#81242 (Enforce statically that `MIN_NON_ZERO_CAP` is calculated at compile time)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 98c0364 into rust-lang:master Jan 22, 2021
@rustbot rustbot added this to the 1.51.0 milestone Jan 22, 2021
@jyn514 jyn514 deleted the tool-lints branch January 22, 2021 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: Lints (warnings about flaws in source code) such as unused_mut. C-cleanup Category: PRs that clean code up or issues documenting cleanup. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-dev-tools Relevant to the dev-tools subteam, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants