Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ module.exports = grammar({
alias(choice(...primitiveTypes), $.primitive_type),
prec.right(repeat1(choice(...TOKEN_TREE_NON_SPECIAL_PUNCTUATION))),
'\'',
'as', 'async', 'await', 'break', 'const', 'continue', 'default', 'enum', 'fn', 'for', 'gen',
'as', 'async', 'auto', 'await', 'break', 'const', 'continue', 'default', 'enum', 'fn', 'for', 'gen',
'if', 'impl', 'let', 'loop', 'match', 'mod', 'pub', 'return', 'static', 'struct', 'trait',
'type', 'union', 'unsafe', 'use', 'where', 'while',
),
Expand Down Expand Up @@ -509,6 +509,7 @@ module.exports = grammar({
trait_item: $ => seq(
optional($.visibility_modifier),
optional('unsafe'),
optional('auto'),
'trait',
field('name', $._type_identifier),
field('type_parameters', optional($.type_parameters)),
Expand Down
7 changes: 6 additions & 1 deletion test/corpus/declarations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ unsafe impl Trait for dyn (::std::any::Any) + Send { }
(scoped_identifier
(identifier))
(identifier))
(type_identifier))))
(type_identifier))))
(type_identifier))
(declaration_list)))

Expand Down Expand Up @@ -1786,6 +1786,8 @@ pub trait Item: Clone + Eq + fmt::Debug {

unsafe trait Foo { }

unsafe auto trait Bar { }

--------------------------------------------------------------------------------

(source_file
Expand All @@ -1807,6 +1809,9 @@ unsafe trait Foo { }
(scoped_type_identifier
(identifier)
(type_identifier)))))
(trait_item
(type_identifier)
(declaration_list))
(trait_item
(type_identifier)
(declaration_list)))
Expand Down