]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
1 | // Tests that the use of uninitialized variable in assignment operator |
2 | // expression is detected. | |
3 | ||
4 | pub fn main() { | |
5 | let x: isize; | |
e1599b0c | 6 | x += 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
7 | |
8 | let x: isize; | |
e1599b0c | 9 | x -= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
10 | |
11 | let x: isize; | |
e1599b0c | 12 | x *= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
13 | |
14 | let x: isize; | |
e1599b0c | 15 | x /= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
16 | |
17 | let x: isize; | |
e1599b0c | 18 | x %= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
19 | |
20 | let x: isize; | |
e1599b0c | 21 | x ^= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
22 | |
23 | let x: isize; | |
e1599b0c | 24 | x &= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
25 | |
26 | let x: isize; | |
e1599b0c | 27 | x |= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
28 | |
29 | let x: isize; | |
e1599b0c | 30 | x <<= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc JJ |
31 | |
32 | let x: isize; | |
e1599b0c | 33 | x >>= 1; //~ ERROR use of possibly-uninitialized variable: `x` |
1a4d82fc | 34 | } |