summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/torture/struct_decl.rs
blob: 9e8ea6b100bb490247508fa2a95b7d8fc811fed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// { dg-additional-options "-fdump-tree-gimple -frust-crate=example" }

struct Foo {
    a: u16,
    // { dg-warning "field is never read" "" { target *-*-* } .-1 }
    b: u8,
    // { dg-warning "field is never read" "" { target *-*-* } .-1 }
}

fn main() {
    let my_foo = Foo { a: 1, b: 2 };
    // { dg-warning "unused name" "" { target *-*-* } .-1 }
    // { dg-final { scan-tree-dump-times {(?n)const struct example::Foo my_foo;$} 1 gimple } }
}