]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs/struct-base-wrong-type.rs
Rollup merge of #95534 - jyn514:std-mem-copy, r=joshtriplett
[rust.git] / src / test / ui / structs / struct-base-wrong-type.rs
1 // Check that `base` in `Fru { field: expr, ..base }` must have right type.
2
3 struct Foo { a: isize, b: isize }
4 struct Bar { x: isize }
5
6 static bar: Bar = Bar { x: 5 };
7 static foo: Foo = Foo { a: 2, ..bar }; //~  ERROR mismatched types
8 static foo_i: Foo = Foo { a: 2, ..4 }; //~  ERROR mismatched types
9
10 fn main() {
11     let b = Bar { x: 5 };
12     let f = Foo { a: 2, ..b };        //~ ERROR mismatched types
13     let f__isize = Foo { a: 2, ..4 }; //~ ERROR mismatched types
14 }