2014-03-21 18:05:05 -07:00
|
|
|
#![allow(dead_code)]
|
2014-10-27 15:37:07 -07:00
|
|
|
#![deny(unused_assignments)]
|
2013-04-30 01:15:17 -04:00
|
|
|
|
2015-01-08 21:54:35 +11:00
|
|
|
fn f1(x: &mut isize) {
|
2012-10-05 14:58:42 -07:00
|
|
|
*x = 1; // no error
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f2() {
|
2015-01-08 21:54:35 +11:00
|
|
|
let mut x: isize = 3; //~ ERROR: value assigned to `x` is never read
|
2012-05-23 20:53:49 -07:00
|
|
|
x = 4;
|
2013-07-02 12:47:32 -07:00
|
|
|
x.clone();
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn f3() {
|
2015-01-08 21:54:35 +11:00
|
|
|
let mut x: isize = 3;
|
2013-07-02 12:47:32 -07:00
|
|
|
x.clone();
|
2013-04-30 01:15:17 -04:00
|
|
|
x = 4; //~ ERROR: value assigned to `x` is never read
|
2012-05-23 20:53:49 -07:00
|
|
|
}
|
|
|
|
|
2015-11-03 19:04:36 +09:00
|
|
|
fn f4(mut x: i32) { //~ ERROR: value passed to `x` is never read
|
|
|
|
x = 4;
|
|
|
|
x.clone();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn f5(mut x: i32) {
|
|
|
|
x.clone();
|
|
|
|
x = 4; //~ ERROR: value assigned to `x` is never read
|
|
|
|
}
|
|
|
|
|
2019-01-03 21:49:56 +09:00
|
|
|
// #22630
|
|
|
|
fn f6() {
|
|
|
|
let mut done = false;
|
|
|
|
while !done {
|
|
|
|
done = true; // no error
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-04-30 01:15:17 -04:00
|
|
|
fn main() {}
|