Merge builtins
into EarlyLintPassObjects
.
This avoids calling `early_lint_node` twice. Note: one `early_lint_node` call had `!pre_expansion` for the second argument and the other had `false`. The new single call just has `!pre_expansion`. This results in a reduction of duplicate error messages in some `ui-fulldeps` tests. The order of some `ui-fulldeps` output also changes, but that doesn't matter.
This commit is contained in:
parent
44cb4f70a8
commit
a9b02af62b
12 changed files with 93 additions and 147 deletions
|
@ -393,36 +393,25 @@ pub fn check_ast_node<'a>(
|
|||
lint_store: &LintStore,
|
||||
registered_tools: &RegisteredTools,
|
||||
lint_buffer: Option<LintBuffer>,
|
||||
builtin_lints: impl EarlyLintPass,
|
||||
builtin_lints: impl EarlyLintPass + 'static,
|
||||
check_node: impl EarlyCheckNode<'a>,
|
||||
) {
|
||||
let passes =
|
||||
if pre_expansion { &lint_store.pre_expansion_passes } else { &lint_store.early_passes };
|
||||
let mut passes: Vec<_> = passes.iter().map(|p| (p)()).collect();
|
||||
let mut buffered = lint_buffer.unwrap_or_default();
|
||||
passes.push(Box::new(builtin_lints));
|
||||
|
||||
let mut buffered = lint_buffer.unwrap_or_default();
|
||||
buffered = early_lint_node(
|
||||
sess,
|
||||
!pre_expansion,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
builtin_lints,
|
||||
EarlyLintPassObjects { lints: &mut passes[..] },
|
||||
check_node,
|
||||
);
|
||||
|
||||
if !passes.is_empty() {
|
||||
buffered = early_lint_node(
|
||||
sess,
|
||||
false,
|
||||
lint_store,
|
||||
registered_tools,
|
||||
buffered,
|
||||
EarlyLintPassObjects { lints: &mut passes[..] },
|
||||
check_node,
|
||||
);
|
||||
}
|
||||
|
||||
// All of the buffered lints should have been emitted at this point.
|
||||
// If not, that means that we somehow buffered a lint for a node id
|
||||
// that was not lint-checked (perhaps it doesn't exist?). This is a bug.
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> <crate attribute>:1:1
|
||||
|
|
||||
LL | plugin(lint_plugin_test)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: item is named 'lintme'
|
||||
--> $DIR/lint-plugin-cmdline-load.rs:8:1
|
||||
|
|
||||
|
@ -14,5 +6,13 @@ LL | fn lintme() { }
|
|||
|
|
||||
= note: `#[warn(test_lint)]` on by default
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> <crate attribute>:1:1
|
||||
|
|
||||
LL | plugin(lint_plugin_test)
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-deny-attr.rs:5:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: item is named 'lintme'
|
||||
--> $DIR/lint-plugin-deny-attr.rs:9:1
|
||||
|
|
||||
|
@ -18,5 +10,13 @@ note: the lint level is defined here
|
|||
LL | #![deny(test_lint)]
|
||||
| ^^^^^^^^^
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-deny-attr.rs:5:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-deny-cmdline.rs:6:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: item is named 'lintme'
|
||||
--> $DIR/lint-plugin-deny-cmdline.rs:9:1
|
||||
|
|
||||
|
@ -14,5 +6,13 @@ LL | fn lintme() { }
|
|||
|
|
||||
= note: requested on the command line with `-D test-lint`
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-deny-cmdline.rs:6:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to previous error; 1 warning emitted
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ fn lintme() {} //~ ERROR item is named 'lintme'
|
|||
#[allow(test_lint)]
|
||||
//~^ ERROR allow(test_lint) incompatible
|
||||
//~| ERROR allow(test_lint) incompatible
|
||||
//~| ERROR allow(test_lint) incompatible
|
||||
pub fn main() {
|
||||
lintme();
|
||||
}
|
||||
|
|
|
@ -7,23 +7,6 @@ LL | #![forbid(test_lint)]
|
|||
LL | #[allow(test_lint)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
error[E0453]: allow(test_lint) incompatible with previous forbid
|
||||
--> $DIR/lint-plugin-forbid-attrs.rs:11:9
|
||||
|
|
||||
LL | #![forbid(test_lint)]
|
||||
| --------- `forbid` level set here
|
||||
...
|
||||
LL | #[allow(test_lint)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-forbid-attrs.rs:5:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: item is named 'lintme'
|
||||
--> $DIR/lint-plugin-forbid-attrs.rs:9:1
|
||||
|
|
||||
|
@ -45,6 +28,14 @@ LL | #![forbid(test_lint)]
|
|||
LL | #[allow(test_lint)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-forbid-attrs.rs:5:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0453`.
|
||||
|
|
|
@ -9,7 +9,7 @@ fn lintme() { } //~ ERROR item is named 'lintme'
|
|||
|
||||
#[allow(test_lint)] //~ ERROR allow(test_lint) incompatible
|
||||
//~| ERROR allow(test_lint) incompatible
|
||||
//~| ERROR allow(test_lint)
|
||||
|
||||
pub fn main() {
|
||||
lintme();
|
||||
}
|
||||
|
|
|
@ -6,22 +6,6 @@ LL | #[allow(test_lint)]
|
|||
|
|
||||
= note: `forbid` lint level was set on command line
|
||||
|
||||
error[E0453]: allow(test_lint) incompatible with previous forbid
|
||||
--> $DIR/lint-plugin-forbid-cmdline.rs:10:9
|
||||
|
|
||||
LL | #[allow(test_lint)]
|
||||
| ^^^^^^^^^ overruled by previous forbid
|
||||
|
|
||||
= note: `forbid` lint level was set on command line
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-forbid-cmdline.rs:6:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: item is named 'lintme'
|
||||
--> $DIR/lint-plugin-forbid-cmdline.rs:8:1
|
||||
|
|
||||
|
@ -38,6 +22,14 @@ LL | #[allow(test_lint)]
|
|||
|
|
||||
= note: `forbid` lint level was set on command line
|
||||
|
||||
error: aborting due to 4 previous errors; 1 warning emitted
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin-forbid-cmdline.rs:6:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
error: aborting due to 3 previous errors; 1 warning emitted
|
||||
|
||||
For more information about this error, try `rustc --explain E0453`.
|
||||
|
|
|
@ -1,11 +1,3 @@
|
|||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin.rs:5:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: item is named 'lintme'
|
||||
--> $DIR/lint-plugin.rs:8:1
|
||||
|
|
||||
|
@ -14,5 +6,13 @@ LL | fn lintme() { }
|
|||
|
|
||||
= note: `#[warn(test_lint)]` on by default
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-plugin.rs:5:1
|
||||
|
|
||||
LL | #![plugin(lint_plugin_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: 2 warnings emitted
|
||||
|
||||
|
|
|
@ -6,18 +6,6 @@ warning: lint name `test_lint` is deprecated and does not have an effect anymore
|
|||
|
|
||||
= note: requested on the command line with `-A test_lint`
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-tool-cmdline-allow.rs:7:1
|
||||
|
|
||||
LL | #![plugin(lint_tool_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
|
||||
|
|
||||
= note: requested on the command line with `-A test_lint`
|
||||
|
||||
warning: item is named 'lintme'
|
||||
--> $DIR/lint-tool-cmdline-allow.rs:9:1
|
||||
|
|
||||
|
@ -26,9 +14,17 @@ LL | fn lintme() {}
|
|||
|
|
||||
= note: `#[warn(clippy::test_lint)]` on by default
|
||||
|
||||
warning: use of deprecated attribute `plugin`: compiler plugins are deprecated. See https://github.com/rust-lang/rust/pull/64675
|
||||
--> $DIR/lint-tool-cmdline-allow.rs:7:1
|
||||
|
|
||||
LL | #![plugin(lint_tool_test)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: may be removed in a future compiler version
|
||||
|
|
||||
= note: `#[warn(deprecated)]` on by default
|
||||
|
||||
warning: lint name `test_lint` is deprecated and does not have an effect anymore. Use: clippy::test_lint
|
||||
|
|
||||
= note: requested on the command line with `-A test_lint`
|
||||
|
||||
warning: 6 warnings emitted
|
||||
warning: 5 warnings emitted
|
||||
|
||||
|
|
|
@ -10,12 +10,10 @@
|
|||
//~^ WARNING lint name `test_lint` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `test_lint` is deprecated and may not have an effect in the future
|
||||
#![deny(clippy_group)]
|
||||
//~^ WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `clippy_group` is deprecated and may not have an effect in the future
|
||||
|
||||
fn lintme() { } //~ ERROR item is named 'lintme'
|
||||
|
||||
|
@ -32,7 +30,6 @@ pub fn main() {
|
|||
//~^ WARNING lint name `test_group` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
|
||||
//~| WARNING lint name `test_group` is deprecated and may not have an effect in the future
|
||||
#[deny(this_lint_does_not_exist)] //~ WARNING unknown lint: `this_lint_does_not_exist`
|
||||
fn hello() {
|
||||
fn lintmetoo() { }
|
||||
|
|
|
@ -7,13 +7,13 @@ LL | #![cfg_attr(foo, warn(test_lint))]
|
|||
= note: `#[warn(renamed_and_removed_lints)]` on by default
|
||||
|
||||
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:14:9
|
||||
--> $DIR/lint-tool-test.rs:13:9
|
||||
|
|
||||
LL | #![deny(clippy_group)]
|
||||
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
|
||||
|
||||
warning: lint name `test_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:31:9
|
||||
--> $DIR/lint-tool-test.rs:29:9
|
||||
|
|
||||
LL | #[allow(test_group)]
|
||||
| ^^^^^^^^^^ help: change it to: `clippy::test_group`
|
||||
|
@ -25,19 +25,40 @@ LL | #![cfg_attr(foo, warn(test_lint))]
|
|||
| ^^^^^^^^^ help: change it to: `clippy::test_lint`
|
||||
|
||||
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:14:9
|
||||
--> $DIR/lint-tool-test.rs:13:9
|
||||
|
|
||||
LL | #![deny(clippy_group)]
|
||||
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
|
||||
|
||||
error: item is named 'lintme'
|
||||
--> $DIR/lint-tool-test.rs:18:1
|
||||
|
|
||||
LL | fn lintme() { }
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-tool-test.rs:13:9
|
||||
|
|
||||
LL | #![deny(clippy_group)]
|
||||
| ^^^^^^^^^^^^
|
||||
= note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]`
|
||||
|
||||
error: item is named 'lintmetoo'
|
||||
--> $DIR/lint-tool-test.rs:26:5
|
||||
|
|
||||
LL | fn lintmetoo() { }
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`
|
||||
|
||||
warning: lint name `test_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:31:9
|
||||
--> $DIR/lint-tool-test.rs:29:9
|
||||
|
|
||||
LL | #[allow(test_group)]
|
||||
| ^^^^^^^^^^ help: change it to: `clippy::test_group`
|
||||
|
||||
warning: unknown lint: `this_lint_does_not_exist`
|
||||
--> $DIR/lint-tool-test.rs:36:8
|
||||
--> $DIR/lint-tool-test.rs:33:8
|
||||
|
|
||||
LL | #[deny(this_lint_does_not_exist)]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -59,55 +80,16 @@ LL | #![cfg_attr(foo, warn(test_lint))]
|
|||
| ^^^^^^^^^ help: change it to: `clippy::test_lint`
|
||||
|
||||
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:14:9
|
||||
|
|
||||
LL | #![deny(clippy_group)]
|
||||
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
|
||||
|
||||
error: item is named 'lintme'
|
||||
--> $DIR/lint-tool-test.rs:20:1
|
||||
|
|
||||
LL | fn lintme() { }
|
||||
| ^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the lint level is defined here
|
||||
--> $DIR/lint-tool-test.rs:14:9
|
||||
|
|
||||
LL | #![deny(clippy_group)]
|
||||
| ^^^^^^^^^^^^
|
||||
= note: `#[deny(clippy::test_lint)]` implied by `#[deny(clippy::group)]`
|
||||
|
||||
error: item is named 'lintmetoo'
|
||||
--> $DIR/lint-tool-test.rs:28:5
|
||||
|
|
||||
LL | fn lintmetoo() { }
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[deny(clippy::test_group)]` implied by `#[deny(clippy::group)]`
|
||||
|
||||
warning: lint name `test_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:31:9
|
||||
|
|
||||
LL | #[allow(test_group)]
|
||||
| ^^^^^^^^^^ help: change it to: `clippy::test_group`
|
||||
|
||||
warning: lint name `test_lint` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:9:23
|
||||
|
|
||||
LL | #![cfg_attr(foo, warn(test_lint))]
|
||||
| ^^^^^^^^^ help: change it to: `clippy::test_lint`
|
||||
|
||||
warning: lint name `clippy_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:14:9
|
||||
--> $DIR/lint-tool-test.rs:13:9
|
||||
|
|
||||
LL | #![deny(clippy_group)]
|
||||
| ^^^^^^^^^^^^ help: change it to: `clippy::group`
|
||||
|
||||
warning: lint name `test_group` is deprecated and may not have an effect in the future.
|
||||
--> $DIR/lint-tool-test.rs:31:9
|
||||
--> $DIR/lint-tool-test.rs:29:9
|
||||
|
|
||||
LL | #[allow(test_group)]
|
||||
| ^^^^^^^^^^ help: change it to: `clippy::test_group`
|
||||
|
||||
error: aborting due to 2 previous errors; 14 warnings emitted
|
||||
error: aborting due to 2 previous errors; 11 warnings emitted
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue