fix parser mistaking const closures for const item

This commit is contained in:
Deadbeef 2023-02-01 05:55:48 +00:00
parent ad8e1dc286
commit 679dde7338
5 changed files with 30 additions and 9 deletions

View file

@ -7,6 +7,6 @@ fn main() {
enum Foo { Bar }
fn foo(x: impl Iterator<Item = Foo>) {
for <Foo>::Bar in x {}
//~^ ERROR expected one of `const`, `move`, `static`, `|`
//~^ ERROR expected one of `move`, `static`, `|`
//~^^ ERROR `for<...>` binders for closures are experimental
}

View file

@ -1,8 +1,8 @@
error: expected one of `const`, `move`, `static`, `|`, or `||`, found `::`
error: expected one of `move`, `static`, `|`, or `||`, found `::`
--> $DIR/recover-quantified-closure.rs:9:14
|
LL | for <Foo>::Bar in x {}
| ^^ expected one of `const`, `move`, `static`, `|`, or `||`
| ^^ expected one of `move`, `static`, `|`, or `||`
error[E0658]: `for<...>` binders for closures are experimental
--> $DIR/recover-quantified-closure.rs:2:5

View file

@ -0,0 +1,10 @@
// check-pass
#![feature(const_trait_impl, const_closures)]
#![allow(incomplete_features)]
const fn test() -> impl ~const Fn() {
const move || {}
}
fn main() {}