1 // Check that `base` in `Fru { field: expr, ..base }` must have right type.
3 // See also struct-base-wrong-type-2.rs, which tests same condition
4 // within a function body.
6 struct Foo { a: isize, b: isize }
7 struct Bar { x: isize }
9 static bar: Bar = Bar { x: 5 };
10 static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types
11 //~| expected type `Foo`
13 //~| expected struct `Foo`, found struct `Bar`
14 static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types
15 //~| expected type `Foo`
16 //~| found type `{integer}`
17 //~| expected struct `Foo`, found integer
21 // errors below are no longer caught since error above causes
22 // compilation to abort before we bother checking function bodies.
23 // See also struct-base-wrong-type-2.rs, which checks that we
24 // would catch these errors eventually.
25 let f = Foo { a: 2, ..b };
26 let f__isize = Foo { a: 2, ..4 };