about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-05-06 17:52:52 -0700
committerbors <bors@rust-lang.org>2013-05-06 17:52:52 -0700
commit05460fcd5a9b2be5055f55965f768b0aa37119d9 (patch)
tree88e3b561606409ab312f933eee2df96a5397e643 /src/test
parentbd5fd6e42a904723c99383e684ddeaf02f01d972 (diff)
parent39a119074aa27234a68bcf57899c8c4e015cd478 (diff)
auto merge of #6286 : nikomatsakis/rust/issue-5910-dyna-freeze, r=nikomatsakis
This rather sprawling branch refactors the borrow checker and much of the region code, addressing a number of outstanding issues. I will close them manually after validating that there are test cases for each one, but here is a (probably partial) list:

  - #4903: Flow sensitivity
  - #3387: Moves in overloaded operators
  - #3850: Region granularity
  - #4666: Odd loaning errors
  - #6021: borrow check errors with hashmaps
  - #5910: @mut broken

cc #5047

(take 5)
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/access-mode-in-closures.rs2
-rw-r--r--src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs1
-rw-r--r--src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs1
-rw-r--r--src/test/compile-fail/attempted-access-non-fatal.rs4
-rw-r--r--src/test/compile-fail/borrowck-addr-of-upvar.rs4
-rw-r--r--src/test/compile-fail/borrowck-assign-comp-idx.rs10
-rw-r--r--src/test/compile-fail/borrowck-assign-comp.rs18
-rw-r--r--src/test/compile-fail/borrowck-assign-to-constants.rs4
-rw-r--r--src/test/compile-fail/borrowck-assign-to-enum.rs2
-rw-r--r--src/test/compile-fail/borrowck-assign-to-subfield.rs2
-rw-r--r--src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs (renamed from src/test/compile-fail/auto-ref-borrowck-failure.rs)10
-rw-r--r--src/test/compile-fail/borrowck-autoref-3261.rs4
-rw-r--r--src/test/compile-fail/borrowck-bad-nested-calls-free.rs43
-rw-r--r--src/test/compile-fail/borrowck-bad-nested-calls-move.rs43
-rw-r--r--src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs70
-rw-r--r--src/test/compile-fail/borrowck-borrow-from-stack-variable.rs67
-rw-r--r--src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs3
-rw-r--r--src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs2
-rw-r--r--src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs8
-rw-r--r--src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs4
-rw-r--r--src/test/compile-fail/borrowck-insert-during-each.rs4
-rw-r--r--src/test/compile-fail/borrowck-issue-2657-1.rs4
-rw-r--r--src/test/compile-fail/borrowck-issue-2657-2.rs2
-rw-r--r--src/test/compile-fail/borrowck-lend-flow-if.rs52
-rw-r--r--src/test/compile-fail/borrowck-lend-flow-loop.rs164
-rw-r--r--src/test/compile-fail/borrowck-lend-flow-match.rs60
-rw-r--r--src/test/compile-fail/borrowck-lend-flow.rs93
-rw-r--r--src/test/compile-fail/borrowck-loan-blocks-move-cc.rs8
-rw-r--r--src/test/compile-fail/borrowck-loan-blocks-move.rs4
-rw-r--r--src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs4
-rw-r--r--src/test/compile-fail/borrowck-loan-in-overloaded-op.rs10
-rw-r--r--src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs4
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs9
-rw-r--r--src/test/compile-fail/borrowck-loan-rcvr.rs24
-rw-r--r--src/test/compile-fail/borrowck-loan-vec-content.rs4
-rw-r--r--src/test/compile-fail/borrowck-move-by-capture.rs2
-rw-r--r--src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs2
-rw-r--r--src/test/compile-fail/borrowck-mut-boxed-vec.rs4
-rw-r--r--src/test/compile-fail/borrowck-mut-deref-comp.rs4
-rw-r--r--src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs2
-rw-r--r--src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs4
-rw-r--r--src/test/compile-fail/borrowck-pat-by-value-binding.rs11
-rw-r--r--src/test/compile-fail/borrowck-pat-enum.rs14
-rw-r--r--src/test/compile-fail/borrowck-pat-reassign-binding.rs11
-rw-r--r--src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs26
-rw-r--r--src/test/compile-fail/borrowck-reborrow-from-mut.rs22
-rw-r--r--src/test/compile-fail/borrowck-ref-into-rvalue.rs4
-rw-r--r--src/test/compile-fail/borrowck-ref-mut-of-imm.rs2
-rw-r--r--src/test/compile-fail/borrowck-unary-move-2.rs2
-rw-r--r--src/test/compile-fail/borrowck-unary-move.rs4
-rw-r--r--src/test/compile-fail/borrowck-uniq-via-box.rs54
-rw-r--r--src/test/compile-fail/borrowck-uniq-via-lend.rs8
-rw-r--r--src/test/compile-fail/borrowck-uniq-via-ref.rs7
-rw-r--r--src/test/compile-fail/borrowck-vec-pattern-element-loan.rs12
-rw-r--r--src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs2
-rw-r--r--src/test/compile-fail/borrowck-vec-pattern-move-tail.rs5
-rw-r--r--src/test/compile-fail/borrowck-vec-pattern-nesting.rs4
-rw-r--r--src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs4
-rw-r--r--src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs4
-rw-r--r--src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs4
-rw-r--r--src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs4
-rw-r--r--src/test/compile-fail/borrowck-wg-move-base-2.rs2
-rw-r--r--src/test/compile-fail/dead-code-ret.rs12
-rw-r--r--src/test/compile-fail/die-not-static.rs3
-rw-r--r--src/test/compile-fail/fn-variance-3.rs2
-rw-r--r--src/test/compile-fail/for-loop-decl.rs35
-rw-r--r--src/test/compile-fail/immut-function-arguments.rs4
-rw-r--r--src/test/compile-fail/index_message.rs2
-rw-r--r--src/test/compile-fail/issue-1896-1.rs4
-rw-r--r--src/test/compile-fail/issue-2149.rs1
-rw-r--r--src/test/compile-fail/issue-2151.rs3
-rw-r--r--src/test/compile-fail/issue-2590.rs2
-rw-r--r--src/test/compile-fail/issue-3044.rs1
-rw-r--r--src/test/compile-fail/issue-511.rs2
-rw-r--r--src/test/compile-fail/kindck-owned-trait-contains.rs3
-rw-r--r--src/test/compile-fail/lambda-mutate-nested.rs2
-rw-r--r--src/test/compile-fail/lambda-mutate.rs2
-rw-r--r--src/test/compile-fail/moves-based-on-type-block-bad.rs2
-rw-r--r--src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs2
-rw-r--r--src/test/compile-fail/mutable-class-fields-2.rs3
-rw-r--r--src/test/compile-fail/mutable-class-fields.rs5
-rw-r--r--src/test/compile-fail/mutable-huh-ptr-assign.rs2
-rw-r--r--src/test/compile-fail/regions-addr-of-arg.rs2
-rw-r--r--src/test/compile-fail/regions-bounds.rs6
-rw-r--r--src/test/compile-fail/regions-creating-enums.rs4
-rw-r--r--src/test/compile-fail/regions-creating-enums4.rs3
-rw-r--r--src/test/compile-fail/regions-escape-bound-fn.rs2
-rw-r--r--src/test/compile-fail/regions-escape-loop-via-variable.rs2
-rw-r--r--src/test/compile-fail/regions-escape-loop-via-vec.rs4
-rw-r--r--src/test/compile-fail/regions-escape-via-trait-or-not.rs7
-rw-r--r--src/test/compile-fail/regions-infer-borrow-scope-too-big.rs2
-rw-r--r--src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs6
-rw-r--r--src/test/compile-fail/regions-nested-fns-2.rs2
-rw-r--r--src/test/compile-fail/regions-nested-fns.rs2
-rw-r--r--src/test/compile-fail/regions-ret-borrowed-1.rs1
-rw-r--r--src/test/compile-fail/regions-ret-borrowed.rs1
-rw-r--r--src/test/compile-fail/regions-ret.rs2
-rw-r--r--src/test/compile-fail/regions-var-type-out-of-scope.rs2
-rw-r--r--src/test/compile-fail/swap-no-lval.rs4
-rw-r--r--src/test/compile-fail/type-shadow.rs7
-rw-r--r--src/test/compile-fail/writing-to-immutable-vec.rs6
-rw-r--r--src/test/run-fail/borrowck-wg-fail-2.rs6
-rw-r--r--src/test/run-fail/borrowck-wg-fail-3.rs6
-rw-r--r--src/test/run-fail/borrowck-wg-fail.rs9
-rw-r--r--src/test/run-fail/borrowck-wg-imm-then-mut.rs19
-rw-r--r--src/test/run-fail/borrowck-wg-mut-then-imm.rs19
-rw-r--r--src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs37
-rw-r--r--src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs16
-rw-r--r--src/test/run-fail/borrowck-wg-one-mut-one-imm.rs17
-rw-r--r--src/test/run-fail/borrowck-wg-two-array-indices.rs17
-rw-r--r--src/test/run-pass/auto-ref-slice-plus-ref.rs8
-rw-r--r--src/test/run-pass/borrowck-nested-calls.rs (renamed from src/test/compile-fail/issue-4500.rs)24
-rw-r--r--src/test/run-pass/borrowck-wg-two-imm-borrows.rs14
-rw-r--r--src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs6
-rw-r--r--src/test/run-pass/issue-2735-2.rs18
-rw-r--r--src/test/run-pass/issue-2735-3.rs18
-rw-r--r--src/test/run-pass/lambda-infer-unresolved.rs2
-rw-r--r--src/test/run-pass/reflect-visit-data.rs16
-rw-r--r--src/test/run-pass/regions-mock-trans-impls.rs54
119 files changed, 883 insertions, 552 deletions
diff --git a/src/test/compile-fail/access-mode-in-closures.rs b/src/test/compile-fail/access-mode-in-closures.rs
index f6b9a82ec67..61fb754f761 100644
--- a/src/test/compile-fail/access-mode-in-closures.rs
+++ b/src/test/compile-fail/access-mode-in-closures.rs
@@ -16,6 +16,6 @@ fn unpack(_unpack: &fn(v: &sty) -> ~[int]) {}
 fn main() {
     let _foo = unpack(|s| {
         // Test that `s` is moved here.
-        match *s { sty(v) => v } //~ ERROR moving out of dereference of immutable & pointer
+        match *s { sty(v) => v } //~ ERROR cannot move out
     });
 }
diff --git a/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs b/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs
index e2dd13a4405..85f60f34bdb 100644
--- a/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs
+++ b/src/test/compile-fail/arc-rw-read-mode-shouldnt-escape.rs
@@ -17,6 +17,7 @@ fn main() {
         y = Some(x.downgrade(write_mode));
         //~^ ERROR cannot infer an appropriate lifetime
     }
+    y.get();
     // Adding this line causes a method unification failure instead
     // do (&option::unwrap(y)).read |state| { assert!(*state == 1); }
 }
diff --git a/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs b/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs
index 78a50a4f212..c7ae6a0dc6c 100644
--- a/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs
+++ b/src/test/compile-fail/arc-rw-write-mode-shouldnt-escape.rs
@@ -17,6 +17,7 @@ fn main() {
     do x.write_downgrade |write_mode| {
         y = Some(write_mode);
     }
+    y.get();
     // Adding this line causes a method unification failure instead
     // do (&option::unwrap(y)).write |state| { assert!(*state == 1); }
 }
diff --git a/src/test/compile-fail/attempted-access-non-fatal.rs b/src/test/compile-fail/attempted-access-non-fatal.rs
index ba15abc3f89..1d9249bc17b 100644
--- a/src/test/compile-fail/attempted-access-non-fatal.rs
+++ b/src/test/compile-fail/attempted-access-non-fatal.rs
@@ -11,6 +11,6 @@
 // Check that bogus field access is non-fatal
 fn main() {
     let x = 0;
-    debug!(x.foo); //~ ERROR attempted access of field
-    debug!(x.bar); //~ ERROR attempted access of field
+    let _ = x.foo; //~ ERROR attempted access of field
+    let _ = x.bar; //~ ERROR attempted access of field
 }
diff --git a/src/test/compile-fail/borrowck-addr-of-upvar.rs b/src/test/compile-fail/borrowck-addr-of-upvar.rs
index 640bc887731..83baedc7892 100644
--- a/src/test/compile-fail/borrowck-addr-of-upvar.rs
+++ b/src/test/compile-fail/borrowck-addr-of-upvar.rs
@@ -9,12 +9,12 @@
 // except according to those terms.
 
 fn foo(x: @int) -> @fn() -> &'static int {
-    let result: @fn() -> &'static int = || &*x;  //~ ERROR illegal borrow
+    let result: @fn() -> &'static int = || &*x;  //~ ERROR cannot root
     result
 }
 
 fn bar(x: @int) -> @fn() -> &int {
-    let result: @fn() -> &int = || &*x; //~ ERROR illegal borrow
+    let result: @fn() -> &int = || &*x; //~ ERROR cannot root
     result
 }
 
diff --git a/src/test/compile-fail/borrowck-assign-comp-idx.rs b/src/test/compile-fail/borrowck-assign-comp-idx.rs
index a284cd5b4a7..9b21cbf9768 100644
--- a/src/test/compile-fail/borrowck-assign-comp-idx.rs
+++ b/src/test/compile-fail/borrowck-assign-comp-idx.rs
@@ -17,9 +17,11 @@ fn a() {
     let mut p = ~[1];
 
     // Create an immutable pointer into p's contents:
-    let _q: &int = &p[0]; //~ NOTE loan of mutable vec content granted here
+    let q: &int = &p[0];
 
-    p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
+    p[0] = 5; //~ ERROR cannot assign
+
+    debug!("%d", *q);
 }
 
 fn borrow(_x: &[int], _f: &fn()) {}
@@ -30,8 +32,8 @@ fn b() {
 
     let mut p = ~[1];
 
-    do borrow(p) { //~ NOTE loan of mutable vec content granted here
-        p[0] = 5; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
+    do borrow(p) {
+        p[0] = 5; //~ ERROR cannot assign to
     }
 }
 
diff --git a/src/test/compile-fail/borrowck-assign-comp.rs b/src/test/compile-fail/borrowck-assign-comp.rs
index eb832fe738d..ccd0542ca7f 100644
--- a/src/test/compile-fail/borrowck-assign-comp.rs
+++ b/src/test/compile-fail/borrowck-assign-comp.rs
@@ -12,12 +12,13 @@ struct point { x: int, y: int }
 
 fn a() {
     let mut p = point {x: 3, y: 4};
-    let _q = &p; //~ NOTE loan of mutable local variable granted here
+    let q = &p;
 
     // This assignment is illegal because the field x is not
     // inherently mutable; since `p` was made immutable, `p.x` is now
     // immutable.  Otherwise the type of &_q.x (&int) would be wrong.
-    p.x = 5; //~ ERROR assigning to mutable field prohibited due to outstanding loan
+    p.x = 5; //~ ERROR cannot assign to `p.x`
+    q.x;
 }
 
 fn c() {
@@ -25,9 +26,10 @@ fn c() {
     // and then try to overwrite `p` as a whole.
 
     let mut p = point {x: 3, y: 4};
-    let _q = &p.y; //~ NOTE loan of mutable local variable granted here
-    p = point {x: 5, y: 7};//~ ERROR assigning to mutable local variable prohibited due to outstanding loan
-    copy p;
+    let q = &p.y;
+    p = point {x: 5, y: 7};//~ ERROR cannot assign to `p`
+    p.x; // silence warning
+    *q; // stretch loan
 }
 
 fn d() {
@@ -35,9 +37,9 @@ fn d() {
     // address of a subcomponent and then modify that subcomponent:
 
     let mut p = point {x: 3, y: 4};
-    let _q = &p.y; //~ NOTE loan of mutable field granted here
-    p.y = 5; //~ ERROR assigning to mutable field prohibited due to outstanding loan
-    copy p;
+    let q = &p.y;
+    p.y = 5; //~ ERROR cannot assign to `p.y`
+    *q;
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-assign-to-constants.rs b/src/test/compile-fail/borrowck-assign-to-constants.rs
index 0d65aacb65b..f0dc28b736d 100644
--- a/src/test/compile-fail/borrowck-assign-to-constants.rs
+++ b/src/test/compile-fail/borrowck-assign-to-constants.rs
@@ -12,6 +12,6 @@ static foo: int = 5;
 
 fn main() {
     // assigning to various global constants
-    None = Some(3); //~ ERROR assigning to static item
-    foo = 6; //~ ERROR assigning to static item
+    None = Some(3); //~ ERROR cannot assign to immutable static item
+    foo = 6; //~ ERROR cannot assign to immutable static item
 }
diff --git a/src/test/compile-fail/borrowck-assign-to-enum.rs b/src/test/compile-fail/borrowck-assign-to-enum.rs
index a35d88a76f3..fcaba0adc46 100644
--- a/src/test/compile-fail/borrowck-assign-to-enum.rs
+++ b/src/test/compile-fail/borrowck-assign-to-enum.rs
@@ -12,5 +12,5 @@ struct foo(int);
 
 fn main() {
     let x = foo(3);
-    *x = 4; //~ ERROR assigning to anonymous field
+    *x = 4; //~ ERROR cannot assign to immutable anonymous field
 }
diff --git a/src/test/compile-fail/borrowck-assign-to-subfield.rs b/src/test/compile-fail/borrowck-assign-to-subfield.rs
index 610802ca68b..2ee5ecfcb9c 100644
--- a/src/test/compile-fail/borrowck-assign-to-subfield.rs
+++ b/src/test/compile-fail/borrowck-assign-to-subfield.rs
@@ -34,6 +34,6 @@ fn main() {
 
     // in these cases we pass through a box, so the mut
     // of the box is dominant
-    p.x.a = 2;     //~ ERROR assigning to immutable field
+    p.x.a = 2;     //~ ERROR cannot assign to immutable field
     p.z.a = 2;
 }
diff --git a/src/test/compile-fail/auto-ref-borrowck-failure.rs b/src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs
index 894b71357b7..2ba5d0473cc 100644
--- a/src/test/compile-fail/auto-ref-borrowck-failure.rs
+++ b/src/test/compile-fail/borrowck-auto-mut-ref-to-immut-var.rs
@@ -14,17 +14,13 @@ struct Foo {
     x: int
 }
 
-trait Stuff {
-    fn printme(self);
-}
-
-impl<'self> Stuff for &'self mut Foo {
-    fn printme(self) {
+pub impl Foo {
+    fn printme(&mut self) {
         io::println(fmt!("%d", self.x));
     }
 }
 
 fn main() {
     let x = Foo { x: 3 };
-    x.printme();    //~ ERROR illegal borrow
+    x.printme();    //~ ERROR cannot borrow
 }
diff --git a/src/test/compile-fail/borrowck-autoref-3261.rs b/src/test/compile-fail/borrowck-autoref-3261.rs
index c95b93445ad..192fe669f57 100644
--- a/src/test/compile-fail/borrowck-autoref-3261.rs
+++ b/src/test/compile-fail/borrowck-autoref-3261.rs
@@ -17,10 +17,10 @@ pub impl X {
 }
 fn main() {
     let mut x = X(Right(main));
-    do (&mut x).with |opt| {  //~ ERROR illegal borrow
+    do (&mut x).with |opt| {
         match opt {
             &Right(ref f) => {
-                x = X(Left((0,0))); //~ ERROR assigning to captured outer mutable variable
+                x = X(Left((0,0))); //~ ERROR cannot assign to `x`
                 (*f)()
             },
             _ => fail!()
diff --git a/src/test/compile-fail/borrowck-bad-nested-calls-free.rs b/src/test/compile-fail/borrowck-bad-nested-calls-free.rs
new file mode 100644
index 00000000000..ff1ec38ad64
--- /dev/null
+++ b/src/test/compile-fail/borrowck-bad-nested-calls-free.rs
@@ -0,0 +1,43 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that we detect nested calls that could free pointers evaluated
+// for earlier arguments.
+
+fn rewrite(v: &mut ~uint) -> uint {
+    *v = ~22;
+    **v
+}
+
+fn add(v: &uint, w: uint) -> uint {
+    *v + w
+}
+
+fn implicit() {
+    let mut a = ~1;
+
+    // Note the danger here:
+    //
+    //    the pointer for the first argument has already been
+    //    evaluated, but it gets freed when evaluating the second
+    //    argument!
+    add(
+        a,
+        rewrite(&mut a)); //~ ERROR cannot borrow
+}
+
+fn explicit() {
+    let mut a = ~1;
+    add(
+        &*a,
+        rewrite(&mut a)); //~ ERROR cannot borrow
+}
+
+fn main() {}
\ No newline at end of file
diff --git a/src/test/compile-fail/borrowck-bad-nested-calls-move.rs b/src/test/compile-fail/borrowck-bad-nested-calls-move.rs
new file mode 100644
index 00000000000..0adf486b8b3
--- /dev/null
+++ b/src/test/compile-fail/borrowck-bad-nested-calls-move.rs
@@ -0,0 +1,43 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Test that we detect nested calls that could free pointers evaluated
+// for earlier arguments.
+
+fn rewrite(v: &mut ~uint) -> uint {
+    *v = ~22;
+    **v
+}
+
+fn add(v: &uint, w: ~uint) -> uint {
+    *v + *w
+}
+
+fn implicit() {
+    let mut a = ~1;
+
+    // Note the danger here:
+    //
+    //    the pointer for the first argument has already been
+    //    evaluated, but it gets moved when evaluating the second
+    //    argument!
+    add(
+        a,
+        a); //~ ERROR cannot move
+}
+
+fn explicit() {
+    let mut a = ~1;
+    add(
+        &*a,
+        a); //~ ERROR cannot move
+}
+
+fn main() {}
\ No newline at end of file
diff --git a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
index 005908f86d8..1051c5829ec 100644
--- a/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
+++ b/src/test/compile-fail/borrowck-borrow-from-owned-ptr.rs
@@ -22,32 +22,37 @@ fn make_foo() -> ~Foo { fail!() }
 
 fn borrow_same_field_twice_mut_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
-    let _bar2 = &mut foo.bar1;  //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1;
+    let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_same_field_twice_mut_imm() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
-    let _bar2 = &foo.bar1;  //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1;
+    let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_same_field_twice_imm_mut() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1;
-    let _bar2 = &mut foo.bar1;  //~ ERROR conflicts with prior loan
+    let bar1 = &foo.bar1;
+    let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_same_field_twice_imm_imm() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1;
+    let bar1 = &foo.bar1;
     let _bar2 = &foo.bar1;
+    *bar1;
 }
 
-fn borrow_both_mut() {
+fn borrow_both_fields_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
+    let bar1 = &mut foo.bar1;
     let _bar2 = &mut foo.bar2;
+    *bar1;
 }
 
 fn borrow_both_mut_pattern() {
@@ -59,66 +64,77 @@ fn borrow_both_mut_pattern() {
 
 fn borrow_var_and_pattern() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
+    let bar1 = &mut foo.bar1;
     match *foo {
         Foo { bar1: ref mut _bar1, bar2: _ } => {}
-        //~^ ERROR conflicts with prior loan
+        //~^ ERROR cannot borrow
     }
+    *bar1;
 }
 
 fn borrow_mut_and_base_imm() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &foo.bar1; //~ ERROR conflicts with prior loan
-    let _foo2 = &*foo; //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1.int1;
+    let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+    let _foo2 = &*foo; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_mut_and_base_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &mut foo.bar1; //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1.int1;
+    let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_mut_and_base_mut2() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo2 = &mut *foo; //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1.int1;
+    let _foo2 = &mut *foo; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_imm_and_base_mut() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1.int1;
-    let _foo1 = &mut foo.bar1; //~ ERROR conflicts with prior loan
+    let bar1 = &foo.bar1.int1;
+    let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_imm_and_base_mut2() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1.int1;
-    let _foo2 = &mut *foo; //~ ERROR conflicts with prior loan
+    let bar1 = &foo.bar1.int1;
+    let _foo2 = &mut *foo; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_imm_and_base_imm() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1.int1;
+    let bar1 = &foo.bar1.int1;
     let _foo1 = &foo.bar1;
     let _foo2 = &*foo;
+    *bar1;
 }
 
 fn borrow_mut_and_imm() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
+    let bar1 = &mut foo.bar1;
     let _foo1 = &foo.bar2;
+    *bar1;
 }
 
 fn borrow_mut_from_imm() {
     let foo = make_foo();
-    let _bar1 = &mut foo.bar1; //~ ERROR illegal borrow
+    let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_long_path_both_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &mut foo.bar2.int2;
+    let bar1 = &mut foo.bar1.int1;
+    let foo1 = &mut foo.bar2.int2;
+    *bar1;
+    *foo1;
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
index 035e293bc36..cdcf50c906e 100644
--- a/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
+++ b/src/test/compile-fail/borrowck-borrow-from-stack-variable.rs
@@ -22,32 +22,37 @@ fn make_foo() -> Foo { fail!() }
 
 fn borrow_same_field_twice_mut_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
-    let _bar2 = &mut foo.bar1;  //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1;
+    let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_same_field_twice_mut_imm() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
-    let _bar2 = &foo.bar1;  //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1;
+    let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_same_field_twice_imm_mut() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1;
-    let _bar2 = &mut foo.bar1;  //~ ERROR conflicts with prior loan
+    let bar1 = &foo.bar1;
+    let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_same_field_twice_imm_imm() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1;
+    let bar1 = &foo.bar1;
     let _bar2 = &foo.bar1;
+    *bar1;
 }
 
 fn borrow_both_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
+    let bar1 = &mut foo.bar1;
     let _bar2 = &mut foo.bar2;
+    *bar1;
 }
 
 fn borrow_both_mut_pattern() {
@@ -59,66 +64,76 @@ fn borrow_both_mut_pattern() {
 
 fn borrow_var_and_pattern() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
+    let bar1 = &mut foo.bar1;
     match foo {
-        Foo { bar1: ref mut _bar1, bar2: _ } => {}
-        //~^ ERROR conflicts with prior loan
+        Foo { bar1: ref mut _bar1, bar2: _ } => {} //
+        //~^ ERROR cannot borrow
     }
+    *bar1;
 }
 
 fn borrow_mut_and_base_imm() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &foo.bar1; //~ ERROR conflicts with prior loan
-    let _foo2 = &foo; //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1.int1;
+    let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+    let _foo2 = &foo; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_mut_and_base_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &mut foo.bar1; //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1.int1;
+    let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_mut_and_base_mut2() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
-    let _foo2 = &mut foo; //~ ERROR conflicts with prior loan
+    let bar1 = &mut foo.bar1.int1;
+    let _foo2 = &mut foo; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_imm_and_base_mut() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1.int1;
-    let _foo1 = &mut foo.bar1; //~ ERROR conflicts with prior loan
+    let bar1 = &foo.bar1.int1;
+    let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_imm_and_base_mut2() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1.int1;
-    let _foo2 = &mut foo; //~ ERROR conflicts with prior loan
+    let bar1 = &foo.bar1.int1;
+    let _foo2 = &mut foo; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_imm_and_base_imm() {
     let mut foo = make_foo();
-    let _bar1 = &foo.bar1.int1;
+    let bar1 = &foo.bar1.int1;
     let _foo1 = &foo.bar1;
     let _foo2 = &foo;
+    *bar1;
 }
 
 fn borrow_mut_and_imm() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1;
+    let bar1 = &mut foo.bar1;
     let _foo1 = &foo.bar2;
+    *bar1;
 }
 
 fn borrow_mut_from_imm() {
     let foo = make_foo();
-    let _bar1 = &mut foo.bar1; //~ ERROR illegal borrow
+    let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
+    *bar1;
 }
 
 fn borrow_long_path_both_mut() {
     let mut foo = make_foo();
-    let _bar1 = &mut foo.bar1.int1;
+    let bar1 = &mut foo.bar1.int1;
     let _foo1 = &mut foo.bar2.int2;
+    *bar1;
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
index 4a6a90ae516..1e5c4c5cc41 100644
--- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
+++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs
@@ -28,5 +28,6 @@ fn defer<'r>(x: &'r [&'r str]) -> defer<'r> {
 }
 
 fn main() {
-    let _x = defer(~["Goodbye", "world!"]); //~ ERROR illegal borrow
+    let x = defer(~["Goodbye", "world!"]); //~ ERROR borrowed value does not live long enough
+    x.x[0];
 }
diff --git a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
index bda659aa7b9..887cb59930e 100644
--- a/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
+++ b/src/test/compile-fail/borrowck-borrowed-uniq-rvalue.rs
@@ -15,7 +15,7 @@ use core::hashmap::HashMap;
 fn main() {
     let mut buggy_map :HashMap<uint, &uint> =
       HashMap::new::<uint, &uint>();
-    buggy_map.insert(42, &*~1); //~ ERROR illegal borrow
+    buggy_map.insert(42, &*~1); //~ ERROR borrowed value does not live long enough
 
     // but it is ok if we use a temporary
     let tmp = ~2;
diff --git a/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs b/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
index f2c6ae98819..3abd19e5a11 100644
--- a/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
+++ b/src/test/compile-fail/borrowck-call-method-from-mut-aliasable.rs
@@ -27,13 +27,15 @@ fn a(x: &mut Foo) {
 fn b(x: &Foo) {
     x.f();
     x.g();
-    x.h(); //~ ERROR illegal borrow
+    x.h(); //~ ERROR cannot borrow
 }
 
 fn c(x: &const Foo) {
-    x.f(); //~ ERROR illegal borrow unless pure
+    x.f(); //~ ERROR cannot borrow
+    //~^ ERROR unsafe borrow
     x.g();
-    x.h(); //~ ERROR illegal borrow
+    x.h(); //~ ERROR cannot borrow
+    //~^ ERROR unsafe borrow
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs b/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
index 88db5f54341..8af10231921 100644
--- a/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
+++ b/src/test/compile-fail/borrowck-imm-ref-to-mut-rec-field-issue-3162-c.rs
@@ -10,9 +10,9 @@
 
 fn main() {
     let mut _a = 3;
-    let _b = &mut _a; //~ NOTE loan of mutable local variable granted here
+    let _b = &mut _a;
     {
         let _c = &*_b;
-        _a = 4; //~ ERROR assigning to mutable local variable prohibited
+        _a = 4; //~ ERROR cannot assign to `_a`
     }
 }
diff --git a/src/test/compile-fail/borrowck-insert-during-each.rs b/src/test/compile-fail/borrowck-insert-during-each.rs
index 17c0efe225e..109753b38e7 100644
--- a/src/test/compile-fail/borrowck-insert-during-each.rs
+++ b/src/test/compile-fail/borrowck-insert-during-each.rs
@@ -23,8 +23,8 @@ pub impl Foo {
 }
 
 fn bar(f: &mut Foo) {
-  do f.foo |a| { //~ NOTE prior loan as mutable granted here
-    f.n.insert(*a); //~ ERROR conflicts with prior loan
+  do f.foo |a| {
+    f.n.insert(*a); //~ ERROR cannot borrow
   }
 }
 
diff --git a/src/test/compile-fail/borrowck-issue-2657-1.rs b/src/test/compile-fail/borrowck-issue-2657-1.rs
index ce183c1888f..8bcd5f9a72e 100644
--- a/src/test/compile-fail/borrowck-issue-2657-1.rs
+++ b/src/test/compile-fail/borrowck-issue-2657-1.rs
@@ -10,9 +10,9 @@
 
 fn main() {
 let x = Some(~1);
-match x { //~ NOTE loan of immutable local variable granted here
+match x {
   Some(ref _y) => {
-    let _a = x; //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
+    let _a = x; //~ ERROR cannot move
   }
   _ => {}
 }
diff --git a/src/test/compile-fail/borrowck-issue-2657-2.rs b/src/test/compile-fail/borrowck-issue-2657-2.rs
index d2217778d41..fac805c57ca 100644
--- a/src/test/compile-fail/borrowck-issue-2657-2.rs
+++ b/src/test/compile-fail/borrowck-issue-2657-2.rs
@@ -12,7 +12,7 @@ fn main() {
 let x = Some(~1);
 match x {
   Some(ref y) => {
-    let _b = *y; //~ ERROR moving out of dereference of immutable & pointer
+    let _b = *y; //~ ERROR cannot move out
   }
   _ => {}
 }
diff --git a/src/test/compile-fail/borrowck-lend-flow-if.rs b/src/test/compile-fail/borrowck-lend-flow-if.rs
new file mode 100644
index 00000000000..563f63b98be
--- /dev/null
+++ b/src/test/compile-fail/borrowck-lend-flow-if.rs
@@ -0,0 +1,52 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Note: the borrowck analysis is currently flow-insensitive.
+// Therefore, some of these errors are marked as spurious and could be
+// corrected by a simple change to the analysis.  The others are
+// either genuine or would require more advanced changes.  The latter
+// cases are noted.
+
+fn borrow(_v: &int) {}
+fn borrow_mut(_v: &mut int) {}
+fn cond() -> bool { fail!() }
+fn for_func(_f: &fn() -> bool) { fail!() }
+fn produce<T>() -> T { fail!(); }
+
+fn inc(v: &mut ~int) {
+    *v = ~(**v + 1);
+}
+
+fn pre_freeze_cond() {
+    // In this instance, the freeze is conditional and starts before
+    // the mut borrow.
+
+    let mut v = ~3;
+    let _w;
+    if cond() {
+        _w = &v;
+    }
+    borrow_mut(v); //~ ERROR cannot borrow
+}
+
+fn pre_freeze_else() {
+    // In this instance, the freeze and mut borrow are on separate sides
+    // of the if.
+
+    let mut v = ~3;
+    let _w;
+    if cond() {
+        _w = &v;
+    } else {
+        borrow_mut(v);
+    }
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs
new file mode 100644
index 00000000000..b6384ad9590
--- /dev/null
+++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs
@@ -0,0 +1,164 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// Note: the borrowck analysis is currently flow-insensitive.
+// Therefore, some of these errors are marked as spurious and could be
+// corrected by a simple change to the analysis.  The others are
+// either genuine or would require more advanced changes.  The latter
+// cases are noted.
+
+fn borrow(_v: &int) {}
+fn borrow_mut(_v: &mut int) {}
+fn cond() -> bool { fail!() }
+fn for_func(_f: &fn() -> bool) { fail!() }
+fn produce<T>() -> T { fail!(); }
+
+fn inc(v: &mut ~int) {
+    *v = ~(**v + 1);
+}
+
+fn loop_overarching_alias_mut() {
+    // In this instance, the borrow encompasses the entire loop.
+
+    let mut v = ~3;
+    let mut x = &mut v;
+    **x += 1;
+    loop {
+        borrow(v); //~ ERROR cannot borrow
+    }
+}
+
+fn block_overarching_alias_mut() {
+    // In this instance, the borrow encompasses the entire closure call.
+
+    let mut v = ~3;
+    let mut x = &mut v;
+    for 3.times {
+        borrow(v); //~ ERROR cannot borrow
+    }
+    *x = ~5;
+}
+
+fn loop_aliased_mut() {
+    // In this instance, the borrow is carried through the loop.
+
+    let mut v = ~3, w = ~4;
+    let mut _x = &w;
+    loop {
+        borrow_mut(v); //~ ERROR cannot borrow
+        _x = &v;
+    }
+}
+
+fn while_aliased_mut() {
+    // In this instance, the borrow is carried through the loop.
+
+    let mut v = ~3, w = ~4;
+    let mut _x = &w;
+    while cond() {
+        borrow_mut(v); //~ ERROR cannot borrow
+        _x = &v;
+    }
+}
+
+fn for_loop_aliased_mut() {
+    // In this instance, the borrow is carried through the loop.
+
+    let mut v = ~3, w = ~4;
+    let mut _x = &w;
+    for for_func {
+        borrow_mut(v); //~ ERROR cannot borrow
+        _x = &v;
+    }
+}
+
+fn loop_aliased_mut_break() {
+    // In this instance, the borrow is carried through the loop.
+
+    let mut v = ~3, w = ~4;
+    let mut _x = &w;
+    loop {
+        borrow_mut(v);
+        _x = &v;
+        break;
+    }
+    borrow_mut(v); //~ ERROR cannot borrow
+}
+
+fn while_aliased_mut_break() {
+    // In this instance, the borrow is carried through the loop.
+
+    let mut v = ~3, w = ~4;
+    let mut _x = &w;
+    while cond() {
+        borrow_mut(v);
+        _x = &v;
+        break;
+    }
+    borrow_mut(v); //~ ERROR cannot borrow
+}
+
+fn for_aliased_mut_break() {
+    // In this instance, the borrow is carried through the loop.
+
+    let mut v = ~3, w = ~4;
+    let mut _x = &w;
+    for for_func {
+        // here we cannot be sure that `for_func` respects the break below
+        borrow_mut(v); //~ ERROR cannot borrow
+        _x = &v;
+        break;
+    }
+    borrow_mut(v); //~ ERROR cannot borrow
+}
+
+fn while_aliased_mut_cond(cond: bool, cond2: bool) {
+    let mut v = ~3, w = ~4;
+    let mut x = &mut w;
+    while cond {
+        **x += 1;
+        borrow(v); //~ ERROR cannot borrow
+        if cond2 {
+            x = &mut v; //~ ERROR cannot borrow
+        }
+    }
+}
+
+fn loop_break_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) {
+    // Here we check that when you break out of an inner loop, the
+    // borrows that go out of scope as you exit the inner loop are
+    // removed from the bitset.
+
+    while cond() {
+        while cond() {
+            // this borrow is limited to the scope of `r`...
+            let r: &'r mut uint = produce();
+            if !f(&mut *r) {
+                break; // ...so it is not live as exit the `while` loop here
+            }
+        }
+    }
+}
+
+fn loop_loop_pops_scopes<'r>(_v: &'r mut [uint], f: &fn(&'r mut uint) -> bool) {
+    // Similar to `loop_break_pops_scopes` but for the `loop` keyword
+
+    while cond() {
+        while cond() {
+            // this borrow is limited to the scope of `r`...
+            let r: &'r mut uint = produce();
+            if !f(&mut *r) {
+                loop; // ...so it is not live as exit (and re-enter) the `while` loop here
+            }
+        }
+    }
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs
new file mode 100644
index 00000000000..7603fdc82a8
--- /dev/null
+++ b/src/test/compile-fail/borrowck-lend-flow-match.rs
@@ -0,0 +1,60 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// xfail-pretty -- comments are infaithfully preserved
+
+#[allow(unused_variable)];
+#[allow(dead_assignment)];
+
+fn cond() -> bool { fail!() }
+fn link<'a>(v: &'a uint, w: &mut &'a uint) -> bool { *w = v; true }
+
+fn separate_arms() {
+    // Here both arms perform assignments, but only is illegal.
+
+    let mut x = None;
+    match x {
+        None => {
+            // It is ok to reassign x here, because there is in
+            // fact no outstanding loan of x!
+            x = Some(0);
+        }
+        Some(ref _i) => {
+            x = Some(1); //~ ERROR cannot assign
+        }
+    }
+    copy x; // just to prevent liveness warnings
+}
+
+fn guard() {
+    // Here the guard performs a borrow. This borrow "infects" all
+    // subsequent arms (but not the prior ones).
+
+    let mut a = ~3;
+    let mut b = ~4;
+    let mut w = &*a;
+    match 22 {
+        _ if cond() => {
+            b = ~5;
+        }
+
+        _ if link(&*b, &mut w) => {
+            b = ~6; //~ ERROR cannot assign
+        }
+
+        _ => {
+            b = ~7; //~ ERROR cannot assign
+        }
+    }
+
+    b = ~8; //~ ERROR cannot assign
+}
+
+fn main() {}
diff --git a/src/test/compile-fail/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck-lend-flow.rs
index ed6446a6311..59cac0c5d95 100644
--- a/src/test/compile-fail/borrowck-lend-flow.rs
+++ b/src/test/compile-fail/borrowck-lend-flow.rs
@@ -15,96 +15,37 @@
 // cases are noted.
 
 fn borrow(_v: &int) {}
+fn borrow_mut(_v: &mut int) {}
+fn cond() -> bool { fail!() }
+fn for_func(_f: &fn() -> bool) { fail!() }
+fn produce<T>() -> T { fail!(); }
 
 fn inc(v: &mut ~int) {
     *v = ~(**v + 1);
 }
 
-fn post_aliased_const() {
-    let mut v = ~3;
-    borrow(v);
-    let _w = &const v;
-}
-
-fn post_aliased_mut() {
-    // SPURIOUS--flow
-    let mut v = ~3;
-    borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-    let _w = &mut v; //~ NOTE prior loan as mutable granted here
-}
+fn pre_freeze() {
+    // In this instance, the freeze starts before the mut borrow.
 
-fn post_aliased_scope(cond: bool) {
     let mut v = ~3;
-    borrow(v);
-    if cond { inc(&mut v); }
+    let _w = &v;
+    borrow_mut(v); //~ ERROR cannot borrow
 }
 
-fn loop_overarching_alias_mut() {
-    let mut v = ~3;
-    let mut _x = &mut v; //~ NOTE prior loan as mutable granted here
-    loop {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-    }
-}
+fn pre_const() {
+    // In this instance, the freeze starts before the mut borrow.
 
-fn block_overarching_alias_mut() {
     let mut v = ~3;
-    let mut _x = &mut v; //~ NOTE prior loan as mutable granted here
-    for 3.times {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-    }
-}
-
-fn loop_aliased_mut() {
-    let mut v = ~3, w = ~4;
-    let mut _x = &mut w;
-    loop {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-        _x = &mut v; //~ NOTE prior loan as mutable granted here
-    }
-}
-
-fn while_aliased_mut(cond: bool) {
-    let mut v = ~3, w = ~4;
-    let mut _x = &mut w;
-    while cond {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-        _x = &mut v; //~ NOTE prior loan as mutable granted here
-    }
-}
-
-fn while_aliased_mut_cond(cond: bool, cond2: bool) {
-    let mut v = ~3, w = ~4;
-    let mut _x = &mut w;
-    while cond {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-        if cond2 {
-            _x = &mut v; //~ NOTE prior loan as mutable granted here
-        }
-    }
-}
-
-fn loop_in_block() {
-    let mut v = ~3, w = ~4;
-    let mut _x = &mut w;
-    for uint::range(0u, 10u) |_i| {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-        _x = &mut v; //~ NOTE prior loan as mutable granted here
-    }
+    let _w = &const v;
+    borrow_mut(v);
 }
 
-fn at_most_once_block() {
-    fn at_most_once(f: &fn()) { f() }
+fn post_freeze() {
+    // In this instance, the const alias starts after the borrow.
 
-    // Here, the borrow check has no way of knowing that the block is
-    // executed at most once.
-
-    let mut v = ~3, w = ~4;
-    let mut _x = &mut w;
-    do at_most_once {
-        borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-        _x = &mut v; //~ NOTE prior loan as mutable granted here
-    }
+    let mut v = ~3;
+    borrow_mut(v);
+    let _w = &v;
 }
 
 fn main() {}
diff --git a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
index 784fce1300f..50dd815d493 100644
--- a/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
+++ b/src/test/compile-fail/borrowck-loan-blocks-move-cc.rs
@@ -14,17 +14,17 @@ fn borrow(v: &int, f: &fn(x: &int)) {
 
 fn box_imm() {
     let v = ~3;
-    let _w = &v; //~ NOTE loan of immutable local variable granted here
+    let _w = &v;
     do task::spawn {
         debug!("v=%d", *v);
-        //~^ ERROR by-move capture of immutable local variable prohibited due to outstanding loan
+        //~^ ERROR cannot move `v` into closure
     }
 
     let v = ~3;
-    let _w = &v; //~ NOTE loan of immutable local variable granted here
+    let _w = &v;
     task::spawn(|| {
         debug!("v=%d", *v);
-        //~^ ERROR by-move capture of immutable local variable prohibited due to outstanding loan
+        //~^ ERROR cannot move
     });
 }
 
diff --git a/src/test/compile-fail/borrowck-loan-blocks-move.rs b/src/test/compile-fail/borrowck-loan-blocks-move.rs
index 3af77d2df7f..b9a79f4f3b1 100644
--- a/src/test/compile-fail/borrowck-loan-blocks-move.rs
+++ b/src/test/compile-fail/borrowck-loan-blocks-move.rs
@@ -13,8 +13,8 @@ fn take(_v: ~int) {
 
 fn box_imm() {
     let v = ~3;
-    let _w = &v; //~ NOTE loan of immutable local variable granted here
-    take(v); //~ ERROR moving out of immutable local variable prohibited due to outstanding loan
+    let _w = &v;
+    take(v); //~ ERROR cannot move out of `v` because it is borrowed
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
index 14cb37d775c..f8415a38573 100644
--- a/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
+++ b/src/test/compile-fail/borrowck-loan-blocks-mut-uniq.rs
@@ -14,8 +14,8 @@ fn borrow(v: &int, f: &fn(x: &int)) {
 
 fn box_imm() {
     let mut v = ~3;
-    do borrow(v) |w| { //~ NOTE loan of mutable local variable granted here
-        v = ~4; //~ ERROR assigning to captured outer mutable variable in a stack closure prohibited due to outstanding loan
+    do borrow(v) |w| {
+        v = ~4; //~ ERROR cannot assign to `v` because it is borrowed
         assert!(*v == 3);
         assert!(*w == 4);
     }
diff --git a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
index 482d1b6b8b6..0361213af22 100644
--- a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
+++ b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs
@@ -8,18 +8,16 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// xfail-test #3387
-
 struct foo(~uint);
 
 impl Add<foo, foo> for foo {
-    fn add(f: &foo) -> foo {
-        foo(~(**self + **(*f)))
+    fn add(&self, f: &foo) -> foo {
+        foo(~(***self + **(*f)))
     }
 }
 
 fn main() {
     let x = foo(~3);
-    let _y = x + x;
-    //~^ ERROR moving out of immutable local variable prohibited due to outstanding loan
+    let _y = x + {x}; // the `{x}` forces a move to occur
+    //~^ ERROR cannot move out of `x`
 }
diff --git a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs
index 1c2bd8dc8e1..6e8e3da143e 100644
--- a/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs
+++ b/src/test/compile-fail/borrowck-loan-local-as-both-mut-and-imm.rs
@@ -22,13 +22,13 @@ use core::either::{Either, Left, Right};
 
     fn g() {
         let mut x: Either<int,float> = Left(3);
-        io::println(f(&mut x, &x).to_str()); //~ ERROR conflicts with prior loan
+        io::println(f(&mut x, &x).to_str()); //~ ERROR cannot borrow
     }
 
     fn h() {
         let mut x: Either<int,float> = Left(3);
         let y: &Either<int, float> = &x;
-        let z: &mut Either<int, float> = &mut x; //~ ERROR conflicts with prior loan
+        let z: &mut Either<int, float> = &mut x; //~ ERROR cannot borrow
         *z = *y;
     }
 
diff --git a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
index 21bb7434f8d..061a6c553e4 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr-overloaded-op.rs
@@ -38,12 +38,13 @@ fn b() {
 
     // Here I create an outstanding loan and check that we get conflicts:
 
-    let q = &mut p; //~ NOTE prior loan as mutable granted here
+    let q = &mut p;
 
-    p + 3;  // ok for pure fns
-    p.times(3); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
+    p + 3;  //~ ERROR cannot borrow `p`
+    p.times(3); //~ ERROR cannot borrow `p`
 
-    q.x += 1;
+    *q + 3; // OK to use the new alias `q`
+    q.x += 1; // and OK to mutate it
 }
 
 fn c() {
diff --git a/src/test/compile-fail/borrowck-loan-rcvr.rs b/src/test/compile-fail/borrowck-loan-rcvr.rs
index 36007abf05e..27a66557434 100644
--- a/src/test/compile-fail/borrowck-loan-rcvr.rs
+++ b/src/test/compile-fail/borrowck-loan-rcvr.rs
@@ -13,7 +13,6 @@ struct point { x: int, y: int }
 trait methods {
     fn impurem(&self);
     fn blockm(&self, f: &fn());
-    fn purem(&self);
 }
 
 impl methods for point {
@@ -21,9 +20,6 @@ impl methods for point {
     }
 
     fn blockm(&self, f: &fn()) { f() }
-
-    fn purem(&self) {
-    }
 }
 
 fn a() {
@@ -31,12 +27,11 @@ fn a() {
 
     // Here: it's ok to call even though receiver is mutable, because we
     // can loan it out.
-    p.purem();
     p.impurem();
 
     // But in this case we do not honor the loan:
-    do p.blockm { //~ NOTE loan of mutable local variable granted here
-        p.x = 10; //~ ERROR assigning to mutable field prohibited due to outstanding loan
+    do p.blockm {
+        p.x = 10; //~ ERROR cannot assign
     }
 }
 
@@ -45,20 +40,21 @@ fn b() {
 
     // Here I create an outstanding loan and check that we get conflicts:
 
-    let l = &mut p; //~ NOTE prior loan as mutable granted here
-    //~^ NOTE prior loan as mutable granted here
-
-    p.purem(); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
-    p.impurem(); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
+    let l = &mut p;
+    p.impurem(); //~ ERROR cannot borrow
 
     l.x += 1;
 }
 
 fn c() {
-    // Loaning @mut as & is considered legal due to dynamic checks:
+    // Loaning @mut as & is considered legal due to dynamic checks...
     let q = @mut point {x: 3, y: 4};
-    q.purem();
     q.impurem();
+
+    // ...but we still detect errors statically when we can.
+    do q.blockm {
+        q.x = 10; //~ ERROR cannot assign
+    }
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-loan-vec-content.rs b/src/test/compile-fail/borrowck-loan-vec-content.rs
index d27d690437a..6a8e64377aa 100644
--- a/src/test/compile-fail/borrowck-loan-vec-content.rs
+++ b/src/test/compile-fail/borrowck-loan-vec-content.rs
@@ -24,8 +24,8 @@ fn has_mut_vec_and_does_not_try_to_change_it() {
 
 fn has_mut_vec_but_tries_to_change_it() {
     let mut v = ~[1, 2, 3];
-    do takes_imm_elt(&v[0]) { //~ NOTE loan of mutable vec content granted here
-        v[1] = 4; //~ ERROR assigning to mutable vec content prohibited due to outstanding loan
+    do takes_imm_elt(&v[0]) {
+        v[1] = 4; //~ ERROR cannot assign
     }
 }
 
diff --git a/src/test/compile-fail/borrowck-move-by-capture.rs b/src/test/compile-fail/borrowck-move-by-capture.rs
index 18b4ce0640c..c199c879575 100644
--- a/src/test/compile-fail/borrowck-move-by-capture.rs
+++ b/src/test/compile-fail/borrowck-move-by-capture.rs
@@ -4,7 +4,7 @@ fn main() {
     let foo = ~3;
     let _pfoo = &foo;
     let _f: @fn() -> int = || *foo + 5;
-    //~^ ERROR by-move capture
+    //~^ ERROR cannot move `foo`
 
     let bar = ~3;
     let _g = || {
diff --git a/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs b/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs
index d0b0f51d0cf..e4e44982276 100644
--- a/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs
+++ b/src/test/compile-fail/borrowck-mut-addr-of-imm-var.rs
@@ -10,7 +10,7 @@
 
 fn main() {
     let x: int = 3;
-    let y: &mut int = &mut x; //~ ERROR illegal borrow
+    let y: &mut int = &mut x; //~ ERROR cannot borrow
     *y = 5;
     debug!(*y);
 }
diff --git a/src/test/compile-fail/borrowck-mut-boxed-vec.rs b/src/test/compile-fail/borrowck-mut-boxed-vec.rs
index e8ed362176f..716f70b2913 100644
--- a/src/test/compile-fail/borrowck-mut-boxed-vec.rs
+++ b/src/test/compile-fail/borrowck-mut-boxed-vec.rs
@@ -10,7 +10,7 @@
 
 fn main() {
     let v = @mut [ 1, 2, 3 ];
-    for v.each |_x| {   //~ ERROR illegal borrow
-        v[1] = 4;
+    for v.each |_x| {
+        v[1] = 4; //~ ERROR cannot assign
     }
 }
diff --git a/src/test/compile-fail/borrowck-mut-deref-comp.rs b/src/test/compile-fail/borrowck-mut-deref-comp.rs
index 540793d4135..d1dc2961978 100644
--- a/src/test/compile-fail/borrowck-mut-deref-comp.rs
+++ b/src/test/compile-fail/borrowck-mut-deref-comp.rs
@@ -11,8 +11,8 @@
 struct foo(~int);
 
 fn borrow(x: @mut foo) {
-    let _y = &***x; //~ ERROR illegal borrow unless pure
-    *x = foo(~4); //~ NOTE impure due to assigning to dereference of mutable @ pointer
+    let _y = &***x;
+    *x = foo(~4); //~ ERROR cannot assign
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs b/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs
index bc0340983ae..ec17976c506 100644
--- a/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs
+++ b/src/test/compile-fail/borrowck-mut-slice-of-imm-vec.rs
@@ -14,5 +14,5 @@ fn write(v: &mut [int]) {
 
 fn main() {
     let v = ~[1, 2, 3];
-    write(v); //~ ERROR illegal borrow
+    write(v); //~ ERROR cannot borrow
 }
diff --git a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
index 4af3bc17240..ed270de51e2 100644
--- a/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
+++ b/src/test/compile-fail/borrowck-no-cycle-in-exchange-heap.rs
@@ -19,9 +19,9 @@ enum cycle {
 fn main() {
     let mut x = ~node(node_ {a: ~empty});
     // Create a cycle!
-    match *x { //~ NOTE loan of mutable local variable granted here
+    match *x {
       node(ref mut y) => {
-        y.a = x; //~ ERROR moving out of mutable local variable prohibited due to outstanding loan
+        y.a = x; //~ ERROR cannot move out of
       }
       empty => {}
     };
diff --git a/src/test/compile-fail/borrowck-pat-by-value-binding.rs b/src/test/compile-fail/borrowck-pat-by-value-binding.rs
index d8c8841d391..d60ed3d0e37 100644
--- a/src/test/compile-fail/borrowck-pat-by-value-binding.rs
+++ b/src/test/compile-fail/borrowck-pat-by-value-binding.rs
@@ -12,23 +12,24 @@ fn process<T>(_t: T) {}
 
 fn match_const_opt_by_mut_ref(v: &const Option<int>) {
     match *v {
-      Some(ref mut i) => process(i), //~ ERROR illegal borrow
+      Some(ref mut i) => process(i), //~ ERROR cannot borrow
+        //~^ ERROR unsafe borrow of aliasable, const value
       None => ()
     }
 }
 
 fn match_const_opt_by_const_ref(v: &const Option<int>) {
     match *v {
-      Some(ref const i) => process(i), //~ ERROR illegal borrow unless pure
-      //~^ NOTE impure due to
+      Some(ref const i) => process(i),
+        //~^ ERROR unsafe borrow of aliasable, const value
       None => ()
     }
 }
 
 fn match_const_opt_by_imm_ref(v: &const Option<int>) {
     match *v {
-      Some(ref i) => process(i), //~ ERROR illegal borrow unless pure
-      //~^ NOTE impure due to
+      Some(ref i) => process(i), //~ ERROR cannot borrow
+        //~^ ERROR unsafe borrow of aliasable, const value
       None => ()
     }
 }
diff --git a/src/test/compile-fail/borrowck-pat-enum.rs b/src/test/compile-fail/borrowck-pat-enum.rs
index 4aa1ecc0ce3..c50357e8b9c 100644
--- a/src/test/compile-fail/borrowck-pat-enum.rs
+++ b/src/test/compile-fail/borrowck-pat-enum.rs
@@ -26,7 +26,8 @@ fn match_ref_unused(&&v: Option<int>) {
 
 fn match_const_reg(v: &const Option<int>) -> int {
     match *v {
-      Some(ref i) => {*i} // OK because this is pure
+      Some(ref i) => {*i} //~ ERROR cannot borrow
+        //~^ ERROR unsafe borrow
       None => {0}
     }
 }
@@ -43,8 +44,8 @@ fn match_const_reg_unused(v: &const Option<int>) {
 
 fn match_const_reg_impure(v: &const Option<int>) {
     match *v {
-      Some(ref i) => {impure(*i)} //~ ERROR illegal borrow unless pure
-      //~^ NOTE impure due to access to impure function
+      Some(ref i) => {impure(*i)} //~ ERROR cannot borrow
+        //~^ ERROR unsafe borrow
       None => {}
     }
 }
@@ -56,5 +57,12 @@ fn match_imm_reg(v: &Option<int>) {
     }
 }
 
+fn match_mut_reg(v: &mut Option<int>) {
+    match *v {
+      Some(ref i) => {impure(*i)} // OK, frozen
+      None => {}
+    }
+}
+
 fn main() {
 }
diff --git a/src/test/compile-fail/borrowck-pat-reassign-binding.rs b/src/test/compile-fail/borrowck-pat-reassign-binding.rs
index ca1fdc97c22..d05160132c6 100644
--- a/src/test/compile-fail/borrowck-pat-reassign-binding.rs
+++ b/src/test/compile-fail/borrowck-pat-reassign-binding.rs
@@ -12,11 +12,14 @@
 
 fn main() {
     let mut x: Option<int> = None;
-    match x { //~ NOTE loan of mutable local variable granted here
-      None => {}
+    match x {
+      None => {
+          // Note: on this branch, no borrow has occurred.
+          x = Some(0);
+      }
       Some(ref i) => {
-        // Not ok: i is an outstanding ptr into x.
-        x = Some(*i+1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
+          // But on this branch, `i` is an outstanding borrow
+          x = Some(*i+1); //~ ERROR cannot assign to `x`
       }
     }
     copy x; // just to prevent liveness warnings
diff --git a/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs b/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs
deleted file mode 100644
index dd6eca951b8..00000000000
--- a/src/test/compile-fail/borrowck-pat-reassign-sometimes-binding.rs
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// xfail-pretty -- comments are infaithfully preserved
-
-fn main() {
-    let mut x = None;
-    match x { //~ NOTE loan of mutable local variable granted here
-      None => {
-        // It is ok to reassign x here, because there is in
-        // fact no outstanding loan of x!
-        x = Some(0);
-      }
-      Some(ref _i) => {
-        x = Some(1); //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
-      }
-    }
-    copy x; // just to prevent liveness warnings
-}
diff --git a/src/test/compile-fail/borrowck-reborrow-from-mut.rs b/src/test/compile-fail/borrowck-reborrow-from-mut.rs
index 60f817dee0c..b4bd64f2135 100644
--- a/src/test/compile-fail/borrowck-reborrow-from-mut.rs
+++ b/src/test/compile-fail/borrowck-reborrow-from-mut.rs
@@ -20,17 +20,17 @@ struct Bar {
 
 fn borrow_same_field_twice_mut_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
-    let _bar2 = &mut foo.bar1;  //~ ERROR conflicts with prior loan
+    let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
 }
 
 fn borrow_same_field_twice_mut_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
-    let _bar2 = &foo.bar1;  //~ ERROR conflicts with prior loan
+    let _bar2 = &foo.bar1;  //~ ERROR cannot borrow
 }
 
 fn borrow_same_field_twice_imm_mut(foo: &mut Foo) {
     let _bar1 = &foo.bar1;
-    let _bar2 = &mut foo.bar1;  //~ ERROR conflicts with prior loan
+    let _bar2 = &mut foo.bar1;  //~ ERROR cannot borrow
 }
 
 fn borrow_same_field_twice_imm_imm(foo: &mut Foo) {
@@ -53,34 +53,34 @@ fn borrow_var_and_pattern(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1;
     match *foo {
         Foo { bar1: ref mut _bar1, bar2: _ } => {}
-        //~^ ERROR conflicts with prior loan
+        //~^ ERROR cannot borrow
     }
 }
 
 fn borrow_mut_and_base_imm(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &foo.bar1; //~ ERROR conflicts with prior loan
-    let _foo2 = &*foo; //~ ERROR conflicts with prior loan
+    let _foo1 = &foo.bar1; //~ ERROR cannot borrow
+    let _foo2 = &*foo; //~ ERROR cannot borrow
 }
 
 fn borrow_mut_and_base_mut(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
-    let _foo1 = &mut foo.bar1; //~ ERROR conflicts with prior loan
+    let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
 }
 
 fn borrow_mut_and_base_mut2(foo: &mut Foo) {
     let _bar1 = &mut foo.bar1.int1;
-    let _foo2 = &mut *foo; //~ ERROR conflicts with prior loan
+    let _foo2 = &mut *foo; //~ ERROR cannot borrow
 }
 
 fn borrow_imm_and_base_mut(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
-    let _foo1 = &mut foo.bar1; //~ ERROR conflicts with prior loan
+    let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
 }
 
 fn borrow_imm_and_base_mut2(foo: &mut Foo) {
     let _bar1 = &foo.bar1.int1;
-    let _foo2 = &mut *foo; //~ ERROR conflicts with prior loan
+    let _foo2 = &mut *foo; //~ ERROR cannot borrow
 }
 
 fn borrow_imm_and_base_imm(foo: &mut Foo) {
@@ -95,7 +95,7 @@ fn borrow_mut_and_imm(foo: &mut Foo) {
 }
 
 fn borrow_mut_from_imm(foo: &Foo) {
-    let _bar1 = &mut foo.bar1; //~ ERROR illegal borrow
+    let _bar1 = &mut foo.bar1; //~ ERROR cannot borrow
 }
 
 fn borrow_long_path_both_mut(foo: &mut Foo) {
diff --git a/src/test/compile-fail/borrowck-ref-into-rvalue.rs b/src/test/compile-fail/borrowck-ref-into-rvalue.rs
index 84acd0df20b..7026f06c2b7 100644
--- a/src/test/compile-fail/borrowck-ref-into-rvalue.rs
+++ b/src/test/compile-fail/borrowck-ref-into-rvalue.rs
@@ -10,8 +10,8 @@
 
 fn main() {
     let msg;
-    match Some(~"Hello") { //~ ERROR illegal borrow
-        Some(ref m) => {
+    match Some(~"Hello") {
+        Some(ref m) => { //~ ERROR borrowed value does not live long enough
             msg = m;
         },
         None => { fail!() }
diff --git a/src/test/compile-fail/borrowck-ref-mut-of-imm.rs b/src/test/compile-fail/borrowck-ref-mut-of-imm.rs
index aad86241e9a..3a37116a166 100644
--- a/src/test/compile-fail/borrowck-ref-mut-of-imm.rs
+++ b/src/test/compile-fail/borrowck-ref-mut-of-imm.rs
@@ -11,7 +11,7 @@
 fn destructure(x: Option<int>) -> int {
     match x {
       None => 0,
-      Some(ref mut v) => *v //~ ERROR illegal borrow
+      Some(ref mut v) => *v //~ ERROR cannot borrow
     }
 }
 
diff --git a/src/test/compile-fail/borrowck-unary-move-2.rs b/src/test/compile-fail/borrowck-unary-move-2.rs
index 520772f1cee..898830bbe55 100644
--- a/src/test/compile-fail/borrowck-unary-move-2.rs
+++ b/src/test/compile-fail/borrowck-unary-move-2.rs
@@ -28,5 +28,5 @@ struct wrapper(noncopyable);
 
 fn main() {
     let x1 = wrapper(noncopyable());
-    let _x2 = *x1; //~ ERROR moving out of anonymous field
+    let _x2 = *x1; //~ ERROR cannot move out
 }
diff --git a/src/test/compile-fail/borrowck-unary-move.rs b/src/test/compile-fail/borrowck-unary-move.rs
index f95b365ee2e..107e478004a 100644
--- a/src/test/compile-fail/borrowck-unary-move.rs
+++ b/src/test/compile-fail/borrowck-unary-move.rs
@@ -9,8 +9,8 @@
 // except according to those terms.
 
 fn foo(+x: ~int) -> int {
-    let y = &*x; //~ NOTE loan of argument granted here
-    free(x); //~ ERROR moving out of argument prohibited due to outstanding loan
+    let y = &*x;
+    free(x); //~ ERROR cannot move out of `*x` because it is borrowed
     *y
 }
 
diff --git a/src/test/compile-fail/borrowck-uniq-via-box.rs b/src/test/compile-fail/borrowck-uniq-via-box.rs
deleted file mode 100644
index 97414ff5e78..00000000000
--- a/src/test/compile-fail/borrowck-uniq-via-box.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-struct Rec {
-    f: ~int,
-}
-
-struct Outer {
-    f: Inner
-}
-
-struct Inner {
-    g: Innermost
-}
-
-struct Innermost {
-    h: ~int,
-}
-
-fn borrow(_v: &int) {}
-
-fn box_mut(v: @mut ~int) {
-    borrow(*v); //~ ERROR illegal borrow unless pure
-}
-
-fn box_mut_rec(v: @mut Rec) {
-    borrow(v.f); //~ ERROR illegal borrow unless pure
-}
-
-fn box_mut_recs(v: @mut Outer) {
-    borrow(v.f.g.h); //~ ERROR illegal borrow unless pure
-}
-
-fn box_imm(v: @~int) {
-    borrow(*v); // OK
-}
-
-fn box_imm_rec(v: @Rec) {
-    borrow(v.f); // OK
-}
-
-fn box_imm_recs(v: @Outer) {
-    borrow(v.f.g.h); // OK
-}
-
-fn main() {
-}
diff --git a/src/test/compile-fail/borrowck-uniq-via-lend.rs b/src/test/compile-fail/borrowck-uniq-via-lend.rs
index ee96237a26c..80ba1968bc7 100644
--- a/src/test/compile-fail/borrowck-uniq-via-lend.rs
+++ b/src/test/compile-fail/borrowck-uniq-via-lend.rs
@@ -43,8 +43,8 @@ fn aliased_const() {
 
 fn aliased_mut() {
     let mut v = ~3;
-    let _w = &mut v; //~ NOTE prior loan as mutable granted here
-    borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
+    let _w = &mut v;
+    borrow(v); //~ ERROR cannot borrow `*v`
 }
 
 fn aliased_other() {
@@ -56,8 +56,8 @@ fn aliased_other() {
 fn aliased_other_reassign() {
     let mut v = ~3, w = ~4;
     let mut _x = &mut w;
-    _x = &mut v; //~ NOTE prior loan as mutable granted here
-    borrow(v); //~ ERROR loan of mutable local variable as immutable conflicts with prior loan
+    _x = &mut v;
+    borrow(v); //~ ERROR cannot borrow `*v`
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-uniq-via-ref.rs b/src/test/compile-fail/borrowck-uniq-via-ref.rs
index 2cf363e13ee..8bf627d9919 100644
--- a/src/test/compile-fail/borrowck-uniq-via-ref.rs
+++ b/src/test/compile-fail/borrowck-uniq-via-ref.rs
@@ -25,6 +25,7 @@ struct Innermost {
 }
 
 fn borrow(_v: &int) {}
+fn borrow_const(_v: &const int) {}
 
 fn box_mut(v: &mut ~int) {
     borrow(*v); // OK: &mut -> &imm
@@ -51,15 +52,15 @@ fn box_imm_recs(v: &Outer) {
 }
 
 fn box_const(v: &const ~int) {
-    borrow(*v); //~ ERROR illegal borrow unless pure
+    borrow_const(*v); //~ ERROR unsafe borrow
 }
 
 fn box_const_rec(v: &const Rec) {
-    borrow(v.f); //~ ERROR illegal borrow unless pure
+    borrow_const(v.f); //~ ERROR unsafe borrow
 }
 
 fn box_const_recs(v: &const Outer) {
-    borrow(v.f.g.h); //~ ERROR illegal borrow unless pure
+    borrow_const(v.f.g.h); //~ ERROR unsafe borrow
 }
 
 fn main() {
diff --git a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
index c8a0dbedd5d..0c21b64bb0f 100644
--- a/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
+++ b/src/test/compile-fail/borrowck-vec-pattern-element-loan.rs
@@ -1,7 +1,7 @@
 fn a() -> &[int] {
     let vec = [1, 2, 3, 4];
-    let tail = match vec { //~ ERROR illegal borrow
-        [_, ..tail] => tail,
+    let tail = match vec {
+        [_, ..tail] => tail, //~ ERROR does not live long enough
         _ => fail!(~"a")
     };
     tail
@@ -9,8 +9,8 @@ fn a() -> &[int] {
 
 fn b() -> &[int] {
     let vec = [1, 2, 3, 4];
-    let init = match vec { //~ ERROR illegal borrow
-        [..init, _] => init,
+    let init = match vec {
+        [..init, _] => init, //~ ERROR does not live long enough
         _ => fail!(~"b")
     };
     init
@@ -18,8 +18,8 @@ fn b() -> &[int] {
 
 fn c() -> &[int] {
     let vec = [1, 2, 3, 4];
-    let slice = match vec { //~ ERROR illegal borrow
-        [_, ..slice, _] => slice,
+    let slice = match vec {
+        [_, ..slice, _] => slice, //~ ERROR does not live long enough
         _ => fail!(~"c")
     };
     slice
diff --git a/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs b/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs
index 805b162f1d3..635ce77bb8a 100644
--- a/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs
+++ b/src/test/compile-fail/borrowck-vec-pattern-loan-from-mut.rs
@@ -2,7 +2,7 @@ fn a() {
     let mut v = ~[1, 2, 3];
     match v {
         [_a, ..tail] => {
-            v.push(tail[0] + tail[1]); //~ ERROR conflicts with prior loan
+            v.push(tail[0] + tail[1]); //~ ERROR cannot borrow
         }
         _ => {}
     };
diff --git a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
index 16b48aedb0c..2898e312930 100644
--- a/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
+++ b/src/test/compile-fail/borrowck-vec-pattern-move-tail.rs
@@ -1,8 +1,9 @@
 fn main() {
     let mut a = [1, 2, 3, 4];
-    let _ = match a {
+    let t = match a {
         [1, 2, ..tail] => tail,
         _ => core::util::unreachable()
     };
-    a[0] = 0; //~ ERROR: assigning to mutable vec content prohibited due to outstanding loan
+    a[0] = 0; //~ ERROR cannot assign to `a[]` because it is borrowed
+    t[0];
 }
diff --git a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs
index eef99aafd68..941455d086c 100644
--- a/src/test/compile-fail/borrowck-vec-pattern-nesting.rs
+++ b/src/test/compile-fail/borrowck-vec-pattern-nesting.rs
@@ -2,7 +2,7 @@ fn a() {
     let mut vec = [~1, ~2, ~3];
     match vec {
         [~ref _a] => {
-            vec[0] = ~4; //~ ERROR prohibited due to outstanding loan
+            vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
         }
         _ => fail!(~"foo")
     }
@@ -12,7 +12,7 @@ fn b() {
     let mut vec = [~1, ~2, ~3];
     match vec {
         [.._b] => {
-            vec[0] = ~4; //~ ERROR prohibited due to outstanding loan
+            vec[0] = ~4; //~ ERROR cannot assign to `vec[]` because it is borrowed
         }
     }
 }
diff --git a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
index 714a80def93..dbdd8f0809a 100644
--- a/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
+++ b/src/test/compile-fail/borrowck-vec-pattern-tail-element-loan.rs
@@ -1,7 +1,7 @@
 fn a() -> &int {
     let vec = [1, 2, 3, 4];
-    let tail = match vec { //~ ERROR illegal borrow
-        [_a, ..tail] => &tail[0],
+    let tail = match vec {
+        [_a, ..tail] => &tail[0], //~ ERROR borrowed value does not live long enough
         _ => fail!(~"foo")
     };
     tail
diff --git a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs
index f9e6bc1b22e..451f023f5fc 100644
--- a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs
+++ b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-2.rs
@@ -1,5 +1,5 @@
 fn main() {
     let mut b = ~3;
-    let _x = &mut *b;   //~ NOTE prior loan as mutable granted here
-    let _y = &mut *b;   //~ ERROR loan of dereference of mutable ~ pointer as mutable conflicts with prior loan
+    let _x = &mut *b;
+    let _y = &mut *b; //~ ERROR cannot borrow
 }
diff --git a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs
index 6c82b25a6a1..c455de888a3 100644
--- a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs
+++ b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail-3.rs
@@ -1,7 +1,7 @@
 fn main() {
     let mut a = ~3;
-    let mut b = &mut a; //~ NOTE loan of mutable local variable granted here
+    let mut b = &mut a;
     let _c = &mut *b;
-    let mut d = /*move*/ a; //~ ERROR moving out of mutable local variable prohibited due to outstanding loan
+    let mut d = /*move*/ a; //~ ERROR cannot move out
     *d += 1;
 }
diff --git a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs
index dc453d98193..e18808dfe53 100644
--- a/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs
+++ b/src/test/compile-fail/borrowck-wg-borrow-mut-to-imm-fail.rs
@@ -1,6 +1,6 @@
 fn main() {
     let mut b = ~3;
-    let _x = &mut *b;   //~ NOTE loan of mutable local variable granted here
-    let mut y = /*move*/ b; //~ ERROR moving out of mutable local variable prohibited
+    let _x = &mut *b;
+    let mut y = /*move*/ b; //~ ERROR cannot move out
     *y += 1;
 }
diff --git a/src/test/compile-fail/borrowck-wg-move-base-2.rs b/src/test/compile-fail/borrowck-wg-move-base-2.rs
index 0ede523daa4..4050b4c5971 100644
--- a/src/test/compile-fail/borrowck-wg-move-base-2.rs
+++ b/src/test/compile-fail/borrowck-wg-move-base-2.rs
@@ -2,7 +2,7 @@ fn foo(x: &mut int) {
     let mut a = 3;
     let mut _y = &mut *x;
     let _z = &mut *_y;
-    _y = &mut a; //~ ERROR assigning to mutable local variable prohibited
+    _y = &mut a; //~ ERROR cannot assign
 }
 
 fn main() {
diff --git a/src/test/compile-fail/dead-code-ret.rs b/src/test/compile-fail/dead-code-ret.rs
index 97f6149b162..5fa796db884 100644
--- a/src/test/compile-fail/dead-code-ret.rs
+++ b/src/test/compile-fail/dead-code-ret.rs
@@ -10,8 +10,12 @@
 // except according to those terms.
 
 
-// error-pattern: dead
+fn f(caller: &str) {
+    debug!(caller);
+    let x: uint = 0u32; // induce type error //~ ERROR mismatched types
+}
 
-fn f(caller: str) { debug!(caller); }
-
-fn main() { return f("main"); debug!("Paul is dead"); }
+fn main() {
+    return f("main");
+    debug!("Paul is dead"); //~ WARNING unreachable
+}
diff --git a/src/test/compile-fail/die-not-static.rs b/src/test/compile-fail/die-not-static.rs
index b30e3942e63..d33c591d8c8 100644
--- a/src/test/compile-fail/die-not-static.rs
+++ b/src/test/compile-fail/die-not-static.rs
@@ -1,7 +1,6 @@
-// error-pattern:illegal borrow: borrowed value does not live long enough
-
 fn main() {
     let v = ~"test";
     let sslice = str::slice(v, 0, v.len());
+    //~^ ERROR borrowed value does not live long enough
     fail!(sslice);
 }
diff --git a/src/test/compile-fail/fn-variance-3.rs b/src/test/compile-fail/fn-variance-3.rs
index 5df2007721d..4d145d3f9ea 100644
--- a/src/test/compile-fail/fn-variance-3.rs
+++ b/src/test/compile-fail/fn-variance-3.rs
@@ -31,5 +31,5 @@ fn main() {
     // mutability check will fail, because the
     // type of r has been inferred to be
     // fn(@const int) -> @const int
-    *r(@mut 3) = 4; //~ ERROR assigning to dereference of const @ pointer
+    *r(@mut 3) = 4; //~ ERROR cannot assign to const dereference of @ pointer
 }
diff --git a/src/test/compile-fail/for-loop-decl.rs b/src/test/compile-fail/for-loop-decl.rs
deleted file mode 100644
index de28d726777..00000000000
--- a/src/test/compile-fail/for-loop-decl.rs
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// error-pattern: mismatched types
-extern mod std;
-use std::bitv;
-use core::hashmap::HashMap;
-
-struct FnInfo {
-    vars: HashMap<uint, VarInfo>
-}
-
-struct VarInfo {
-    a: uint,
-    b: uint,
-}
-
-fn bitv_to_str(enclosing: FnInfo, v: ~bitv::Bitv) -> str {
-    let s = "";
-
-    // error is that the value type in the hash map is var_info, not a box
-    for enclosing.vars.each_value |val| {
-        if *v.get(val) { s += "foo"; }
-    }
-    return s;
-}
-
-fn main() { debug!("OK"); }
diff --git a/src/test/compile-fail/immut-function-arguments.rs b/src/test/compile-fail/immut-function-arguments.rs
index 2084729372d..66b5bd172ca 100644
--- a/src/test/compile-fail/immut-function-arguments.rs
+++ b/src/test/compile-fail/immut-function-arguments.rs
@@ -9,11 +9,11 @@
 // except according to those terms.
 
 fn f(y: ~int) {
-    *y = 5; //~ ERROR assigning to dereference of immutable ~ pointer
+    *y = 5; //~ ERROR cannot assign
 }
 
 fn g() {
-    let _frob: &fn(~int) = |q| { *q = 2; }; //~ ERROR assigning to dereference of immutable ~ pointer
+    let _frob: &fn(~int) = |q| { *q = 2; }; //~ ERROR cannot assign
 
 }
 
diff --git a/src/test/compile-fail/index_message.rs b/src/test/compile-fail/index_message.rs
index 3611dbb6866..26dd98757a8 100644
--- a/src/test/compile-fail/index_message.rs
+++ b/src/test/compile-fail/index_message.rs
@@ -10,5 +10,5 @@
 
 fn main() {
     let z = ();
-    debug!(z[0]); //~ ERROR cannot index a value of type `()`
+    let _ = z[0]; //~ ERROR cannot index a value of type `()`
 }
diff --git a/src/test/compile-fail/issue-1896-1.rs b/src/test/compile-fail/issue-1896-1.rs
index fc5132d6510..13adcd42da2 100644
--- a/src/test/compile-fail/issue-1896-1.rs
+++ b/src/test/compile-fail/issue-1896-1.rs
@@ -8,11 +8,13 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
+// Test that we require managed closures to be rooted when borrowed.
+
 struct boxedFn<'self> { theFn: &'self fn() -> uint }
 
 fn createClosure (closedUint: uint) -> boxedFn {
     let theFn: @fn() -> uint = || closedUint;
-    boxedFn {theFn: theFn} //~ ERROR illegal borrow
+    boxedFn {theFn: theFn} //~ ERROR cannot root
 }
 
 fn main () {
diff --git a/src/test/compile-fail/issue-2149.rs b/src/test/compile-fail/issue-2149.rs
index 2842d884c99..cdc8d546dd8 100644
--- a/src/test/compile-fail/issue-2149.rs
+++ b/src/test/compile-fail/issue-2149.rs
@@ -23,5 +23,4 @@ impl<A> vec_monad<A> for ~[A] {
 fn main() {
     ["hi"].bind(|x| [x] );
     //~^ ERROR type `[&'static str, .. 1]` does not implement any method in scope named `bind`
-    //~^^ ERROR Unconstrained region variable
 }
diff --git a/src/test/compile-fail/issue-2151.rs b/src/test/compile-fail/issue-2151.rs
index e2bbda7d65a..bb6d47a4762 100644
--- a/src/test/compile-fail/issue-2151.rs
+++ b/src/test/compile-fail/issue-2151.rs
@@ -10,7 +10,6 @@
 
 fn main() {
     for vec::each(fail!()) |i| {
-        debug!(i * 2);
-        //~^ ERROR the type of this value must be known
+        let _ = i * 2; //~ ERROR the type of this value must be known
    };
 }
diff --git a/src/test/compile-fail/issue-2590.rs b/src/test/compile-fail/issue-2590.rs
index 7a99ab8a94f..a0b967d5959 100644
--- a/src/test/compile-fail/issue-2590.rs
+++ b/src/test/compile-fail/issue-2590.rs
@@ -18,7 +18,7 @@ trait parse {
 
 impl parse for parser {
     fn parse(&self) -> ~[int] {
-        self.tokens //~ ERROR moving out of immutable field
+        self.tokens //~ ERROR cannot move out of field
     }
 }
 
diff --git a/src/test/compile-fail/issue-3044.rs b/src/test/compile-fail/issue-3044.rs
index 635d0aa3df1..06fb18d7e47 100644
--- a/src/test/compile-fail/issue-3044.rs
+++ b/src/test/compile-fail/issue-3044.rs
@@ -11,7 +11,6 @@
 fn main() {
     let needlesArr: ~[char] = ~['a', 'f'];
     do vec::foldr(needlesArr) |x, y| {
-        //~^ ERROR Unconstrained region variable #2
     }
     //~^ ERROR 2 parameters were supplied (including the closure passed by the `do` keyword)
     //
diff --git a/src/test/compile-fail/issue-511.rs b/src/test/compile-fail/issue-511.rs
index 90c46e5d602..c872f89d884 100644
--- a/src/test/compile-fail/issue-511.rs
+++ b/src/test/compile-fail/issue-511.rs
@@ -17,5 +17,5 @@ fn f<T:Eq>(o: &mut Option<T>) {
 
 fn main() {
     f::<int>(&mut option::None);
-    //~^ ERROR illegal borrow: creating mutable alias to static item
+    //~^ ERROR cannot borrow
 }
diff --git a/src/test/compile-fail/kindck-owned-trait-contains.rs b/src/test/compile-fail/kindck-owned-trait-contains.rs
index 54ee8bcc70e..6bb90bff228 100644
--- a/src/test/compile-fail/kindck-owned-trait-contains.rs
+++ b/src/test/compile-fail/kindck-owned-trait-contains.rs
@@ -29,4 +29,7 @@ fn main() {
     };
     assert!(3 == *(y.get())); //~ ERROR dereference of reference outside its lifetime
     //~^ ERROR reference is not valid outside of its lifetime
+    //~^^ ERROR reference is not valid outside of its lifetime
+    //~^^^ ERROR reference is not valid outside of its lifetime
+    //~^^^^ ERROR cannot infer an appropriate lifetime
 }
diff --git a/src/test/compile-fail/lambda-mutate-nested.rs b/src/test/compile-fail/lambda-mutate-nested.rs
index 8b009b91af9..bfd1e12f3a6 100644
--- a/src/test/compile-fail/lambda-mutate-nested.rs
+++ b/src/test/compile-fail/lambda-mutate-nested.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:assigning to captured outer immutable variable in a stack closure
 // Make sure that nesting a block within a @fn doesn't let us
 // mutate upvars from a @fn.
 fn f2(x: &fn()) { x(); }
@@ -16,6 +15,7 @@ fn f2(x: &fn()) { x(); }
 fn main() {
     let i = 0;
     let ctr: @fn() -> int = || { f2(|| i = i + 1 ); i };
+    //~^ ERROR cannot assign
     error!(ctr());
     error!(ctr());
     error!(ctr());
diff --git a/src/test/compile-fail/lambda-mutate.rs b/src/test/compile-fail/lambda-mutate.rs
index ee5b3d89684..a848d8698a3 100644
--- a/src/test/compile-fail/lambda-mutate.rs
+++ b/src/test/compile-fail/lambda-mutate.rs
@@ -8,11 +8,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:assigning to captured outer variable in a heap closure
 // Make sure we can't write to upvars from @fns
 fn main() {
     let i = 0;
     let ctr: @fn() -> int = || { i = i + 1; i };
+    //~^ ERROR cannot assign
     error!(ctr());
     error!(ctr());
     error!(ctr());
diff --git a/src/test/compile-fail/moves-based-on-type-block-bad.rs b/src/test/compile-fail/moves-based-on-type-block-bad.rs
index 67eb06ab424..76d50710bb8 100644
--- a/src/test/compile-fail/moves-based-on-type-block-bad.rs
+++ b/src/test/compile-fail/moves-based-on-type-block-bad.rs
@@ -16,7 +16,7 @@ fn main() {
     let s = S { x: ~Bar(~42) };
     loop {
         do f(&s) |hellothere| {
-            match hellothere.x {    //~ ERROR moving out of immutable field
+            match hellothere.x {    //~ ERROR cannot move out
                 ~Foo(_) => {}
                 ~Bar(x) => io::println(x.to_str()),
                 ~Baz => {}
diff --git a/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs b/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
index 3c15047a296..ecd58d485a8 100644
--- a/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
+++ b/src/test/compile-fail/moves-based-on-type-move-out-of-closure-env-issue-1965.rs
@@ -13,6 +13,6 @@ fn test(_x: ~uint) {}
 fn main() {
     let i = ~3;
     for uint::range(0, 10) |_x| {
-        test(i); //~ ERROR moving out of captured outer immutable variable in a stack closure
+        test(i); //~ ERROR cannot move out
     }
 }
diff --git a/src/test/compile-fail/mutable-class-fields-2.rs b/src/test/compile-fail/mutable-class-fields-2.rs
index 56c715c9847..f5d24b31641 100644
--- a/src/test/compile-fail/mutable-class-fields-2.rs
+++ b/src/test/compile-fail/mutable-class-fields-2.rs
@@ -8,7 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:assigning to immutable field
 struct cat {
   priv mut meows : uint,
 
@@ -17,7 +16,7 @@ struct cat {
 
 pub impl cat {
   fn eat(&self) {
-    self.how_hungry -= 5;
+    self.how_hungry -= 5; //~ ERROR cannot assign
   }
 
 }
diff --git a/src/test/compile-fail/mutable-class-fields.rs b/src/test/compile-fail/mutable-class-fields.rs
index 6d11a98c0cb..8bebec7134c 100644
--- a/src/test/compile-fail/mutable-class-fields.rs
+++ b/src/test/compile-fail/mutable-class-fields.rs
@@ -8,12 +8,9 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:assigning to immutable field
 struct cat {
   priv mut meows : uint,
-
   how_hungry : int,
-
 }
 
 fn cat(in_x : uint, in_y : int) -> cat {
@@ -25,5 +22,5 @@ fn cat(in_x : uint, in_y : int) -> cat {
 
 fn main() {
   let nyan : cat = cat(52u, 99);
-  nyan.how_hungry = 0;
+  nyan.how_hungry = 0; //~ ERROR cannot assign
 }
diff --git a/src/test/compile-fail/mutable-huh-ptr-assign.rs b/src/test/compile-fail/mutable-huh-ptr-assign.rs
index ed356f4001d..6b3fd4f7153 100644
--- a/src/test/compile-fail/mutable-huh-ptr-assign.rs
+++ b/src/test/compile-fail/mutable-huh-ptr-assign.rs
@@ -12,7 +12,7 @@ extern mod std;
 
 fn main() {
     unsafe fn f(&&v: *const int) {
-        *v = 1 //~ ERROR assigning to dereference of const * pointer
+        *v = 1 //~ ERROR cannot assign
     }
 
     unsafe {
diff --git a/src/test/compile-fail/regions-addr-of-arg.rs b/src/test/compile-fail/regions-addr-of-arg.rs
index 7f2140d96e1..4fff5a6f87c 100644
--- a/src/test/compile-fail/regions-addr-of-arg.rs
+++ b/src/test/compile-fail/regions-addr-of-arg.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn foo(a: int) {
-    let _p: &'static int = &a; //~ ERROR illegal borrow
+    let _p: &'static int = &a; //~ ERROR borrowed value does not live long enough
 }
 
 fn bar(a: int) {
diff --git a/src/test/compile-fail/regions-bounds.rs b/src/test/compile-fail/regions-bounds.rs
index cccd135e9f8..ab2620d46fd 100644
--- a/src/test/compile-fail/regions-bounds.rs
+++ b/src/test/compile-fail/regions-bounds.rs
@@ -23,10 +23,8 @@ fn a_fn3<'a,'b>(e: a_class<'a>) -> a_class<'b> {
     return e; //~ ERROR mismatched types: expected `a_class/&'b ` but found `a_class/&'a `
 }
 
-fn a_fn4<'a,'b>(e: int<'a>) -> int<'b> {
-    //~^ ERROR region parameters are not allowed on this type
-    //~^^ ERROR region parameters are not allowed on this type
-    return e;
+fn a_fn4<'a,'b>() {
+    let _: int<'a> = 1; //~ ERROR region parameters are not allowed on this type
 }
 
 fn main() { }
diff --git a/src/test/compile-fail/regions-creating-enums.rs b/src/test/compile-fail/regions-creating-enums.rs
index 120428e02f4..2ab0c14b49b 100644
--- a/src/test/compile-fail/regions-creating-enums.rs
+++ b/src/test/compile-fail/regions-creating-enums.rs
@@ -30,12 +30,12 @@ fn compute(x: &ast) -> uint {
 fn map_nums(x: &ast, f: &fn(uint) -> uint) -> &ast {
     match *x {
       num(x) => {
-        return &num(f(x)); //~ ERROR illegal borrow
+        return &num(f(x)); //~ ERROR borrowed value does not live long enough
       }
       add(x, y) => {
         let m_x = map_nums(x, f);
         let m_y = map_nums(y, f);
-        return &add(m_x, m_y);  //~ ERROR illegal borrow
+        return &add(m_x, m_y);  //~ ERROR borrowed value does not live long enough
       }
     }
 }
diff --git a/src/test/compile-fail/regions-creating-enums4.rs b/src/test/compile-fail/regions-creating-enums4.rs
index 1cb378cf406..8f764745697 100644
--- a/src/test/compile-fail/regions-creating-enums4.rs
+++ b/src/test/compile-fail/regions-creating-enums4.rs
@@ -14,8 +14,7 @@ enum ast<'self> {
 }
 
 fn mk_add_bad2<'a>(x: &'a ast<'a>, y: &'a ast<'a>, z: &ast) -> ast {
-    add(x, y)
-         //~^ ERROR cannot infer an appropriate lifetime
+    add(x, y) //~ ERROR cannot infer an appropriate lifetime
 }
 
 fn main() {
diff --git a/src/test/compile-fail/regions-escape-bound-fn.rs b/src/test/compile-fail/regions-escape-bound-fn.rs
index c81ef77f497..5ac5e334be2 100644
--- a/src/test/compile-fail/regions-escape-bound-fn.rs
+++ b/src/test/compile-fail/regions-escape-bound-fn.rs
@@ -14,6 +14,6 @@ fn with_int(f: &fn(x: &int)) {
 }
 
 fn main() {
-    let mut x: Option<&int> = None; //~ ERROR cannot infer
+    let mut x: Option<&int> = None;   //~ ERROR cannot infer
     with_int(|y| x = Some(y));
 }
diff --git a/src/test/compile-fail/regions-escape-loop-via-variable.rs b/src/test/compile-fail/regions-escape-loop-via-variable.rs
index ac10b5c454a..19bd0bf9747 100644
--- a/src/test/compile-fail/regions-escape-loop-via-variable.rs
+++ b/src/test/compile-fail/regions-escape-loop-via-variable.rs
@@ -18,6 +18,6 @@ fn main() {
 
     loop {
         let x = 1 + *p;
-        p = &x; //~ ERROR illegal borrow
+        p = &x; //~ ERROR borrowed value does not live long enough
     }
 }
diff --git a/src/test/compile-fail/regions-escape-loop-via-vec.rs b/src/test/compile-fail/regions-escape-loop-via-vec.rs
index da5e3c2660e..92e2cd73dfb 100644
--- a/src/test/compile-fail/regions-escape-loop-via-vec.rs
+++ b/src/test/compile-fail/regions-escape-loop-via-vec.rs
@@ -14,8 +14,8 @@ fn broken() {
     let mut _y = ~[&mut x];
     while x < 10 {
         let mut z = x;
-        _y.push(&mut z); //~ ERROR illegal borrow
-        x += 1; //~ ERROR assigning to mutable local variable prohibited due to outstanding loan
+        _y.push(&mut z); //~ ERROR borrowed value does not live long enough
+        x += 1; //~ ERROR cannot assign
     }
 }
 
diff --git a/src/test/compile-fail/regions-escape-via-trait-or-not.rs b/src/test/compile-fail/regions-escape-via-trait-or-not.rs
index f7165784c79..aa431d6b81c 100644
--- a/src/test/compile-fail/regions-escape-via-trait-or-not.rs
+++ b/src/test/compile-fail/regions-escape-via-trait-or-not.rs
@@ -23,13 +23,8 @@ fn with<R:deref>(f: &fn(x: &int) -> R) -> int {
 }
 
 fn return_it() -> int {
-    with(|o| o)
-    //~^ ERROR cannot infer an appropriate lifetime due to conflicting requirements
-    //~^^ ERROR reference is not valid outside of its lifetime
-    //~^^^ ERROR reference is not valid outside of its lifetime
+    with(|o| o) //~ ERROR reference is not valid outside of its lifetime
 }
 
 fn main() {
-    let x = return_it();
-    debug!("foo=%d", x);
 }
diff --git a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs b/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
index 6ee0216655e..d519397f68c 100644
--- a/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
+++ b/src/test/compile-fail/regions-infer-borrow-scope-too-big.rs
@@ -18,7 +18,7 @@ fn x_coord<'r>(p: &'r point) -> &'r int {
 }
 
 fn foo(p: @point) -> &int {
-    let xc = x_coord(p); //~ ERROR illegal borrow
+    let xc = x_coord(p); //~ ERROR cannot root
     assert!(*xc == 3);
     return xc;
 }
diff --git a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
index 602f5dc6983..50ac5f65772 100644
--- a/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
+++ b/src/test/compile-fail/regions-infer-borrow-scope-within-loop.rs
@@ -15,9 +15,9 @@ fn foo(cond: &fn() -> bool, box: &fn() -> @int) {
     loop {
         let x = box();
 
-        // Here we complain because the resulting region
-        // of this borrow is the fn body as a whole.
-        y = borrow(x); //~ ERROR illegal borrow: cannot root managed value long enough
+	    // Here we complain because the resulting region
+	    // of this borrow is the fn body as a whole.
+        y = borrow(x); //~ ERROR cannot root
 
         assert!(*x == *y);
         if cond() { break; }
diff --git a/src/test/compile-fail/regions-nested-fns-2.rs b/src/test/compile-fail/regions-nested-fns-2.rs
index 2e9a4eb1410..fe995052c52 100644
--- a/src/test/compile-fail/regions-nested-fns-2.rs
+++ b/src/test/compile-fail/regions-nested-fns-2.rs
@@ -13,7 +13,7 @@ fn ignore(_f: &fn<'z>(&'z int) -> &'z int) {}
 fn nested() {
     let y = 3;
     ignore(|z| {
-        if false { &y } else { z } //~ ERROR illegal borrow
+        if false { &y } else { z } //~ ERROR borrowed value does not live long enough
     });
 }
 
diff --git a/src/test/compile-fail/regions-nested-fns.rs b/src/test/compile-fail/regions-nested-fns.rs
index 3089c362a50..74399967446 100644
--- a/src/test/compile-fail/regions-nested-fns.rs
+++ b/src/test/compile-fail/regions-nested-fns.rs
@@ -16,7 +16,7 @@ fn nested<'x>(x: &'x int) {
 
     ignore::<&fn<'z>(&'z int)>(|z| {
         ay = x;
-        ay = &y;  //~ ERROR cannot infer an appropriate lifetime
+        ay = &y;
         ay = z;
     });
 
diff --git a/src/test/compile-fail/regions-ret-borrowed-1.rs b/src/test/compile-fail/regions-ret-borrowed-1.rs
index f916b0d95c2..a572d90313b 100644
--- a/src/test/compile-fail/regions-ret-borrowed-1.rs
+++ b/src/test/compile-fail/regions-ret-borrowed-1.rs
@@ -18,7 +18,6 @@ fn with<'a, R>(f: &fn(x: &'a int) -> R) -> R {
 
 fn return_it<'a>() -> &'a int {
     with(|o| o) //~ ERROR mismatched types
-        //~^ ERROR reference is not valid outside of its lifetime
 }
 
 fn main() {
diff --git a/src/test/compile-fail/regions-ret-borrowed.rs b/src/test/compile-fail/regions-ret-borrowed.rs
index 157b99de9e8..ec9a908ba98 100644
--- a/src/test/compile-fail/regions-ret-borrowed.rs
+++ b/src/test/compile-fail/regions-ret-borrowed.rs
@@ -21,7 +21,6 @@ fn with<R>(f: &fn(x: &int) -> R) -> R {
 
 fn return_it() -> &int {
     with(|o| o) //~ ERROR mismatched types
-        //~^ ERROR reference is not valid outside of its lifetime
 }
 
 fn main() {
diff --git a/src/test/compile-fail/regions-ret.rs b/src/test/compile-fail/regions-ret.rs
index cf7cb175bb8..eccffb4051e 100644
--- a/src/test/compile-fail/regions-ret.rs
+++ b/src/test/compile-fail/regions-ret.rs
@@ -9,7 +9,7 @@
 // except according to those terms.
 
 fn f<'a>(_x : &'a int) -> &'a int {
-    return &3; //~ ERROR illegal borrow
+    return &3; //~ ERROR borrowed value does not live long enough
 }
 
 fn main() {
diff --git a/src/test/compile-fail/regions-var-type-out-of-scope.rs b/src/test/compile-fail/regions-var-type-out-of-scope.rs
index 7d75ac74349..addf20fd702 100644
--- a/src/test/compile-fail/regions-var-type-out-of-scope.rs
+++ b/src/test/compile-fail/regions-var-type-out-of-scope.rs
@@ -14,7 +14,7 @@ fn foo(cond: bool) {
     let mut x;
 
     if cond {
-        x = &3; //~ ERROR illegal borrow: borrowed value does not live long enough
+        x = &3; //~ ERROR borrowed value does not live long enough
         assert!((*x == 3));
     }
 }
diff --git a/src/test/compile-fail/swap-no-lval.rs b/src/test/compile-fail/swap-no-lval.rs
index 4fe30792e4b..eca5fb0d315 100644
--- a/src/test/compile-fail/swap-no-lval.rs
+++ b/src/test/compile-fail/swap-no-lval.rs
@@ -10,6 +10,6 @@
 
 fn main() {
     5 <-> 3;
-    //~^ ERROR swapping to and from non-lvalue
-    //~^^ ERROR swapping to and from non-lvalue
+    //~^ ERROR cannot assign
+    //~^^ ERROR cannot assign
 }
diff --git a/src/test/compile-fail/type-shadow.rs b/src/test/compile-fail/type-shadow.rs
index a9b4a85e638..c4a412f64c8 100644
--- a/src/test/compile-fail/type-shadow.rs
+++ b/src/test/compile-fail/type-shadow.rs
@@ -9,14 +9,11 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-
-// error-pattern: mismatched types
-
 fn main() {
     type X = int;
     type Y = X;
     if true {
-        type X = str;
-        let y: Y = "hello";
+        type X = &'static str;
+        let y: Y = "hello"; //~ ERROR mismatched types
     }
 }
diff --git a/src/test/compile-fail/writing-to-immutable-vec.rs b/src/test/compile-fail/writing-to-immutable-vec.rs
index 3f4c8ccef81..faa3d6cfe47 100644
--- a/src/test/compile-fail/writing-to-immutable-vec.rs
+++ b/src/test/compile-fail/writing-to-immutable-vec.rs
@@ -8,5 +8,7 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// error-pattern:assigning to immutable vec content
-fn main() { let v: ~[int] = ~[1, 2, 3]; v[1] = 4; }
+fn main() {
+    let v: ~[int] = ~[1, 2, 3];
+    v[1] = 4; //~ ERROR cannot assign
+}
diff --git a/src/test/run-fail/borrowck-wg-fail-2.rs b/src/test/run-fail/borrowck-wg-fail-2.rs
index 126135772ad..59a5fecd340 100644
--- a/src/test/run-fail/borrowck-wg-fail-2.rs
+++ b/src/test/run-fail/borrowck-wg-fail-2.rs
@@ -1,5 +1,8 @@
 // error-pattern:borrowed
 
+// Test that write guards trigger when there is a write to a field
+// of a frozen structure.
+
 struct S {
     x: int
 }
@@ -7,5 +10,6 @@ struct S {
 fn main() {
     let x = @mut S { x: 3 };
     let y: &S = x;
-    x.x = 5;
+    let z = x;
+    z.x = 5;
 }
diff --git a/src/test/run-fail/borrowck-wg-fail-3.rs b/src/test/run-fail/borrowck-wg-fail-3.rs
index b239bfc3b31..a40faa1ac6f 100644
--- a/src/test/run-fail/borrowck-wg-fail-3.rs
+++ b/src/test/run-fail/borrowck-wg-fail-3.rs
@@ -1,7 +1,11 @@
 // error-pattern:borrowed
 
+// Test that write guards trigger when there is a write to a directly
+// frozen @mut box.
+
 fn main() {
     let x = @mut 3;
     let y: &mut int = x;
-    *x = 5;
+    let z = x;
+    *z = 5;
 }
diff --git a/src/test/run-fail/borrowck-wg-fail.rs b/src/test/run-fail/borrowck-wg-fail.rs
index 93e7f9275b6..201db14eb17 100644
--- a/src/test/run-fail/borrowck-wg-fail.rs
+++ b/src/test/run-fail/borrowck-wg-fail.rs
@@ -1,9 +1,10 @@
 // error-pattern:borrowed
 
-fn f(x: &int, y: @mut int) {
-    unsafe {
-        *y = 2;
-    }
+// Test that write guards trigger when mut box is frozen
+// as part of argument coercion.
+
+fn f(_x: &int, y: @mut int) {
+    *y = 2;
 }
 
 fn main() {
diff --git a/src/test/run-fail/borrowck-wg-imm-then-mut.rs b/src/test/run-fail/borrowck-wg-imm-then-mut.rs
new file mode 100644
index 00000000000..e2c8a0b549c
--- /dev/null
+++ b/src/test/run-fail/borrowck-wg-imm-then-mut.rs
@@ -0,0 +1,19 @@
+// error-pattern:borrowed
+
+// Test that if you imm borrow then mut borrow it fails.
+
+fn add1(a:@mut int)
+{
+    add2(a); // already frozen
+}
+
+fn add2(_:&mut int)
+{
+}
+
+pub fn main()
+{
+    let a = @mut 3;
+    let b = &*a; // freezes a
+    add1(a);
+}
diff --git a/src/test/run-fail/borrowck-wg-mut-then-imm.rs b/src/test/run-fail/borrowck-wg-mut-then-imm.rs
new file mode 100644
index 00000000000..58b2a1d87be
--- /dev/null
+++ b/src/test/run-fail/borrowck-wg-mut-then-imm.rs
@@ -0,0 +1,19 @@
+// error-pattern:borrowed
+
+// Test that if you mut borrow then imm borrow it fails.
+
+fn add1(a:@mut int)
+{
+    add2(a); // already frozen
+}
+
+fn add2(_:&int)
+{
+}
+
+pub fn main()
+{
+    let a = @mut 3;
+    let b = &mut *a; // freezes a
+    add1(a);
+}
diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
new file mode 100644
index 00000000000..91df90f8b3a
--- /dev/null
+++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slice-method.rs
@@ -0,0 +1,37 @@
+// error-pattern:borrowed
+
+// Test that write guards trigger when there is a coercion to
+// a slice on the receiver of a method.
+
+trait MyMutSlice {
+    fn my_mut_slice(self) -> Self;
+}
+
+impl<'self, T> MyMutSlice for &'self mut [T] {
+    fn my_mut_slice(self) -> &'self mut [T] {
+        self
+    }
+}
+
+trait MySlice {
+    fn my_slice(self) -> Self;
+}
+
+impl<'self, T> MySlice for &'self [T] {
+    fn my_slice(self) -> &'self [T] {
+        self
+    }
+}
+
+fn add(x:&mut [int], y:&[int])
+{
+    x[0] = x[0] + y[0];
+}
+
+pub fn main()
+{
+    let z = @mut [1,2,3];
+    let z2 = z;
+    add(z.my_mut_slice(), z2.my_slice());
+    print(fmt!("%d\n", z[0]));
+}
diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
new file mode 100644
index 00000000000..bae693ce4ea
--- /dev/null
+++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm-slices.rs
@@ -0,0 +1,16 @@
+// error-pattern:borrowed
+
+// Test that write guards trigger when arguments are coerced to slices.
+
+fn add(x:&mut [int], y:&[int])
+{
+    x[0] = x[0] + y[0];
+}
+
+pub fn main()
+{
+    let z = @mut [1,2,3];
+    let z2 = z;
+    add(z, z2);
+    print(fmt!("%d\n", z[0]));
+}
diff --git a/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs b/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
new file mode 100644
index 00000000000..9e2a02b32df
--- /dev/null
+++ b/src/test/run-fail/borrowck-wg-one-mut-one-imm.rs
@@ -0,0 +1,17 @@
+// error-pattern:borrowed
+
+// Test that write guards trigger when we are indexing into
+// an @mut vector.
+
+fn add(x:&mut int, y:&int)
+{
+    *x = *x + *y;
+}
+
+pub fn main()
+{
+    let z = @mut [1,2,3];
+    let z2 = z;
+    add(&mut z[0], &z2[0]);
+    print(fmt!("%d\n", z[0]));
+}
diff --git a/src/test/run-fail/borrowck-wg-two-array-indices.rs b/src/test/run-fail/borrowck-wg-two-array-indices.rs
new file mode 100644
index 00000000000..ad684488760
--- /dev/null
+++ b/src/test/run-fail/borrowck-wg-two-array-indices.rs
@@ -0,0 +1,17 @@
+// error-pattern:borrowed
+
+// Test that arguments trigger when there are *two mutable* borrows
+// of indices.
+
+fn add(x:&mut int, y:&mut int)
+{
+    *x = *x + *y;
+}
+
+pub fn main()
+{
+    let z = @mut [1,2,3];
+    let z2 = z;
+    add(&mut z[0], &mut z2[0]);
+    print(fmt!("%d\n", z[0]));
+}
diff --git a/src/test/run-pass/auto-ref-slice-plus-ref.rs b/src/test/run-pass/auto-ref-slice-plus-ref.rs
index 1dc56132875..58a477900c3 100644
--- a/src/test/run-pass/auto-ref-slice-plus-ref.rs
+++ b/src/test/run-pass/auto-ref-slice-plus-ref.rs
@@ -17,13 +17,13 @@ trait MyIter {
 }
 
 impl<'self> MyIter for &'self [int] {
-    fn test_imm(&self) { assert!(self[0] == 1) }
-    fn test_const(&const self) { assert!(self[0] == 1) }
+    fn test_imm(&self) { assert_eq!(self[0], 1) }
+    fn test_const(&const self) { assert_eq!(self[0], 1) }
 }
 
 impl<'self> MyIter for &'self str {
-    fn test_imm(&self) { assert!(*self == "test") }
-    fn test_const(&const self) { assert!(*self == "test") }
+    fn test_imm(&self) { assert_eq!(*self, "test") }
+    fn test_const(&const self) { assert_eq!(self[0], 't' as u8) }
 }
 
 pub fn main() {
diff --git a/src/test/compile-fail/issue-4500.rs b/src/test/run-pass/borrowck-nested-calls.rs
index 356a6449821..4494f5f2fa3 100644
--- a/src/test/compile-fail/issue-4500.rs
+++ b/src/test/run-pass/borrowck-nested-calls.rs
@@ -8,7 +8,25 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-fn main () {
-    let mut _p: & int = & 4;
-    _p = &*~3; //~ ERROR illegal borrow
+// xfail-test #5074 nested method calls
+
+// Test that (safe) nested calls with `&mut` receivers are permitted.
+
+struct Foo {a: uint, b: uint}
+
+pub impl Foo {
+    fn inc_a(&mut self, v: uint) { self.a += v; }
+
+    fn next_b(&mut self) -> uint {
+        let b = self.b;
+        self.b += 1;
+        b
+    }
+}
+
+fn main() {
+    let mut f = Foo {a: 22, b: 23};
+    f.inc_a(f.next_b());
+    assert_eq!(f.a, 22+23);
+    assert_eq!(f.b, 24);
 }
diff --git a/src/test/run-pass/borrowck-wg-two-imm-borrows.rs b/src/test/run-pass/borrowck-wg-two-imm-borrows.rs
new file mode 100644
index 00000000000..20f824e969a
--- /dev/null
+++ b/src/test/run-pass/borrowck-wg-two-imm-borrows.rs
@@ -0,0 +1,14 @@
+// Test that we can borrow the same @mut box twice, so long as both are imm.
+
+fn add(x:&int, y:&int)
+{
+    *x + *y;
+}
+
+pub fn main()
+{
+    let z = @mut [1,2,3];
+    let z2 = z;
+    add(&z[0], &z2[0]);
+    print(fmt!("%d\n", z[0]));
+}
diff --git a/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs b/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs
index 0e67532d7a1..b0d06dae10d 100644
--- a/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs
+++ b/src/test/run-pass/coerce-reborrow-mut-vec-rcvr.rs
@@ -1,10 +1,10 @@
 trait Reverser {
-    fn reverse(&self);
+    fn reverse(self);
 }
 
 impl<'self> Reverser for &'self mut [uint] {
-    fn reverse(&self) {
-        vec::reverse(*self);
+    fn reverse(self) {
+        vec::reverse(self);
     }
 }
 
diff --git a/src/test/run-pass/issue-2735-2.rs b/src/test/run-pass/issue-2735-2.rs
index 96f76b0fd6b..ca584e1a6e3 100644
--- a/src/test/run-pass/issue-2735-2.rs
+++ b/src/test/run-pass/issue-2735-2.rs
@@ -9,27 +9,25 @@
 // except according to those terms.
 
 // This test should behave exactly like issue-2735-3
-struct defer<'self> {
-    b: &'self mut bool,
+struct defer {
+    b: @mut bool,
 }
 
 #[unsafe_destructor]
-impl<'self> Drop for defer<'self> {
+impl Drop for defer {
     fn finalize(&self) {
-        unsafe {
-            *(self.b) = true;
-        }
+        *self.b = true;
     }
 }
 
-fn defer<'r>(b: &'r mut bool) -> defer<'r> {
+fn defer(b: @mut bool) -> defer {
     defer {
         b: b
     }
 }
 
 pub fn main() {
-    let mut dtor_ran = false;
-    let _  = defer(&mut dtor_ran);
-    assert!((dtor_ran));
+    let dtor_ran = @mut false;
+    let _  = defer(dtor_ran);
+    assert!(*dtor_ran);
 }
diff --git a/src/test/run-pass/issue-2735-3.rs b/src/test/run-pass/issue-2735-3.rs
index 50e3c946f50..44ca5d6929b 100644
--- a/src/test/run-pass/issue-2735-3.rs
+++ b/src/test/run-pass/issue-2735-3.rs
@@ -9,27 +9,25 @@
 // except according to those terms.
 
 // This test should behave exactly like issue-2735-2
-struct defer<'self> {
-    b: &'self mut bool,
+struct defer {
+    b: @mut bool,
 }
 
 #[unsafe_destructor]
-impl<'self> Drop for defer<'self> {
+impl Drop for defer {
     fn finalize(&self) {
-        unsafe {
-            *(self.b) = true;
-        }
+        *self.b = true;
     }
 }
 
-fn defer<'r>(b: &'r mut bool) -> defer<'r> {
+fn defer(b: @mut bool) -> defer {
     defer {
         b: b
     }
 }
 
 pub fn main() {
-    let mut dtor_ran = false;
-    defer(&mut dtor_ran);
-    assert!((dtor_ran));
+    let dtor_ran = @mut false;
+    defer(dtor_ran);
+    assert!(*dtor_ran);
 }
diff --git a/src/test/run-pass/lambda-infer-unresolved.rs b/src/test/run-pass/lambda-infer-unresolved.rs
index 2e70e900389..4aeeda8312c 100644
--- a/src/test/run-pass/lambda-infer-unresolved.rs
+++ b/src/test/run-pass/lambda-infer-unresolved.rs
@@ -17,5 +17,5 @@ struct Refs { refs: ~[int], n: int }
 pub fn main() {
     let e = @mut Refs{refs: ~[], n: 0};
     let f: @fn() = || error!(copy e.n);
-    e.refs += ~[1];
+    e.refs.push(1);
 }
diff --git a/src/test/run-pass/reflect-visit-data.rs b/src/test/run-pass/reflect-visit-data.rs
index e520d221c99..5b01d24aa8b 100644
--- a/src/test/run-pass/reflect-visit-data.rs
+++ b/src/test/run-pass/reflect-visit-data.rs
@@ -513,16 +513,16 @@ impl TyVisitor for my_visitor {
     fn visit_bot(&self) -> bool { true }
     fn visit_nil(&self) -> bool { true }
     fn visit_bool(&self) -> bool {
-      do self.get::<bool>() |b| {
-            self.vals += ~[bool::to_str(b)];
-      };
-      true
+        do self.get::<bool>() |b| {
+            self.vals.push(bool::to_str(b));
+        };
+        true
     }
     fn visit_int(&self) -> bool {
-      do self.get::<int>() |i| {
-            self.vals += ~[int::to_str(i)];
-      };
-      true
+        do self.get::<int>() |i| {
+            self.vals.push(int::to_str(i));
+        };
+        true
     }
     fn visit_i8(&self) -> bool { true }
     fn visit_i16(&self) -> bool { true }
diff --git a/src/test/run-pass/regions-mock-trans-impls.rs b/src/test/run-pass/regions-mock-trans-impls.rs
deleted file mode 100644
index d54aae7bb63..00000000000
--- a/src/test/run-pass/regions-mock-trans-impls.rs
+++ /dev/null
@@ -1,54 +0,0 @@
-// xfail-fast
-
-// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-extern mod std;
-use core::libc;
-use core::sys;
-use core::cast;
-use std::arena::Arena;
-
-struct Bcx<'self> {
-    fcx: &'self Fcx<'self>
-}
-
-struct Fcx<'self> {
-    arena: &'self mut Arena,
-    ccx: &'self Ccx
-}
-
-struct Ccx {
-    x: int
-}
-
-fn h<'r>(bcx : &'r mut Bcx<'r>) -> &'r mut Bcx<'r> {
-    // XXX: Arena has a bad interface here; it should return mutable pointers.
-    // But this patch is too big to roll that in.
-    unsafe {
-        cast::transmute(bcx.fcx.arena.alloc(|| Bcx { fcx: bcx.fcx }))
-    }
-}
-
-fn g(fcx: &mut Fcx) {
-    let mut bcx = Bcx { fcx: fcx };
-    h(&mut bcx);
-}
-
-fn f(ccx: &mut Ccx) {
-    let mut a = Arena();
-    let mut fcx = Fcx { arena: &mut a, ccx: ccx };
-    return g(&mut fcx);
-}
-
-pub fn main() {
-    let mut ccx = Ccx { x: 0 };
-    f(&mut ccx);
-}