Skip to content

Commit cd2da7d

Browse files
committed
auto merge of #9389 : poiru/rust/issue-9333, r=alexcrichton
Closes #9333.
2 parents be5db48 + 2ab278f commit cd2da7d

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/etc/vim/syntax/rust.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ syn match rustIdentifier contains=rustIdentifierPrime "\%([^[:cntrl:][:spac
3434
syn match rustFuncName "\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*" display contained
3535

3636
" Reserved (but not yet used) keywords {{{2
37-
syn keyword rustKeyword be yield typeof
37+
syn keyword rustKeyword alignof be offsetof pure sizeof typeof yield
3838

3939
" Built-in types {{{2
4040
syn keyword rustType int uint float char bool u8 u16 u32 u64 f32

src/libsyntax/parse/token.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,9 @@ fn mk_fresh_ident_interner() -> @ident_interner {
482482
"pure", // 65
483483
"yield", // 66
484484
"typeof", // 67
485+
"alignof", // 68
486+
"offsetof", // 69
487+
"sizeof", // 70
485488
];
486489

487490
@interner::StrInterner::prefill(init_vec)
@@ -622,14 +625,17 @@ pub mod keywords {
622625
True,
623626
Trait,
624627
Type,
625-
Typeof,
626628
Unsafe,
627629
Use,
628630
While,
629631

630632
// Reserved keywords
633+
Alignof,
631634
Be,
635+
Offsetof,
632636
Pure,
637+
Sizeof,
638+
Typeof,
633639
Yield,
634640
}
635641

@@ -667,12 +673,16 @@ pub mod keywords {
667673
True => Ident { name: 57, ctxt: 0 },
668674
Trait => Ident { name: 58, ctxt: 0 },
669675
Type => Ident { name: 59, ctxt: 0 },
670-
Typeof => Ident { name: 67, ctxt: 0 },
671676
Unsafe => Ident { name: 60, ctxt: 0 },
672677
Use => Ident { name: 61, ctxt: 0 },
673678
While => Ident { name: 62, ctxt: 0 },
679+
680+
Alignof => Ident { name: 68, ctxt: 0 },
674681
Be => Ident { name: 64, ctxt: 0 },
682+
Offsetof => Ident { name: 69, ctxt: 0 },
675683
Pure => Ident { name: 65, ctxt: 0 },
684+
Sizeof => Ident { name: 70, ctxt: 0 },
685+
Typeof => Ident { name: 67, ctxt: 0 },
676686
Yield => Ident { name: 66, ctxt: 0 },
677687
}
678688
}
@@ -689,7 +699,7 @@ pub fn is_keyword(kw: keywords::Keyword, tok: &Token) -> bool {
689699
pub fn is_any_keyword(tok: &Token) -> bool {
690700
match *tok {
691701
token::IDENT(sid, false) => match sid.name {
692-
8 | 27 | 32 .. 67 => true,
702+
8 | 27 | 32 .. 70 => true,
693703
_ => false,
694704
},
695705
_ => false
@@ -709,7 +719,7 @@ pub fn is_strict_keyword(tok: &Token) -> bool {
709719
pub fn is_reserved_keyword(tok: &Token) -> bool {
710720
match *tok {
711721
token::IDENT(sid, false) => match sid.name {
712-
64 .. 67 => true,
722+
64 .. 70 => true,
713723
_ => false,
714724
},
715725
_ => false,

0 commit comments

Comments
 (0)