about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRémy Rakic <remy.rakic+github@gmail.com>2021-08-03 19:42:07 +0200
committerRémy Rakic <remy.rakic+github@gmail.com>2021-08-03 20:30:10 +0200
commit8a21c2f7f2f4d9cba837f186eb66c0478343b458 (patch)
tree258fd2a16b2c7a3caf9eeb61f8355e430d3f8408
parent6421432d47b9aff551c77726234dc09fd52db084 (diff)
downloadrust-8a21c2f7f2f4d9cba837f186eb66c0478343b458.tar.gz
rust-8a21c2f7f2f4d9cba837f186eb66c0478343b458.zip
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.
-rw-r--r--src/test/ui/regions/issue-78262.default.stderr6
-rw-r--r--src/test/ui/regions/issue-78262.nll.stderr2
-rw-r--r--src/test/ui/regions/issue-78262.polonius.stderr11
-rw-r--r--src/test/ui/regions/issue-78262.rs7
4 files changed, 20 insertions, 6 deletions
diff --git a/src/test/ui/regions/issue-78262.default.stderr b/src/test/ui/regions/issue-78262.default.stderr
index e97b8eca948..5250848a65c 100644
--- a/src/test/ui/regions/issue-78262.default.stderr
+++ b/src/test/ui/regions/issue-78262.default.stderr
@@ -1,13 +1,13 @@
 error[E0308]: mismatched types
-  --> $DIR/issue-78262.rs:12:28
+  --> $DIR/issue-78262.rs:14:28
    |
 LL |     let f = |x: &dyn TT| x.func();
    |                            ^^^^ lifetime mismatch
    |
    = note: expected reference `&(dyn TT + 'static)`
               found reference `&dyn TT`
-note: the anonymous lifetime #1 defined on the body at 12:13...
-  --> $DIR/issue-78262.rs:12:13
+note: the anonymous lifetime #1 defined on the body at 14:13...
+  --> $DIR/issue-78262.rs:14:13
    |
 LL |     let f = |x: &dyn TT| x.func();
    |             ^^^^^^^^^^^^^^^^^^^^^
diff --git a/src/test/ui/regions/issue-78262.nll.stderr b/src/test/ui/regions/issue-78262.nll.stderr
index fafff35e415..a35d6fd9bf8 100644
--- a/src/test/ui/regions/issue-78262.nll.stderr
+++ b/src/test/ui/regions/issue-78262.nll.stderr
@@ -1,5 +1,5 @@
 error[E0521]: borrowed data escapes outside of closure
-  --> $DIR/issue-78262.rs:12:26
+  --> $DIR/issue-78262.rs:14:26
    |
 LL |     let f = |x: &dyn TT| x.func();
    |              -           ^^^^^^^^ `x` escapes the closure body here
diff --git a/src/test/ui/regions/issue-78262.polonius.stderr b/src/test/ui/regions/issue-78262.polonius.stderr
new file mode 100644
index 00000000000..a35d6fd9bf8
--- /dev/null
+++ b/src/test/ui/regions/issue-78262.polonius.stderr
@@ -0,0 +1,11 @@
+error[E0521]: borrowed data escapes outside of closure
+  --> $DIR/issue-78262.rs:14:26
+   |
+LL |     let f = |x: &dyn TT| x.func();
+   |              -           ^^^^^^^^ `x` escapes the closure body here
+   |              |
+   |              `x` is a reference that is only valid in the closure body
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0521`.
diff --git a/src/test/ui/regions/issue-78262.rs b/src/test/ui/regions/issue-78262.rs
index 0bdb0abac30..b88ad678ee6 100644
--- a/src/test/ui/regions/issue-78262.rs
+++ b/src/test/ui/regions/issue-78262.rs
@@ -1,6 +1,8 @@
-// revisions: nll default
+// revisions: default nll polonius
 // ignore-compare-mode-nll
-//[nll]compile-flags: -Z borrowck=mir
+// ignore-compare-mode-polonius
+// [nll] compile-flags: -Z borrowck=mir
+// [polonius] compile-flags: -Z borrowck=mir -Z polonius
 
 trait TT {}
 
@@ -11,4 +13,5 @@ impl dyn TT {
 fn main() {
     let f = |x: &dyn TT| x.func(); //[default]~ ERROR: mismatched types
     //[nll]~^ ERROR: borrowed data escapes outside of closure
+    //[polonius]~^^ ERROR: borrowed data escapes outside of closure
 }