about summary refs log tree commit diff
path: root/tests/ui/nll/cannot-move-block-spans.stderr
blob: d96773e1edfded87016e3eef9bb3340c268065dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
error[E0507]: cannot move out of `*r` which is behind a shared reference
  --> $DIR/cannot-move-block-spans.rs:5:15
   |
LL |     let x = { *r };
   |               ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait
   |
help: consider removing the dereference here
   |
LL -     let x = { *r };
LL +     let x = { r };
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL -     let x = { *r };
LL +     let x = { r.clone() };
   |

error[E0507]: cannot move out of `*r` which is behind a shared reference
  --> $DIR/cannot-move-block-spans.rs:6:22
   |
LL |     let y = unsafe { *r };
   |                      ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait
   |
help: consider removing the dereference here
   |
LL -     let y = unsafe { *r };
LL +     let y = unsafe { r };
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL -     let y = unsafe { *r };
LL +     let y = unsafe { r.clone() };
   |

error[E0507]: cannot move out of `*r` which is behind a shared reference
  --> $DIR/cannot-move-block-spans.rs:7:26
   |
LL |     let z = loop { break *r; };
   |                          ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait
   |
help: consider removing the dereference here
   |
LL -     let z = loop { break *r; };
LL +     let z = loop { break r; };
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL -     let z = loop { break *r; };
LL +     let z = loop { break r.clone(); };
   |

error[E0508]: cannot move out of type `[String; 2]`, a non-copy array
  --> $DIR/cannot-move-block-spans.rs:11:15
   |
LL |     let x = { arr[0] };
   |               ^^^^^^
   |               |
   |               cannot move out of here
   |               move occurs because `arr[_]` has type `String`, which does not implement the `Copy` trait
   |
help: consider borrowing here
   |
LL |     let x = { &arr[0] };
   |               +
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let x = { arr[0].clone() };
   |                     ++++++++

error[E0508]: cannot move out of type `[String; 2]`, a non-copy array
  --> $DIR/cannot-move-block-spans.rs:12:22
   |
LL |     let y = unsafe { arr[0] };
   |                      ^^^^^^
   |                      |
   |                      cannot move out of here
   |                      move occurs because `arr[_]` has type `String`, which does not implement the `Copy` trait
   |
help: consider borrowing here
   |
LL |     let y = unsafe { &arr[0] };
   |                      +
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let y = unsafe { arr[0].clone() };
   |                            ++++++++

error[E0508]: cannot move out of type `[String; 2]`, a non-copy array
  --> $DIR/cannot-move-block-spans.rs:13:26
   |
LL |     let z = loop { break arr[0]; };
   |                          ^^^^^^
   |                          |
   |                          cannot move out of here
   |                          move occurs because `arr[_]` has type `String`, which does not implement the `Copy` trait
   |
help: consider borrowing here
   |
LL |     let z = loop { break &arr[0]; };
   |                          +
help: consider cloning the value if the performance cost is acceptable
   |
LL |     let z = loop { break arr[0].clone(); };
   |                                ++++++++

error[E0507]: cannot move out of `*r` which is behind a shared reference
  --> $DIR/cannot-move-block-spans.rs:17:38
   |
LL |     let x = { let mut u = 0; u += 1; *r };
   |                                      ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait
   |
help: consider removing the dereference here
   |
LL -     let x = { let mut u = 0; u += 1; *r };
LL +     let x = { let mut u = 0; u += 1; r };
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL -     let x = { let mut u = 0; u += 1; *r };
LL +     let x = { let mut u = 0; u += 1; r.clone() };
   |

error[E0507]: cannot move out of `*r` which is behind a shared reference
  --> $DIR/cannot-move-block-spans.rs:18:45
   |
LL |     let y = unsafe { let mut u = 0; u += 1; *r };
   |                                             ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait
   |
help: consider removing the dereference here
   |
LL -     let y = unsafe { let mut u = 0; u += 1; *r };
LL +     let y = unsafe { let mut u = 0; u += 1; r };
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL -     let y = unsafe { let mut u = 0; u += 1; *r };
LL +     let y = unsafe { let mut u = 0; u += 1; r.clone() };
   |

error[E0507]: cannot move out of `*r` which is behind a shared reference
  --> $DIR/cannot-move-block-spans.rs:19:49
   |
LL |     let z = loop { let mut u = 0; u += 1; break *r; u += 2; };
   |                                                 ^^ move occurs because `*r` has type `String`, which does not implement the `Copy` trait
   |
help: consider removing the dereference here
   |
LL -     let z = loop { let mut u = 0; u += 1; break *r; u += 2; };
LL +     let z = loop { let mut u = 0; u += 1; break r; u += 2; };
   |
help: consider cloning the value if the performance cost is acceptable
   |
LL -     let z = loop { let mut u = 0; u += 1; break *r; u += 2; };
LL +     let z = loop { let mut u = 0; u += 1; break r.clone(); u += 2; };
   |

error: aborting due to 9 previous errors

Some errors have detailed explanations: E0507, E0508.
For more information about an error, try `rustc --explain E0507`.