Skip to content

Putting a lifetime on @ skips the next token and forces fn. #8615

Closed

Description

fn main() {
    // expected `fn`, but found `;`
    // let _: @'static int;

    let _: @'static whatever fn();
    let _: @'static + fn() = || {};
    let _: @'static for fn() = || {};
    let _: @'static "a string" fn() = || {};
    let _: @'static 'a fn() = || {};

    // Illegal lifetime: named region `&'a` not in scope here
    // let _: @'a whatever fn();
}

The last example is just showing that the 'static actually get parsed as a lifetime.

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

Metadata

Assignees

No one assigned

    Labels

    A-parserArea: The parsing of Rust source code to an AST

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions