From 42a541e0f152441204a00ae77dc23a82bf1fec02 Mon Sep 17 00:00:00 2001 From: Matthew Jasper Date: Sat, 20 Oct 2018 10:08:36 +0100 Subject: [PATCH] Don't emit cannot move errors twice in migrate mode --- src/librustc_mir/borrow_check/mod.rs | 14 ++-- .../borrow_check/mutability_errors.rs | 6 +- .../ui/access-mode-in-closures.nll.stderr | 14 +--- .../ui/binop/binop-move-semantics.nll.stderr | 14 +--- .../borrowck-fn-in-const-a.ast.nll.stderr | 20 ------ ...or-loop-correct-cmt-for-pattern.nll.stderr | 32 +-------- .../ui/borrowck/borrowck-in-static.nll.stderr | 17 +---- .../borrowck/borrowck-issue-2657-2.nll.stderr | 13 +--- .../borrowck-migrate-to-nll.edition.stderr | 14 ---- .../borrowck-migrate-to-nll.zflag.stderr | 14 ---- .../borrowck-move-error-with-note.nll.stderr | 50 +------------ .../borrowck-move-from-unsafe-ptr.nll.stderr | 13 +--- ...orrowck-move-in-irrefut-pat.ast.nll.stderr | 29 +------- ...ut-of-overloaded-auto-deref.ast.nll.stderr | 11 +-- ...ck-move-out-of-overloaded-deref.nll.stderr | 11 +-- ...wck-move-out-of-static-item.ast.nll.stderr | 18 ----- .../borrowck-move-out-of-vec-tail.nll.stderr | 29 +------- ...-overloaded-index-move-from-vec.nll.stderr | 11 +-- src/test/ui/borrowck/issue-51415.nll.stderr | 11 +-- ...tic-initializer-issue-38520.ast.nll.stderr | 33 --------- ...upvar-from-non-once-ref-closure.nll.stderr | 21 +----- .../ui/by-move-pattern-binding.nll.stderr | 11 +-- ...check-static-values-constraints.nll.stderr | 11 +-- src/test/ui/dst/dst-index.nll.stderr | 20 +----- src/test/ui/dst/dst-rvalue.nll.stderr | 22 +----- src/test/ui/error-codes/E0507.nll.stderr | 18 ----- src/test/ui/issues/issue-12567.nll.stderr | 41 +---------- .../issues/issue-17718-static-move.nll.stderr | 11 +-- src/test/ui/issues/issue-20801.nll.stderr | 20 +----- src/test/ui/issues/issue-2590.nll.stderr | 13 +--- src/test/ui/issues/issue-30355.nll.stderr | 13 +--- .../issue-40402-1.nll.stderr | 11 +-- .../issue-40402-2.nll.stderr | 20 +----- src/test/ui/issues/issue-4335.nll.stderr | 11 +-- .../moves-based-on-type-block-bad.nll.stderr | 14 +--- ...e-out-of-closure-env-issue-1965.nll.stderr | 17 +---- .../ui/nll/cannot-move-block-spans.nll.stderr | 72 +------------------ .../match-guards-always-borrow.ast.nll.stderr | 14 ---- .../static/static-items-cant-move.nll.stderr | 18 ----- src/test/ui/std-uncopyable-atomics.nll.stderr | 38 +--------- .../trivial-bounds-leak-copy.nll.stderr | 20 ------ .../unboxed-closure-illegal-move.nll.stderr | 32 +-------- src/test/ui/unop-move-semantics.nll.stderr | 14 +--- .../unsized-locals/unsized-exprs2.nll.stderr | 14 +--- 44 files changed, 48 insertions(+), 822 deletions(-) delete mode 100644 src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr delete mode 100644 src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr delete mode 100644 src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr delete mode 100644 src/test/ui/error-codes/E0507.nll.stderr delete mode 100644 src/test/ui/static/static-items-cant-move.nll.stderr delete mode 100644 src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs index 6ef8b15545872..ddea7e5226024 100644 --- a/src/librustc_mir/borrow_check/mod.rs +++ b/src/librustc_mir/borrow_check/mod.rs @@ -1831,7 +1831,10 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { | Write(wk @ WriteKind::StorageDeadOrDrop) | Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shared)) | Write(wk @ WriteKind::MutableBorrow(BorrowKind::Shallow)) => { - if let Err(_place_err) = self.is_mutable(place, is_local_mutation_allowed) { + if let (Err(_place_err), true) = ( + self.is_mutable(place, is_local_mutation_allowed), + self.errors_buffer.is_empty() + ) { if self.infcx.tcx.migrate_borrowck() { // rust-lang/rust#46908: In pure NLL mode this // code path should be unreachable (and thus @@ -1855,12 +1858,11 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> { location, ); } else { - self.infcx.tcx.sess.delay_span_bug( + span_bug!( span, - &format!( - "Accessing `{:?}` with the kind `{:?}` shouldn't be possible", - place, kind - ), + "Accessing `{:?}` with the kind `{:?}` shouldn't be possible", + place, + kind, ); } } diff --git a/src/librustc_mir/borrow_check/mutability_errors.rs b/src/librustc_mir/borrow_check/mutability_errors.rs index b71b131570d7b..7afe2c67adc9b 100644 --- a/src/librustc_mir/borrow_check/mutability_errors.rs +++ b/src/librustc_mir/borrow_check/mutability_errors.rs @@ -180,9 +180,9 @@ impl<'a, 'gcx, 'tcx> MirBorrowckCtxt<'a, 'gcx, 'tcx> { AccessKind::Move => { err = self.infcx.tcx .cannot_move_out_of(span, &(item_msg + &reason), Origin::Mir); - act = "move"; - acted_on = "moved"; - span + err.span_label(span, "cannot move"); + err.buffer(&mut self.errors_buffer); + return; } AccessKind::Mutate => { err = self.infcx.tcx diff --git a/src/test/ui/access-mode-in-closures.nll.stderr b/src/test/ui/access-mode-in-closures.nll.stderr index 3366f0639caa5..b9de60f43f703 100644 --- a/src/test/ui/access-mode-in-closures.nll.stderr +++ b/src/test/ui/access-mode-in-closures.nll.stderr @@ -13,18 +13,6 @@ note: move occurs because `v` has type `std::vec::Vec`, which does not im LL | match *s { sty(v) => v } //~ ERROR cannot move out | ^ -error[E0507]: cannot move out of `s.0` which is behind a `&` reference - --> $DIR/access-mode-in-closures.rs:19:24 - | -LL | let _foo = unpack(|s| { - | - help: consider changing this to be a mutable reference: `&mut sty` -LL | // Test that `s` is moved here. -LL | match *s { sty(v) => v } //~ ERROR cannot move out - | ^ - | | - | cannot move out of `s.0` which is behind a `&` reference - | `s` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/binop/binop-move-semantics.nll.stderr b/src/test/ui/binop/binop-move-semantics.nll.stderr index 94676f0e5ad77..545a60f6770d9 100644 --- a/src/test/ui/binop/binop-move-semantics.nll.stderr +++ b/src/test/ui/binop/binop-move-semantics.nll.stderr @@ -32,18 +32,6 @@ error[E0507]: cannot move out of borrowed content LL | *n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content -error[E0507]: cannot move out of `*n` which is behind a `&` reference - --> $DIR/binop-move-semantics.rs:42:5 - | -LL | let n = &y; - | -- help: consider changing this to be a mutable reference: `&mut y` -... -LL | *n; //~ ERROR: cannot move out of borrowed content - | ^^ - | | - | cannot move out of `*n` which is behind a `&` reference - | `n` is a `&` reference, so the data it refers to cannot be moved - error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable --> $DIR/binop-move-semantics.rs:64:5 | @@ -74,7 +62,7 @@ LL | | &mut f; //~ ERROR: cannot borrow `f` as mutable because it is also b | | immutable borrow later used here | mutable borrow occurs here -error: aborting due to 7 previous errors +error: aborting due to 6 previous errors Some errors occurred: E0382, E0502, E0507. For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr b/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr deleted file mode 100644 index b171a48ac5081..0000000000000 --- a/src/test/ui/borrowck/borrowck-fn-in-const-a.ast.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0507]: cannot move out of borrowed content - --> $DIR/borrowck-fn-in-const-a.rs:19:16 - | -LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] - | ^^ cannot move out of borrowed content - -error[E0507]: cannot move out of `*x` which is behind a `&` reference - --> $DIR/borrowck-fn-in-const-a.rs:19:16 - | -LL | fn broken(x: &String) -> String { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | return *x //[ast]~ ERROR cannot move out of borrowed content [E0507] - | ^^ - | | - | cannot move out of `*x` which is behind a `&` reference - | `x` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr index 0ab3d3ea5cdfe..25eb69ad9377d 100644 --- a/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr +++ b/src/test/ui/borrowck/borrowck-for-loop-correct-cmt-for-pattern.nll.stderr @@ -1,13 +1,3 @@ -error[E0507]: cannot move out of `*__next` which is behind a `&` reference - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:10 - | -LL | for &a in x.iter() { //~ ERROR cannot move out - | -^ - | || - | |cannot move out of `*__next` which is behind a `&` reference - | |`__next` is a `&` reference, so the data it refers to cannot be moved - | help: consider changing this to be a mutable reference: `&mut a` - error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:22:15 | @@ -23,16 +13,6 @@ note: move occurs because `a` has type `&mut i32`, which does not implement the LL | for &a in x.iter() { //~ ERROR cannot move out | ^ -error[E0507]: cannot move out of `*__next` which is behind a `&` reference - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:10 - | -LL | for &a in &f.a { //~ ERROR cannot move out - | -^ - | || - | |cannot move out of `*__next` which is behind a `&` reference - | |`__next` is a `&` reference, so the data it refers to cannot be moved - | help: consider changing this to be a mutable reference: `&mut a` - error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:28:15 | @@ -48,16 +28,6 @@ note: move occurs because `a` has type `std::boxed::Box`, which does not LL | for &a in &f.a { //~ ERROR cannot move out | ^ -error[E0507]: cannot move out of `*__next` which is behind a `&` reference - --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:10 - | -LL | for &a in x.iter() { //~ ERROR cannot move out - | -^ - | || - | |cannot move out of `*__next` which is behind a `&` reference - | |`__next` is a `&` reference, so the data it refers to cannot be moved - | help: consider changing this to be a mutable reference: `&mut a` - error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-for-loop-correct-cmt-for-pattern.rs:32:15 | @@ -73,6 +43,6 @@ note: move occurs because `a` has type `std::boxed::Box`, which does not im LL | for &a in x.iter() { //~ ERROR cannot move out | ^ -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-in-static.nll.stderr b/src/test/ui/borrowck/borrowck-in-static.nll.stderr index ba42dc2436377..45fa1764f7027 100644 --- a/src/test/ui/borrowck/borrowck-in-static.nll.stderr +++ b/src/test/ui/borrowck/borrowck-in-static.nll.stderr @@ -6,21 +6,6 @@ LL | let x = Box::new(0); LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable | ^ cannot move out of captured variable in an `Fn` closure -error[E0507]: cannot move out of `x`, as it is a captured variable in a `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 `x`, as it is a captured variable in a `Fn` closure - | cannot move - | -help: consider changing this to accept closures that implement `FnMut` - --> $DIR/borrowck-in-static.rs:15:14 - | -LL | Box::new(|| x) //~ ERROR cannot move out of captured outer variable - | ^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr index 0445a75d61a9d..cdbfab8bd054a 100644 --- a/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr +++ b/src/test/ui/borrowck/borrowck-issue-2657-2.nll.stderr @@ -7,17 +7,6 @@ LL | let _b = *y; //~ ERROR cannot move out | cannot move out of borrowed content | help: consider removing the `*`: `y` -error[E0507]: cannot move out of `*y` which is behind a `&` reference - --> $DIR/borrowck-issue-2657-2.rs:17:18 - | -LL | Some(ref y) => { - | ----- help: consider changing this to be a mutable reference: `ref mut y` -LL | let _b = *y; //~ ERROR cannot move out - | ^^ - | | - | cannot move out of `*y` which is behind a `&` reference - | `y` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr index f5a9db364065f..e7dbc6f6e3ba0 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.edition.stderr @@ -8,17 +8,3 @@ LL | (|| { let bar = foo; bar.take() })(); It represents potential unsoundness in your code. This warning will become a hard error in the future. -warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard - --> $DIR/borrowck-migrate-to-nll.rs:35:17 - | -LL | (|| { let bar = foo; bar.take() })(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | cannot move out of `foo`, as it is immutable for the pattern guard - | cannot move - | - = note: variables bound in patterns are immutable until the end of the pattern guard - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. - diff --git a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr index f5a9db364065f..e7dbc6f6e3ba0 100644 --- a/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr +++ b/src/test/ui/borrowck/borrowck-migrate-to-nll.zflag.stderr @@ -8,17 +8,3 @@ LL | (|| { let bar = foo; bar.take() })(); It represents potential unsoundness in your code. This warning will become a hard error in the future. -warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard - --> $DIR/borrowck-migrate-to-nll.rs:35:17 - | -LL | (|| { let bar = foo; bar.take() })(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | cannot move out of `foo`, as it is immutable for the pattern guard - | cannot move - | - = note: variables bound in patterns are immutable until the end of the pattern guard - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. - diff --git a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr index 99f69515a4732..2df520a936c9d 100644 --- a/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-error-with-note.nll.stderr @@ -24,42 +24,6 @@ LL | num2) => (), LL | Foo::Foo2(num) => (), | ^^^ -error[E0507]: cannot move out of `f.0` which is behind a `&` reference - --> $DIR/borrowck-move-error-with-note.rs:23:19 - | -LL | let f = &Foo::Foo1(box 1, box 2); - | ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)` -... -LL | Foo::Foo1(num1, - | ^^^^ - | | - | cannot move out of `f.0` which is behind a `&` reference - | `f` is a `&` reference, so the data it refers to cannot be moved - -error[E0507]: cannot move out of `f.1` which is behind a `&` reference - --> $DIR/borrowck-move-error-with-note.rs:24:19 - | -LL | let f = &Foo::Foo1(box 1, box 2); - | ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)` -... -LL | num2) => (), - | ^^^^ - | | - | cannot move out of `f.1` which is behind a `&` reference - | `f` is a `&` reference, so the data it refers to cannot be moved - -error[E0507]: cannot move out of `f.0` which is behind a `&` reference - --> $DIR/borrowck-move-error-with-note.rs:25:19 - | -LL | let f = &Foo::Foo1(box 1, box 2); - | ------------------------ help: consider changing this to be a mutable reference: `&mut Foo::Foo1(box 1, box 2)` -... -LL | Foo::Foo2(num) => (), - | ^^^ - | | - | cannot move out of `f.0` which is behind a `&` reference - | `f` is a `&` reference, so the data it refers to cannot be moved - error[E0509]: cannot move out of type `S`, which implements the `Drop` trait --> $DIR/borrowck-move-error-with-note.rs:39:11 | @@ -97,19 +61,7 @@ note: move occurs because `n` has type `std::boxed::Box`, which does not LL | n => { | ^ -error[E0507]: cannot move out of `a.a` which is behind a `&` reference - --> $DIR/borrowck-move-error-with-note.rs:59:9 - | -LL | let a = &A { a: box 1 }; - | --------------- help: consider changing this to be a mutable reference: `&mut A { a: box 1 }` -... -LL | n => { - | ^ - | | - | cannot move out of `a.a` which is behind a `&` reference - | `a` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 7 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0507, E0509. For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr index 83c5b82957dea..c3a2180b9f082 100644 --- a/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-from-unsafe-ptr.nll.stderr @@ -7,17 +7,6 @@ LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer | cannot move out of dereference of raw pointer | help: consider removing the `*`: `x` -error[E0507]: cannot move out of `*x` which is behind a `*const` pointer - --> $DIR/borrowck-move-from-unsafe-ptr.rs:13:13 - | -LL | unsafe fn foo(x: *const Box) -> Box { - | ----------------- help: consider changing this to be a mutable pointer: `*mut std::boxed::Box` -LL | let y = *x; //~ ERROR cannot move out of dereference of raw pointer - | ^^ - | | - | cannot move out of `*x` which is behind a `*const` pointer - | `x` is a `*const` pointer, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr index f22aca9994986..49c2ec0dcf4e7 100644 --- a/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-in-irrefut-pat.ast.nll.stderr @@ -14,15 +14,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im LL | fn arg_item(&_x: &String) {} | ^^ -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/borrowck-move-in-irrefut-pat.rs:16:14 - | -LL | fn arg_item(&_x: &String) {} - | ^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-in-irrefut-pat.rs:21:11 | @@ -39,24 +30,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im LL | with(|&_x| ()) | ^^ -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/borrowck-move-in-irrefut-pat.rs:21:12 - | -LL | with(|&_x| ()) - | ^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/borrowck-move-in-irrefut-pat.rs:27:10 - | -LL | let &_x = &"hi".to_string(); - | ^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/borrowck-move-in-irrefut-pat.rs:27:15 | @@ -72,6 +45,6 @@ note: move occurs because `_x` has type `std::string::String`, which does not im LL | let &_x = &"hi".to_string(); | ^^ -error: aborting due to 6 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr index ba74cd2514e1a..d58beabb3038a 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-auto-deref.ast.nll.stderr @@ -4,15 +4,6 @@ error[E0507]: cannot move out of an `Rc` LL | let _x = Rc::new(vec![1, 2]).into_iter(); | ^^^^^^^^^^^^^^^^^^^ cannot move out of an `Rc` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/borrowck-move-out-of-overloaded-auto-deref.rs:17:14 - | -LL | let _x = Rc::new(vec![1, 2]).into_iter(); - | ^^^^^^^^^^^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr index 205044bb36885..c9c8cf104ce2e 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-overloaded-deref.nll.stderr @@ -7,15 +7,6 @@ LL | let _x = *Rc::new("hi".to_string()); | cannot move out of an `Rc` | help: consider removing the `*`: `Rc::new("hi".to_string())` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/borrowck-move-out-of-overloaded-deref.rs:14:14 - | -LL | let _x = *Rc::new("hi".to_string()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr deleted file mode 100644 index 675458d8c2b85..0000000000000 --- a/src/test/ui/borrowck/borrowck-move-out-of-static-item.ast.nll.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0507]: cannot move out of static item - --> $DIR/borrowck-move-out-of-static-item.rs:28:10 - | -LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] - | ^^^ cannot move out of static item - -error[E0507]: cannot move out of immutable static item `BAR` - --> $DIR/borrowck-move-out-of-static-item.rs:28:10 - | -LL | test(BAR); //[ast]~ ERROR cannot move out of static item [E0507] - | ^^^ - | | - | cannot move out of immutable static item `BAR` - | cannot move - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr index dea42c53992b1..f3430ba4e06c9 100644 --- a/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr +++ b/src/test/ui/borrowck/borrowck-move-out-of-vec-tail.nll.stderr @@ -26,31 +26,6 @@ LL | //~| to prevent move LL | Foo { string: b }] => { | -error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference - --> $DIR/borrowck-move-out-of-vec-tail.rs:30:33 - | -LL | [_, ref tail..] => { - | -------- help: consider changing this to be a mutable reference: `ref mut tail` -LL | match tail { -LL | &[Foo { string: a }, - | ^ - | | - | cannot move out of `tail[..].string` which is behind a `&` reference - | `tail` is a `&` reference, so the data it refers to cannot be moved - -error[E0507]: cannot move out of `tail[..].string` which is behind a `&` reference - --> $DIR/borrowck-move-out-of-vec-tail.rs:34:33 - | -LL | [_, ref tail..] => { - | -------- help: consider changing this to be a mutable reference: `ref mut tail` -... -LL | Foo { string: b }] => { - | ^ - | | - | cannot move out of `tail[..].string` which is behind a `&` reference - | `tail` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 3 previous errors +error: aborting due to previous error -Some errors occurred: E0507, E0508. -For more information about an error, try `rustc --explain E0507`. +For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr index 05fd6d71520c7..92e10c258c269 100644 --- a/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr +++ b/src/test/ui/borrowck/borrowck-overloaded-index-move-from-vec.nll.stderr @@ -7,15 +7,6 @@ LL | let bad = v[0]; | cannot move out of borrowed content | help: consider borrowing here: `&v[0]` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/borrowck-overloaded-index-move-from-vec.rs:30:15 - | -LL | let bad = v[0]; - | ^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/issue-51415.nll.stderr b/src/test/ui/borrowck/issue-51415.nll.stderr index ee7e3e71962e8..d4340938eebc1 100644 --- a/src/test/ui/borrowck/issue-51415.nll.stderr +++ b/src/test/ui/borrowck/issue-51415.nll.stderr @@ -13,15 +13,6 @@ note: move occurs because `s` has type `std::string::String`, which does not imp LL | let opt = a.iter().enumerate().find(|(_, &s)| { | ^ -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-51415.rs:16:47 - | -LL | let opt = a.iter().enumerate().find(|(_, &s)| { - | ^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr b/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr deleted file mode 100644 index d25fc75977542..0000000000000 --- a/src/test/ui/borrowck/move-in-static-initializer-issue-38520.ast.nll.stderr +++ /dev/null @@ -1,33 +0,0 @@ -error[E0507]: cannot move out of borrowed content - --> $DIR/move-in-static-initializer-issue-38520.rs:25:23 - | -LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507 - | ^^^ cannot move out of borrowed content - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/move-in-static-initializer-issue-38520.rs:25:23 - | -LL | static Y: usize = get(*&X); //[ast]~ ERROR E0507 - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error[E0507]: cannot move out of borrowed content - --> $DIR/move-in-static-initializer-issue-38520.rs:27:22 - | -LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507 - | ^^^ cannot move out of borrowed content - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/move-in-static-initializer-issue-38520.rs:27:22 - | -LL | const Z: usize = get(*&X); //[ast]~ ERROR E0507 - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 4 previous errors - -For more information about this error, try `rustc --explain E0507`. 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 0844ac32b8b60..0eb5fc8c32435 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 @@ -7,25 +7,6 @@ LL | call(|| { LL | y.into_iter(); | ^ cannot move out of captured variable in an `Fn` closure -error[E0507]: cannot move out of `y`, as it is a captured variable in a `Fn` closure - --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:21:9 - | -LL | y.into_iter(); - | ^ - | | - | cannot move out of `y`, as it is a captured variable in a `Fn` closure - | cannot move - | -help: consider changing this to accept closures that implement `FnMut` - --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:20:10 - | -LL | call(|| { - | __________^ -LL | | y.into_iter(); -LL | | //~^ ERROR cannot move out of captured outer variable in an `Fn` closure -LL | | }); - | |_____^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/by-move-pattern-binding.nll.stderr b/src/test/ui/by-move-pattern-binding.nll.stderr index 4098795811589..491b5b5bd74ab 100644 --- a/src/test/ui/by-move-pattern-binding.nll.stderr +++ b/src/test/ui/by-move-pattern-binding.nll.stderr @@ -16,15 +16,6 @@ note: move occurs because `identifier` has type `std::string::String`, which doe LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move | ^^^^^^^^^^ -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/by-move-pattern-binding.rs:26:17 - | -LL | &E::Bar(identifier) => f(identifier.clone()) //~ ERROR cannot move - | ^^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/check-static-values-constraints.nll.stderr b/src/test/ui/check-static-values-constraints.nll.stderr index 576322ff5c195..5522e22fb1fa2 100644 --- a/src/test/ui/check-static-values-constraints.nll.stderr +++ b/src/test/ui/check-static-values-constraints.nll.stderr @@ -58,22 +58,13 @@ LL | let y = { static x: Box = box 3; x }; | cannot move out of static item | help: consider borrowing here: `&x` -error[E0507]: cannot move out of immutable static item `x` - --> $DIR/check-static-values-constraints.rs:120:45 - | -LL | let y = { static x: Box = box 3; x }; - | ^ - | | - | cannot move out of immutable static item `x` - | cannot move - error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:120:38 | LL | let y = { static x: Box = box 3; x }; | ^^^^^ allocation not allowed in statics -error: aborting due to 11 previous errors +error: aborting due to 10 previous errors Some errors occurred: E0010, E0015, E0493, E0507. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/dst/dst-index.nll.stderr b/src/test/ui/dst/dst-index.nll.stderr index d14760b707db2..0aa85d3ed7a3d 100644 --- a/src/test/ui/dst/dst-index.nll.stderr +++ b/src/test/ui/dst/dst-index.nll.stderr @@ -16,31 +16,13 @@ error[E0507]: cannot move out of borrowed content LL | S[0]; | ^^^^ cannot move out of borrowed content -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/dst-index.rs:41:5 - | -LL | S[0]; - | ^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/dst-index.rs:44:5 | LL | T[0]; | ^^^^ cannot move out of borrowed content -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/dst-index.rs:44:5 - | -LL | T[0]; - | ^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0161, E0507. For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/dst/dst-rvalue.nll.stderr b/src/test/ui/dst/dst-rvalue.nll.stderr index 537ece48e012c..b120da773a24a 100644 --- a/src/test/ui/dst/dst-rvalue.nll.stderr +++ b/src/test/ui/dst/dst-rvalue.nll.stderr @@ -16,33 +16,13 @@ error[E0507]: cannot move out of borrowed content LL | let _x: Box = box *"hello world"; | ^^^^^^^^^^^^^^ cannot move out of borrowed content -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/dst-rvalue.rs:16:28 - | -LL | let _x: Box = box *"hello world"; - | ^^^^^^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0508]: cannot move out of type `[isize]`, a non-copy slice --> $DIR/dst-rvalue.rs:21:32 | LL | let _x: Box<[isize]> = box *array; | ^^^^^^ cannot move out of here -error[E0507]: cannot move out of `*array` which is behind a `&` reference - --> $DIR/dst-rvalue.rs:21:32 - | -LL | let array: &[isize] = &[1, 2, 3]; - | ---------- help: consider changing this to be a mutable reference: `&mut [1, 2, 3]` -LL | let _x: Box<[isize]> = box *array; - | ^^^^^^ - | | - | cannot move out of `*array` which is behind a `&` reference - | `array` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors Some errors occurred: E0161, E0507, E0508. For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/error-codes/E0507.nll.stderr b/src/test/ui/error-codes/E0507.nll.stderr deleted file mode 100644 index 43795e5224ddc..0000000000000 --- a/src/test/ui/error-codes/E0507.nll.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0507]: cannot move out of borrowed content - --> $DIR/E0507.rs:22:5 - | -LL | x.borrow().nothing_is_true(); //~ ERROR E0507 - | ^^^^^^^^^^ cannot move out of borrowed content - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/E0507.rs:22:5 - | -LL | x.borrow().nothing_is_true(); //~ ERROR E0507 - | ^^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-12567.nll.stderr b/src/test/ui/issues/issue-12567.nll.stderr index bb844c4a69f22..72d21d47d86fa 100644 --- a/src/test/ui/issues/issue-12567.nll.stderr +++ b/src/test/ui/issues/issue-12567.nll.stderr @@ -40,43 +40,6 @@ LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) LL | (&[hd1, ..], &[hd2, ..]) | ^^^ -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-12567.rs:16:17 - | -LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) - | ^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-12567.rs:16:31 - | -LL | (&[], &[hd, ..]) | (&[hd, ..], &[]) - | ^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-12567.rs:20:12 - | -LL | (&[hd1, ..], &[hd2, ..]) - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-12567.rs:20:24 - | -LL | (&[hd1, ..], &[hd2, ..]) - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 6 previous errors +error: aborting due to 2 previous errors -Some errors occurred: E0507, E0508. -For more information about an error, try `rustc --explain E0507`. +For more information about this error, try `rustc --explain E0508`. diff --git a/src/test/ui/issues/issue-17718-static-move.nll.stderr b/src/test/ui/issues/issue-17718-static-move.nll.stderr index 66fba7749f479..f8da3c3d5989e 100644 --- a/src/test/ui/issues/issue-17718-static-move.nll.stderr +++ b/src/test/ui/issues/issue-17718-static-move.nll.stderr @@ -7,15 +7,6 @@ LL | let _a = FOO; //~ ERROR: cannot move out of static item | cannot move out of static item | help: consider borrowing here: `&FOO` -error[E0507]: cannot move out of immutable static item `FOO` - --> $DIR/issue-17718-static-move.rs:16:14 - | -LL | let _a = FOO; //~ ERROR: cannot move out of static item - | ^^^ - | | - | cannot move out of immutable static item `FOO` - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-20801.nll.stderr b/src/test/ui/issues/issue-20801.nll.stderr index 60e3056b8c4d4..362778b26c861 100644 --- a/src/test/ui/issues/issue-20801.nll.stderr +++ b/src/test/ui/issues/issue-20801.nll.stderr @@ -16,15 +16,6 @@ LL | let b = unsafe { *imm_ref() }; | cannot move out of borrowed content | help: consider removing the `*`: `imm_ref()` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-20801.rs:39:22 - | -LL | let b = unsafe { *imm_ref() }; - | ^^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of dereference of raw pointer --> $DIR/issue-20801.rs:42:22 | @@ -43,15 +34,6 @@ LL | let d = unsafe { *const_ptr() }; | cannot move out of dereference of raw pointer | help: consider removing the `*`: `const_ptr()` -error[E0507]: cannot move out of data in a `*const` pointer - --> $DIR/issue-20801.rs:45:22 - | -LL | let d = unsafe { *const_ptr() }; - | ^^^^^^^^^^^^ - | | - | cannot move out of data in a `*const` pointer - | cannot move - -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-2590.nll.stderr b/src/test/ui/issues/issue-2590.nll.stderr index ae726d26d072b..fa2df26498a06 100644 --- a/src/test/ui/issues/issue-2590.nll.stderr +++ b/src/test/ui/issues/issue-2590.nll.stderr @@ -4,17 +4,6 @@ error[E0507]: cannot move out of borrowed content LL | self.tokens //~ ERROR cannot move out of borrowed content | ^^^^^^^^^^^ cannot move out of borrowed content -error[E0507]: cannot move out of `self.tokens` which is behind a `&` reference - --> $DIR/issue-2590.rs:22:9 - | -LL | fn parse(&self) -> Vec { - | ----- help: consider changing this to be a mutable reference: `&mut self` -LL | self.tokens //~ ERROR cannot move out of borrowed content - | ^^^^^^^^^^^ - | | - | cannot move out of `self.tokens` which is behind a `&` reference - | `self` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-30355.nll.stderr b/src/test/ui/issues/issue-30355.nll.stderr index 78cf3661bb763..fdf8157dcf833 100644 --- a/src/test/ui/issues/issue-30355.nll.stderr +++ b/src/test/ui/issues/issue-30355.nll.stderr @@ -16,16 +16,7 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice LL | &X(*Y) | ^^ cannot move out of here -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-30355.rs:15:8 - | -LL | &X(*Y) - | ^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors -Some errors occurred: E0161, E0507, E0508. +Some errors occurred: E0161, E0508. For more information about an error, try `rustc --explain E0161`. diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr index 22fcffb9527a4..9020d3778c373 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-1.nll.stderr @@ -7,15 +7,6 @@ LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content | cannot move out of borrowed content | help: consider borrowing here: `&f.v[0]` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-40402-1.rs:19:13 - | -LL | let e = f.v[0]; //~ ERROR cannot move out of indexed content - | ^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr index cdb547ad10064..a80e9a5fe091f 100644 --- a/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr +++ b/src/test/ui/issues/issue-40402-ref-hints/issue-40402-2.nll.stderr @@ -1,21 +1,3 @@ -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-40402-2.rs:15:10 - | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content - | ^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/issue-40402-2.rs:15:13 - | -LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content - | ^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/issue-40402-2.rs:15:18 | @@ -33,6 +15,6 @@ note: move occurs because these variables have types that don't implement the `C LL | let (a, b) = x[0]; //~ ERROR cannot move out of indexed content | ^ ^ -error: aborting due to 3 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/issues/issue-4335.nll.stderr b/src/test/ui/issues/issue-4335.nll.stderr index beb853fc91ae5..d31eddfa5b65d 100644 --- a/src/test/ui/issues/issue-4335.nll.stderr +++ b/src/test/ui/issues/issue-4335.nll.stderr @@ -6,15 +6,6 @@ LL | fn f<'r, T>(v: &'r T) -> Box T + 'r> { LL | id(Box::new(|| *v)) | ^^ cannot move out of captured variable in an `FnMut` closure -error[E0507]: cannot move out of `*v` which is behind a `&` reference - --> $DIR/issue-4335.rs:16:20 - | -LL | id(Box::new(|| *v)) - | ^^ - | | - | cannot move out of `*v` which is behind a `&` reference - | cannot move - error[E0373]: closure may outlive the current function, but it borrows `v`, which is owned by the current function --> $DIR/issue-4335.rs:16:17 | @@ -33,7 +24,7 @@ help: to force the closure to take ownership of `v` (and any other referenced va LL | id(Box::new(move || *v)) | ^^^^^^^ -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors Some errors occurred: E0373, E0507. For more information about an error, try `rustc --explain E0373`. diff --git a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr index 1ded703fd5a2f..1f22ab1481852 100644 --- a/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-block-bad.nll.stderr @@ -16,18 +16,6 @@ note: move occurs because `x` has type `std::boxed::Box`, which does not LL | box E::Bar(x) => println!("{}", x.to_string()), | ^ -error[E0507]: cannot move out of `hellothere.x.0` which is behind a `&` reference - --> $DIR/moves-based-on-type-block-bad.rs:37:28 - | -LL | f(&s, |hellothere| { - | ---------- help: consider changing this to be a mutable reference: `&mut S` -... -LL | box E::Bar(x) => println!("{}", x.to_string()), - | ^ - | | - | cannot move out of `hellothere.x.0` which is behind a `&` reference - | `hellothere` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr index a34a9efab6bce..13a6fc15ce318 100644 --- a/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr +++ b/src/test/ui/moves/moves-based-on-type-move-out-of-closure-env-issue-1965.nll.stderr @@ -6,21 +6,6 @@ LL | let i = box 3; LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out | ^ cannot move out of captured variable in an `Fn` closure -error[E0507]: cannot move out of `i`, as it is a captured variable in a `Fn` closure - --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:28 - | -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out - | ^ - | | - | cannot move out of `i`, as it is a captured variable in a `Fn` closure - | cannot move - | -help: consider changing this to accept closures that implement `FnMut` - --> $DIR/moves-based-on-type-move-out-of-closure-env-issue-1965.rs:21:20 - | -LL | let _f = to_fn(|| test(i)); //~ ERROR cannot move out - | ^^^^^^^^^^ - -error: aborting due to 2 previous errors +error: aborting due to previous error For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/nll/cannot-move-block-spans.nll.stderr b/src/test/ui/nll/cannot-move-block-spans.nll.stderr index 2d54ae0b81ec8..6a4c8f2e8d815 100644 --- a/src/test/ui/nll/cannot-move-block-spans.nll.stderr +++ b/src/test/ui/nll/cannot-move-block-spans.nll.stderr @@ -7,17 +7,6 @@ LL | let x = { *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error[E0507]: cannot move out of `*r` which is behind a `&` reference - --> $DIR/cannot-move-block-spans.rs:15:15 - | -LL | pub fn deref(r: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | let x = { *r }; //~ ERROR - | ^^ - | | - | cannot move out of `*r` which is behind a `&` reference - | `r` is a `&` reference, so the data it refers to cannot be moved - error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:16:22 | @@ -27,18 +16,6 @@ LL | let y = unsafe { *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error[E0507]: cannot move out of `*r` which is behind a `&` reference - --> $DIR/cannot-move-block-spans.rs:16:22 - | -LL | pub fn deref(r: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | let x = { *r }; //~ ERROR -LL | let y = unsafe { *r }; //~ ERROR - | ^^ - | | - | cannot move out of `*r` which is behind a `&` reference - | `r` is a `&` reference, so the data it refers to cannot be moved - error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:17:26 | @@ -48,18 +25,6 @@ LL | let z = loop { break *r; }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error[E0507]: cannot move out of `*r` which is behind a `&` reference - --> $DIR/cannot-move-block-spans.rs:17:26 - | -LL | pub fn deref(r: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -... -LL | let z = loop { break *r; }; //~ ERROR - | ^^ - | | - | cannot move out of `*r` which is behind a `&` reference - | `r` is a `&` reference, so the data it refers to cannot be moved - error[E0508]: cannot move out of type `[std::string::String; 2]`, a non-copy array --> $DIR/cannot-move-block-spans.rs:21:15 | @@ -96,17 +61,6 @@ LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error[E0507]: cannot move out of `*r` which is behind a `&` reference - --> $DIR/cannot-move-block-spans.rs:27:38 - | -LL | pub fn additional_statement_cases(r: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR - | ^^ - | | - | cannot move out of `*r` which is behind a `&` reference - | `r` is a `&` reference, so the data it refers to cannot be moved - error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:28:45 | @@ -116,18 +70,6 @@ LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error[E0507]: cannot move out of `*r` which is behind a `&` reference - --> $DIR/cannot-move-block-spans.rs:28:45 - | -LL | pub fn additional_statement_cases(r: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | let x = { let mut u = 0; u += 1; *r }; //~ ERROR -LL | let y = unsafe { let mut u = 0; u += 1; *r }; //~ ERROR - | ^^ - | | - | cannot move out of `*r` which is behind a `&` reference - | `r` is a `&` reference, so the data it refers to cannot be moved - error[E0507]: cannot move out of borrowed content --> $DIR/cannot-move-block-spans.rs:29:49 | @@ -137,19 +79,7 @@ LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR | cannot move out of borrowed content | help: consider removing the `*`: `r` -error[E0507]: cannot move out of `*r` which is behind a `&` reference - --> $DIR/cannot-move-block-spans.rs:29:49 - | -LL | pub fn additional_statement_cases(r: &String) { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -... -LL | let z = loop { let mut u = 0; u += 1; break *r; u += 2; }; //~ ERROR - | ^^ - | | - | cannot move out of `*r` which is behind a `&` reference - | `r` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 15 previous errors +error: aborting due to 9 previous errors Some errors occurred: E0507, E0508. For more information about an error, try `rustc --explain E0507`. diff --git a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr index 4fe01d472f50e..afb85c69990f9 100644 --- a/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr +++ b/src/test/ui/nll/match-guards-always-borrow.ast.nll.stderr @@ -8,20 +8,6 @@ LL | (|| { let bar = foo; bar.take() })(); It represents potential unsoundness in your code. This warning will become a hard error in the future. -warning[E0507]: cannot move out of `foo`, as it is immutable for the pattern guard - --> $DIR/match-guards-always-borrow.rs:23:13 - | -LL | (|| { let bar = foo; bar.take() })(); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | | - | cannot move out of `foo`, as it is immutable for the pattern guard - | cannot move - | - = note: variables bound in patterns are immutable until the end of the pattern guard - = warning: This error has been downgraded to a warning for backwards compatibility with previous releases. - It represents potential unsoundness in your code. - This warning will become a hard error in the future. - error: compilation successful --> $DIR/match-guards-always-borrow.rs:57:1 | diff --git a/src/test/ui/static/static-items-cant-move.nll.stderr b/src/test/ui/static/static-items-cant-move.nll.stderr deleted file mode 100644 index 35a400b15089f..0000000000000 --- a/src/test/ui/static/static-items-cant-move.nll.stderr +++ /dev/null @@ -1,18 +0,0 @@ -error[E0507]: cannot move out of static item - --> $DIR/static-items-cant-move.rs:28:10 - | -LL | test(BAR); //~ ERROR cannot move out of static item - | ^^^ cannot move out of static item - -error[E0507]: cannot move out of immutable static item `BAR` - --> $DIR/static-items-cant-move.rs:28:10 - | -LL | test(BAR); //~ ERROR cannot move out of static item - | ^^^ - | | - | cannot move out of immutable static item `BAR` - | cannot move - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/std-uncopyable-atomics.nll.stderr b/src/test/ui/std-uncopyable-atomics.nll.stderr index d2576a4baf369..e6b612fed8588 100644 --- a/src/test/ui/std-uncopyable-atomics.nll.stderr +++ b/src/test/ui/std-uncopyable-atomics.nll.stderr @@ -7,15 +7,6 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/std-uncopyable-atomics.rs:19:13 - | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:21:13 | @@ -25,15 +16,6 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/std-uncopyable-atomics.rs:21:13 - | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:23:13 | @@ -43,15 +25,6 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/std-uncopyable-atomics.rs:23:13 - | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - error[E0507]: cannot move out of borrowed content --> $DIR/std-uncopyable-atomics.rs:25:13 | @@ -61,15 +34,6 @@ LL | let x = *&x; //~ ERROR: cannot move out of borrowed content | cannot move out of borrowed content | help: consider removing the `*`: `&x` -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/std-uncopyable-atomics.rs:25:13 - | -LL | let x = *&x; //~ ERROR: cannot move out of borrowed content - | ^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 8 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr b/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr deleted file mode 100644 index 9f56bf0538436..0000000000000 --- a/src/test/ui/trivial-bounds/trivial-bounds-leak-copy.nll.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error[E0507]: cannot move out of borrowed content - --> $DIR/trivial-bounds-leak-copy.rs:19:5 - | -LL | *t //~ ERROR - | ^^ cannot move out of borrowed content - -error[E0507]: cannot move out of `*t` which is behind a `&` reference - --> $DIR/trivial-bounds-leak-copy.rs:19:5 - | -LL | fn move_out_string(t: &String) -> String { - | ------- help: consider changing this to be a mutable reference: `&mut std::string::String` -LL | *t //~ ERROR - | ^^ - | | - | cannot move out of `*t` which is behind a `&` reference - | `t` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 2 previous errors - -For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr index 625084efec2ff..4baa54e34c755 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-illegal-move.nll.stderr @@ -6,21 +6,6 @@ LL | let x = Box::new(0); LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `Fn` closure -error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure - --> $DIR/unboxed-closure-illegal-move.rs:25:31 - | -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move - | ^ - | | - | cannot move out of `x`, as it is a captured variable in a `Fn` closure - | cannot move - | -help: consider changing this to accept closures that implement `FnMut` - --> $DIR/unboxed-closure-illegal-move.rs:25:23 - | -LL | let f = to_fn(|| drop(x)); //~ ERROR cannot move - | ^^^^^^^^^^ - error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/unboxed-closure-illegal-move.rs:29:35 | @@ -37,21 +22,6 @@ LL | let x = Box::new(0); LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `Fn` closure -error[E0507]: cannot move out of `x`, as it is a captured variable in a `Fn` closure - --> $DIR/unboxed-closure-illegal-move.rs:38:36 - | -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move - | ^ - | | - | cannot move out of `x`, as it is a captured variable in a `Fn` closure - | cannot move - | -help: consider changing this to accept closures that implement `FnMut` - --> $DIR/unboxed-closure-illegal-move.rs:38:23 - | -LL | let f = to_fn(move || drop(x)); //~ ERROR cannot move - | ^^^^^^^^^^^^^^^ - error[E0507]: cannot move out of captured variable in an `FnMut` closure --> $DIR/unboxed-closure-illegal-move.rs:42:40 | @@ -60,6 +30,6 @@ LL | let x = Box::new(0); LL | let f = to_fn_mut(move || drop(x)); //~ ERROR cannot move | ^ cannot move out of captured variable in an `FnMut` closure -error: aborting due to 6 previous errors +error: aborting due to 4 previous errors For more information about this error, try `rustc --explain E0507`. diff --git a/src/test/ui/unop-move-semantics.nll.stderr b/src/test/ui/unop-move-semantics.nll.stderr index 8112ddbe2f16e..111940aab2c32 100644 --- a/src/test/ui/unop-move-semantics.nll.stderr +++ b/src/test/ui/unop-move-semantics.nll.stderr @@ -21,19 +21,7 @@ error[E0507]: cannot move out of borrowed content LL | !*n; //~ ERROR: cannot move out of borrowed content | ^^ cannot move out of borrowed content -error[E0507]: cannot move out of `*n` which is behind a `&` reference - --> $DIR/unop-move-semantics.rs:36:6 - | -LL | let n = &y; - | -- help: consider changing this to be a mutable reference: `&mut y` -... -LL | !*n; //~ ERROR: cannot move out of borrowed content - | ^^ - | | - | cannot move out of `*n` which is behind a `&` reference - | `n` is a `&` reference, so the data it refers to cannot be moved - -error: aborting due to 4 previous errors +error: aborting due to 3 previous errors Some errors occurred: E0382, E0507. For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr b/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr index 675457b0db6bb..a94414ef5603b 100644 --- a/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr +++ b/src/test/ui/unsized-locals/unsized-exprs2.nll.stderr @@ -4,16 +4,6 @@ error[E0508]: cannot move out of type `[u8]`, a non-copy slice LL | udrop::<[u8]>(foo()[..]); | ^^^^^^^^^ cannot move out of here -error[E0507]: cannot move out of data in a `&` reference - --> $DIR/unsized-exprs2.rs:22:19 - | -LL | udrop::<[u8]>(foo()[..]); - | ^^^^^^^^^ - | | - | cannot move out of data in a `&` reference - | cannot move - -error: aborting due to 2 previous errors +error: aborting due to previous error -Some errors occurred: E0507, E0508. -For more information about an error, try `rustc --explain E0507`. +For more information about this error, try `rustc --explain E0508`.