forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#128104 - mu001999-contrib:fix/128053, r=pet…
…rochenkov Not lint pub structs without pub constructors intentionally Fixes rust-lang#128053
- Loading branch information
Showing
5 changed files
with
83 additions
and
22 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
16 changes: 13 additions & 3 deletions
16
tests/ui/derives/clone-debug-dead-code-in-the-same-struct.stderr
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,35 @@ | ||
#![feature(never_type)] | ||
#![deny(dead_code)] | ||
|
||
pub struct T1(!); | ||
pub struct T2(()); | ||
pub struct T3<X>(std::marker::PhantomData<X>); | ||
|
||
pub struct T4 { | ||
_x: !, | ||
} | ||
|
||
pub struct T5<X> { | ||
_x: !, | ||
_y: X, | ||
} | ||
|
||
pub struct T6 { | ||
_x: (), | ||
} | ||
|
||
pub struct T7<X> { | ||
_x: (), | ||
_y: X, | ||
} | ||
|
||
pub struct T8<X> { | ||
_x: std::marker::PhantomData<X>, | ||
} | ||
|
||
pub struct T9<X> { //~ ERROR struct `T9` is never constructed | ||
_x: std::marker::PhantomData<X>, | ||
_y: i32, | ||
} | ||
|
||
fn main() {} |
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,14 @@ | ||
error: struct `T9` is never constructed | ||
--> $DIR/unconstructible-pub-struct.rs:30:12 | ||
| | ||
LL | pub struct T9<X> { | ||
| ^^ | ||
| | ||
note: the lint level is defined here | ||
--> $DIR/unconstructible-pub-struct.rs:2:9 | ||
| | ||
LL | #![deny(dead_code)] | ||
| ^^^^^^^^^ | ||
|
||
error: aborting due to 1 previous error | ||
|