2012-05-23 20:53:49 -07:00
|
|
|
fn f1(x: int) {
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ WARNING unused variable: `x`
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f1b(&x: int) {
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ WARNING unused variable: `x`
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f2() {
|
|
|
|
let x = 3;
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ WARNING unused variable: `x`
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f3() {
|
|
|
|
let mut x = 3;
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ WARNING variable `x` is assigned to, but never used
|
2012-05-23 20:53:49 -07:00
|
|
|
x += 4;
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ WARNING value assigned to `x` is never read
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f3b() {
|
|
|
|
let mut z = 3;
|
2012-06-30 12:23:59 +01:00
|
|
|
//~^ WARNING variable `z` is assigned to, but never used
|
2012-05-23 20:53:49 -07:00
|
|
|
loop {
|
|
|
|
z += 4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f4() {
|
2012-08-06 12:34:08 -07:00
|
|
|
match some(3) {
|
2012-08-03 19:59:04 -07:00
|
|
|
some(i) => {
|
2012-08-24 11:04:07 -07:00
|
|
|
//~^ WARNING unused variable: `i`
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
2012-08-03 19:59:04 -07:00
|
|
|
none => {}
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-08-24 11:04:07 -07: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 20:53:49 -07:00
|
|
|
// leave this in here just to trigger compile-fail:
|
2012-08-15 18:46:55 -07:00
|
|
|
struct r {
|
2012-07-13 18:43:52 -07:00
|
|
|
let x: ();
|
|
|
|
new() { self.x = (); }
|
|
|
|
drop {}
|
|
|
|
}
|
2012-05-23 20:53:49 -07:00
|
|
|
fn main() {
|
2012-07-13 18:43:52 -07:00
|
|
|
let x = r();
|
|
|
|
fn@() { copy x; }; //~ ERROR copying a noncopyable value
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|