You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fnmain(){letmut x = 1;let r1 = &mut x;let r2 = &mut*r1;let x = *r1;*r2 = 200;}
error[E0503]: cannot use `*r1` because it was mutably borrowed
--> foo.rs:7:11
|
5 | let r2 = &mut *r1;
| -------- `*r1` is borrowed here
6 |
7 | let x = *r1;
| ^^^ use of borrowed `*r1`
8 | *r2 = 200;
| --------- borrow later used here
Rust flags the use of *r1 when there's a live reborrow *r2. Circle doesn't do that. This compiles: (Compiler Explorer)
#feature on safety
intmain() {
int x = 1;
int^ r1 = ^x;
int^ r2 = ^*r1;
*r1 = 100;
*r2 = 200;
}
It's not clear how to determine that the loan on *r1 is a relevant loan that should raise the conflict.
The text was updated successfully, but these errors were encountered:
Rust flags the use of *r1 when there's a live reborrow *r2. Circle doesn't do that. This compiles:
(Compiler Explorer)
It's not clear how to determine that the loan on *r1 is a relevant loan that should raise the conflict.
The text was updated successfully, but these errors were encountered: