Skip to content

Keyword table in the language reference is not updated #17969

Closed
@nodakai

Description

@nodakai

Compare

as
box break
continue crate
else enum extern
false fn for
if impl in
let loop
match mod mut
priv proc pub
ref return
self static struct super
trait true type
unsafe use
while

with

    pub mod keywords {
        // These ones are variants of the Keyword enum

        'strict:
        (12,                         As,         "as");
        (13,                         Break,      "break");
        (14,                         Crate,      "crate");
        (15,                         Else,       "else");
        (16,                         Enum,       "enum");
        (17,                         Extern,     "extern");
        (18,                         False,      "false");
        (19,                         Fn,         "fn");
        (20,                         For,        "for");
        (21,                         If,         "if");
        (22,                         Impl,       "impl");
        (23,                         In,         "in");
        (24,                         Let,        "let");
        (25,                         Loop,       "loop");
        (26,                         Match,      "match");
        (27,                         Mod,        "mod");
        (28,                         Move,       "move");
        (29,                         Mut,        "mut");
        (30,                         Once,       "once");
        (31,                         Pub,        "pub");
        (32,                         Ref,        "ref");
        (33,                         Return,     "return");
        // Static and Self are also special idents (prefill de-dupes)
        (super::STATIC_KEYWORD_NAME_NUM, Static, "static");
        (super::SELF_KEYWORD_NAME_NUM,   Self,   "self");
        (34,                         Struct,     "struct");
        (super::SUPER_KEYWORD_NAME_NUM, Super,   "super");
        (35,                         True,       "true");
        (36,                         Trait,      "trait");
        (37,                         Type,       "type");
        (38,                         Unsafe,     "unsafe");
        (39,                         Use,        "use");
        (40,                         Virtual,    "virtual");
        (41,                         While,      "while");
        (42,                         Continue,   "continue");
        (43,                         Proc,       "proc");
        (44,                         Box,        "box");
        (45,                         Const,      "const");
        (46,                         Where,      "where");

        'reserved:
        (47,                         Alignof,    "alignof");
        (48,                         Be,         "be");
        (49,                         Offsetof,   "offsetof");
        (50,                         Priv,       "priv");
        (51,                         Pure,       "pure");
        (52,                         Sizeof,     "sizeof");
        (53,                         Typeof,     "typeof");
        (54,                         Unsized,    "unsized");
        (55,                         Yield,      "yield");
        (56,                         Do,         "do");
        (57,                         Abstract,   "abstract");
        (58,                         Final,      "final");
        (59,                         Override,   "override");
    }

from https://github.com/rust-lang/rust/blob/master/src/libsyntax/parse/token.rs#L468

I'm not sure how to treat obsoleted but still "reserved" keywords such as do. (Maybe we can refer to Java's const ??)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions