rust/tests/ui/borrowck/borrowck-uninit-in-assignop.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

35 lines
588 B
Rust
Raw Normal View History

// 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
}