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