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
5 changes: 3 additions & 2 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,12 @@ module.exports = grammar({
field('bounds', $.trait_bounds),
),

impl_item: $ => seq(
impl_item: $ => prec(1, seq(
optional('unsafe'),
'impl',
field('type_parameters', optional($.type_parameters)),
optional(seq(
optional('const'),
optional('!'),
field('trait', choice(
$._type_identifier,
Expand All @@ -504,7 +505,7 @@ module.exports = grammar({
field('type', $._type),
optional($.where_clause),
choice(field('body', $.declaration_list), ';'),
),
)),

trait_item: $ => seq(
optional($.visibility_modifier),
Expand Down
15 changes: 15 additions & 0 deletions test/corpus/declarations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1667,6 +1667,21 @@ unsafe impl Foo {
(type_identifier)
(declaration_list)))

================================================================================
Const impls
================================================================================

impl const Foo for Bar {
}

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

(source_file
(impl_item
(type_identifier)
(type_identifier)
(declaration_list)))

================================================================================
Disable automatically derived trait impls
================================================================================
Expand Down