about summary refs log tree commit diff
path: root/src/test/ui/borrowck
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2018-07-20 17:30:31 +0100
committerDavid Wood <david@davidtw.co>2018-07-22 12:49:35 +0100
commit571eec627c63cea40ea9fba16b86cfafb1446c34 (patch)
treed2c72ef7ef4e6357c3380cf58b1f026d9ddb39ab /src/test/ui/borrowck
parent24c5751197f4971c7f7e387c035cac3565f2f629 (diff)
Improved closure errors.
Diffstat (limited to 'src/test/ui/borrowck')
-rw-r--r--src/test/ui/borrowck/issue-45983.nll.stderr8
-rw-r--r--src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr8
-rw-r--r--src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr8
-rw-r--r--src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr8
4 files changed, 16 insertions, 16 deletions
diff --git a/src/test/ui/borrowck/issue-45983.nll.stderr b/src/test/ui/borrowck/issue-45983.nll.stderr
index 4edec568737..64086cb0791 100644
--- a/src/test/ui/borrowck/issue-45983.nll.stderr
+++ b/src/test/ui/borrowck/issue-45983.nll.stderr
@@ -4,15 +4,15 @@ warning: not reporting region error due to nll
 LL |     give_any(|y| x = Some(y));
    |                           ^
 
-error: unsatisfied lifetime constraints
+error: borrowed data escapes outside of closure
   --> $DIR/issue-45983.rs:17:18
    |
 LL |     let x = None;
-   |         - lifetime `'2` appears in the type of `x`
+   |         - `x` is declared here, outside of the closure body
 LL |     give_any(|y| x = Some(y));
-   |               -  ^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
    |               |
-   |               lifetime `'1` appears in this argument
+   |               `y` is a reference that is only valid in the closure body
 
 error[E0594]: cannot assign to `x`, as it is not declared as mutable
   --> $DIR/issue-45983.rs:17:18
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr
index a162d9ea7f1..1a18817e943 100644
--- a/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr
+++ b/src/test/ui/borrowck/regions-escape-bound-fn-2.nll.stderr
@@ -4,15 +4,15 @@ warning: not reporting region error due to nll
 LL |     with_int(|y| x = Some(y));
    |                           ^
 
-error: unsatisfied lifetime constraints
+error: borrowed data escapes outside of closure
   --> $DIR/regions-escape-bound-fn-2.rs:18:18
    |
 LL |     let mut x = None;
-   |         ----- lifetime `'2` appears in the type of `x`
+   |         ----- `x` is declared here, outside of the closure body
 LL |     with_int(|y| x = Some(y));
-   |               -  ^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
    |               |
-   |               lifetime `'1` appears in this argument
+   |               `y` is a reference that is only valid in the closure body
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr
index af5db0e3ff6..62ea9a0854b 100644
--- a/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr
+++ b/src/test/ui/borrowck/regions-escape-bound-fn.nll.stderr
@@ -4,15 +4,15 @@ warning: not reporting region error due to nll
 LL |     with_int(|y| x = Some(y));
    |                      ^^^^^^^
 
-error: unsatisfied lifetime constraints
+error: borrowed data escapes outside of closure
   --> $DIR/regions-escape-bound-fn.rs:18:18
    |
 LL |     let mut x: Option<&isize> = None;
-   |         ----- lifetime `'2` appears in the type of `x`
+   |         ----- `x` is declared here, outside of the closure body
 LL |     with_int(|y| x = Some(y));
-   |               -  ^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+   |               -  ^^^^^^^^^^^ `y` escapes the closure body here
    |               |
-   |               lifetime `'1` appears in this argument
+   |               `y` is a reference that is only valid in the closure body
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr
index df93a1204b2..44eead9fb5a 100644
--- a/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr
+++ b/src/test/ui/borrowck/regions-escape-unboxed-closure.nll.stderr
@@ -4,15 +4,15 @@ warning: not reporting region error due to nll
 LL |     with_int(&mut |y| x = Some(y));
    |                           ^^^^^^^
 
-error: unsatisfied lifetime constraints
+error: borrowed data escapes outside of closure
   --> $DIR/regions-escape-unboxed-closure.rs:16:23
    |
 LL |     let mut x: Option<&isize> = None;
-   |         ----- lifetime `'2` appears in the type of `x`
+   |         ----- `x` is declared here, outside of the closure body
 LL |     with_int(&mut |y| x = Some(y));
-   |                    -  ^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
+   |                    -  ^^^^^^^^^^^ `y` escapes the closure body here
    |                    |
-   |                    lifetime `'1` appears in this argument
+   |                    `y` is a reference that is only valid in the closure body
 
 error: aborting due to previous error