2012-05-23 22:53:49 -05:00
|
|
|
fn f1(x: int) {
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f1b(&x: int) {
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f2() {
|
|
|
|
let x = 3;
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f3() {
|
|
|
|
let mut x = 3;
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING variable `x` is assigned to, but never used
|
2012-05-23 22:53:49 -05:00
|
|
|
x += 4;
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING value assigned to `x` is never read
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f3b() {
|
|
|
|
let mut z = 3;
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING variable `z` is assigned to, but never used
|
2012-05-23 22:53:49 -05:00
|
|
|
loop {
|
|
|
|
z += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f4() {
|
|
|
|
alt some(3) {
|
|
|
|
some(i) {
|
|
|
|
}
|
|
|
|
none {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// leave this in here just to trigger compile-fail:
|
2012-07-13 20:43:52 -05:00
|
|
|
class r {
|
|
|
|
let x: ();
|
|
|
|
new() { self.x = (); }
|
|
|
|
drop {}
|
|
|
|
}
|
2012-05-23 22:53:49 -05:00
|
|
|
fn main() {
|
2012-07-13 20:43:52 -05:00
|
|
|
let x = r();
|
|
|
|
fn@() { copy x; }; //~ ERROR copying a noncopyable value
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|