Skip to content

Commit 6432f89

Browse files
committed
cut scope for more complicated cases of flow-sensitivity
1 parent baf4f6b commit 6432f89

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
error[E0499]: cannot borrow `**other` as mutable more than once at a time
2+
--> $DIR/issue-46589.rs:24:21
3+
|
4+
LL | *other = match (*other).get_self() {
5+
| -------- first mutable borrow occurs here
6+
LL | Some(s) => s,
7+
LL | None => (*other).new_self()
8+
| ^^^^^^^^
9+
| |
10+
| second mutable borrow occurs here
11+
| first borrow later used here
12+
13+
error: aborting due to 1 previous error
14+
15+
For more information about this error, try `rustc --explain E0499`.

tests/ui/nll/issue-46589.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//@ ignore-compare-mode-polonius (explicit revisions)
22
//@ revisions: nll polonius_next polonius
3-
//@ [polonius_next] check-pass
3+
//@ [polonius_next] check-fail
44
//@ [polonius_next] compile-flags: -Zpolonius=next
55
//@ [polonius] check-pass
66
//@ [polonius] compile-flags: -Zpolonius
@@ -23,6 +23,7 @@ impl Foo {
2323
Some(s) => s,
2424
None => (*other).new_self()
2525
//[nll]~^ ERROR cannot borrow `**other` as mutable more than once at a time [E0499]
26+
//[polonius_next]~^^ ERROR cannot borrow `**other` as mutable more than once at a time [E0499]
2627
};
2728

2829
let c = other;

0 commit comments

Comments
 (0)