]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-uninit-in-assignop.rs
Miscellaneous inlining improvements
[rust.git] / src / test / ui / borrowck / borrowck-uninit-in-assignop.rs
1 // Tests that the use of uninitialized variable in assignment operator
2 // expression is detected.
3
4 pub fn main() {
5     let x: isize;
6     x += 1; //~ ERROR use of possibly-uninitialized variable: `x`
7
8     let x: isize;
9     x -= 1; //~ ERROR use of possibly-uninitialized variable: `x`
10
11     let x: isize;
12     x *= 1; //~ ERROR use of possibly-uninitialized variable: `x`
13
14     let x: isize;
15     x /= 1; //~ ERROR use of possibly-uninitialized variable: `x`
16
17     let x: isize;
18     x %= 1; //~ ERROR use of possibly-uninitialized variable: `x`
19
20     let x: isize;
21     x ^= 1; //~ ERROR use of possibly-uninitialized variable: `x`
22
23     let x: isize;
24     x &= 1; //~ ERROR use of possibly-uninitialized variable: `x`
25
26     let x: isize;
27     x |= 1; //~ ERROR use of possibly-uninitialized variable: `x`
28
29     let x: isize;
30     x <<= 1;    //~ ERROR use of possibly-uninitialized variable: `x`
31
32     let x: isize;
33     x >>= 1;    //~ ERROR use of possibly-uninitialized variable: `x`
34 }