Skip to content

Commit 8a21c2f

Browse files
committed
restructure issue-78262 to test polonius
This test is ignored in the NLL compare-mode and manually checks the NLL output. This makes the polonius compare-mode fail, even though the output is the same as NLL.
1 parent 6421432 commit 8a21c2f

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

src/test/ui/regions/issue-78262.default.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
error[E0308]: mismatched types
2-
--> $DIR/issue-78262.rs:12:28
2+
--> $DIR/issue-78262.rs:14:28
33
|
44
LL | let f = |x: &dyn TT| x.func();
55
| ^^^^ lifetime mismatch
66
|
77
= note: expected reference `&(dyn TT + 'static)`
88
found reference `&dyn TT`
9-
note: the anonymous lifetime #1 defined on the body at 12:13...
10-
--> $DIR/issue-78262.rs:12:13
9+
note: the anonymous lifetime #1 defined on the body at 14:13...
10+
--> $DIR/issue-78262.rs:14:13
1111
|
1212
LL | let f = |x: &dyn TT| x.func();
1313
| ^^^^^^^^^^^^^^^^^^^^^

src/test/ui/regions/issue-78262.nll.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0521]: borrowed data escapes outside of closure
2-
--> $DIR/issue-78262.rs:12:26
2+
--> $DIR/issue-78262.rs:14:26
33
|
44
LL | let f = |x: &dyn TT| x.func();
55
| - ^^^^^^^^ `x` escapes the closure body here
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0521]: borrowed data escapes outside of closure
2+
--> $DIR/issue-78262.rs:14:26
3+
|
4+
LL | let f = |x: &dyn TT| x.func();
5+
| - ^^^^^^^^ `x` escapes the closure body here
6+
| |
7+
| `x` is a reference that is only valid in the closure body
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0521`.

src/test/ui/regions/issue-78262.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
// revisions: nll default
1+
// revisions: default nll polonius
22
// ignore-compare-mode-nll
3-
//[nll]compile-flags: -Z borrowck=mir
3+
// ignore-compare-mode-polonius
4+
// [nll] compile-flags: -Z borrowck=mir
5+
// [polonius] compile-flags: -Z borrowck=mir -Z polonius
46

57
trait TT {}
68

@@ -11,4 +13,5 @@ impl dyn TT {
1113
fn main() {
1214
let f = |x: &dyn TT| x.func(); //[default]~ ERROR: mismatched types
1315
//[nll]~^ ERROR: borrowed data escapes outside of closure
16+
//[polonius]~^^ ERROR: borrowed data escapes outside of closure
1417
}

0 commit comments

Comments
 (0)