]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/reassignment_immutable_fields_twice.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / reassignment_immutable_fields_twice.rs
1 // This should never be allowed -- since `x` is not `mut`, so `x.0`
2 // cannot be assigned twice.
3
4 fn var_then_field() {
5     let x: (u32, u32);
6     x = (22, 44);
7     x.0 = 1; //~ ERROR
8 }
9
10 fn same_field_twice() {
11     let x: (u32, u32);
12     x.0 = 1; //~ ERROR
13     x.0 = 22;
14     x.1 = 44;
15 }
16
17 fn main() { }