about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWesley Wiser <wwiser@gmail.com>2016-08-20 21:07:19 -0400
committerWesley Wiser <wwiser@gmail.com>2016-08-20 21:07:19 -0400
commit9bb8b65bddad92030c77c7eefbe930b40611c300 (patch)
treead5a56163d61cf022e1eb13048e5220a16158866
parent490189634b656dcca9e41e6b52093569c03bd4df (diff)
downloadrust-9bb8b65bddad92030c77c7eefbe930b40611c300.tar.gz
rust-9bb8b65bddad92030c77c7eefbe930b40611c300.zip
Update E0503 to the new format
Fixes #35703
Part of #35233
-rw-r--r--src/librustc_borrowck/borrowck/check_loans.rs5
-rw-r--r--src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs2
-rw-r--r--src/test/compile-fail/issue-25793.rs1
-rw-r--r--src/test/compile-fail/regions-escape-loop-via-vec.rs9
4 files changed, 16 insertions, 1 deletions
diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs
index 9cae270984f..c1f162e5772 100644
--- a/src/librustc_borrowck/borrowck/check_loans.rs
+++ b/src/librustc_borrowck/borrowck/check_loans.rs
@@ -647,10 +647,13 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
                 struct_span_err!(self.bccx, span, E0503,
                                  "cannot use `{}` because it was mutably borrowed",
                                  &self.bccx.loan_path_to_string(copy_path))
-                    .span_note(loan_span,
+                    .span_label(loan_span,
                                &format!("borrow of `{}` occurs here",
                                        &self.bccx.loan_path_to_string(&loan_path))
                                )
+                    .span_label(span,
+                               &format!("use of borrowed `{}`",
+                                        &self.bccx.loan_path_to_string(&loan_path)))
                     .emit();
             }
         }
diff --git a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs b/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
index 3fd71f71564..530822f6c5b 100644
--- a/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
+++ b/src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs
@@ -71,6 +71,7 @@ fn copy_after_mut_borrow() {
     let _x = &mut a.x;
     //~^ NOTE borrow of `a.x` occurs here
     let _y = a.y; //~ ERROR cannot use
+    //~^ NOTE use of borrowed `a.x`
 }
 
 fn move_after_mut_borrow() {
@@ -141,6 +142,7 @@ fn copy_after_mut_borrow_nested() {
     let _x = &mut a.x.x;
     //~^ NOTE borrow of `a.x.x` occurs here
     let _y = a.y; //~ ERROR cannot use
+    //~^ NOTE use of borrowed `a.x.x`
 }
 
 fn move_after_mut_borrow_nested() {
diff --git a/src/test/compile-fail/issue-25793.rs b/src/test/compile-fail/issue-25793.rs
index 44b3ada97fe..ceefd583a5c 100644
--- a/src/test/compile-fail/issue-25793.rs
+++ b/src/test/compile-fail/issue-25793.rs
@@ -12,6 +12,7 @@ macro_rules! width(
     ($this:expr) => {
         $this.width.unwrap()
         //~^ ERROR cannot use `self.width` because it was mutably borrowed
+        //~| NOTE use of borrowed `*self`
     }
 );
 
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 89350f16167..8c026df7d97 100644
--- a/src/test/compile-fail/regions-escape-loop-via-vec.rs
+++ b/src/test/compile-fail/regions-escape-loop-via-vec.rs
@@ -12,11 +12,20 @@
 fn broken() {
     let mut x = 3;
     let mut _y = vec!(&mut x);
+    //~^ NOTE borrow of `x` occurs here
+    //~| NOTE borrow of `x` occurs here
+    //~| NOTE borrow of `x` occurs here
     while x < 10 { //~ ERROR cannot use `x` because it was mutably borrowed
+        //~^ NOTE use of borrowed `x`
         let mut z = x; //~ ERROR cannot use `x` because it was mutably borrowed
+        //~^ NOTE use of borrowed `x`
         _y.push(&mut z); //~ ERROR `z` does not live long enough
+        //~^ NOTE does not live long enough
         x += 1; //~ ERROR cannot assign
+        //~^ NOTE assignment to borrowed `x` occurs here
     }
+    //~^ NOTE borrowed value only valid until here
 }
+//~^ NOTE borrowed value must be valid until here
 
 fn main() { }