blob: 6252673c296fb1d63bc5dc248e8618595294f5d3 [file] [log] [blame]
// Check that `base` in `Fru { field: expr, ..base }` must have right type.
//
// See also struct-base-wrong-type-2.rs, which tests same condition
// within a function body.
struct Foo { a: isize, b: isize }
struct Bar { x: isize }
static bar: Bar = Bar { x: 5 };
static foo: Foo = Foo { a: 2, ..bar }; //~ ERROR mismatched types
//~| expected type `Foo`
//~| found type `Bar`
//~| expected struct `Foo`, found struct `Bar`
static foo_i: Foo = Foo { a: 2, ..4 }; //~ ERROR mismatched types
//~| expected type `Foo`
//~| found type `{integer}`
//~| expected struct `Foo`, found integer
fn main() {
let b = Bar { x: 5 };
// errors below are no longer caught since error above causes
// compilation to abort before we bother checking function bodies.
// See also struct-base-wrong-type-2.rs, which checks that we
// would catch these errors eventually.
let f = Foo { a: 2, ..b };
let f__isize = Foo { a: 2, ..4 };
}