Skip to content
This repository was archived by the owner on Apr 8, 2024. It is now read-only.
This repository was archived by the owner on Apr 8, 2024. It is now read-only.

Handle IDENT restrictions #39

@ehuss

Description

@ehuss

Currently the grammar allows restricted identifiers in IDENT. However, libsyntax does not. parse_ident_common

The following are examples rejected by libsyntax:

mod _ {}
mod as {}
mod abstract {}
mod self {}

The restriction should include all strong and reserved keywords, and _.

_ is special, it is allowed in a few places:

Where Example
const item const _: i32 = 0;
extern crate as alias extern crate c as _;
use aliases use x as _;
extern block function parameter names extern { fn f(_: i32); }
function pointer type fn(_: i32)

self is allowed for extern crate self as foo;

Paths allow several keywords: super, self, Self, and crate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ambiguityPotential sources of ambiguitygrammarIssues with the definition of the rust grammarlexerIssues with the lexerrestrictionsIssues related to the permissiveness of the grammar

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions