-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace
cfg_attr
in AST with rustc-cfg-placeholder
for accurate s…
…pan tracking Previously, when evaluating a `#[cfg_attr(..)]` to false, the entire attribute was removed from the AST. Afterwards, we insert in its place a `#[rustc-cfg-placeholder]` attribute so that checks for attributes can still know about their placement. This is particularly relevant when we suggest removing items with `cfg_attr`s (fix #56328). We use `rustc-cfg-placeholder` as it is an ident that can't be written by the end user to begin with. We tweak the wording of the existing "unused `extern crate`" lint. ``` warning: unused `extern crate` --> $DIR/removing-extern-crate.rs:9:1 | LL | extern crate removing_extern_crate as foo; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | note: the lint level is defined here --> $DIR/removing-extern-crate.rs:6:9 | LL | #![warn(rust_2018_idioms)] | ^^^^^^^^^^^^^^^^ = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` help: remove the unused `extern crate` | LL - #[cfg_attr(test, macro_use)] LL - extern crate removing_extern_crate as foo; LL + | ```
- Loading branch information
Showing
34 changed files
with
210 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,19 @@ | ||
warning: unused extern crate | ||
warning: unused `extern crate` | ||
--> $DIR/edition-extern-crate-allowed.rs:7:1 | ||
| | ||
LL | extern crate edition_extern_crate_allowed; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/edition-extern-crate-allowed.rs:5:9 | ||
| | ||
LL | #![warn(rust_2018_idioms)] | ||
| ^^^^^^^^^^^^^^^^ | ||
= note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate edition_extern_crate_allowed; | ||
| | ||
|
||
warning: 1 warning emitted | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/extern-crate-used.rs:18:1 | ||
| | ||
LL | extern crate core; | ||
| ^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/extern-crate-used.rs:6:9 | ||
| | ||
LL | #![deny(unused_extern_crates)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core; | ||
LL + | ||
| | ||
|
||
error: aborting due to 1 previous error | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,73 @@ | ||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/unnecessary-extern-crate.rs:6:1 | ||
| | ||
LL | extern crate core; | ||
| ^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unnecessary-extern-crate.rs:3:9 | ||
| | ||
LL | #![deny(unused_extern_crates)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core; | ||
| | ||
|
||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/unnecessary-extern-crate.rs:9:1 | ||
| | ||
LL | extern crate core as x; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core as x; | ||
| | ||
|
||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/unnecessary-extern-crate.rs:31:5 | ||
| | ||
LL | extern crate core; | ||
| ^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core; | ||
| | ||
|
||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/unnecessary-extern-crate.rs:35:5 | ||
| | ||
LL | extern crate core as x; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core as x; | ||
| | ||
|
||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/unnecessary-extern-crate.rs:44:9 | ||
| | ||
LL | extern crate core; | ||
| ^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core; | ||
| | ||
|
||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/unnecessary-extern-crate.rs:48:9 | ||
| | ||
LL | extern crate core as x; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate core as x; | ||
| | ||
|
||
error: aborting due to 6 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,31 @@ | ||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/lint-unused-extern-crate.rs:11:1 | ||
| | ||
LL | extern crate lint_unused_extern_crate5; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/lint-unused-extern-crate.rs:7:9 | ||
| | ||
LL | #![deny(unused_extern_crates)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate lint_unused_extern_crate5; | ||
LL + | ||
| | ||
|
||
error: unused extern crate | ||
error: unused `extern crate` | ||
--> $DIR/lint-unused-extern-crate.rs:29:5 | ||
| | ||
LL | extern crate lint_unused_extern_crate2; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove it | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unused | ||
| | ||
help: remove the unused `extern crate` | ||
| | ||
LL - extern crate lint_unused_extern_crate2; | ||
LL + | ||
| | ||
|
||
error: aborting due to 2 previous errors | ||
|
Oops, something went wrong.