-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Use ident.span instead of def_span in dead-code pass #65830
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
269d384
Renamed ui/dead-code-ret to ui/unreachable-code-ret
Quantumplation e063ddb
Move dead_code related tests to test/ui/dead-code
Quantumplation 7985510
Use ident instead of def_span in dead-code pass
Quantumplation 15ccad3
Detect if item.span is in a macro, and fall back
Quantumplation 6186ede
Use source_callee().is_some() to detect macros
Quantumplation File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
src/test/ui/fail-no-dead-code.stderr → src/test/ui/lint/dead-code/basic.stderr
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
...t/lint-dead-code-empty-unused-enum.stderr → ...i/lint/dead-code/empty-unused-enum.stderr
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
.../ui/lint/lint-dead-code-impl-trait.stderr → src/test/ui/lint/dead-code/impl-trait.stderr
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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
File renamed without changes.
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#![deny(dead_code)] | ||
|
||
fn unused() { //~ error: function is never used: | ||
println!("blah"); | ||
} | ||
|
||
fn unused2(var: i32) { //~ error: function is never used: | ||
println!("foo {}", var); | ||
} | ||
|
||
fn unused3( //~ error: function is never used: | ||
var: i32, | ||
) { | ||
println!("bar {}", var); | ||
} | ||
|
||
fn main() { | ||
println!("Hello world!"); | ||
} |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
error: function is never used: `unused` | ||
--> $DIR/newline-span.rs:3:4 | ||
| | ||
LL | fn unused() { | ||
| ^^^^^^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/newline-span.rs:1:9 | ||
| | ||
LL | #![deny(dead_code)] | ||
| ^^^^^^^^^ | ||
|
||
error: function is never used: `unused2` | ||
--> $DIR/newline-span.rs:7:4 | ||
| | ||
LL | fn unused2(var: i32) { | ||
| ^^^^^^^ | ||
|
||
error: function is never used: `unused3` | ||
--> $DIR/newline-span.rs:11:4 | ||
| | ||
LL | fn unused3( | ||
| ^^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
.../ui/lint/lint-dead-code-type-alias.stderr → src/test/ui/lint/dead-code/type-alias.stderr
This file contains hidden or 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
File renamed without changes.
14 changes: 7 additions & 7 deletions
14
...ui/lint/lint-dead-code-unused-enum.stderr → ...test/ui/lint/dead-code/unused-enum.stderr
This file contains hidden or 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,27 +1,27 @@ | ||
error: struct is never constructed: `F` | ||
--> $DIR/lint-dead-code-unused-enum.rs:3:1 | ||
--> $DIR/unused-enum.rs:3:8 | ||
| | ||
LL | struct F; | ||
| ^^^^^^^^^ | ||
| ^ | ||
| | ||
note: lint level defined here | ||
--> $DIR/lint-dead-code-unused-enum.rs:1:9 | ||
--> $DIR/unused-enum.rs:1:9 | ||
| | ||
LL | #![deny(unused)] | ||
| ^^^^^^ | ||
= note: `#[deny(dead_code)]` implied by `#[deny(unused)]` | ||
|
||
error: struct is never constructed: `B` | ||
--> $DIR/lint-dead-code-unused-enum.rs:4:1 | ||
--> $DIR/unused-enum.rs:4:8 | ||
| | ||
LL | struct B; | ||
| ^^^^^^^^^ | ||
| ^ | ||
|
||
error: enum is never used: `E` | ||
--> $DIR/lint-dead-code-unused-enum.rs:6:1 | ||
--> $DIR/unused-enum.rs:6:6 | ||
| | ||
LL | enum E { | ||
| ^^^^^^ | ||
| ^ | ||
|
||
error: aborting due to 3 previous errors | ||
|
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...lint/lint-dead-code-unused-variant.stderr → ...nt/dead-code/unused-struct-variant.stderr
This file contains hidden or 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
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
...est/ui/lint/lint-dead-code-variant.stderr → ...t/ui/lint/dead-code/unused-variant.stderr
This file contains hidden or 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
File renamed without changes.
6 changes: 3 additions & 3 deletions
6
src/test/ui/fail-no-dead-code-core.stderr → .../ui/lint/dead-code/with-core-crate.stderr
This file contains hidden or 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
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.