summary refs log tree commit diff
path: root/src/test/compile-fail/liveness-dead.rs
blob: a115d7c4e34021a9d5aa34cd7102362f3d7c4ba2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
fn f1(&x: int) {
    x = 1; // no error
}

fn f2() {
    let mut x = 3; //~ WARNING value assigned to `x` is never read
    x = 4;
    copy x;
}

fn f3() {
    let mut x = 3;
    copy x;
    x = 4; //~ WARNING value assigned to `x` is never read
}

fn main() { // leave this in here just to trigger compile-fail:
    let x: int;
    copy x; //~ ERROR use of possibly uninitialized variable: `x`
}