]> git.lizzy.rs Git - rust.git/blob - tests/ui/structs/struct-base-wrong-type.rs
internally change regions to be covariant
[rust.git] / tests / 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 }