]> git.proxmox.com Git - rustc.git/blame - src/test/ui/borrowck/borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-borrow-mut-base-ptr-in-aliasable-loc.stderr
CommitLineData
136023e0 1error[E0594]: cannot assign to `**t1`, which is behind a `&` reference
0731742a 2 --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:9:5
b7449926 3 |
48663c56 4LL | let t1 = t0;
064997fb 5 | -- consider changing this binding's type to be: `&mut &mut isize`
48663c56 6LL | let p: &isize = &**t0;
532ac7d7 7LL | **t1 = 22;
48663c56 8 | ^^^^^^^^^ `t1` is a `&` reference, so the data it refers to cannot be written
b7449926 9
48663c56
XL
10error[E0502]: cannot borrow `**t0` as immutable because it is also borrowed as mutable
11 --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:14:21
b7449926
XL
12 |
13LL | let t1 = &mut *t0;
48663c56 14 | -------- mutable borrow occurs here
532ac7d7 15LL | let p: &isize = &**t0;
48663c56 16 | ^^^^^ immutable borrow occurs here
b7449926 17LL | **t1 = 22;
48663c56 18 | --------- mutable borrow later used here
b7449926 19
48663c56
XL
20error[E0596]: cannot borrow `**t0` as mutable, as it is behind a `&` reference
21 --> $DIR/borrowck-borrow-mut-base-ptr-in-aliasable-loc.rs:19:26
b7449926
XL
22 |
23LL | fn foo4(t0: & &mut isize) {
48663c56 24 | ------------ help: consider changing this to be a mutable reference: `&mut &mut isize`
532ac7d7 25LL | let x: &mut isize = &mut **t0;
48663c56 26 | ^^^^^^^^^ `t0` is a `&` reference, so the data it refers to cannot be borrowed as mutable
b7449926
XL
27
28error: aborting due to 3 previous errors
29
60c5eb7d 30Some errors have detailed explanations: E0502, E0594, E0596.
48663c56 31For more information about an error, try `rustc --explain E0502`.