Open ehuss opened 5 years ago
Currently the grammar allows restricted identifiers in IDENT. However, libsyntax does not. parse_ident_common
IDENT
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:
const
const _: i32 = 0;
extern crate
as
extern crate c as _;
use
use x as _;
extern
extern { fn f(_: i32); }
fn(_: i32)
self is allowed for extern crate self as foo;
self
extern crate self as foo;
Paths allow several keywords: super, self, Self, and crate.
super
Self
crate
Currently the grammar allows restricted identifiers in
IDENT
. However, libsyntax does not.parse_ident_common
The following are examples rejected by libsyntax:
The restriction should include all strong and reserved keywords, and
_
._
is special, it is allowed in a few places:const
itemconst _: i32 = 0;
extern crate
as
aliasextern crate c as _;
use
aliasesuse x as _;
extern
block function parameter namesextern { fn f(_: i32); }
fn(_: i32)
self
is allowed forextern crate self as foo;
Paths allow several keywords:
super
,self
,Self
, andcrate
.