Closed
Description
Code
#![feature(never_type)]
pub struct JustEmpty(!);
pub struct FancyEmpty {
_empty: !,
}
Current output
warning: struct `FancyEmpty` is never constructed
--> src/lib.rs:5:12
|
5 | pub struct FancyEmpty {
| ^^^^^^^^^^
|
= note: `#[warn(dead_code)]` on by default
warning: `playground` (lib) generated 1 warning
Desired output
Compiles without warnings.
Rationale and extra context
The struct is meant to not be constructible. Also the behavior is incoherent between tuple structs (correct behavior) and named structs (incorrect behavior).
Also, this is a regression, this didn't use to be the case.
Other cases
No response
Rust Version
rustc 1.82.0-nightly (92c6c0380 2024-07-21)
binary: rustc
commit-hash: 92c6c03805408a1a261b98013304e9bbf59ee428
commit-date: 2024-07-21
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 18.1.7
Anything else?
No response