1 // Verify the binding mode shifts - only when no `&` are auto-dereferenced is the
2 // final default binding mode mutable.
3
main()4 fn main() {
5 match &&Some(5i32) {
6 Some(n) => {
7 *n += 1; //~ ERROR cannot assign to `*n`, which is behind a `&` reference
8 let _ = n;
9 }
10 None => {},
11 };
12
13 match &mut &Some(5i32) {
14 Some(n) => {
15 *n += 1; //~ ERROR cannot assign to `*n`, which is behind a `&` reference
16 let _ = n;
17 }
18 None => {},
19 };
20
21 match &&mut Some(5i32) {
22 Some(n) => {
23 *n += 1; //~ ERROR cannot assign to `*n`, which is behind a `&` reference
24 let _ = n;
25 }
26 None => {},
27 };
28 }
29