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() {
|
2012-08-06 14:34:08 -05:00
|
|
|
match some(3) {
|
2012-08-03 21:59:04 -05:00
|
|
|
some(i) => {
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
2012-08-03 21:59:04 -05:00
|
|
|
none => {}
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// leave this in here just to trigger compile-fail:
|
2012-08-15 20:46:55 -05:00
|
|
|
struct r {
|
2012-07-13 20:43:52 -05:00
|
|
|
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
|
|
|
}
|