]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/assign_mutable_fields.rs
Rollup merge of #106798 - scottmcm:signum-via-cmp, r=Mark-Simulacrum
[rust.git] / tests / ui / borrowck / assign_mutable_fields.rs
1 // Currently, we do permit you to assign to individual fields of an
2 // uninitialized var.
3 // We hope to fix this at some point.
4 //
5 // FIXME(#54987)
6
7 fn assign_both_fields_and_use() {
8     let mut x: (u32, u32);
9     x.0 = 1; //~ ERROR
10     x.1 = 22;
11     drop(x.0);
12     drop(x.1);
13 }
14
15 fn assign_both_fields_the_use_var() {
16     let mut x: (u32, u32);
17     x.0 = 1; //~ ERROR
18     x.1 = 22;
19     drop(x);
20 }
21
22 fn main() { }