]> git.proxmox.com Git - rustc.git/blob - tests/ui/rfcs/rfc-2528-type-changing-struct-update/feature-gate.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / rfcs / rfc-2528-type-changing-struct-update / feature-gate.rs
1 // gate-test-type_changing_struct_update
2
3 #[derive(Debug)]
4 struct Machine<S> {
5 state: S,
6 common_field1: &'static str,
7 common_field2: i32,
8 }
9 #[derive(Debug)]
10 struct State1;
11 #[derive(Debug, PartialEq)]
12 struct State2;
13
14 fn update_to_state2() {
15 let m1: Machine<State1> = Machine {
16 state: State1,
17 common_field1: "hello",
18 common_field2: 2,
19 };
20 let m2: Machine<State2> = Machine {
21 state: State2,
22 ..m1
23 //~^ ERROR type changing struct updating is experimental [E0658]
24 //~| ERROR mismatched types [E0308]
25 };
26 assert_eq!(State2, m2.state);
27 }
28
29 fn main() {}