]>
Commit | Line | Data |
---|---|---|
48663c56 XL |
1 | error[E0382]: borrow of moved value: `x` |
2 | --> $DIR/moves-based-on-type-exprs.rs:12:11 | |
b7449926 | 3 | | |
48663c56 | 4 | LL | let x = "hi".to_string(); |
1b1a35ee | 5 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
b7449926 XL |
6 | LL | let _y = Foo { f:x }; |
7 | | - value moved here | |
532ac7d7 | 8 | LL | touch(&x); |
48663c56 | 9 | | ^^ value borrowed here after move |
487cf647 FG |
10 | | |
11 | help: consider cloning the value if the performance cost is acceptable | |
12 | | | |
13 | LL | let _y = Foo { f:x.clone() }; | |
14 | | ++++++++ | |
b7449926 | 15 | |
48663c56 XL |
16 | error[E0382]: borrow of moved value: `x` |
17 | --> $DIR/moves-based-on-type-exprs.rs:18:11 | |
b7449926 | 18 | | |
48663c56 | 19 | LL | let x = "hi".to_string(); |
1b1a35ee | 20 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
b7449926 XL |
21 | LL | let _y = (x, 3); |
22 | | - value moved here | |
532ac7d7 | 23 | LL | touch(&x); |
48663c56 | 24 | | ^^ value borrowed here after move |
487cf647 FG |
25 | | |
26 | help: consider cloning the value if the performance cost is acceptable | |
27 | | | |
28 | LL | let _y = (x.clone(), 3); | |
29 | | ++++++++ | |
b7449926 | 30 | |
48663c56 XL |
31 | error[E0382]: borrow of moved value: `x` |
32 | --> $DIR/moves-based-on-type-exprs.rs:35:11 | |
b7449926 | 33 | | |
48663c56 | 34 | LL | let x = "hi".to_string(); |
1b1a35ee | 35 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
48663c56 | 36 | ... |
b7449926 XL |
37 | LL | x |
38 | | - value moved here | |
39 | ... | |
532ac7d7 | 40 | LL | touch(&x); |
48663c56 | 41 | | ^^ value borrowed here after move |
487cf647 FG |
42 | | |
43 | help: consider cloning the value if the performance cost is acceptable | |
44 | | | |
45 | LL | x.clone() | |
46 | | ++++++++ | |
b7449926 | 47 | |
48663c56 XL |
48 | error[E0382]: borrow of moved value: `y` |
49 | --> $DIR/moves-based-on-type-exprs.rs:36:11 | |
b7449926 | 50 | | |
48663c56 | 51 | LL | let y = "ho".to_string(); |
1b1a35ee | 52 | | - move occurs because `y` has type `String`, which does not implement the `Copy` trait |
48663c56 | 53 | ... |
b7449926 XL |
54 | LL | y |
55 | | - value moved here | |
56 | ... | |
532ac7d7 | 57 | LL | touch(&y); |
48663c56 | 58 | | ^^ value borrowed here after move |
487cf647 FG |
59 | | |
60 | help: consider cloning the value if the performance cost is acceptable | |
61 | | | |
62 | LL | y.clone() | |
63 | | ++++++++ | |
b7449926 | 64 | |
48663c56 XL |
65 | error[E0382]: borrow of moved value: `x` |
66 | --> $DIR/moves-based-on-type-exprs.rs:46:11 | |
b7449926 | 67 | | |
48663c56 | 68 | LL | let x = "hi".to_string(); |
1b1a35ee | 69 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
48663c56 | 70 | ... |
b7449926 XL |
71 | LL | true => x, |
72 | | - value moved here | |
73 | ... | |
532ac7d7 | 74 | LL | touch(&x); |
48663c56 | 75 | | ^^ value borrowed here after move |
487cf647 FG |
76 | | |
77 | help: consider cloning the value if the performance cost is acceptable | |
78 | | | |
79 | LL | true => x.clone(), | |
80 | | ++++++++ | |
b7449926 | 81 | |
48663c56 XL |
82 | error[E0382]: borrow of moved value: `y` |
83 | --> $DIR/moves-based-on-type-exprs.rs:47:11 | |
b7449926 | 84 | | |
48663c56 | 85 | LL | let y = "ho".to_string(); |
1b1a35ee | 86 | | - move occurs because `y` has type `String`, which does not implement the `Copy` trait |
48663c56 | 87 | ... |
b7449926 XL |
88 | LL | false => y |
89 | | - value moved here | |
90 | ... | |
532ac7d7 | 91 | LL | touch(&y); |
48663c56 | 92 | | ^^ value borrowed here after move |
487cf647 FG |
93 | | |
94 | help: consider cloning the value if the performance cost is acceptable | |
95 | | | |
96 | LL | false => y.clone() | |
97 | | ++++++++ | |
b7449926 | 98 | |
48663c56 XL |
99 | error[E0382]: borrow of moved value: `x` |
100 | --> $DIR/moves-based-on-type-exprs.rs:58:11 | |
b7449926 | 101 | | |
48663c56 | 102 | LL | let x = "hi".to_string(); |
1b1a35ee | 103 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
48663c56 | 104 | ... |
b7449926 XL |
105 | LL | _ if guard(x) => 10, |
106 | | - value moved here | |
107 | ... | |
532ac7d7 | 108 | LL | touch(&x); |
48663c56 | 109 | | ^^ value borrowed here after move |
487cf647 FG |
110 | | |
111 | note: consider changing this parameter type in function `guard` to borrow instead if owning the value isn't necessary | |
112 | --> $DIR/moves-based-on-type-exprs.rs:6:14 | |
113 | | | |
114 | LL | fn guard(_s: String) -> bool {panic!()} | |
115 | | ----- ^^^^^^ this parameter takes ownership of the value | |
116 | | | | |
117 | | in this function | |
118 | help: consider cloning the value if the performance cost is acceptable | |
119 | | | |
120 | LL | _ if guard(x.clone()) => 10, | |
121 | | ++++++++ | |
b7449926 | 122 | |
48663c56 XL |
123 | error[E0382]: borrow of moved value: `x` |
124 | --> $DIR/moves-based-on-type-exprs.rs:65:11 | |
b7449926 | 125 | | |
48663c56 | 126 | LL | let x = "hi".to_string(); |
1b1a35ee | 127 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
b7449926 XL |
128 | LL | let _y = [x]; |
129 | | - value moved here | |
532ac7d7 | 130 | LL | touch(&x); |
48663c56 | 131 | | ^^ value borrowed here after move |
487cf647 FG |
132 | | |
133 | help: consider cloning the value if the performance cost is acceptable | |
134 | | | |
135 | LL | let _y = [x.clone()]; | |
136 | | ++++++++ | |
b7449926 | 137 | |
48663c56 XL |
138 | error[E0382]: borrow of moved value: `x` |
139 | --> $DIR/moves-based-on-type-exprs.rs:71:11 | |
b7449926 | 140 | | |
48663c56 | 141 | LL | let x = "hi".to_string(); |
1b1a35ee | 142 | | - move occurs because `x` has type `String`, which does not implement the `Copy` trait |
b7449926 XL |
143 | LL | let _y = vec![x]; |
144 | | - value moved here | |
532ac7d7 | 145 | LL | touch(&x); |
48663c56 | 146 | | ^^ value borrowed here after move |
487cf647 FG |
147 | | |
148 | help: consider cloning the value if the performance cost is acceptable | |
149 | | | |
150 | LL | let _y = vec![x.clone()]; | |
151 | | ++++++++ | |
b7449926 | 152 | |
48663c56 XL |
153 | error[E0382]: borrow of moved value: `x` |
154 | --> $DIR/moves-based-on-type-exprs.rs:77:11 | |
b7449926 | 155 | | |
48663c56 | 156 | LL | let x = vec!["hi".to_string()]; |
1b1a35ee | 157 | | - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait |
b7449926 | 158 | LL | let _y = x.into_iter().next().unwrap(); |
f035d41b | 159 | | ----------- `x` moved due to this method call |
532ac7d7 | 160 | LL | touch(&x); |
48663c56 | 161 | | ^^ value borrowed here after move |
f035d41b | 162 | | |
5869c6ff | 163 | note: this function takes ownership of the receiver `self`, which moves `x` |
3dfed10e | 164 | --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL |
f035d41b XL |
165 | | |
166 | LL | fn into_iter(self) -> Self::IntoIter; | |
167 | | ^^^^ | |
487cf647 FG |
168 | help: consider cloning the value if the performance cost is acceptable |
169 | | | |
170 | LL | let _y = x.clone().into_iter().next().unwrap(); | |
171 | | ++++++++ | |
b7449926 | 172 | |
48663c56 XL |
173 | error[E0382]: borrow of moved value: `x` |
174 | --> $DIR/moves-based-on-type-exprs.rs:83:11 | |
b7449926 | 175 | | |
48663c56 | 176 | LL | let x = vec!["hi".to_string()]; |
1b1a35ee | 177 | | - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait |
b7449926 | 178 | LL | let _y = [x.into_iter().next().unwrap(); 1]; |
f035d41b | 179 | | ----------- `x` moved due to this method call |
532ac7d7 | 180 | LL | touch(&x); |
48663c56 | 181 | | ^^ value borrowed here after move |
f035d41b | 182 | | |
5869c6ff | 183 | note: this function takes ownership of the receiver `self`, which moves `x` |
3dfed10e | 184 | --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL |
f035d41b XL |
185 | | |
186 | LL | fn into_iter(self) -> Self::IntoIter; | |
187 | | ^^^^ | |
487cf647 FG |
188 | help: consider cloning the value if the performance cost is acceptable |
189 | | | |
190 | LL | let _y = [x.clone().into_iter().next().unwrap(); 1]; | |
191 | | ++++++++ | |
b7449926 XL |
192 | |
193 | error: aborting due to 11 previous errors | |
194 | ||
195 | For more information about this error, try `rustc --explain E0382`. |