about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJack Huey <31162821+jackh726@users.noreply.github.com>2022-05-21 14:22:42 -0400
committerJack Huey <31162821+jackh726@users.noreply.github.com>2022-05-22 15:21:26 -0400
commitf1a7f9ab40ba4fe063cfedbd67e8828a880c5ffc (patch)
treee801b8da8bf19ac87e03673bc7fb0e1d10639910
parenteb222bf9432660d0ced8e38e839837e4ad55bec0 (diff)
downloadrust-f1a7f9ab40ba4fe063cfedbd67e8828a880c5ffc.tar.gz
rust-f1a7f9ab40ba4fe063cfedbd67e8828a880c5ffc.zip
Use revisions for NLL in closures
-rw-r--r--src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.base.stderr (renamed from src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr)8
-rw-r--r--src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr12
-rw-r--r--src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs8
-rw-r--r--src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.base.stderr (renamed from src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr)12
-rw-r--r--src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr4
-rw-r--r--src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.rs10
6 files changed, 36 insertions, 18 deletions
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.base.stderr
index af1f908a808..93ed51fa7e1 100644
--- a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.stderr
+++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.base.stderr
@@ -1,22 +1,24 @@
 error[E0759]: `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement
-  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:9
    |
 LL |   fn foo(x: &()) {
    |             --- this data with an anonymous lifetime `'_`...
 LL |       bar(|| {
    |  _________^
 LL | |
+LL | |
+LL | |
 LL | |         let _ = x;
 LL | |     })
    | |_____^ ...is used here...
    |
 note: ...and is required to live as long as `'static` here
-  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:5
    |
 LL |     bar(|| {
    |     ^^^
 note: `'static` lifetime requirement introduced by this bound
-  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:1:39
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:39
    |
 LL | fn bar<F>(blk: F) where F: FnOnce() + 'static {
    |                                       ^^^^^^^
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
index af3810e91ae..dc5188a8651 100644
--- a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
+++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.nll.stderr
@@ -1,5 +1,5 @@
 error[E0521]: borrowed data escapes outside of function
-  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:5
    |
 LL |   fn foo(x: &()) {
    |          -  - let's call the lifetime of this reference `'1`
@@ -7,6 +7,8 @@ LL |   fn foo(x: &()) {
    |          `x` is a reference that is only valid in the function body
 LL | /     bar(|| {
 LL | |
+LL | |
+LL | |
 LL | |         let _ = x;
 LL | |     })
    | |      ^
@@ -15,19 +17,21 @@ LL | |     })
    |        argument requires that `'1` must outlive `'static`
 
 error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
-  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:9
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:9
    |
 LL |     bar(|| {
    |         ^^ may outlive borrowed value `x`
-LL |
+...
 LL |         let _ = x;
    |                 - `x` is borrowed here
    |
 note: function requires argument type to outlive `'static`
-  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:5:5
+  --> $DIR/closure-bounds-static-cant-capture-borrowed.rs:9:5
    |
 LL | /     bar(|| {
 LL | |
+LL | |
+LL | |
 LL | |         let _ = x;
 LL | |     })
    | |______^
diff --git a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs
index cbdc8b7deef..6c49cd76b13 100644
--- a/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs
+++ b/src/test/ui/closures/closure-bounds-static-cant-capture-borrowed.rs
@@ -1,9 +1,15 @@
+// ignore-compare-mode-nll
+// revisions: base nll
+// [nll]compile-flags: -Zborrowck=mir
+
 fn bar<F>(blk: F) where F: FnOnce() + 'static {
 }
 
 fn foo(x: &()) {
     bar(|| {
-        //~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
+        //[base]~^ ERROR `x` has an anonymous lifetime `'_` but it needs to satisfy a `'static` lifetime requirement [E0759]
+        //[nll]~^^ ERROR borrowed data escapes
+        //[nll]~| ERROR closure may outlive
         let _ = x;
     })
 }
diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.base.stderr
index f584b0c8382..be81efd27c4 100644
--- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.stderr
+++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.base.stderr
@@ -1,5 +1,5 @@
 error[E0308]: mismatched types
-  --> $DIR/expect-region-supply-region-2.rs:14:33
+  --> $DIR/expect-region-supply-region-2.rs:18:33
    |
 LL |     closure_expecting_bound(|x: &'x u32| {
    |                                 ^^^^^^^ lifetime mismatch
@@ -7,7 +7,7 @@ LL |     closure_expecting_bound(|x: &'x u32| {
    = note: expected reference `&u32`
               found reference `&'x u32`
 note: the anonymous lifetime #1 defined here...
-  --> $DIR/expect-region-supply-region-2.rs:14:29
+  --> $DIR/expect-region-supply-region-2.rs:18:29
    |
 LL |       closure_expecting_bound(|x: &'x u32| {
    |  _____________________________^
@@ -19,13 +19,13 @@ LL | |         f = Some(x);
 LL | |     });
    | |_____^
 note: ...does not necessarily outlive the lifetime `'x` as defined here
-  --> $DIR/expect-region-supply-region-2.rs:9:30
+  --> $DIR/expect-region-supply-region-2.rs:13:30
    |
 LL | fn expect_bound_supply_named<'x>() {
    |                              ^^
 
 error[E0308]: mismatched types
-  --> $DIR/expect-region-supply-region-2.rs:14:33
+  --> $DIR/expect-region-supply-region-2.rs:18:33
    |
 LL |     closure_expecting_bound(|x: &'x u32| {
    |                                 ^^^^^^^ lifetime mismatch
@@ -33,12 +33,12 @@ LL |     closure_expecting_bound(|x: &'x u32| {
    = note: expected reference `&u32`
               found reference `&'x u32`
 note: the lifetime `'x` as defined here...
-  --> $DIR/expect-region-supply-region-2.rs:9:30
+  --> $DIR/expect-region-supply-region-2.rs:13:30
    |
 LL | fn expect_bound_supply_named<'x>() {
    |                              ^^
 note: ...does not necessarily outlive the anonymous lifetime #1 defined here
-  --> $DIR/expect-region-supply-region-2.rs:14:29
+  --> $DIR/expect-region-supply-region-2.rs:18:29
    |
 LL |       closure_expecting_bound(|x: &'x u32| {
    |  _____________________________^
diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr
index 9aab51c986c..4a9a19422d7 100644
--- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr
+++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.nll.stderr
@@ -1,5 +1,5 @@
 error: lifetime may not live long enough
-  --> $DIR/expect-region-supply-region-2.rs:14:30
+  --> $DIR/expect-region-supply-region-2.rs:18:30
    |
 LL | fn expect_bound_supply_named<'x>() {
    |                              -- lifetime `'x` defined here
@@ -10,7 +10,7 @@ LL |     closure_expecting_bound(|x: &'x u32| {
    |                              requires that `'1` must outlive `'x`
 
 error: lifetime may not live long enough
-  --> $DIR/expect-region-supply-region-2.rs:14:30
+  --> $DIR/expect-region-supply-region-2.rs:18:30
    |
 LL | fn expect_bound_supply_named<'x>() {
    |                              -- lifetime `'x` defined here
diff --git a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.rs b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.rs
index 7405b1a1e3a..072ba57c10b 100644
--- a/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.rs
+++ b/src/test/ui/closures/closure-expected-type/expect-region-supply-region-2.rs
@@ -1,3 +1,7 @@
+// ignore-compare-mode-nll
+// revisions: base nll
+// [nll]compile-flags: -Zborrowck=mir
+
 #![allow(warnings)]
 
 fn closure_expecting_bound<F>(_: F)
@@ -12,8 +16,10 @@ fn expect_bound_supply_named<'x>() {
     // Here we give a type annotation that `x` should be free. We get
     // an error because of that.
     closure_expecting_bound(|x: &'x u32| {
-        //~^ ERROR mismatched types
-        //~| ERROR mismatched types
+        //[base]~^ ERROR mismatched types
+        //[base]~| ERROR mismatched types
+        //[nll]~^^^ ERROR lifetime may not live long enough
+        //[nll]~| ERROR lifetime may not live long enough
 
         // Borrowck doesn't get a chance to run, but if it did it should error
         // here.