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