Skip to content

Commit d4f5ae0

Browse files
committed
Remove the following unused special identifiers:
- underscore ("_") - unary ("unary") - not_fn ("!") - idx_fn ("[]") - unary_minus_fn ("unary-") - item ("item") - block ("block") - stmt ("stmt") - pat ("pat") - expr ("expr") - ty ("ty") - ident ("ident") - path ("path") - descrim ("descrim") - clownshoe_stack_shim ("__rust_stack_shim") - blk ("blk") - c_abi ("C") (And, of course, renumber everything to match.)
1 parent 267ac45 commit d4f5ae0

File tree

1 file changed

+67
-107
lines changed

1 file changed

+67
-107
lines changed

src/libsyntax/parse/token.rs

Lines changed: 67 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -374,128 +374,88 @@ macro_rules! declare_special_idents_and_keywords {(
374374
}}
375375

376376
// If modifying the numbers below, remember to modify these as appropriate
377-
static SELF_KEYWORD_NAME: Name = 8;
378-
static STATIC_KEYWORD_NAME: Name = 27;
379-
static STRICT_KEYWORD_START: Name = 32;
380-
static STRICT_KEYWORD_FINAL: Name = 65;
381-
static RESERVED_KEYWORD_START: Name = 66;
382-
static RESERVED_KEYWORD_FINAL: Name = 72;
377+
static SELF_KEYWORD_NAME: Name = 3;
378+
static STATIC_KEYWORD_NAME: Name = 10;
379+
static STRICT_KEYWORD_START: Name = 14;
380+
static STRICT_KEYWORD_FINAL: Name = 47;
381+
static RESERVED_KEYWORD_START: Name = 48;
382+
static RESERVED_KEYWORD_FINAL: Name = 54;
383383

384384
declare_special_idents_and_keywords! {
385385
pub mod special_idents {
386386
// These ones are statics
387-
(0, underscore, "_"); // apparently unused?
388-
(1, anon, "anon");
389-
(2, invalid, ""); // ''
390-
(3, unary, "unary"); // apparently unused?
391-
(4, not_fn, "!"); // apparently unused?
392-
(5, idx_fn, "[]"); // apparently unused?
393-
(6, unary_minus_fn, "unary-"); // apparently unused?
394-
(7, clownshoes_extensions, "__extensions__");
387+
388+
(0, anon, "anon");
389+
(1, invalid, ""); // ''
390+
(2, clownshoes_extensions, "__extensions__");
395391

396392
(super::SELF_KEYWORD_NAME, self_, "self"); // 'self'
397393

398-
/* for matcher NTs */
399-
// none of these appear to be used, but perhaps references to
400-
// these are artificially fabricated by the macro system....
401-
(9, item, "item");
402-
(10, block, "block");
403-
(11, stmt, "stmt");
404-
(12, pat, "pat");
405-
(13, expr, "expr");
406-
(14, ty, "ty");
407-
(15, ident, "ident");
408-
(16, path, "path");
409-
(17, tt, "tt");
410-
(18, matchers, "matchers");
411-
412-
// for the type // apparently unused?
413-
(19, str, "str");
414-
415-
/* outside of libsyntax */
416-
(20, arg, "arg");
417-
(21, descrim, "descrim");
418-
(22, clownshoe_abi, "__rust_abi");
419-
(23, clownshoe_stack_shim, "__rust_stack_shim");
420-
(24, main, "main");
421-
(25, opaque, "<opaque>");
422-
(26, blk, "blk");
394+
// for matcher NTs
395+
(4, tt, "tt");
396+
(5, matchers, "matchers");
397+
398+
// outside of libsyntax
399+
(6, arg, "arg");
400+
(7, clownshoe_abi, "__rust_abi");
401+
(8, main, "main");
402+
(9, opaque, "<opaque>");
423403
(super::STATIC_KEYWORD_NAME, statik, "static");
424-
(28, clownshoes_foreign_mod, "__foreign_mod__");
425-
(29, unnamed_field, "<unnamed_field>");
426-
(30, c_abi, "C"); // apparently unused?
427-
(31, type_self, "Self"); // `Self`
428-
429-
// here are the ones that actually occur in the source. Maybe the rest
430-
// should be removed?
431-
/*
432-
special_idents::anon
433-
special_idents::arg
434-
special_idents::blk
435-
special_idents::clownshoe_abi
436-
special_idents::clownshoe_stack_shim
437-
special_idents::clownshoes_extensions
438-
special_idents::clownshoes_foreign_mod
439-
special_idents::descrim
440-
special_idents::invalid
441-
special_idents::main
442-
special_idents::matchers
443-
special_idents::opaque
444-
special_idents::self_
445-
special_idents::statik
446-
special_idents::tt
447-
special_idents::type_self
448-
special_idents::unnamed_field
449-
*/
404+
(11, clownshoes_foreign_mod, "__foreign_mod__");
405+
(12, unnamed_field, "<unnamed_field>");
406+
(13, type_self, "Self"); // `Self`
450407
}
451408

452409
pub mod keywords {
453410
// These ones are variants of the Keyword enum
454-
(32, As, "as");
455-
(33, Break, "break");
456-
(34, Const, "const");
457-
(35, Do, "do");
458-
(36, Else, "else");
459-
(37, Enum, "enum");
460-
(38, Extern, "extern");
461-
(39, False, "false");
462-
(40, Fn, "fn");
463-
(41, For, "for");
464-
(42, If, "if");
465-
(43, Impl, "impl");
466-
(44, In, "in");
467-
(45, Let, "let");
468-
(46, __LogLevel, "__log_level");
469-
(47, Loop, "loop");
470-
(48, Match, "match");
471-
(49, Mod, "mod");
472-
(50, Mut, "mut");
473-
(51, Once, "once");
474-
(52, Priv, "priv");
475-
(53, Pub, "pub");
476-
(54, Ref, "ref");
477-
(55, Return, "return");
411+
412+
// Strict keywords
413+
(14, As, "as");
414+
(15, Break, "break");
415+
(16, Const, "const");
416+
(17, Do, "do");
417+
(18, Else, "else");
418+
(19, Enum, "enum");
419+
(20, Extern, "extern");
420+
(21, False, "false");
421+
(22, Fn, "fn");
422+
(23, For, "for");
423+
(24, If, "if");
424+
(25, Impl, "impl");
425+
(26, In, "in");
426+
(27, Let, "let");
427+
(28, __LogLevel, "__log_level");
428+
(29, Loop, "loop");
429+
(30, Match, "match");
430+
(31, Mod, "mod");
431+
(32, Mut, "mut");
432+
(33, Once, "once");
433+
(34, Priv, "priv");
434+
(35, Pub, "pub");
435+
(36, Ref, "ref");
436+
(37, Return, "return");
478437
// Static and Self are also special idents (prefill de-dupes)
479438
(super::STATIC_KEYWORD_NAME, Static, "static");
480439
(super::SELF_KEYWORD_NAME, Self, "self");
481-
(56, Struct, "struct");
482-
(57, Super, "super");
483-
(58, True, "true");
484-
(59, Trait, "trait");
485-
(60, Type, "type");
486-
(61, Unsafe, "unsafe");
487-
(62, Use, "use");
488-
(63, While, "while");
489-
(64, Continue, "continue");
490-
(65, Proc, "proc");
491-
492-
(66, Alignof, "alignof");
493-
(67, Be, "be");
494-
(68, Offsetof, "offsetof");
495-
(69, Pure, "pure");
496-
(70, Sizeof, "sizeof");
497-
(71, Typeof, "typeof");
498-
(72, Yield, "yield");
440+
(38, Struct, "struct");
441+
(39, Super, "super");
442+
(40, True, "true");
443+
(41, Trait, "trait");
444+
(42, Type, "type");
445+
(43, Unsafe, "unsafe");
446+
(44, Use, "use");
447+
(45, While, "while");
448+
(46, Continue, "continue");
449+
(47, Proc, "proc");
450+
451+
// Reserved keywords
452+
(48, Alignof, "alignof");
453+
(49, Be, "be");
454+
(50, Offsetof, "offsetof");
455+
(51, Pure, "pure");
456+
(52, Sizeof, "sizeof");
457+
(53, Typeof, "typeof");
458+
(54, Yield, "yield");
499459
}
500460
}
501461

0 commit comments

Comments
 (0)