fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error[E0503]: cannot use `arr` because it was mutably borrowed 2 --> $DIR/arrays.rs:14:5 3 | 4LL | let mut c = || { 5 | -- `arr` is borrowed here 6LL | arr[0] += 10; 7 | --- borrow occurs due to use of `arr` in closure 8... 9LL | arr[1] += 10; 10 | ^^^^^^ use of borrowed `arr` 11... 12LL | c(); 13 | - borrow later used here 14 15error[E0503]: cannot use `arr[_]` because it was mutably borrowed 16 --> $DIR/arrays.rs:14:5 17 | 18LL | let mut c = || { 19 | -- `arr` is borrowed here 20LL | arr[0] += 10; 21 | --- borrow occurs due to use of `arr` in closure 22... 23LL | arr[1] += 10; 24 | ^^^^^^^^^^^^ use of borrowed `arr` 25... 26LL | c(); 27 | - borrow later used here 28 29error[E0506]: cannot assign to `arr[_]` because it is borrowed 30 --> $DIR/arrays.rs:29:5 31 | 32LL | let c = || { 33 | -- `arr[_]` is borrowed here 34LL | println!("{:#?}", &arr[3..4]); 35 | --- borrow occurs due to use in closure 36... 37LL | arr[1] += 10; 38 | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed 39LL | 40LL | c(); 41 | - borrow later used here 42 43error[E0506]: cannot assign to `arr[_]` because it is borrowed 44 --> $DIR/arrays.rs:43:5 45 | 46LL | let c = || { 47 | -- `arr[_]` is borrowed here 48LL | println!("{}", arr[3]); 49 | --- borrow occurs due to use in closure 50... 51LL | arr[1] += 10; 52 | ^^^^^^^^^^^^ `arr[_]` is assigned to here but it was already borrowed 53LL | 54LL | c(); 55 | - borrow later used here 56 57error[E0503]: cannot use `arr` because it was mutably borrowed 58 --> $DIR/arrays.rs:57:20 59 | 60LL | let mut c = || { 61 | -- `arr` is borrowed here 62LL | arr[1] += 10; 63 | --- borrow occurs due to use of `arr` in closure 64... 65LL | println!("{}", arr[3]); 66 | ^^^^^^ use of borrowed `arr` 67... 68LL | c(); 69 | - borrow later used here 70 71error[E0502]: cannot borrow `arr[_]` as immutable because it is also borrowed as mutable 72 --> $DIR/arrays.rs:57:20 73 | 74LL | let mut c = || { 75 | -- mutable borrow occurs here 76LL | arr[1] += 10; 77 | --- first borrow occurs due to use of `arr` in closure 78... 79LL | println!("{}", arr[3]); 80 | ^^^^^^ immutable borrow occurs here 81... 82LL | c(); 83 | - mutable borrow later used here 84 | 85 = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info) 86 87error[E0502]: cannot borrow `arr` as immutable because it is also borrowed as mutable 88 --> $DIR/arrays.rs:73:24 89 | 90LL | let mut c = || { 91 | -- mutable borrow occurs here 92LL | arr[1] += 10; 93 | --- first borrow occurs due to use of `arr` in closure 94... 95LL | println!("{:#?}", &arr[3..2]); 96 | ^^^ immutable borrow occurs here 97... 98LL | c(); 99 | - mutable borrow later used here 100 101error: aborting due to 7 previous errors 102 103Some errors have detailed explanations: E0502, E0503, E0506. 104For more information about an error, try `rustc --explain E0502`.