about summary refs log tree commit diff
path: root/src/test/compile-fail/mutable-arguments.rs
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-10-05 14:58:42 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-10-05 15:37:01 -0700
commite16dbb7888504ef5d0de0c14493fc8ecc492ee30 (patch)
tree80c1bde3c3f3b0cf47993dfe769418cc2ac55323 /src/test/compile-fail/mutable-arguments.rs
parente3cb70fa8a6f9163352f26ae2614ab4c9a261838 (diff)
downloadrust-e16dbb7888504ef5d0de0c14493fc8ecc492ee30.tar.gz
rust-e16dbb7888504ef5d0de0c14493fc8ecc492ee30.zip
Demode some code using by-mutbl-ref; warn about by-mutbl-ref
The parser now warns about use of mutbl-ref mode, though it's kind
of a lie since this commit doesn't remove support for the mode.

Changed move_val_init to have stage0 and stage1/2 versions, the latter of
which is demoded.

Changed the type that the typechecker expects the move_val_init
intrinsic to have. After this is pushed, I can make a new snapshot,
which will remove the need for the stage0 versions.
Diffstat (limited to 'src/test/compile-fail/mutable-arguments.rs')
-rw-r--r--src/test/compile-fail/mutable-arguments.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/test/compile-fail/mutable-arguments.rs b/src/test/compile-fail/mutable-arguments.rs
index 4fcb73e8516..d84c9401e25 100644
--- a/src/test/compile-fail/mutable-arguments.rs
+++ b/src/test/compile-fail/mutable-arguments.rs
@@ -1,28 +1,28 @@
 // Note: it would be nice to give fewer warnings in these cases.
 
-fn mutate_by_mut_ref(&x: uint) {
-    x = 0u;
+fn mutate_by_mut_ref(x: &mut uint) {
+    *x = 0;
 }
 
 fn mutate_by_ref(&&x: uint) {
     //~^ WARNING unused variable: `x`
-    x = 0u; //~ ERROR assigning to argument
+    x = 0; //~ ERROR assigning to argument
 }
 
 fn mutate_by_val(++x: uint) {
     //~^ WARNING unused variable: `x`
-    x = 0u; //~ ERROR assigning to argument
+    x = 0; //~ ERROR assigning to argument
 }
 
 fn mutate_by_copy(+x: uint) {
     //~^ WARNING unused variable: `x`
-    x = 0u; //~ ERROR assigning to argument
+    x = 0; //~ 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
+    x = 0; //~ ERROR assigning to argument
     //~^ WARNING value assigned to `x` is never read
 }