fork/rust
git clone https://git.julia.blue/fork/rust
b8cedc00407
1.42.0
1error: cannot borrow `z` as immutable because it is also borrowed as mutable 2 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:9 3 | 4LL | ref mut z @ &mut Some(ref a) => { 5 | ---------^^^^^^^^^^^^^-----^ 6 | | | 7 | | immutable borrow occurs here 8 | mutable borrow occurs here 9 10error: cannot borrow `a` as mutable more than once at a time 11 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:9 12 | 13LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub 14 | ---------^^^^-----------------^ 15 | | | | 16 | | | another mutable borrow occurs here 17 | | also borrowed as immutable here 18 | first mutable borrow occurs here 19 20error: cannot borrow `b` as mutable because it is also borrowed as immutable 21 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:31:22 22 | 23LL | let ref mut a @ (ref b @ ref mut c) = u(); // sub-in-sub 24 | -----^^^--------- 25 | | | 26 | | mutable borrow occurs here 27 | immutable borrow occurs here 28 29error: cannot borrow `a` as mutable because it is also borrowed as immutable 30 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:35:9 31 | 32LL | let ref a @ ref mut b = U; 33 | -----^^^--------- 34 | | | 35 | | mutable borrow occurs here 36 | immutable borrow occurs here 37 38error: cannot borrow `a` as immutable because it is also borrowed as mutable 39 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:37:9 40 | 41LL | let ref mut a @ ref b = U; 42 | ---------^^^----- 43 | | | 44 | | immutable borrow occurs here 45 | mutable borrow occurs here 46 47error: cannot borrow `a` as mutable because it is also borrowed as immutable 48 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:39:9 49 | 50LL | let ref a @ (ref mut b, ref mut c) = (U, U); 51 | -----^^^^---------^^---------^ 52 | | | | 53 | | | mutable borrow occurs here 54 | | mutable borrow occurs here 55 | immutable borrow occurs here 56 57error: cannot borrow `a` as immutable because it is also borrowed as mutable 58 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:41:9 59 | 60LL | let ref mut a @ (ref b, ref c) = (U, U); 61 | ---------^^^^-----^^-----^ 62 | | | | 63 | | | immutable borrow occurs here 64 | | immutable borrow occurs here 65 | mutable borrow occurs here 66 67error: cannot borrow `a` as immutable because it is also borrowed as mutable 68 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:9 69 | 70LL | let ref mut a @ ref b = u(); 71 | ---------^^^----- 72 | | | 73 | | immutable borrow occurs here 74 | mutable borrow occurs here 75 76error: cannot borrow `a` as mutable because it is also borrowed as immutable 77 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:9 78 | 79LL | let ref a @ ref mut b = u(); 80 | -----^^^--------- 81 | | | 82 | | mutable borrow occurs here 83 | immutable borrow occurs here 84 85error: cannot borrow `a` as immutable because it is also borrowed as mutable 86 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:55:9 87 | 88LL | let ref mut a @ ref b = U; 89 | ---------^^^----- 90 | | | 91 | | immutable borrow occurs here 92 | mutable borrow occurs here 93 94error: cannot borrow `a` as mutable because it is also borrowed as immutable 95 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:59:9 96 | 97LL | let ref a @ ref mut b = U; 98 | -----^^^--------- 99 | | | 100 | | mutable borrow occurs here 101 | immutable borrow occurs here 102 103error: cannot borrow `a` as immutable because it is also borrowed as mutable 104 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:65:9 105 | 106LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { 107 | ---------^^^^^^-----^ 108 | | | 109 | | immutable borrow occurs here 110 | mutable borrow occurs here 111 112error: cannot borrow `a` as immutable because it is also borrowed as mutable 113 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:65:33 114 | 115LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) => { 116 | ---------^^^^^^^-----^ 117 | | | 118 | | immutable borrow occurs here 119 | mutable borrow occurs here 120 121error: cannot borrow `a` as mutable because it is also borrowed as immutable 122 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:9 123 | 124LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { 125 | -----^^^^^^---------^ 126 | | | 127 | | mutable borrow occurs here 128 | immutable borrow occurs here 129 130error: cannot borrow `a` as mutable because it is also borrowed as immutable 131 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:33 132 | 133LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { 134 | -----^^^^^^^---------^ 135 | | | 136 | | mutable borrow occurs here 137 | immutable borrow occurs here 138 139error: cannot borrow `a` as mutable because it is also borrowed as immutable 140 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:9 141 | 142LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} 143 | -----^^^^^^---------^ 144 | | | 145 | | mutable borrow occurs here 146 | immutable borrow occurs here 147 148error: cannot borrow `a` as mutable because it is also borrowed as immutable 149 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:33 150 | 151LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} 152 | -----^^^^^^^---------^ 153 | | | 154 | | mutable borrow occurs here 155 | immutable borrow occurs here 156 157error: cannot borrow `a` as immutable because it is also borrowed as mutable 158 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:9 159 | 160LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} 161 | ---------^^^^^^-----^ 162 | | | 163 | | immutable borrow occurs here 164 | mutable borrow occurs here 165 166error: cannot borrow `a` as immutable because it is also borrowed as mutable 167 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:33 168 | 169LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} 170 | ---------^^^^^^^-----^ 171 | | | 172 | | immutable borrow occurs here 173 | mutable borrow occurs here 174 175error: cannot borrow `a` as mutable because it is also borrowed as immutable 176 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:9 177 | 178LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} 179 | -----^^^^^^---------^ 180 | | | 181 | | mutable borrow occurs here 182 | immutable borrow occurs here 183 184error: cannot borrow `a` as mutable because it is also borrowed as immutable 185 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:33 186 | 187LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} 188 | -----^^^^^^^---------^ 189 | | | 190 | | mutable borrow occurs here 191 | immutable borrow occurs here 192 193error: cannot borrow `a` as immutable because it is also borrowed as mutable 194 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:9 195 | 196LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} 197 | ---------^^^^^^-----^ 198 | | | 199 | | immutable borrow occurs here 200 | mutable borrow occurs here 201 202error: cannot borrow `a` as immutable because it is also borrowed as mutable 203 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:33 204 | 205LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} 206 | ---------^^^^^^^-----^ 207 | | | 208 | | immutable borrow occurs here 209 | mutable borrow occurs here 210 211error: cannot borrow `a` as mutable because it is also borrowed as immutable 212 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:115:9 213 | 214LL | let ref a @ (ref mut b, ref mut c) = (U, U); 215 | -----^^^^---------^^---------^ 216 | | | | 217 | | | mutable borrow occurs here 218 | | mutable borrow occurs here 219 | immutable borrow occurs here 220 221error: cannot borrow `a` as mutable because it is also borrowed as immutable 222 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:9 223 | 224LL | let ref a @ (ref mut b, ref mut c) = (U, U); 225 | -----^^^^---------^^---------^ 226 | | | | 227 | | | mutable borrow occurs here 228 | | mutable borrow occurs here 229 | immutable borrow occurs here 230 231error: cannot borrow `a` as mutable because it is also borrowed as immutable 232 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:9 233 | 234LL | let ref a @ (ref mut b, ref mut c) = (U, U); 235 | -----^^^^---------^^---------^ 236 | | | | 237 | | | mutable borrow occurs here 238 | | mutable borrow occurs here 239 | immutable borrow occurs here 240 241error: cannot borrow `a` as immutable because it is also borrowed as mutable 242 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:132:9 243 | 244LL | let ref mut a @ (ref b, ref c) = (U, U); 245 | ---------^^^^-----^^-----^ 246 | | | | 247 | | | immutable borrow occurs here 248 | | immutable borrow occurs here 249 | mutable borrow occurs here 250 251error: cannot borrow `a` as mutable because it is also borrowed as immutable 252 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:24:11 253 | 254LL | fn f1(ref a @ ref mut b: U) {} 255 | -----^^^--------- 256 | | | 257 | | mutable borrow occurs here 258 | immutable borrow occurs here 259 260error: cannot borrow `a` as immutable because it is also borrowed as mutable 261 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:26:11 262 | 263LL | fn f2(ref mut a @ ref b: U) {} 264 | ---------^^^----- 265 | | | 266 | | immutable borrow occurs here 267 | mutable borrow occurs here 268 269error: cannot borrow `a` as mutable because it is also borrowed as immutable 270 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:28:11 271 | 272LL | fn f3(ref a @ [ref b, ref mut mid @ .., ref c]: [U; 4]) {} 273 | -----^^^^^^^^^^^----------------^^^^^^^^ 274 | | | 275 | | mutable borrow occurs here 276 | immutable borrow occurs here 277 278error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable 279 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:10:31 280 | 281LL | ref mut z @ &mut Some(ref a) => { 282 | ----------------------^^^^^- 283 | | | 284 | | immutable borrow occurs here 285 | mutable borrow occurs here 286... 287LL | **z = None; 288 | ---------- mutable borrow later used here 289 290error[E0502]: cannot borrow `_` as immutable because it is also borrowed as mutable 291 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:44:21 292 | 293LL | let ref mut a @ ref b = u(); 294 | ------------^^^^^ 295 | | | 296 | | immutable borrow occurs here 297 | mutable borrow occurs here 298... 299LL | *a = u(); 300 | -------- mutable borrow later used here 301 302error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 303 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:49:17 304 | 305LL | let ref a @ ref mut b = u(); 306 | --------^^^^^^^^^ 307 | | | 308 | | mutable borrow occurs here 309 | immutable borrow occurs here 310... 311LL | drop(a); 312 | - immutable borrow later used here 313 314error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 315 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:20 316 | 317LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { 318 | -----------^^^^^^^^^- 319 | | | 320 | | mutable borrow occurs here 321 | immutable borrow occurs here 322... 323LL | drop(a); 324 | - immutable borrow later used here 325 326error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 327 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:74:45 328 | 329LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) => { 330 | ------------^^^^^^^^^- 331 | | | 332 | | mutable borrow occurs here 333 | immutable borrow occurs here 334... 335LL | drop(a); 336 | - immutable borrow later used here 337 338error[E0594]: cannot assign to `*b`, as it is immutable for the pattern guard 339 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:85:61 340 | 341LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { *b = U; false } => {} 342 | ^^^^^^ cannot assign 343 | 344 = note: variables bound in patterns are immutable until the end of the pattern guard 345 346error[E0594]: cannot assign to `*a`, as it is immutable for the pattern guard 347 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:92:61 348 | 349LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { *a = Err(U); false } => {} 350 | ^^^^^^^^^^^ cannot assign 351 | 352 = note: variables bound in patterns are immutable until the end of the pattern guard 353 354error[E0507]: cannot move out of `b` in pattern guard 355 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:66 356 | 357LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} 358 | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait 359 | 360 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard 361 362error[E0507]: cannot move out of `b` in pattern guard 363 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:99:66 364 | 365LL | ref a @ Ok(ref mut b) | ref a @ Err(ref mut b) if { drop(b); false } => {} 366 | ^ move occurs because `b` has type `&mut main::U`, which does not implement the `Copy` trait 367 | 368 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard 369 370error[E0507]: cannot move out of `a` in pattern guard 371 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66 372 | 373LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} 374 | ^ move occurs because `a` has type `&mut std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait 375 | 376 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard 377 378error[E0507]: cannot move out of `a` in pattern guard 379 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:107:66 380 | 381LL | ref mut a @ Ok(ref b) | ref mut a @ Err(ref b) if { drop(a); false } => {} 382 | ^ move occurs because `a` has type `&mut std::result::Result<main::U, main::U>`, which does not implement the `Copy` trait 383 | 384 = note: variables bound in patterns cannot be moved from until after the end of the pattern guard 385 386error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 387 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:18 388 | 389LL | let ref a @ (ref mut b, ref mut c) = (U, U); 390 | ---------^^^^^^^^^------------ 391 | | | 392 | | mutable borrow occurs here 393 | immutable borrow occurs here 394... 395LL | drop(a); 396 | - immutable borrow later used here 397 398error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 399 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:120:29 400 | 401LL | let ref a @ (ref mut b, ref mut c) = (U, U); 402 | --------------------^^^^^^^^^- 403 | | | 404 | | mutable borrow occurs here 405 | immutable borrow occurs here 406... 407LL | drop(a); 408 | - immutable borrow later used here 409 410error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 411 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:18 412 | 413LL | let ref a @ (ref mut b, ref mut c) = (U, U); 414 | ---------^^^^^^^^^------------ 415 | | | 416 | | mutable borrow occurs here 417 | immutable borrow occurs here 418... 419LL | drop(a); 420 | - immutable borrow later used here 421 422error[E0502]: cannot borrow `_` as mutable because it is also borrowed as immutable 423 --> $DIR/borrowck-pat-ref-mut-and-ref.rs:127:29 424 | 425LL | let ref a @ (ref mut b, ref mut c) = (U, U); 426 | --------------------^^^^^^^^^- 427 | | | 428 | | mutable borrow occurs here 429 | immutable borrow occurs here 430... 431LL | drop(a); 432 | - immutable borrow later used here 433 434error: aborting due to 45 previous errors 435 436Some errors have detailed explanations: E0502, E0507, E0594. 437For more information about an error, try `rustc --explain E0502`.