2012-05-29 17:37:50 -05:00
|
|
|
// Note: it would be nice to give fewer warnings in these cases.
|
|
|
|
|
|
|
|
fn mutate_by_mut_ref(&x: uint) {
|
|
|
|
x = 0u;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn mutate_by_ref(&&x: uint) {
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
|
|
|
x = 0u; //~ ERROR assigning to argument
|
2012-05-29 17:37:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn mutate_by_val(++x: uint) {
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
|
|
|
x = 0u; //~ ERROR assigning to argument
|
2012-05-29 17:37:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn mutate_by_copy(+x: uint) {
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
|
|
|
x = 0u; //~ ERROR assigning to argument
|
|
|
|
//~^ WARNING value assigned to `x` is never read
|
2012-05-29 17:37:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn mutate_by_move(-x: uint) {
|
2012-06-30 06:23:59 -05:00
|
|
|
//~^ WARNING unused variable: `x`
|
|
|
|
x = 0u; //~ ERROR assigning to argument
|
|
|
|
//~^ WARNING value assigned to `x` is never read
|
2012-05-29 17:37:50 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
}
|