Skip to content

Parse non-lifetime binders on closures #1906

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 {};
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions