From c45b6f815dd405fc7b4984d326c05bf75b48d432 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Fri, 6 Jun 2025 18:04:08 +0200 Subject: [PATCH] feat: Extern types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tracking issue: https://github.com/rust-lang/rust/issues/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. --- grammar.js | 1 + test/corpus/declarations.txt | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/grammar.js b/grammar.js index 1907a3a3..47ca711e 100644 --- a/grammar.js +++ b/grammar.js @@ -518,6 +518,7 @@ module.exports = grammar({ ), associated_type: $ => seq( + optional($.visibility_modifier), 'type', field('name', $._type_identifier), field('type_parameters', optional($.type_parameters)), diff --git a/test/corpus/declarations.txt b/test/corpus/declarations.txt index 77195e86..5a3c7530 100644 --- a/test/corpus/declarations.txt +++ b/test/corpus/declarations.txt @@ -2091,6 +2091,24 @@ where (type_identifier))))))) (block))) +================================================================================ +Extern types +================================================================================ + +extern { + pub type Opaque; +} + +-------------------------------------------------------------------------------- + +(source_file + (foreign_mod_item + (extern_modifier) + (declaration_list + (associated_type + (visibility_modifier) + (type_identifier))))) + ================================================================================ Higher-ranked types ================================================================================