]> git.lizzy.rs Git - rust.git/blob - tests/ui/moves/moves-based-on-type-exprs.stderr
fn-trait-closure test now pass on new solver
[rust.git] / tests / ui / moves / moves-based-on-type-exprs.stderr
1 error[E0382]: borrow of moved value: `x`
2   --> $DIR/moves-based-on-type-exprs.rs:12:11
3    |
4 LL |     let x = "hi".to_string();
5    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
6 LL |     let _y = Foo { f:x };
7    |                      - value moved here
8 LL |     touch(&x);
9    |           ^^ value borrowed here after move
10    |
11 help: consider cloning the value if the performance cost is acceptable
12    |
13 LL |     let _y = Foo { f:x.clone() };
14    |                       ++++++++
15
16 error[E0382]: borrow of moved value: `x`
17   --> $DIR/moves-based-on-type-exprs.rs:18:11
18    |
19 LL |     let x = "hi".to_string();
20    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
21 LL |     let _y = (x, 3);
22    |               - value moved here
23 LL |     touch(&x);
24    |           ^^ value borrowed here after move
25    |
26 help: consider cloning the value if the performance cost is acceptable
27    |
28 LL |     let _y = (x.clone(), 3);
29    |                ++++++++
30
31 error[E0382]: borrow of moved value: `x`
32   --> $DIR/moves-based-on-type-exprs.rs:35:11
33    |
34 LL |     let x = "hi".to_string();
35    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
36 ...
37 LL |         x
38    |         - value moved here
39 ...
40 LL |     touch(&x);
41    |           ^^ value borrowed here after move
42    |
43 help: consider cloning the value if the performance cost is acceptable
44    |
45 LL |         x.clone()
46    |          ++++++++
47
48 error[E0382]: borrow of moved value: `y`
49   --> $DIR/moves-based-on-type-exprs.rs:36:11
50    |
51 LL |     let y = "ho".to_string();
52    |         - move occurs because `y` has type `String`, which does not implement the `Copy` trait
53 ...
54 LL |         y
55    |         - value moved here
56 ...
57 LL |     touch(&y);
58    |           ^^ value borrowed here after move
59    |
60 help: consider cloning the value if the performance cost is acceptable
61    |
62 LL |         y.clone()
63    |          ++++++++
64
65 error[E0382]: borrow of moved value: `x`
66   --> $DIR/moves-based-on-type-exprs.rs:46:11
67    |
68 LL |     let x = "hi".to_string();
69    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
70 ...
71 LL |         true => x,
72    |                 - value moved here
73 ...
74 LL |     touch(&x);
75    |           ^^ value borrowed here after move
76    |
77 help: consider cloning the value if the performance cost is acceptable
78    |
79 LL |         true => x.clone(),
80    |                  ++++++++
81
82 error[E0382]: borrow of moved value: `y`
83   --> $DIR/moves-based-on-type-exprs.rs:47:11
84    |
85 LL |     let y = "ho".to_string();
86    |         - move occurs because `y` has type `String`, which does not implement the `Copy` trait
87 ...
88 LL |         false => y
89    |                  - value moved here
90 ...
91 LL |     touch(&y);
92    |           ^^ value borrowed here after move
93    |
94 help: consider cloning the value if the performance cost is acceptable
95    |
96 LL |         false => y.clone()
97    |                   ++++++++
98
99 error[E0382]: borrow of moved value: `x`
100   --> $DIR/moves-based-on-type-exprs.rs:58:11
101    |
102 LL |     let x = "hi".to_string();
103    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
104 ...
105 LL |         _ if guard(x) => 10,
106    |                    - value moved here
107 ...
108 LL |     touch(&x);
109    |           ^^ value borrowed here after move
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    |                     ++++++++
122
123 error[E0382]: borrow of moved value: `x`
124   --> $DIR/moves-based-on-type-exprs.rs:65:11
125    |
126 LL |     let x = "hi".to_string();
127    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
128 LL |     let _y = [x];
129    |               - value moved here
130 LL |     touch(&x);
131    |           ^^ value borrowed here after move
132    |
133 help: consider cloning the value if the performance cost is acceptable
134    |
135 LL |     let _y = [x.clone()];
136    |                ++++++++
137
138 error[E0382]: borrow of moved value: `x`
139   --> $DIR/moves-based-on-type-exprs.rs:71:11
140    |
141 LL |     let x = "hi".to_string();
142    |         - move occurs because `x` has type `String`, which does not implement the `Copy` trait
143 LL |     let _y = vec![x];
144    |                   - value moved here
145 LL |     touch(&x);
146    |           ^^ value borrowed here after move
147    |
148 help: consider cloning the value if the performance cost is acceptable
149    |
150 LL |     let _y = vec![x.clone()];
151    |                    ++++++++
152
153 error[E0382]: borrow of moved value: `x`
154   --> $DIR/moves-based-on-type-exprs.rs:77:11
155    |
156 LL |     let x = vec!["hi".to_string()];
157    |         - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait
158 LL |     let _y = x.into_iter().next().unwrap();
159    |                ----------- `x` moved due to this method call
160 LL |     touch(&x);
161    |           ^^ value borrowed here after move
162    |
163 note: `into_iter` takes ownership of the receiver `self`, which moves `x`
164   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
165 help: you can `clone` the value and consume it, but this might not be your desired behavior
166    |
167 LL |     let _y = x.clone().into_iter().next().unwrap();
168    |                ++++++++
169
170 error[E0382]: borrow of moved value: `x`
171   --> $DIR/moves-based-on-type-exprs.rs:83:11
172    |
173 LL |     let x = vec!["hi".to_string()];
174    |         - move occurs because `x` has type `Vec<String>`, which does not implement the `Copy` trait
175 LL |     let _y = [x.into_iter().next().unwrap(); 1];
176    |                 ----------- `x` moved due to this method call
177 LL |     touch(&x);
178    |           ^^ value borrowed here after move
179    |
180 note: `into_iter` takes ownership of the receiver `self`, which moves `x`
181   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
182 help: you can `clone` the value and consume it, but this might not be your desired behavior
183    |
184 LL |     let _y = [x.clone().into_iter().next().unwrap(); 1];
185    |                 ++++++++
186
187 error: aborting due to 11 previous errors
188
189 For more information about this error, try `rustc --explain E0382`.