forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
// run-pass | ||
// pretty-expanded FIXME #23616 | ||
#![allow(dead_code)] | ||
|
||
pub fn main() { | ||
struct A { | ||
|
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,20 @@ | ||
#![deny(dead_code)] | ||
|
||
struct S { | ||
f: i32, //~ ERROR: field is never read | ||
sub: Sub, //~ ERROR: field is never read | ||
} | ||
|
||
struct Sub { | ||
f: i32, //~ ERROR: field is never read | ||
} | ||
|
||
fn field_write(s: &mut S) { | ||
s.f = 1; | ||
s.sub.f = 2; | ||
} | ||
|
||
fn main() { | ||
let mut s = S { f: 0, sub: Sub { f: 0 } }; | ||
field_write(&mut s); | ||
} |
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,26 @@ | ||
error: field is never read: `f` | ||
--> $DIR/write-only-field.rs:4:5 | ||
| | ||
LL | f: i32, | ||
| ^^^^^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/write-only-field.rs:1:9 | ||
| | ||
LL | #![deny(dead_code)] | ||
| ^^^^^^^^^ | ||
|
||
error: field is never read: `sub` | ||
--> $DIR/write-only-field.rs:5:5 | ||
| | ||
LL | sub: Sub, | ||
| ^^^^^^^^ | ||
|
||
error: field is never read: `f` | ||
--> $DIR/write-only-field.rs:9:5 | ||
| | ||
LL | f: i32, | ||
| ^^^^^^ | ||
|
||
error: aborting due to 3 previous errors | ||
|