rust/src/test/compile-fail/mutable-arguments.rs
Gareth Daniel Smith 6d86969260 change the test suite //! kind syntax to //~ kind in order to avoid a
conflict with the new single-line-sugared-inner-doc-comment (`//! ...`).
2012-06-30 12:23:59 +01:00

31 lines
694 B
Rust

// 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) {
//~^ WARNING unused variable: `x`
x = 0u; //~ ERROR assigning to argument
}
fn mutate_by_val(++x: uint) {
//~^ WARNING unused variable: `x`
x = 0u; //~ ERROR assigning to argument
}
fn mutate_by_copy(+x: uint) {
//~^ WARNING unused variable: `x`
x = 0u; //~ ERROR assigning to argument
//~^ WARNING value assigned to `x` is never read
}
fn mutate_by_move(-x: uint) {
//~^ WARNING unused variable: `x`
x = 0u; //~ ERROR assigning to argument
//~^ WARNING value assigned to `x` is never read
}
fn main() {
}