diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2020-06-21 16:28:19 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2020-06-22 12:46:29 -0400 |
| commit | ad9972a20d0496ef326e93bd6d96d13a0708ada2 (patch) | |
| tree | aa9f02a29fcae956f1624497c71366cce7ea167a /src/test | |
| parent | 62878c20e9ce146123fbac23a98e44dfaae95d69 (diff) | |
Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, r=nikomatsakis"
This reverts commit 372cb9b69c76a042d0b9d4b48ff6084f64c84a2c, reversing changes made to 5c61a8dc34c3e2fc6d7f02cb288c350f0233f944.
Diffstat (limited to 'src/test')
27 files changed, 42 insertions, 453 deletions
diff --git a/src/test/ui/binop/binop-consume-args.stderr b/src/test/ui/binop/binop-consume-args.stderr index addc8a0efe1..acdc03e3726 100644 --- a/src/test/ui/binop/binop-consume-args.stderr +++ b/src/test/ui/binop/binop-consume-args.stderr @@ -4,15 +4,10 @@ error[E0382]: use of moved value: `lhs` LL | fn add<A: Add<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs + rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn add<A: Add<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -40,15 +35,10 @@ error[E0382]: use of moved value: `lhs` LL | fn sub<A: Sub<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs - rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL - | -LL | fn sub(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn sub<A: Sub<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -76,15 +66,10 @@ error[E0382]: use of moved value: `lhs` LL | fn mul<A: Mul<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs * rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL - | -LL | fn mul(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn mul<A: Mul<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -112,15 +97,10 @@ error[E0382]: use of moved value: `lhs` LL | fn div<A: Div<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs / rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL - | -LL | fn div(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn div<A: Div<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -148,15 +128,10 @@ error[E0382]: use of moved value: `lhs` LL | fn rem<A: Rem<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs % rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL - | -LL | fn rem(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn rem<A: Rem<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -184,15 +159,10 @@ error[E0382]: use of moved value: `lhs` LL | fn bitand<A: BitAnd<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs & rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/bit.rs:LL:COL - | -LL | fn bitand(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn bitand<A: BitAnd<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -220,15 +190,10 @@ error[E0382]: use of moved value: `lhs` LL | fn bitor<A: BitOr<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs | rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/bit.rs:LL:COL - | -LL | fn bitor(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn bitor<A: BitOr<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -256,15 +221,10 @@ error[E0382]: use of moved value: `lhs` LL | fn bitxor<A: BitXor<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs ^ rhs; - | --------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/bit.rs:LL:COL - | -LL | fn bitxor(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn bitxor<A: BitXor<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -292,15 +252,10 @@ error[E0382]: use of moved value: `lhs` LL | fn shl<A: Shl<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs << rhs; - | ---------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/bit.rs:LL:COL - | -LL | fn shl(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn shl<A: Shl<B, Output=()> + Copy, B>(lhs: A, rhs: B) { @@ -328,15 +283,10 @@ error[E0382]: use of moved value: `lhs` LL | fn shr<A: Shr<B, Output=()>, B>(lhs: A, rhs: B) { | --- move occurs because `lhs` has type `A`, which does not implement the `Copy` trait LL | lhs >> rhs; - | ---------- `lhs` moved due to usage in operator + | --- value moved here LL | drop(lhs); | ^^^ value used here after move | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/bit.rs:LL:COL - | -LL | fn shr(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn shr<A: Shr<B, Output=()> + Copy, B>(lhs: A, rhs: B) { diff --git a/src/test/ui/binop/binop-move-semantics.stderr b/src/test/ui/binop/binop-move-semantics.stderr index 97b70efe20e..6d5ac9cab30 100644 --- a/src/test/ui/binop/binop-move-semantics.stderr +++ b/src/test/ui/binop/binop-move-semantics.stderr @@ -1,21 +1,14 @@ error[E0382]: use of moved value: `x` --> $DIR/binop-move-semantics.rs:8:5 | -LL | fn double_move<T: Add<Output=()>>(x: T) { - | - move occurs because `x` has type `T`, which does not implement the `Copy` trait -LL | / x -LL | | + -LL | | x; - | | ^ - | | | - | |_____value used here after move - | `x` moved due to usage in operator - | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL +LL | fn double_move<T: Add<Output=()>>(x: T) { + | - move occurs because `x` has type `T`, which does not implement the `Copy` trait +LL | x + | - value moved here +LL | + +LL | x; + | ^ value used here after move | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn double_move<T: Add<Output=()> + Copy>(x: T) { diff --git a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr index bc1721944fb..a51cda548ef 100644 --- a/src/test/ui/borrowck/borrowck-unboxed-closures.stderr +++ b/src/test/ui/borrowck/borrowck-unboxed-closures.stderr @@ -22,15 +22,10 @@ error[E0382]: use of moved value: `f` LL | fn c<F:FnOnce(isize, isize) -> isize>(f: F) { | - move occurs because `f` has type `F`, which does not implement the `Copy` trait LL | f(1, 2); - | ------- `f` moved due to this call + | - value moved here LL | f(1, 2); | ^ value used here after move | -note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/borrowck-unboxed-closures.rs:11:5 - | -LL | f(1, 2); - | ^ help: consider further restricting this bound | LL | fn c<F:FnOnce(isize, isize) -> isize + Copy>(f: F) { diff --git a/src/test/ui/closure_context/issue-42065.stderr b/src/test/ui/closure_context/issue-42065.stderr index 896bb6dc6be..69d98654048 100644 --- a/src/test/ui/closure_context/issue-42065.stderr +++ b/src/test/ui/closure_context/issue-42065.stderr @@ -2,7 +2,7 @@ error[E0382]: use of moved value: `debug_dump_dict` --> $DIR/issue-42065.rs:11:5 | LL | debug_dump_dict(); - | ----------------- `debug_dump_dict` moved due to this call + | --------------- value moved here LL | debug_dump_dict(); | ^^^^^^^^^^^^^^^ value used here after move | @@ -11,11 +11,6 @@ note: closure cannot be invoked more than once because it moves the variable `di | LL | for (key, value) in dict { | ^^^^ -note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/issue-42065.rs:10:5 - | -LL | debug_dump_dict(); - | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/codemap_tests/tab_3.stderr b/src/test/ui/codemap_tests/tab_3.stderr index 614e69e89f6..97816a76004 100644 --- a/src/test/ui/codemap_tests/tab_3.stderr +++ b/src/test/ui/codemap_tests/tab_3.stderr @@ -4,16 +4,10 @@ error[E0382]: borrow of moved value: `some_vec` LL | let some_vec = vec!["hi"]; | -------- move occurs because `some_vec` has type `std::vec::Vec<&str>`, which does not implement the `Copy` trait LL | some_vec.into_iter(); - | ----------- `some_vec` moved due to this method call + | -------- value moved here LL | { LL | println!("{:?}", some_vec); | ^^^^^^^^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `some_vec` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.rs b/src/test/ui/consts/miri_unleashed/ptr_arith.rs index 064dc6c262c..65fc49c0b27 100644 --- a/src/test/ui/consts/miri_unleashed/ptr_arith.rs +++ b/src/test/ui/consts/miri_unleashed/ptr_arith.rs @@ -6,15 +6,14 @@ static CMP: () = { let x = &0 as *const _; - let _v = x == x; //~ NOTE in this + let _v = x == x; //~^ ERROR could not evaluate static initializer //~| NOTE pointer arithmetic or comparison - //~| NOTE in this }; static INT_PTR_ARITH: () = unsafe { let x: usize = std::mem::transmute(&0); - let _v = x + 0; //~ NOTE in this + let _v = x + 0; //~^ ERROR could not evaluate static initializer //~| NOTE pointer-to-integer cast }; diff --git a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr index 4b3fe995700..805ba9c6b03 100644 --- a/src/test/ui/consts/miri_unleashed/ptr_arith.stderr +++ b/src/test/ui/consts/miri_unleashed/ptr_arith.stderr @@ -5,7 +5,7 @@ LL | let _v = x == x; | ^^^^^^ "pointer arithmetic or comparison" needs an rfc before being allowed inside constants error[E0080]: could not evaluate static initializer - --> $DIR/ptr_arith.rs:17:14 + --> $DIR/ptr_arith.rs:16:14 | LL | let _v = x + 0; | ^^^^^ "pointer-to-integer cast" needs an rfc before being allowed inside constants @@ -18,7 +18,7 @@ help: skipping check for `const_compare_raw_pointers` feature LL | let _v = x == x; | ^^^^^^ help: skipping check that does not even have a feature gate - --> $DIR/ptr_arith.rs:16:20 + --> $DIR/ptr_arith.rs:15:20 | LL | let x: usize = std::mem::transmute(&0); | ^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/hygiene/unpretty-debug.stdout b/src/test/ui/hygiene/unpretty-debug.stdout index fc5ed724e3c..acd852103ca 100644 --- a/src/test/ui/hygiene/unpretty-debug.stdout +++ b/src/test/ui/hygiene/unpretty-debug.stdout @@ -18,12 +18,8 @@ fn y /* 0#0 */() { } Expansions: 0: parent: ExpnId(0), call_site_ctxt: #0, kind: Root 1: parent: ExpnId(0), call_site_ctxt: #0, kind: Macro(Bang, "foo") -2: parent: ExpnId(0), call_site_ctxt: #1, kind: Desugaring(Operator) -3: parent: ExpnId(0), call_site_ctxt: #1, kind: Desugaring(Operator) SyntaxContexts: #0: parent: #0, outer_mark: (ExpnId(0), Opaque) #1: parent: #0, outer_mark: (ExpnId(1), SemiTransparent) -#2: parent: #1, outer_mark: (ExpnId(2), Transparent) -#3: parent: #1, outer_mark: (ExpnId(3), Transparent) */ diff --git a/src/test/ui/issues/issue-12127.stderr b/src/test/ui/issues/issue-12127.stderr index b759aa45e3e..2283b1275d0 100644 --- a/src/test/ui/issues/issue-12127.stderr +++ b/src/test/ui/issues/issue-12127.stderr @@ -2,15 +2,10 @@ error[E0382]: use of moved value: `f` --> $DIR/issue-12127.rs:11:9 | LL | f(); - | --- `f` moved due to this call + | - value moved here LL | f(); | ^ value used here after move | -note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/issue-12127.rs:10:9 - | -LL | f(); - | ^ = note: move occurs because `f` has type `[closure@$DIR/issue-12127.rs:8:24: 8:41 x:std::boxed::Box<isize>]`, which does not implement the `Copy` trait error: aborting due to previous error diff --git a/src/test/ui/issues/issue-33941.rs b/src/test/ui/issues/issue-33941.rs index 4fb805b37e0..ccaa6334856 100644 --- a/src/test/ui/issues/issue-33941.rs +++ b/src/test/ui/issues/issue-33941.rs @@ -3,5 +3,4 @@ use std::collections::HashMap; fn main() { for _ in HashMap::new().iter().cloned() {} //~ ERROR type mismatch //~^ ERROR type mismatch - //~| ERROR type mismatch } diff --git a/src/test/ui/issues/issue-33941.stderr b/src/test/ui/issues/issue-33941.stderr index 20335d2cdd6..734ae78f362 100644 --- a/src/test/ui/issues/issue-33941.stderr +++ b/src/test/ui/issues/issue-33941.stderr @@ -17,16 +17,6 @@ LL | for _ in HashMap::new().iter().cloned() {} found reference `&_` = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::iter::Cloned<std::collections::hash_map::Iter<'_, _, _>>` -error[E0271]: type mismatch resolving `<std::collections::hash_map::Iter<'_, _, _> as std::iter::Iterator>::Item == &_` - --> $DIR/issue-33941.rs:4:14 - | -LL | for _ in HashMap::new().iter().cloned() {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected tuple, found reference - | - = note: expected tuple `(&_, &_)` - found reference `&_` - = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::iter::Cloned<std::collections::hash_map::Iter<'_, _, _>>` - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0271`. diff --git a/src/test/ui/issues/issue-34721.stderr b/src/test/ui/issues/issue-34721.stderr index b4cc1a0aa7e..6cfed20f43a 100644 --- a/src/test/ui/issues/issue-34721.stderr +++ b/src/test/ui/issues/issue-34721.stderr @@ -5,19 +5,14 @@ LL | pub fn baz<T: Foo>(x: T) -> T { | - move occurs because `x` has type `T`, which does not implement the `Copy` trait LL | if 0 == 1 { LL | bar::bar(x.zero()) - | ------ `x` moved due to this method call + | - value moved here LL | } else { LL | x.zero() - | ------ `x` moved due to this method call + | - value moved here LL | }; LL | x.zero() | ^ value used here after move | -note: this function consumes the receiver `self` by taking ownership of it, which moves `x` - --> $DIR/issue-34721.rs:4:13 - | -LL | fn zero(self) -> Self; - | ^^^^ help: consider further restricting this bound | LL | pub fn baz<T: Foo + Copy>(x: T) -> T { diff --git a/src/test/ui/issues/issue-61108.stderr b/src/test/ui/issues/issue-61108.stderr index ba43f2d33ee..8523a6f6548 100644 --- a/src/test/ui/issues/issue-61108.stderr +++ b/src/test/ui/issues/issue-61108.stderr @@ -6,17 +6,11 @@ LL | let mut bad_letters = vec!['e', 't', 'o', 'i']; LL | for l in bad_letters { | ----------- | | - | `bad_letters` moved due to this implicit call to `.into_iter()` + | value moved here | help: consider borrowing to avoid moving into the for loop: `&bad_letters` ... LL | bad_letters.push('s'); | ^^^^^^^^^^^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `bad_letters` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-64559.stderr b/src/test/ui/issues/issue-64559.stderr index 2c337bae130..3c685dc8d08 100644 --- a/src/test/ui/issues/issue-64559.stderr +++ b/src/test/ui/issues/issue-64559.stderr @@ -6,18 +6,12 @@ LL | let orig = vec![true]; LL | for _val in orig {} | ---- | | - | `orig` moved due to this implicit call to `.into_iter()` + | value moved here | help: consider borrowing to avoid moving into the for loop: `&orig` LL | let _closure = || orig; | ^^ ---- use occurs due to use in closure | | | value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `orig` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/moves/move-fn-self-receiver.rs b/src/test/ui/moves/move-fn-self-receiver.rs deleted file mode 100644 index 6107f53fa19..00000000000 --- a/src/test/ui/moves/move-fn-self-receiver.rs +++ /dev/null @@ -1,74 +0,0 @@ -use std::pin::Pin; -use std::rc::Rc; -use std::ops::Add; - -struct Foo; - -impl Add for Foo { - type Output = (); - fn add(self, _rhs: Self) -> () {} -} - -impl Foo { - fn use_self(self) {} - fn use_box_self(self: Box<Self>) {} - fn use_pin_box_self(self: Pin<Box<Self>>) {} - fn use_rc_self(self: Rc<Self>) {} - fn use_mut_self(&mut self) -> &mut Self { self } -} - -struct Container(Vec<bool>); - -impl Container { - fn custom_into_iter(self) -> impl Iterator<Item = bool> { - self.0.into_iter() - } -} - -fn move_out(val: Container) { - val.0.into_iter().next(); - val.0; //~ ERROR use of moved - - let foo = Foo; - foo.use_self(); - foo; //~ ERROR use of moved - - let second_foo = Foo; - second_foo.use_self(); - second_foo; //~ ERROR use of moved - - let boxed_foo = Box::new(Foo); - boxed_foo.use_box_self(); - boxed_foo; //~ ERROR use of moved - - let pin_box_foo = Box::pin(Foo); - pin_box_foo.use_pin_box_self(); - pin_box_foo; //~ ERROR use of moved - - let mut mut_foo = Foo; - let ret = mut_foo.use_mut_self(); - mut_foo; //~ ERROR cannot move out - ret; - - let rc_foo = Rc::new(Foo); - rc_foo.use_rc_self(); - rc_foo; //~ ERROR use of moved - - let foo_add = Foo; - foo_add + Foo; - foo_add; //~ ERROR use of moved - - let implicit_into_iter = vec![true]; - for _val in implicit_into_iter {} - implicit_into_iter; //~ ERROR use of moved - - let explicit_into_iter = vec![true]; - for _val in explicit_into_iter.into_iter() {} - explicit_into_iter; //~ ERROR use of moved - - let container = Container(vec![]); - for _val in container.custom_into_iter() {} - container; //~ ERROR use of moved -} - -fn main() {} diff --git a/src/test/ui/moves/move-fn-self-receiver.stderr b/src/test/ui/moves/move-fn-self-receiver.stderr deleted file mode 100644 index 4333e8a23e8..00000000000 --- a/src/test/ui/moves/move-fn-self-receiver.stderr +++ /dev/null @@ -1,158 +0,0 @@ -error[E0382]: use of moved value: `val.0` - --> $DIR/move-fn-self-receiver.rs:30:5 - | -LL | val.0.into_iter().next(); - | ----------- `val.0` moved due to this method call -LL | val.0; - | ^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `val.0` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ - = note: move occurs because `val.0` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait - -error[E0382]: use of moved value: `foo` - --> $DIR/move-fn-self-receiver.rs:34:5 - | -LL | let foo = Foo; - | --- move occurs because `foo` has type `Foo`, which does not implement the `Copy` trait -LL | foo.use_self(); - | ---------- `foo` moved due to this method call -LL | foo; - | ^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `foo` - --> $DIR/move-fn-self-receiver.rs:13:17 - | -LL | fn use_self(self) {} - | ^^^^ - -error[E0382]: use of moved value: `second_foo` - --> $DIR/move-fn-self-receiver.rs:38:5 - | -LL | let second_foo = Foo; - | ---------- move occurs because `second_foo` has type `Foo`, which does not implement the `Copy` trait -LL | second_foo.use_self(); - | ---------- `second_foo` moved due to this method call -LL | second_foo; - | ^^^^^^^^^^ value used here after move - -error[E0382]: use of moved value: `boxed_foo` - --> $DIR/move-fn-self-receiver.rs:42:5 - | -LL | let boxed_foo = Box::new(Foo); - | --------- move occurs because `boxed_foo` has type `std::boxed::Box<Foo>`, which does not implement the `Copy` trait -LL | boxed_foo.use_box_self(); - | -------------- `boxed_foo` moved due to this method call -LL | boxed_foo; - | ^^^^^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `boxed_foo` - --> $DIR/move-fn-self-receiver.rs:14:21 - | -LL | fn use_box_self(self: Box<Self>) {} - | ^^^^ - -error[E0382]: use of moved value: `pin_box_foo` - --> $DIR/move-fn-self-receiver.rs:46:5 - | -LL | let pin_box_foo = Box::pin(Foo); - | ----------- move occurs because `pin_box_foo` has type `std::pin::Pin<std::boxed::Box<Foo>>`, which does not implement the `Copy` trait -LL | pin_box_foo.use_pin_box_self(); - | ------------------ `pin_box_foo` moved due to this method call -LL | pin_box_foo; - | ^^^^^^^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `pin_box_foo` - --> $DIR/move-fn-self-receiver.rs:15:25 - | -LL | fn use_pin_box_self(self: Pin<Box<Self>>) {} - | ^^^^ - -error[E0505]: cannot move out of `mut_foo` because it is borrowed - --> $DIR/move-fn-self-receiver.rs:50:5 - | -LL | let ret = mut_foo.use_mut_self(); - | ------- borrow of `mut_foo` occurs here -LL | mut_foo; - | ^^^^^^^ move out of `mut_foo` occurs here -LL | ret; - | --- borrow later used here - -error[E0382]: use of moved value: `rc_foo` - --> $DIR/move-fn-self-receiver.rs:55:5 - | -LL | let rc_foo = Rc::new(Foo); - | ------ move occurs because `rc_foo` has type `std::rc::Rc<Foo>`, which does not implement the `Copy` trait -LL | rc_foo.use_rc_self(); - | ------------- `rc_foo` moved due to this method call -LL | rc_foo; - | ^^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `rc_foo` - --> $DIR/move-fn-self-receiver.rs:16:20 - | -LL | fn use_rc_self(self: Rc<Self>) {} - | ^^^^ - -error[E0382]: use of moved value: `foo_add` - --> $DIR/move-fn-self-receiver.rs:59:5 - | -LL | let foo_add = Foo; - | ------- move occurs because `foo_add` has type `Foo`, which does not implement the `Copy` trait -LL | foo_add + Foo; - | ------------- `foo_add` moved due to usage in operator -LL | foo_add; - | ^^^^^^^ value used here after move - | -note: calling this operator moves the left-hand side - --> $SRC_DIR/libcore/ops/arith.rs:LL:COL - | -LL | fn add(self, rhs: Rhs) -> Self::Output; - | ^^^^ - -error[E0382]: use of moved value: `implicit_into_iter` - --> $DIR/move-fn-self-receiver.rs:63:5 - | -LL | let implicit_into_iter = vec![true]; - | ------------------ move occurs because `implicit_into_iter` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait -LL | for _val in implicit_into_iter {} - | ------------------ - | | - | `implicit_into_iter` moved due to this implicit call to `.into_iter()` - | help: consider borrowing to avoid moving into the for loop: `&implicit_into_iter` -LL | implicit_into_iter; - | ^^^^^^^^^^^^^^^^^^ value used here after move - -error[E0382]: use of moved value: `explicit_into_iter` - --> $DIR/move-fn-self-receiver.rs:67:5 - | -LL | let explicit_into_iter = vec![true]; - | ------------------ move occurs because `explicit_into_iter` has type `std::vec::Vec<bool>`, which does not implement the `Copy` trait -LL | for _val in explicit_into_iter.into_iter() {} - | ----------- `explicit_into_iter` moved due to this method call -LL | explicit_into_iter; - | ^^^^^^^^^^^^^^^^^^ value used here after move - -error[E0382]: use of moved value: `container` - --> $DIR/move-fn-self-receiver.rs:71:5 - | -LL | let container = Container(vec![]); - | --------- move occurs because `container` has type `Container`, which does not implement the `Copy` trait -LL | for _val in container.custom_into_iter() {} - | ------------------ `container` moved due to this method call -LL | container; - | ^^^^^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `container` - --> $DIR/move-fn-self-receiver.rs:23:25 - | -LL | fn custom_into_iter(self) -> impl Iterator<Item = bool> { - | ^^^^ - -error: aborting due to 11 previous errors - -Some errors have detailed explanations: E0382, E0505. -For more information about an error, try `rustc --explain E0382`. diff --git a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr index 142feb280d1..71a3c4506ea 100644 --- a/src/test/ui/moves/moves-based-on-type-access-to-field.stderr +++ b/src/test/ui/moves/moves-based-on-type-access-to-field.stderr @@ -4,15 +4,9 @@ error[E0382]: borrow of moved value: `x` LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait LL | consume(x.into_iter().next().unwrap()); - | ----------- `x` moved due to this method call + | - value moved here LL | touch(&x[0]); | ^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `x` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/moves/moves-based-on-type-exprs.stderr b/src/test/ui/moves/moves-based-on-type-exprs.stderr index ff98aab50c9..67fae606c4e 100644 --- a/src/test/ui/moves/moves-based-on-type-exprs.stderr +++ b/src/test/ui/moves/moves-based-on-type-exprs.stderr @@ -104,15 +104,9 @@ error[E0382]: borrow of moved value: `x` LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait LL | let _y = x.into_iter().next().unwrap(); - | ----------- `x` moved due to this method call + | - value moved here LL | touch(&x); | ^^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `x` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error[E0382]: borrow of moved value: `x` --> $DIR/moves-based-on-type-exprs.rs:83:11 @@ -120,15 +114,9 @@ error[E0382]: borrow of moved value: `x` LL | let x = vec!["hi".to_string()]; | - move occurs because `x` has type `std::vec::Vec<std::string::String>`, which does not implement the `Copy` trait LL | let _y = [x.into_iter().next().unwrap(); 1]; - | ----------- `x` moved due to this method call + | - value moved here LL | touch(&x); | ^^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `x` - --> $SRC_DIR/libcore/iter/traits/collect.rs:LL:COL - | -LL | fn into_iter(self) -> Self::IntoIter; - | ^^^^ error: aborting due to 11 previous errors diff --git a/src/test/ui/once-cant-call-twice-on-heap.stderr b/src/test/ui/once-cant-call-twice-on-heap.stderr index 8761b5261d5..7133a32431a 100644 --- a/src/test/ui/once-cant-call-twice-on-heap.stderr +++ b/src/test/ui/once-cant-call-twice-on-heap.stderr @@ -4,15 +4,10 @@ error[E0382]: use of moved value: `blk` LL | fn foo<F:FnOnce()>(blk: F) { | --- move occurs because `blk` has type `F`, which does not implement the `Copy` trait LL | blk(); - | ----- `blk` moved due to this call + | --- value moved here LL | blk(); | ^^^ value used here after move | -note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/once-cant-call-twice-on-heap.rs:8:5 - | -LL | blk(); - | ^^^ help: consider further restricting this bound | LL | fn foo<F:FnOnce() + Copy>(blk: F) { diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr index ab6f0651846..0b9aa61a765 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-call-twice.stderr @@ -2,7 +2,7 @@ error[E0382]: use of moved value: `tick` --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:10:5 | LL | tick(); - | ------ `tick` moved due to this call + | ---- value moved here LL | tick(); | ^^^^ value used here after move | @@ -11,11 +11,6 @@ note: closure cannot be invoked more than once because it moves the variable `co | LL | let tick = || mem::drop(counter); | ^^^^^^^ -note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/unboxed-closures-infer-fnonce-call-twice.rs:9:5 - | -LL | tick(); - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr index 8d70a2b1760..20773d561f9 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-infer-fnonce-move-call-twice.stderr @@ -2,7 +2,7 @@ error[E0382]: use of moved value: `tick` --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:10:5 | LL | tick(); - | ------ `tick` moved due to this call + | ---- value moved here LL | tick(); | ^^^^ value used here after move | @@ -11,11 +11,6 @@ note: closure cannot be invoked more than once because it moves the variable `co | LL | let tick = move || mem::drop(counter); | ^^^^^^^ -note: this value implements `FnOnce`, which causes it to be moved when called - --> $DIR/unboxed-closures-infer-fnonce-move-call-twice.rs:9:5 - | -LL | tick(); - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/unop-move-semantics.stderr b/src/test/ui/unop-move-semantics.stderr index 7e9c8559a4b..e0499cfe95c 100644 --- a/src/test/ui/unop-move-semantics.stderr +++ b/src/test/ui/unop-move-semantics.stderr @@ -4,16 +4,11 @@ error[E0382]: borrow of moved value: `x` LL | fn move_then_borrow<T: Not<Output=T> + Clone>(x: T) { | - move occurs because `x` has type `T`, which does not implement the `Copy` trait LL | !x; - | -- `x` moved due to this method call + | - value moved here LL | LL | x.clone(); | ^ value borrowed here after move | -note: this function consumes the receiver `self` by taking ownership of it, which moves `x` - --> $SRC_DIR/libcore/ops/bit.rs:LL:COL - | -LL | fn not(self) -> Self::Output; - | ^^^^ help: consider further restricting this bound | LL | fn move_then_borrow<T: Not<Output=T> + Clone + Copy>(x: T) { diff --git a/src/test/ui/unsized-locals/borrow-after-move.stderr b/src/test/ui/unsized-locals/borrow-after-move.stderr index 906b543e421..110edab69be 100644 --- a/src/test/ui/unsized-locals/borrow-after-move.stderr +++ b/src/test/ui/unsized-locals/borrow-after-move.stderr @@ -37,16 +37,10 @@ error[E0382]: borrow of moved value: `y` LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); - | ----- `y` moved due to this method call + | - value moved here ... LL | println!("{}", &y); | ^^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `y` - --> $DIR/borrow-after-move.rs:4:12 - | -LL | fn foo(self) -> String; - | ^^^^ error[E0382]: borrow of moved value: `x` --> $DIR/borrow-after-move.rs:39:24 diff --git a/src/test/ui/unsized-locals/double-move.stderr b/src/test/ui/unsized-locals/double-move.stderr index 49b2031c6b9..5b936fb6447 100644 --- a/src/test/ui/unsized-locals/double-move.stderr +++ b/src/test/ui/unsized-locals/double-move.stderr @@ -34,15 +34,9 @@ error[E0382]: use of moved value: `y` LL | let y = *x; | - move occurs because `y` has type `str`, which does not implement the `Copy` trait LL | y.foo(); - | ----- `y` moved due to this method call + | - value moved here LL | y.foo(); | ^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `y` - --> $DIR/double-move.rs:4:12 - | -LL | fn foo(self) -> String; - | ^^^^ error[E0382]: use of moved value: `x` --> $DIR/double-move.rs:45:9 diff --git a/src/test/ui/use/use-after-move-self-based-on-type.stderr b/src/test/ui/use/use-after-move-self-based-on-type.stderr index b9440f4de07..9bf1175430c 100644 --- a/src/test/ui/use/use-after-move-self-based-on-type.stderr +++ b/src/test/ui/use/use-after-move-self-based-on-type.stderr @@ -4,15 +4,9 @@ error[E0382]: use of moved value: `self` LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); - | ----- `self` moved due to this method call + | ---- value moved here LL | return self.x; | ^^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `self` - --> $DIR/use-after-move-self-based-on-type.rs:15:16 - | -LL | pub fn bar(self) {} - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/use/use-after-move-self.stderr b/src/test/ui/use/use-after-move-self.stderr index 3da53b024db..3be0a65550b 100644 --- a/src/test/ui/use/use-after-move-self.stderr +++ b/src/test/ui/use/use-after-move-self.stderr @@ -4,15 +4,9 @@ error[E0382]: use of moved value: `self` LL | pub fn foo(self) -> isize { | ---- move occurs because `self` has type `S`, which does not implement the `Copy` trait LL | self.bar(); - | ----- `self` moved due to this method call + | ---- value moved here LL | return *self.x; | ^^^^^^^ value used here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `self` - --> $DIR/use-after-move-self.rs:13:16 - | -LL | pub fn bar(self) {} - | ^^^^ error: aborting due to previous error diff --git a/src/test/ui/walk-struct-literal-with.stderr b/src/test/ui/walk-struct-literal-with.stderr index ece63a2b819..eeb594a21f3 100644 --- a/src/test/ui/walk-struct-literal-with.stderr +++ b/src/test/ui/walk-struct-literal-with.stderr @@ -4,15 +4,9 @@ error[E0382]: borrow of moved value: `start` LL | let start = Mine{test:"Foo".to_string(), other_val:0}; | ----- move occurs because `start` has type `Mine`, which does not implement the `Copy` trait LL | let end = Mine{other_val:1, ..start.make_string_bar()}; - | ----------------- `start` moved due to this method call + | ----- value moved here LL | println!("{}", start.test); | ^^^^^^^^^^ value borrowed here after move - | -note: this function consumes the receiver `self` by taking ownership of it, which moves `start` - --> $DIR/walk-struct-literal-with.rs:7:28 - | -LL | fn make_string_bar(mut self) -> Mine{ - | ^^^^ error: aborting due to previous error |
