about summary refs log tree commit diff
path: root/tests/ui/borrowck/suggest-ref-mut-issue-118596.rs
blob: fb894623e78045dcacf0f559fbab54f266f845bc (plain)
1
2
3
4
5
6
7
8
9
10
11
fn main() {
    let y = Some(0);
    if let Some(x) = y {
        x = 2; //~ ERROR cannot assign twice to immutable variable `x`
    }

    let mut arr = [1, 2, 3];
    let [x, ref xs_hold @ ..] = arr;
    x = 0; //~ ERROR cannot assign twice to immutable variable `x`
    eprintln!("{:?}", arr);
}