-
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 visibility test with reachability test in dead code detection
Fixes #119545
- Loading branch information
Showing
3 changed files
with
29 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#![deny(dead_code)] | ||
|
||
fn main() { | ||
let _ = foo::S{f: false}; | ||
} | ||
|
||
mod foo { | ||
pub struct S { | ||
pub f: bool, //~ ERROR field `f` is never read | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: field `f` is never read | ||
--> $DIR/pub-field-in-priv-mod.rs:9:13 | ||
| | ||
LL | pub struct S { | ||
| - field in this struct | ||
LL | pub f: bool, | ||
| ^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/pub-field-in-priv-mod.rs:1:9 | ||
| | ||
LL | #![deny(dead_code)] | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|