Revert "Rollup merge of #72389 - Aaron1011:feature/move-fn-self-msg, r=nikomatsakis"

This reverts commit 372cb9b69c, reversing
changes made to 5c61a8dc34.
This commit is contained in:
Aaron Hill 2020-06-21 16:28:19 -04:00
parent 62878c20e9
commit ad9972a20d
No known key found for this signature in database
GPG key ID: B4087E510E98B164
45 changed files with 103 additions and 729 deletions

View file

@ -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) {

View file

@ -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
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
|
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 double_move<T: Add<Output=()> + Copy>(x: T) {

View file

@ -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) {

View file

@ -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

View file

@ -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

View file

@ -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
};

View file

@ -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);
| ^^^^^^^^^^^^^^^^^^^^^^^

View file

@ -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)
*/

View file

@ -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

View file

@ -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
}

View file

@ -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`.

View file

@ -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 {

View file

@ -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

View file

@ -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

View file

@ -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() {}

View file

@ -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`.

View file

@ -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

View file

@ -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

View file

@ -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) {

View file

@ -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

View file

@ -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

View file

@ -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) {

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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