Skip to content

Commit 717f46f

Browse files
committed
feat: Extern types
Tracking issue: rust-lang/rust#43467 I am not sure if the parsing as an associated type is really ideal, but introducing a specific node type would likely introduce more conflicts.
1 parent 261b202 commit 717f46f

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

grammar.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,7 @@ module.exports = grammar({
519519
),
520520

521521
associated_type: $ => seq(
522+
optional($.visibility_modifier),
522523
'type',
523524
field('name', $._type_identifier),
524525
field('type_parameters', optional($.type_parameters)),

test/corpus/declarations.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2091,6 +2091,24 @@ where
20912091
(type_identifier)))))))
20922092
(block)))
20932093

2094+
================================================================================
2095+
Extern types
2096+
================================================================================
2097+
2098+
extern {
2099+
pub type Opaque;
2100+
}
2101+
2102+
--------------------------------------------------------------------------------
2103+
2104+
(source_file
2105+
(foreign_mod_item
2106+
(extern_modifier)
2107+
(declaration_list
2108+
(associated_type
2109+
(visibility_modifier)
2110+
(type_identifier)))))
2111+
20942112
================================================================================
20952113
Higher-ranked types
20962114
================================================================================

0 commit comments

Comments
 (0)