File tree Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Expand file tree Collapse file tree 3 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1+ // This tests passes in Polonius mode, so is skipped in the automated compare-mode.
2+ // We will manually check it passes in Polonius tests, as we can't have a test here
3+ // which conditionally passes depending on a test revision/compile-flags.
4+
5+ // ignore-compare-mode-polonius
6+
17struct Foo ;
28
39impl Foo {
Original file line number Diff line number Diff line change 11error[E0499]: cannot borrow `**other` as mutable more than once at a time
2- --> $DIR/issue-46589.rs:17 :21
2+ --> $DIR/issue-46589.rs:23 :21
33 |
44LL | *other = match (*other).get_self() {
55 | -------- first mutable borrow occurs here
Original file line number Diff line number Diff line change 1+ // This test is a copy of `ui/nll/issue-46589.rs` which fails in NLL but succeeds in Polonius.
2+ // As we can't have a test here which conditionally passes depending on a test
3+ // revision/compile-flags. We ensure here that it passes in Polonius mode.
4+
5+ // check-pass
6+ // compile-flags: -Z borrowck=mir -Z polonius
7+ // ignore-compare-mode-nll
8+
9+ struct Foo ;
10+
11+ impl Foo {
12+ fn get_self ( & mut self ) -> Option < & mut Self > {
13+ Some ( self )
14+ }
15+
16+ fn new_self ( & mut self ) -> & mut Self {
17+ self
18+ }
19+
20+ fn trigger_bug ( & mut self ) {
21+ let other = & mut ( & mut * self ) ;
22+
23+ * other = match ( * other) . get_self ( ) {
24+ Some ( s) => s,
25+ None => ( * other) . new_self ( )
26+ } ;
27+
28+ let c = other;
29+ }
30+ }
31+
32+ fn main ( ) { }
You can’t perform that action at this time.
0 commit comments