summaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/missing_constructor_fields.rs
blob: 6e3965b56870a953895a66c98f5ae60efad6fb30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// https://doc.rust-lang.org/error_codes/E0063.html
struct Foo {
    x: i32,
    y: i32,
    z: i32,
}

fn main() {
    let z = Foo { x: 0 , y:1 }; // { dg-error "missing field z in initializer of 'Foo'" }
    let xz = Foo { y:1 }; // { dg-error "missing fields x, z in initializer of 'Foo'" }
    let xyz = Foo { }; // { dg-error "missing fields x, y, z in initializer of 'Foo'" }
}