about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-01-19 12:30:30 -0800
committerEsteban Küber <esteban@kuber.com.ar>2018-01-19 13:28:43 -0800
commit6f9ecaa7cf0a15db46d13d72932acb2d678c29f1 (patch)
tree89aff86d1b1ffdb8e1e229c5cc7ecce4e5efd8ea /src/test/ui
parent1820da52110cc5cfb40436225c939067049ccf32 (diff)
downloadrust-6f9ecaa7cf0a15db46d13d72932acb2d678c29f1.tar.gz
rust-6f9ecaa7cf0a15db46d13d72932acb2d678c29f1.zip
Tweak wording and spans of closure lifetime errors
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/borrowck/issue-7573.rs1
-rw-r--r--src/test/ui/borrowck/issue-7573.stderr12
-rw-r--r--src/test/ui/borrowck/regions-escape-bound-fn.stderr10
-rw-r--r--src/test/ui/borrowck/regions-escape-unboxed-closure.stderr10
-rw-r--r--src/test/ui/closure-expected-type/expect-region-supply-region.stderr28
5 files changed, 31 insertions, 30 deletions
diff --git a/src/test/ui/borrowck/issue-7573.rs b/src/test/ui/borrowck/issue-7573.rs
index b318bd70cf2..8f1545fa009 100644
--- a/src/test/ui/borrowck/issue-7573.rs
+++ b/src/test/ui/borrowck/issue-7573.rs
@@ -28,6 +28,7 @@ pub fn remove_package_from_database() {
         //~^ NOTE cannot infer an appropriate lifetime
     let push_id = |installed_id: &CrateId| {
         //~^ NOTE borrowed data cannot outlive this closure
+        //~| NOTE ...so that variable is valid at time of its declaration
         lines_to_use.push(installed_id);
         //~^ ERROR borrowed data cannot be stored outside of its closure
         //~| NOTE cannot be stored outside of its closure
diff --git a/src/test/ui/borrowck/issue-7573.stderr b/src/test/ui/borrowck/issue-7573.stderr
index 6c549a029b6..99b48d9276c 100644
--- a/src/test/ui/borrowck/issue-7573.stderr
+++ b/src/test/ui/borrowck/issue-7573.stderr
@@ -1,13 +1,15 @@
 error: borrowed data cannot be stored outside of its closure
-  --> $DIR/issue-7573.rs:31:27
+  --> $DIR/issue-7573.rs:32:27
    |
 27 |     let mut lines_to_use: Vec<&CrateId> = Vec::new();
-   |                               - cannot infer an appropriate lifetime
+   |                               - cannot infer an appropriate lifetime...
 28 |         //~^ NOTE cannot infer an appropriate lifetime
 29 |     let push_id = |installed_id: &CrateId| {
-   |                   ------------------------ borrowed data cannot outlive this closure
-30 |         //~^ NOTE borrowed data cannot outlive this closure
-31 |         lines_to_use.push(installed_id);
+   |         -------   ------------------------ borrowed data cannot outlive this closure
+   |         |
+   |         ...so that variable is valid at time of its declaration
+...
+32 |         lines_to_use.push(installed_id);
    |                           ^^^^^^^^^^^^ cannot be stored outside of its closure
 
 error: aborting due to previous error
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.stderr
index 306da8b54e4..a2ad7c3f768 100644
--- a/src/test/ui/borrowck/regions-escape-bound-fn.stderr
+++ b/src/test/ui/borrowck/regions-escape-bound-fn.stderr
@@ -1,12 +1,12 @@
 error: borrowed data cannot be stored outside of its closure
   --> $DIR/regions-escape-bound-fn.rs:18:27
    |
+17 |     let mut x: Option<&isize> = None;
+   |         ----- borrowed data cannot be stored into here...
 18 |     with_int(|y| x = Some(y));
-   |              ---     -----^-
-   |              |       |    |
-   |              |       |    cannot be stored outside of its closure
-   |              |       cannot infer an appropriate lifetime
-   |              borrowed data cannot outlive this closure
+   |              ---          ^ cannot be stored outside of its closure
+   |              |
+   |              ...because it cannot outlive this closure
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr
index 5e51be46295..4b01e42fa67 100644
--- a/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr
+++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.stderr
@@ -1,12 +1,12 @@
 error: borrowed data cannot be stored outside of its closure
   --> $DIR/regions-escape-unboxed-closure.rs:16:32
    |
+15 |     let mut x: Option<&isize> = None;
+   |         ----- borrowed data cannot be stored into here...
 16 |     with_int(&mut |y| x = Some(y));
-   |                   ---     -----^-
-   |                   |       |    |
-   |                   |       |    cannot be stored outside of its closure
-   |                   |       cannot infer an appropriate lifetime
-   |                   borrowed data cannot outlive this closure
+   |                   ---          ^ cannot be stored outside of its closure
+   |                   |
+   |                   ...because it cannot outlive this closure
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/closure-expected-type/expect-region-supply-region.stderr b/src/test/ui/closure-expected-type/expect-region-supply-region.stderr
index d34b17bb25b..ebb1e561e57 100644
--- a/src/test/ui/closure-expected-type/expect-region-supply-region.stderr
+++ b/src/test/ui/closure-expected-type/expect-region-supply-region.stderr
@@ -1,24 +1,22 @@
 error: borrowed data cannot be stored outside of its closure
   --> $DIR/expect-region-supply-region.rs:28:18
    |
+26 |     let mut f: Option<&u32> = None;
+   |         ----- borrowed data cannot be stored into here...
 27 |     closure_expecting_bound(|x| {
-   |                             --- borrowed data cannot outlive this closure
+   |                             --- ...because it cannot outlive this closure
 28 |         f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
-   |             -----^-
-   |             |    |
-   |             |    cannot be stored outside of its closure
-   |             cannot infer an appropriate lifetime
+   |                  ^ cannot be stored outside of its closure
 
 error: borrowed data cannot be stored outside of its closure
   --> $DIR/expect-region-supply-region.rs:38:18
    |
+36 |     let mut f: Option<&u32> = None;
+   |         ----- borrowed data cannot be stored into here...
 37 |     closure_expecting_bound(|x: &u32| {
-   |                             --------- borrowed data cannot outlive this closure
+   |                             --------- ...because it cannot outlive this closure
 38 |         f = Some(x); //~ ERROR borrowed data cannot be stored outside of its closure
-   |             -----^-
-   |             |    |
-   |             |    cannot be stored outside of its closure
-   |             cannot infer an appropriate lifetime
+   |                  ^ cannot be stored outside of its closure
 
 error[E0308]: mismatched types
   --> $DIR/expect-region-supply-region.rs:47:33
@@ -87,14 +85,14 @@ note: ...does not necessarily outlive the anonymous lifetime #2 defined on the b
 error: borrowed data cannot be stored outside of its closure
   --> $DIR/expect-region-supply-region.rs:52:18
    |
+43 |     let mut f: Option<&u32> = None;
+   |         ----- borrowed data cannot be stored into here...
+...
 47 |     closure_expecting_bound(|x: &'x u32| {
-   |                             ------------ borrowed data cannot outlive this closure
+   |                             ------------ ...because it cannot outlive this closure
 ...
 52 |         f = Some(x);
-   |             -----^-
-   |             |    |
-   |             |    cannot be stored outside of its closure
-   |             cannot infer an appropriate lifetime
+   |                  ^ cannot be stored outside of its closure
 
 error: aborting due to 5 previous errors