fix: Add trait alias grammar to rust.ungram

This commit is contained in:
Lukas Wirth 2022-11-11 15:25:15 +01:00
parent add85397ae
commit 6674bd898e
6 changed files with 37 additions and 22 deletions

View file

@ -239,8 +239,11 @@ Static =
Trait =
Attr* Visibility?
'unsafe'? 'auto'?
'trait' Name GenericParamList? (':' TypeBoundList?)? WhereClause?
AssocItemList
'trait' Name GenericParamList?
(
(':' TypeBoundList?)? WhereClause? AssocItemList
| '=' TypeBoundList? WhereClause? ';'
)
AssocItemList =
'{' Attr* AssocItem* '}'

View file

@ -407,6 +407,8 @@ impl Trait {
pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) }
pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) }
pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) }
pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) }
pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) }
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]