fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
7.2 KiB179 linesraw
1error[E0382]: use of moved value: `val.0`
2  --> $DIR/move-fn-self-receiver.rs:30:5
3   |
4LL |     val.0.into_iter().next();
5   |           ----------- `val.0` moved due to this method call
6LL |     val.0;
7   |     ^^^^^ value used here after move
8   |
9note: `into_iter` takes ownership of the receiver `self`, which moves `val.0`
10  --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
11   = note: move occurs because `val.0` has type `Vec<bool>`, which does not implement the `Copy` trait
12help: you can `clone` the value and consume it, but this might not be your desired behavior
13   |
14LL |     val.0.clone().into_iter().next();
15   |          ++++++++
16
17error[E0382]: use of moved value: `foo`
18  --> $DIR/move-fn-self-receiver.rs:34:5
19   |
20LL |     let foo = Foo;
21   |         --- move occurs because `foo` has type `Foo`, which does not implement the `Copy` trait
22LL |     foo.use_self();
23   |         ---------- `foo` moved due to this method call
24LL |     foo;
25   |     ^^^ value used here after move
26   |
27note: `Foo::use_self` takes ownership of the receiver `self`, which moves `foo`
28  --> $DIR/move-fn-self-receiver.rs:13:17
29   |
30LL |     fn use_self(self) {}
31   |                 ^^^^
32
33error[E0382]: use of moved value: `second_foo`
34  --> $DIR/move-fn-self-receiver.rs:38:5
35   |
36LL |     let second_foo = Foo;
37   |         ---------- move occurs because `second_foo` has type `Foo`, which does not implement the `Copy` trait
38LL |     second_foo.use_self();
39   |                ---------- `second_foo` moved due to this method call
40LL |     second_foo;
41   |     ^^^^^^^^^^ value used here after move
42
43error[E0382]: use of moved value: `boxed_foo`
44  --> $DIR/move-fn-self-receiver.rs:42:5
45   |
46LL |     let boxed_foo = Box::new(Foo);
47   |         --------- move occurs because `boxed_foo` has type `Box<Foo>`, which does not implement the `Copy` trait
48LL |     boxed_foo.use_box_self();
49   |               -------------- `boxed_foo` moved due to this method call
50LL |     boxed_foo;
51   |     ^^^^^^^^^ value used here after move
52   |
53note: `Foo::use_box_self` takes ownership of the receiver `self`, which moves `boxed_foo`
54  --> $DIR/move-fn-self-receiver.rs:14:21
55   |
56LL |     fn use_box_self(self: Box<Self>) {}
57   |                     ^^^^
58
59error[E0382]: use of moved value: `pin_box_foo`
60  --> $DIR/move-fn-self-receiver.rs:46:5
61   |
62LL |     let pin_box_foo = Box::pin(Foo);
63   |         ----------- move occurs because `pin_box_foo` has type `Pin<Box<Foo>>`, which does not implement the `Copy` trait
64LL |     pin_box_foo.use_pin_box_self();
65   |                 ------------------ `pin_box_foo` moved due to this method call
66LL |     pin_box_foo;
67   |     ^^^^^^^^^^^ value used here after move
68   |
69note: `Foo::use_pin_box_self` takes ownership of the receiver `self`, which moves `pin_box_foo`
70  --> $DIR/move-fn-self-receiver.rs:15:25
71   |
72LL |     fn use_pin_box_self(self: Pin<Box<Self>>) {}
73   |                         ^^^^
74
75error[E0505]: cannot move out of `mut_foo` because it is borrowed
76  --> $DIR/move-fn-self-receiver.rs:50:5
77   |
78LL |     let mut mut_foo = Foo;
79   |         ----------- binding `mut_foo` declared here
80LL |     let ret = mut_foo.use_mut_self();
81   |               ------- borrow of `mut_foo` occurs here
82LL |     mut_foo;
83   |     ^^^^^^^ move out of `mut_foo` occurs here
84LL |     ret;
85   |     --- borrow later used here
86
87error[E0382]: use of moved value: `rc_foo`
88  --> $DIR/move-fn-self-receiver.rs:55:5
89   |
90LL |     let rc_foo = Rc::new(Foo);
91   |         ------ move occurs because `rc_foo` has type `Rc<Foo>`, which does not implement the `Copy` trait
92LL |     rc_foo.use_rc_self();
93   |            ------------- `rc_foo` moved due to this method call
94LL |     rc_foo;
95   |     ^^^^^^ value used here after move
96   |
97note: `Foo::use_rc_self` takes ownership of the receiver `self`, which moves `rc_foo`
98  --> $DIR/move-fn-self-receiver.rs:16:20
99   |
100LL |     fn use_rc_self(self: Rc<Self>) {}
101   |                    ^^^^
102help: you can `clone` the value and consume it, but this might not be your desired behavior
103   |
104LL |     rc_foo.clone().use_rc_self();
105   |           ++++++++
106
107error[E0382]: use of moved value: `foo_add`
108  --> $DIR/move-fn-self-receiver.rs:59:5
109   |
110LL |     let foo_add = Foo;
111   |         ------- move occurs because `foo_add` has type `Foo`, which does not implement the `Copy` trait
112LL |     foo_add + Foo;
113   |     ------------- `foo_add` moved due to usage in operator
114LL |     foo_add;
115   |     ^^^^^^^ value used here after move
116   |
117note: calling this operator moves the left-hand side
118  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
119
120error[E0382]: use of moved value: `implicit_into_iter`
121  --> $DIR/move-fn-self-receiver.rs:63:5
122   |
123LL |     let implicit_into_iter = vec![true];
124   |         ------------------ move occurs because `implicit_into_iter` has type `Vec<bool>`, which does not implement the `Copy` trait
125LL |     for _val in implicit_into_iter {}
126   |                 ------------------ `implicit_into_iter` moved due to this implicit call to `.into_iter()`
127LL |     implicit_into_iter;
128   |     ^^^^^^^^^^^^^^^^^^ value used here after move
129   |
130help: consider iterating over a slice of the `Vec<bool>`'s content to avoid moving into the `for` loop
131   |
132LL |     for _val in &implicit_into_iter {}
133   |                 +
134
135error[E0382]: use of moved value: `explicit_into_iter`
136  --> $DIR/move-fn-self-receiver.rs:67:5
137   |
138LL |     let explicit_into_iter = vec![true];
139   |         ------------------ move occurs because `explicit_into_iter` has type `Vec<bool>`, which does not implement the `Copy` trait
140LL |     for _val in explicit_into_iter.into_iter() {}
141   |                                    ----------- `explicit_into_iter` moved due to this method call
142LL |     explicit_into_iter;
143   |     ^^^^^^^^^^^^^^^^^^ value used here after move
144   |
145help: you can `clone` the value and consume it, but this might not be your desired behavior
146   |
147LL |     for _val in explicit_into_iter.clone().into_iter() {}
148   |                                   ++++++++
149
150error[E0382]: use of moved value: `container`
151  --> $DIR/move-fn-self-receiver.rs:71:5
152   |
153LL |     let container = Container(vec![]);
154   |         --------- move occurs because `container` has type `Container`, which does not implement the `Copy` trait
155LL |     for _val in container.custom_into_iter() {}
156   |                           ------------------ `container` moved due to this method call
157LL |     container;
158   |     ^^^^^^^^^ value used here after move
159   |
160note: `Container::custom_into_iter` takes ownership of the receiver `self`, which moves `container`
161  --> $DIR/move-fn-self-receiver.rs:23:25
162   |
163LL |     fn custom_into_iter(self) -> impl Iterator<Item = bool> {
164   |                         ^^^^
165
166error[E0382]: use of moved value: `foo2`
167  --> $DIR/move-fn-self-receiver.rs:75:9
168   |
169LL |     let foo2 = Foo;
170   |         ---- move occurs because `foo2` has type `Foo`, which does not implement the `Copy` trait
171LL |     loop {
172   |     ---- inside of this loop
173LL |         foo2.use_self();
174   |         ^^^^ ---------- `foo2` moved due to this method call, in previous iteration of loop
175
176error: aborting due to 12 previous errors
177
178Some errors have detailed explanations: E0382, E0505.
179For more information about an error, try `rustc --explain E0382`.