about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-07-22 08:52:05 +0000
committerbors <bors@rust-lang.org>2018-07-22 08:52:05 +0000
commitaeca042f8464a98e1821756849f062eeede71e28 (patch)
tree023bb82b2459eb4e0918e577e450c82667efcd15 /src/test
parent3d5108630371932b05d4e650d20536910434c947 (diff)
parentd34924d8247e992cde5ac356440d1c9ccb4c5cdd (diff)
Auto merge of #52359 - matthewjasper:combine-move-error-reporting, r=pnkfelix
[NLL] Small move error reporting improvements

* Use a MirBorrowckContext when reporting errors to be more uniform with other error reporting
* Add a special message for the case of trying to move from capture variables in `Fn` and `FnMut` closures.

part of #51028
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/borrowck/borrowck-in-static.nll.stderr4
-rw-r--r--src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr4
-rw-r--r--src/test/ui/error-codes/E0161.nll.stderr16
-rw-r--r--src/test/ui/issue-20801.nll.stderr25
-rw-r--r--src/test/ui/issue-20801.rs2
-rw-r--r--src/test/ui/issue-30355.nll.stderr12
-rw-r--r--src/test/ui/issue-4335.nll.stderr4
-rw-r--r--src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr4
8 files changed, 36 insertions, 35 deletions
diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr
index 927d8c37458..05a022a726c 100644
--- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr
+++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr
@@ -1,8 +1,8 @@
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of captured variable in an `Fn` closure
   --> $DIR/borrowck-in-static.rs:15:17
    |
 LL |     Box::new(|| x) //~ ERROR cannot move out of captured outer variable
-   |                 ^ cannot move out of borrowed content
+   |                 ^ cannot move out of captured variable in an `Fn` closure
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
index 7464e33e8c1..07a9f374b2c 100644
--- a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
+++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.nll.stderr
@@ -1,8 +1,8 @@
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of captured variable in an `Fn` closure
   --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9
    |
 LL |         y.into_iter();
-   |         ^ cannot move out of borrowed content
+   |         ^ cannot move out of captured variable in an `Fn` closure
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/error-codes/E0161.nll.stderr b/src/test/ui/error-codes/E0161.nll.stderr
deleted file mode 100644
index 6aaff743383..00000000000
--- a/src/test/ui/error-codes/E0161.nll.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error[E0507]: cannot move out of borrowed content
-  --> $DIR/E0161.rs:14:28
-   |
-LL |     let _x: Box<str> = box *"hello"; //~ ERROR E0161
-   |                            ^^^^^^^^ cannot move out of borrowed content
-
-error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
-  --> $DIR/E0161.rs:14:28
-   |
-LL |     let _x: Box<str> = box *"hello"; //~ ERROR E0161
-   |                            ^^^^^^^^
-
-error: aborting due to 2 previous errors
-
-Some errors occurred: E0161, E0507.
-For more information about an error, try `rustc --explain E0161`.
diff --git a/src/test/ui/issue-20801.nll.stderr b/src/test/ui/issue-20801.nll.stderr
index 39b1405991a..0394309a6e2 100644
--- a/src/test/ui/issue-20801.nll.stderr
+++ b/src/test/ui/issue-20801.nll.stderr
@@ -1,8 +1,27 @@
-error: internal compiler error: Accessing `(*_8)` with the kind `Write(Move)` shouldn't be possible
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/issue-20801.rs:36:22
+   |
+LL |     let a = unsafe { *mut_ref() };
+   |                      ^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/issue-20801.rs:39:22
+   |
+LL |     let b = unsafe { *imm_ref() };
+   |                      ^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
+  --> $DIR/issue-20801.rs:42:22
+   |
+LL |     let c = unsafe { *mut_ptr() };
+   |                      ^^^^^^^^^^ cannot move out of borrowed content
+
+error[E0507]: cannot move out of borrowed content
   --> $DIR/issue-20801.rs:45:22
    |
 LL |     let d = unsafe { *const_ptr() };
-   |                      ^^^^^^^^^^^^
+   |                      ^^^^^^^^^^^^ cannot move out of borrowed content
 
-error: aborting due to previous error
+error: aborting due to 4 previous errors
 
+For more information about this error, try `rustc --explain E0507`.
diff --git a/src/test/ui/issue-20801.rs b/src/test/ui/issue-20801.rs
index 0e8b7fb9037..d3b97a9c058 100644
--- a/src/test/ui/issue-20801.rs
+++ b/src/test/ui/issue-20801.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// ignore-test currently ICEs when using NLL (#52416)
-
 // We used to ICE when moving out of a `*mut T` or `*const T`.
 
 struct T(u8);
diff --git a/src/test/ui/issue-30355.nll.stderr b/src/test/ui/issue-30355.nll.stderr
index e565ad59116..fdf8157dcf8 100644
--- a/src/test/ui/issue-30355.nll.stderr
+++ b/src/test/ui/issue-30355.nll.stderr
@@ -1,9 +1,3 @@
-error[E0508]: cannot move out of type `[u8]`, a non-copy slice
-  --> $DIR/issue-30355.rs:15:8
-   |
-LL |     &X(*Y)
-   |        ^^ cannot move out of here
-
 error[E0161]: cannot move a value of type X: the size of X cannot be statically determined
   --> $DIR/issue-30355.rs:15:6
    |
@@ -16,6 +10,12 @@ error[E0161]: cannot move a value of type [u8]: the size of [u8] cannot be stati
 LL |     &X(*Y)
    |        ^^
 
+error[E0508]: cannot move out of type `[u8]`, a non-copy slice
+  --> $DIR/issue-30355.rs:15:8
+   |
+LL |     &X(*Y)
+   |        ^^ cannot move out of here
+
 error: aborting due to 3 previous errors
 
 Some errors occurred: E0161, E0508.
diff --git a/src/test/ui/issue-4335.nll.stderr b/src/test/ui/issue-4335.nll.stderr
index 8eede347478..eacd8b5e580 100644
--- a/src/test/ui/issue-4335.nll.stderr
+++ b/src/test/ui/issue-4335.nll.stderr
@@ -1,8 +1,8 @@
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
   --> $DIR/issue-4335.rs:16:20
    |
 LL |     id(Box::new(|| *v))
-   |                    ^^ cannot move out of borrowed content
+   |                    ^^ cannot move out of captured variable in an `FnMut` closure
 
 error[E0597]: `v` does not live long enough
   --> $DIR/issue-4335.rs:16:17
diff --git a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
index f752015c650..b3563f1b620 100644
--- a/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
+++ b/src/test/ui/span/borrowck-call-is-borrow-issue-12224.nll.stderr
@@ -28,11 +28,11 @@ LL | fn test4(f: &Test) {
 LL |     f.f.call_mut(())
    |     ^^^ `f` is a `&` reference, so the data it refers to cannot be borrowed as mutable
 
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of captured variable in an `FnMut` closure
   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:66:13
    |
 LL |         foo(f);
-   |             ^ cannot move out of borrowed content
+   |             ^ cannot move out of captured variable in an `FnMut` closure
 
 error[E0505]: cannot move out of `f` because it is borrowed
   --> $DIR/borrowck-call-is-borrow-issue-12224.rs:65:16