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
|
|
|
}
|
|
|
|
|
2012-10-05 16:58:42 -05:00
|
|
|
fn f1b(x: &mut 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-20 14:23:37 -05:00
|
|
|
match Some(3) {
|
|
|
|
Some(i) => {
|
2012-08-24 13:04:07 -05:00
|
|
|
//~^ WARNING unused variable: `i`
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
2012-08-20 14:23:37 -05:00
|
|
|
None => {}
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-24 13:04:07 -05:00
|
|
|
enum tri {
|
|
|
|
a(int), b(int), c(int)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f4b() -> int {
|
|
|
|
match a(3) {
|
|
|
|
a(i) | b(i) | c(i) => {
|
|
|
|
i
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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-09-06 21:40:15 -05:00
|
|
|
x: (),
|
2012-07-13 20:43:52 -05:00
|
|
|
drop {}
|
|
|
|
}
|
2012-05-23 22:53:49 -05:00
|
|
|
fn main() {
|
2012-09-05 17:58:43 -05:00
|
|
|
let x = r { x: () };
|
2012-09-19 00:44:46 -05:00
|
|
|
fn@(move x) { copy x; }; //~ ERROR copying a noncopyable value
|
2012-05-23 22:53:49 -05:00
|
|
|
}
|