fork/rust
git clone https://git.julia.blue/fork/rust
8d69840ab92
1.43.1
1error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time 2 --> $DIR/borrowck-borrow-from-stack-variable.rs:18:17 3 | 4LL | let bar1 = &mut foo.bar1; 5 | ------------- first mutable borrow occurs here 6LL | let _bar2 = &mut foo.bar1; 7 | ^^^^^^^^^^^^^ second mutable borrow occurs here 8LL | *bar1; 9 | ----- first borrow later used here 10 11error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable 12 --> $DIR/borrowck-borrow-from-stack-variable.rs:25:17 13 | 14LL | let bar1 = &mut foo.bar1; 15 | ------------- mutable borrow occurs here 16LL | let _bar2 = &foo.bar1; 17 | ^^^^^^^^^ immutable borrow occurs here 18LL | *bar1; 19 | ----- mutable borrow later used here 20 21error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable 22 --> $DIR/borrowck-borrow-from-stack-variable.rs:32:17 23 | 24LL | let bar1 = &foo.bar1; 25 | --------- immutable borrow occurs here 26LL | let _bar2 = &mut foo.bar1; 27 | ^^^^^^^^^^^^^ mutable borrow occurs here 28LL | *bar1; 29 | ----- immutable borrow later used here 30 31error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time 32 --> $DIR/borrowck-borrow-from-stack-variable.rs:61:21 33 | 34LL | let bar1 = &mut foo.bar1; 35 | ------------- first mutable borrow occurs here 36LL | match foo { 37LL | Foo { bar1: ref mut _bar1, bar2: _ } => {} // 38 | ^^^^^^^^^^^^^ second mutable borrow occurs here 39... 40LL | *bar1; 41 | ----- first borrow later used here 42 43error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable 44 --> $DIR/borrowck-borrow-from-stack-variable.rs:70:17 45 | 46LL | let bar1 = &mut foo.bar1.int1; 47 | ------------------ mutable borrow occurs here 48LL | let _foo1 = &foo.bar1; 49 | ^^^^^^^^^ immutable borrow occurs here 50LL | let _foo2 = &foo; 51LL | *bar1; 52 | ----- mutable borrow later used here 53 54error[E0502]: cannot borrow `foo` as immutable because it is also borrowed as mutable 55 --> $DIR/borrowck-borrow-from-stack-variable.rs:71:17 56 | 57LL | let bar1 = &mut foo.bar1.int1; 58 | ------------------ mutable borrow occurs here 59LL | let _foo1 = &foo.bar1; 60LL | let _foo2 = &foo; 61 | ^^^^ immutable borrow occurs here 62LL | *bar1; 63 | ----- mutable borrow later used here 64 65error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time 66 --> $DIR/borrowck-borrow-from-stack-variable.rs:78:17 67 | 68LL | let bar1 = &mut foo.bar1.int1; 69 | ------------------ first mutable borrow occurs here 70LL | let _foo1 = &mut foo.bar1; 71 | ^^^^^^^^^^^^^ second mutable borrow occurs here 72LL | *bar1; 73 | ----- first borrow later used here 74 75error[E0499]: cannot borrow `foo` as mutable more than once at a time 76 --> $DIR/borrowck-borrow-from-stack-variable.rs:85:17 77 | 78LL | let bar1 = &mut foo.bar1.int1; 79 | ------------------ first mutable borrow occurs here 80LL | let _foo2 = &mut foo; 81 | ^^^^^^^^ second mutable borrow occurs here 82LL | *bar1; 83 | ----- first borrow later used here 84 85error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable 86 --> $DIR/borrowck-borrow-from-stack-variable.rs:92:17 87 | 88LL | let bar1 = &foo.bar1.int1; 89 | -------------- immutable borrow occurs here 90LL | let _foo1 = &mut foo.bar1; 91 | ^^^^^^^^^^^^^ mutable borrow occurs here 92LL | *bar1; 93 | ----- immutable borrow later used here 94 95error[E0502]: cannot borrow `foo` as mutable because it is also borrowed as immutable 96 --> $DIR/borrowck-borrow-from-stack-variable.rs:99:17 97 | 98LL | let bar1 = &foo.bar1.int1; 99 | -------------- immutable borrow occurs here 100LL | let _foo2 = &mut foo; 101 | ^^^^^^^^ mutable borrow occurs here 102LL | *bar1; 103 | ----- immutable borrow later used here 104 105error[E0596]: cannot borrow `foo.bar1` as mutable, as `foo` is not declared as mutable 106 --> $DIR/borrowck-borrow-from-stack-variable.rs:120:16 107 | 108LL | let foo = make_foo(); 109 | --- help: consider changing this to be mutable: `mut foo` 110LL | let bar1 = &mut foo.bar1; 111 | ^^^^^^^^^^^^^ cannot borrow as mutable 112 113error: aborting due to 11 previous errors 114 115Some errors have detailed explanations: E0499, E0502, E0596. 116For more information about an error, try `rustc --explain E0499`.