summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-uninit-in-assignop.rs
blob: 92c3692bd2f692094e64ba9038bef3469bea3f59 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Tests that the use of uninitialized variable in assignment operator
// expression is detected.

pub fn main() {
    let x: isize;
    x += 1; //~ ERROR E0381

    let x: isize;
    x -= 1; //~ ERROR E0381

    let x: isize;
    x *= 1; //~ ERROR E0381

    let x: isize;
    x /= 1; //~ ERROR E0381

    let x: isize;
    x %= 1; //~ ERROR E0381

    let x: isize;
    x ^= 1; //~ ERROR E0381

    let x: isize;
    x &= 1; //~ ERROR E0381

    let x: isize;
    x |= 1; //~ ERROR E0381

    let x: isize;
    x <<= 1; //~ ERROR E0381

    let x: isize;
    x >>= 1; //~ ERROR E0381
}