From 4b1d13e11501d378cf7289a71c0e5fc0bbc416cc Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Sat, 5 Nov 2022 15:16:00 +0100 Subject: [PATCH 1/2] Enable internal feature when testing Clippy Clippy has internal lints, that only get build and tested, when the `internal` feature is enabled. Those tests are just regular UI tests, but split out from the normal UI tests, because they usually don't have to be touched when changing something in Clippy. However, changes to Rust internals often require updates of the internal lints, just as for the Rest of the Clippy codebase. Currently I fix this fallout during the sync. But this can lead to sync blockers in rare occasions. --- src/bootstrap/test.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 38873cee93bd9..36229e190c637 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -694,7 +694,11 @@ impl Step for Clippy { let compiler = builder.compiler(stage, host); builder - .ensure(tool::Clippy { compiler, target: self.host, extra_features: Vec::new() }) + .ensure(tool::Clippy { + compiler, + target: self.host, + extra_features: vec!["internal".into()], + }) .expect("in-tree tool"); let mut cargo = tool::prepare_tool_cargo( builder, @@ -704,7 +708,7 @@ impl Step for Clippy { "test", "src/tools/clippy", SourceType::InTree, - &[], + &["internal".into()], ); cargo.env("RUSTC_TEST_SUITE", builder.rustc(compiler)); From 7391e39ea175282ea8dcd90b0527eeca1b29712c Mon Sep 17 00:00:00 2001 From: Philipp Krones Date: Fri, 25 Nov 2022 12:07:15 +0100 Subject: [PATCH 2/2] Fix fallout from Clippy internal features --- .../unnecessary_def_path_hardcoded_path.stderr | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/tools/clippy/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr b/src/tools/clippy/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr index 8bfc060e99106..2a240cc249b0c 100644 --- a/src/tools/clippy/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr +++ b/src/tools/clippy/tests/ui-internal/unnecessary_def_path_hardcoded_path.stderr @@ -1,12 +1,3 @@ -error: hardcoded path to a language item - --> $DIR/unnecessary_def_path_hardcoded_path.rs:11:40 - | -LL | const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"]; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: convert all references to use `LangItem::DerefMut` - = note: `-D clippy::unnecessary-def-path` implied by `-D warnings` - error: hardcoded path to a diagnostic item --> $DIR/unnecessary_def_path_hardcoded_path.rs:10:36 | @@ -14,6 +5,7 @@ LL | const DEREF_TRAIT: [&str; 4] = ["core", "ops", "deref", "Deref"]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: convert all references to use `sym::Deref` + = note: `-D clippy::unnecessary-def-path` implied by `-D warnings` error: hardcoded path to a diagnostic item --> $DIR/unnecessary_def_path_hardcoded_path.rs:12:43 @@ -23,5 +15,13 @@ LL | const DEREF_TRAIT_METHOD: [&str; 5] = ["core", "ops", "deref", "Deref", | = help: convert all references to use `sym::deref_method` +error: hardcoded path to a language item + --> $DIR/unnecessary_def_path_hardcoded_path.rs:11:40 + | +LL | const DEREF_MUT_TRAIT: [&str; 4] = ["core", "ops", "deref", "DerefMut"]; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: convert all references to use `LangItem::DerefMut` + error: aborting due to 3 previous errors