- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
The following code will emit a dead_code warning (playground):
use std::mem;
fn main() {
    struct Value {
        a: i32,
        b: i32,
    };
    let Value { a, b } = unsafe { mem::zeroed() };
    println!("{} {}", a, b);
}It states that Value is never constructed when in fact it has been within the let Value { a, b } pattern match.
   Compiling playground v0.0.1 (/playground)
warning: struct is never constructed: `Value`
 --> src/main.rs:4:5
  |
4 |     struct Value {
  |     ^^^^^^^^^^^^
  |
  = note: #[warn(dead_code)] on by default
    Finished dev [unoptimized + debuginfo] target(s) in 0.90s
     Running `target/debug/playground`
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.C-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.