about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorMaybe Waffle <waffle.lapkin@gmail.com>2022-07-12 13:34:24 +0400
committerMaybe Waffle <waffle.lapkin@gmail.com>2022-07-12 21:00:03 +0400
commitc2dbd62c7c60cd4017c9d499101e40c129e4bc61 (patch)
tree2b995dbbc34a3a74ea4ff4b8a6dcbd3b66198afa /src/test
parentf89ef3cf66206b7c0ba0ca134de40b567c7bda83 (diff)
downloadrust-c2dbd62c7c60cd4017c9d499101e40c129e4bc61.tar.gz
rust-c2dbd62c7c60cd4017c9d499101e40c129e4bc61.zip
Lower closure binders to hir & properly check them
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/closures/binder/async-closure-with-binder.rs1
-rw-r--r--src/test/ui/closures/binder/async-closure-with-binder.stderr10
-rw-r--r--src/test/ui/closures/binder/implicit-return.rs2
-rw-r--r--src/test/ui/closures/binder/implicit-return.stderr2
-rw-r--r--src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.rs10
-rw-r--r--src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.stderr48
-rw-r--r--src/test/ui/parser/recover-quantified-closure.rs5
-rw-r--r--src/test/ui/parser/recover-quantified-closure.stderr27
8 files changed, 33 insertions, 72 deletions
diff --git a/src/test/ui/closures/binder/async-closure-with-binder.rs b/src/test/ui/closures/binder/async-closure-with-binder.rs
index b9ecbd9e5d6..4fa599d37cb 100644
--- a/src/test/ui/closures/binder/async-closure-with-binder.rs
+++ b/src/test/ui/closures/binder/async-closure-with-binder.rs
@@ -4,4 +4,5 @@
 fn main() {
     for<'a> async || ();
     //~^ ERROR `for<...>` binders on `async` closures are not currently supported
+    //~^^ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
 }
diff --git a/src/test/ui/closures/binder/async-closure-with-binder.stderr b/src/test/ui/closures/binder/async-closure-with-binder.stderr
index 46420a17752..1d4628b1a49 100644
--- a/src/test/ui/closures/binder/async-closure-with-binder.stderr
+++ b/src/test/ui/closures/binder/async-closure-with-binder.stderr
@@ -4,5 +4,13 @@ error: `for<...>` binders on `async` closures are not currently supported
 LL |     for<'a> async || ();
    |     ^^^^^^^
 
-error: aborting due to previous error
+error: implicit types in closure signatures are forbidden when `for<...>` is present
+  --> $DIR/async-closure-with-binder.rs:5:5
+   |
+LL |     for<'a> async || ();
+   |     -------^^^^^^^^^
+   |     |
+   |     `for<...>` is here
+
+error: aborting due to 2 previous errors
 
diff --git a/src/test/ui/closures/binder/implicit-return.rs b/src/test/ui/closures/binder/implicit-return.rs
index 3aefbdcb299..d34e5721d91 100644
--- a/src/test/ui/closures/binder/implicit-return.rs
+++ b/src/test/ui/closures/binder/implicit-return.rs
@@ -2,5 +2,5 @@
 
 fn main() {
     let _f = for<'a> |_: &'a ()| {};
-    //~^ implicit return type is forbidden when `for<...>` is present
+    //~^ implicit types in closure signatures are forbidden when `for<...>` is present
 }
diff --git a/src/test/ui/closures/binder/implicit-return.stderr b/src/test/ui/closures/binder/implicit-return.stderr
index 022a4e027b6..5bfb9711334 100644
--- a/src/test/ui/closures/binder/implicit-return.stderr
+++ b/src/test/ui/closures/binder/implicit-return.stderr
@@ -1,4 +1,4 @@
-error: implicit return type is forbidden when `for<...>` is present
+error: implicit types in closure signatures are forbidden when `for<...>` is present
   --> $DIR/implicit-return.rs:4:34
    |
 LL |     let _f = for<'a> |_: &'a ()| {};
diff --git a/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.rs b/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.rs
index 1e2090186a6..b0b494fa3ff 100644
--- a/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.rs
+++ b/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.rs
@@ -1,12 +1,8 @@
 fn main() {
-    for<> || {};
+    for<> || -> () {};
     //~^ ERROR `for<...>` binders for closures are experimental
-    //~^^ ERROR `for<...>` binders for closures are not yet supported
-    for<'a> || {};
+    for<'a> || -> () {};
     //~^ ERROR `for<...>` binders for closures are experimental
-    //~^^ ERROR `for<...>` binders for closures are not yet supported
-    for<'a, 'b> |_: &'a ()| {};
+    for<'a, 'b> |_: &'a ()| -> () {};
     //~^ ERROR `for<...>` binders for closures are experimental
-    //~^^ ERROR `for<...>` binders for closures are not yet supported
-    //~^^^ ERROR use of undeclared lifetime name `'a`
 }
diff --git a/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.stderr b/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.stderr
index 77ce6f9f2d6..aea5cfeed07 100644
--- a/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.stderr
+++ b/src/test/ui/feature-gates/feature-gate-closure_lifetime_binder.stderr
@@ -1,16 +1,7 @@
-error[E0261]: use of undeclared lifetime name `'a`
-  --> $DIR/feature-gate-closure_lifetime_binder.rs:8:22
-   |
-LL | fn main() {
-   |        - help: consider introducing lifetime `'a` here: `<'a>`
-...
-LL |     for<'a, 'b> |_: &'a ()| {};
-   |                      ^^ undeclared lifetime
-
 error[E0658]: `for<...>` binders for closures are experimental
   --> $DIR/feature-gate-closure_lifetime_binder.rs:2:5
    |
-LL |     for<> || {};
+LL |     for<> || -> () {};
    |     ^^^^^
    |
    = note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
@@ -18,9 +9,9 @@ LL |     for<> || {};
    = help: consider removing `for<...>`
 
 error[E0658]: `for<...>` binders for closures are experimental
-  --> $DIR/feature-gate-closure_lifetime_binder.rs:5:5
+  --> $DIR/feature-gate-closure_lifetime_binder.rs:4:5
    |
-LL |     for<'a> || {};
+LL |     for<'a> || -> () {};
    |     ^^^^^^^
    |
    = note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
@@ -28,40 +19,15 @@ LL |     for<'a> || {};
    = help: consider removing `for<...>`
 
 error[E0658]: `for<...>` binders for closures are experimental
-  --> $DIR/feature-gate-closure_lifetime_binder.rs:8:5
+  --> $DIR/feature-gate-closure_lifetime_binder.rs:6:5
    |
-LL |     for<'a, 'b> |_: &'a ()| {};
+LL |     for<'a, 'b> |_: &'a ()| -> () {};
    |     ^^^^^^^^^^^
    |
    = note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
    = help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable
    = help: consider removing `for<...>`
 
-error: `for<...>` binders for closures are not yet supported
-  --> $DIR/feature-gate-closure_lifetime_binder.rs:2:5
-   |
-LL |     for<> || {};
-   |     ^^^^^
-   |
-   = help: consider removing `for<...>`
-
-error: `for<...>` binders for closures are not yet supported
-  --> $DIR/feature-gate-closure_lifetime_binder.rs:5:5
-   |
-LL |     for<'a> || {};
-   |     ^^^^^^^
-   |
-   = help: consider removing `for<...>`
-
-error: `for<...>` binders for closures are not yet supported
-  --> $DIR/feature-gate-closure_lifetime_binder.rs:8:5
-   |
-LL |     for<'a, 'b> |_: &'a ()| {};
-   |     ^^^^^^^^^^^
-   |
-   = help: consider removing `for<...>`
-
-error: aborting due to 7 previous errors
+error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0261, E0658.
-For more information about an error, try `rustc --explain E0261`.
+For more information about this error, try `rustc --explain E0658`.
diff --git a/src/test/ui/parser/recover-quantified-closure.rs b/src/test/ui/parser/recover-quantified-closure.rs
index a2bb7fde8ff..10af39b7007 100644
--- a/src/test/ui/parser/recover-quantified-closure.rs
+++ b/src/test/ui/parser/recover-quantified-closure.rs
@@ -1,8 +1,7 @@
 fn main() {
     for<'a> |x: &'a u8| *x + 1;
-    //~^ ERROR use of undeclared lifetime name `'a`
-    //~^^ ERROR `for<...>` binders for closures are experimental
-    //~^^^ ERROR `for<...>` binders for closures are not yet supported
+    //~^ ERROR `for<...>` binders for closures are experimental
+    //~^^ ERROR implicit types in closure signatures are forbidden when `for<...>` is present
 }
 
 enum Foo { Bar }
diff --git a/src/test/ui/parser/recover-quantified-closure.stderr b/src/test/ui/parser/recover-quantified-closure.stderr
index 168307ea65a..39eec80f658 100644
--- a/src/test/ui/parser/recover-quantified-closure.stderr
+++ b/src/test/ui/parser/recover-quantified-closure.stderr
@@ -1,17 +1,9 @@
 error: expected one of `move`, `static`, `|`, or `||`, found `::`
-  --> $DIR/recover-quantified-closure.rs:10:14
+  --> $DIR/recover-quantified-closure.rs:9:14
    |
 LL |     for <Foo>::Bar in x {}
    |              ^^ expected one of `move`, `static`, `|`, or `||`
 
-error[E0261]: use of undeclared lifetime name `'a`
-  --> $DIR/recover-quantified-closure.rs:2:18
-   |
-LL | fn main() {
-   |        - help: consider introducing lifetime `'a` here: `<'a>`
-LL |     for<'a> |x: &'a u8| *x + 1;
-   |                  ^^ undeclared lifetime
-
 error[E0658]: `for<...>` binders for closures are experimental
   --> $DIR/recover-quantified-closure.rs:2:5
    |
@@ -23,7 +15,7 @@ LL |     for<'a> |x: &'a u8| *x + 1;
    = help: consider removing `for<...>`
 
 error[E0658]: `for<...>` binders for closures are experimental
-  --> $DIR/recover-quantified-closure.rs:10:5
+  --> $DIR/recover-quantified-closure.rs:9:5
    |
 LL |     for <Foo>::Bar in x {}
    |     ^^^^^^^^^
@@ -32,15 +24,14 @@ LL |     for <Foo>::Bar in x {}
    = help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable
    = help: consider removing `for<...>`
 
-error: `for<...>` binders for closures are not yet supported
-  --> $DIR/recover-quantified-closure.rs:2:5
+error: implicit types in closure signatures are forbidden when `for<...>` is present
+  --> $DIR/recover-quantified-closure.rs:2:25
    |
 LL |     for<'a> |x: &'a u8| *x + 1;
-   |     ^^^^^^^
-   |
-   = help: consider removing `for<...>`
+   |     -------             ^
+   |     |
+   |     `for<...>` is here
 
-error: aborting due to 5 previous errors
+error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0261, E0658.
-For more information about an error, try `rustc --explain E0261`.
+For more information about this error, try `rustc --explain E0658`.