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