Skip to content

Parse non-lifetime binders on closures #1906

@dtolnay

Description

@dtolnay

This is the intersection of rust-lang/rust#97362 with rust-lang/rust#108185.

fn main() {
    let _ = for<T> |_: T| {};
}
error: expected `::`
 --> dev/main.rs:2:20
  |
2 |     let _ = for<T> |_: T| {};
  |                    ^

Syn is expecting :: as if it were something like this:

struct T;

impl T {
    const UNIT: () = ();
}

fn main() {
    let _ = for <T>::UNIT in None {};
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions