summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2005-default-binding-mode/enum.rs
blob: 4e57769d6e24c877885437173092118d558a9e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
enum Wrapper {
    Wrap(i32),
}

use Wrapper::Wrap;

pub fn main() {
    let Wrap(x) = &Wrap(3);
    *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference


    if let Some(x) = &Some(3) {
        *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
    } else {
        panic!();
    }

    while let Some(x) = &Some(3) {
        *x += 1; //~ ERROR cannot assign to `*x`, which is behind a `&` reference
        break;
    }
}