From 9bb8b65bddad92030c77c7eefbe930b40611c300 Mon Sep 17 00:00:00 2001 From: Wesley Wiser Date: Sat, 20 Aug 2016 21:07:19 -0400 Subject: Update E0503 to the new format Fixes #35703 Part of #35233 --- src/test/compile-fail/borrowck/borrowck-box-insensitivity.rs | 2 ++ src/test/compile-fail/issue-25793.rs | 1 + src/test/compile-fail/regions-escape-loop-via-vec.rs | 9 +++++++++ 3 files changed, 12 insertions(+) (limited to 'src/test/compile-fail') 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() { } -- cgit 1.4.1-3-g733a5