aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1142
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera16
2 files changed, 961 insertions, 197 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 420d9090c..3878c99a8 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -9,6 +9,8 @@
9 9
10#![cfg_attr(rustfmt, rustfmt_skip)] 10#![cfg_attr(rustfmt, rustfmt_skip)]
11 11
12use std::hash::{Hash, Hasher};
13
12use crate::{ 14use crate::{
13 ast, 15 ast,
14 SyntaxNode, SyntaxNodeRef, AstNode, 16 SyntaxNode, SyntaxNodeRef, AstNode,
@@ -17,12 +19,20 @@ use crate::{
17}; 19};
18 20
19// ArgList 21// ArgList
20#[derive(Debug, Clone, Copy)] 22#[derive(Debug, Clone, Copy,)]
21pub struct ArgListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 23pub struct ArgListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
22 syntax: SyntaxNode<R>, 24 pub(crate) syntax: SyntaxNode<R>,
23} 25}
24pub type ArgList<'a> = ArgListNode<RefRoot<'a>>; 26pub type ArgList<'a> = ArgListNode<RefRoot<'a>>;
25 27
28impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ArgListNode<R1>> for ArgListNode<R2> {
29 fn eq(&self, other: &ArgListNode<R1>) -> bool { self.syntax == other.syntax }
30}
31impl<R: TreeRoot<RaTypes>> Eq for ArgListNode<R> {}
32impl<R: TreeRoot<RaTypes>> Hash for ArgListNode<R> {
33 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
34}
35
26impl<'a> AstNode<'a> for ArgList<'a> { 36impl<'a> AstNode<'a> for ArgList<'a> {
27 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 37 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
28 match syntax.kind() { 38 match syntax.kind() {
@@ -50,12 +60,20 @@ impl<'a> ArgList<'a> {
50} 60}
51 61
52// ArrayExpr 62// ArrayExpr
53#[derive(Debug, Clone, Copy)] 63#[derive(Debug, Clone, Copy,)]
54pub struct ArrayExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 64pub struct ArrayExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
55 syntax: SyntaxNode<R>, 65 pub(crate) syntax: SyntaxNode<R>,
56} 66}
57pub type ArrayExpr<'a> = ArrayExprNode<RefRoot<'a>>; 67pub type ArrayExpr<'a> = ArrayExprNode<RefRoot<'a>>;
58 68
69impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ArrayExprNode<R1>> for ArrayExprNode<R2> {
70 fn eq(&self, other: &ArrayExprNode<R1>) -> bool { self.syntax == other.syntax }
71}
72impl<R: TreeRoot<RaTypes>> Eq for ArrayExprNode<R> {}
73impl<R: TreeRoot<RaTypes>> Hash for ArrayExprNode<R> {
74 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
75}
76
59impl<'a> AstNode<'a> for ArrayExpr<'a> { 77impl<'a> AstNode<'a> for ArrayExpr<'a> {
60 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 78 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
61 match syntax.kind() { 79 match syntax.kind() {
@@ -79,12 +97,20 @@ impl<R: TreeRoot<RaTypes>> ArrayExprNode<R> {
79impl<'a> ArrayExpr<'a> {} 97impl<'a> ArrayExpr<'a> {}
80 98
81// ArrayType 99// ArrayType
82#[derive(Debug, Clone, Copy)] 100#[derive(Debug, Clone, Copy,)]
83pub struct ArrayTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 101pub struct ArrayTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
84 syntax: SyntaxNode<R>, 102 pub(crate) syntax: SyntaxNode<R>,
85} 103}
86pub type ArrayType<'a> = ArrayTypeNode<RefRoot<'a>>; 104pub type ArrayType<'a> = ArrayTypeNode<RefRoot<'a>>;
87 105
106impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ArrayTypeNode<R1>> for ArrayTypeNode<R2> {
107 fn eq(&self, other: &ArrayTypeNode<R1>) -> bool { self.syntax == other.syntax }
108}
109impl<R: TreeRoot<RaTypes>> Eq for ArrayTypeNode<R> {}
110impl<R: TreeRoot<RaTypes>> Hash for ArrayTypeNode<R> {
111 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
112}
113
88impl<'a> AstNode<'a> for ArrayType<'a> { 114impl<'a> AstNode<'a> for ArrayType<'a> {
89 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 115 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
90 match syntax.kind() { 116 match syntax.kind() {
@@ -108,12 +134,20 @@ impl<R: TreeRoot<RaTypes>> ArrayTypeNode<R> {
108impl<'a> ArrayType<'a> {} 134impl<'a> ArrayType<'a> {}
109 135
110// Attr 136// Attr
111#[derive(Debug, Clone, Copy)] 137#[derive(Debug, Clone, Copy,)]
112pub struct AttrNode<R: TreeRoot<RaTypes> = OwnedRoot> { 138pub struct AttrNode<R: TreeRoot<RaTypes> = OwnedRoot> {
113 syntax: SyntaxNode<R>, 139 pub(crate) syntax: SyntaxNode<R>,
114} 140}
115pub type Attr<'a> = AttrNode<RefRoot<'a>>; 141pub type Attr<'a> = AttrNode<RefRoot<'a>>;
116 142
143impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<AttrNode<R1>> for AttrNode<R2> {
144 fn eq(&self, other: &AttrNode<R1>) -> bool { self.syntax == other.syntax }
145}
146impl<R: TreeRoot<RaTypes>> Eq for AttrNode<R> {}
147impl<R: TreeRoot<RaTypes>> Hash for AttrNode<R> {
148 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
149}
150
117impl<'a> AstNode<'a> for Attr<'a> { 151impl<'a> AstNode<'a> for Attr<'a> {
118 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 152 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
119 match syntax.kind() { 153 match syntax.kind() {
@@ -141,12 +175,20 @@ impl<'a> Attr<'a> {
141} 175}
142 176
143// BinExpr 177// BinExpr
144#[derive(Debug, Clone, Copy)] 178#[derive(Debug, Clone, Copy,)]
145pub struct BinExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 179pub struct BinExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
146 syntax: SyntaxNode<R>, 180 pub(crate) syntax: SyntaxNode<R>,
147} 181}
148pub type BinExpr<'a> = BinExprNode<RefRoot<'a>>; 182pub type BinExpr<'a> = BinExprNode<RefRoot<'a>>;
149 183
184impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BinExprNode<R1>> for BinExprNode<R2> {
185 fn eq(&self, other: &BinExprNode<R1>) -> bool { self.syntax == other.syntax }
186}
187impl<R: TreeRoot<RaTypes>> Eq for BinExprNode<R> {}
188impl<R: TreeRoot<RaTypes>> Hash for BinExprNode<R> {
189 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
190}
191
150impl<'a> AstNode<'a> for BinExpr<'a> { 192impl<'a> AstNode<'a> for BinExpr<'a> {
151 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 193 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
152 match syntax.kind() { 194 match syntax.kind() {
@@ -170,12 +212,20 @@ impl<R: TreeRoot<RaTypes>> BinExprNode<R> {
170impl<'a> BinExpr<'a> {} 212impl<'a> BinExpr<'a> {}
171 213
172// BindPat 214// BindPat
173#[derive(Debug, Clone, Copy)] 215#[derive(Debug, Clone, Copy,)]
174pub struct BindPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 216pub struct BindPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
175 syntax: SyntaxNode<R>, 217 pub(crate) syntax: SyntaxNode<R>,
176} 218}
177pub type BindPat<'a> = BindPatNode<RefRoot<'a>>; 219pub type BindPat<'a> = BindPatNode<RefRoot<'a>>;
178 220
221impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BindPatNode<R1>> for BindPatNode<R2> {
222 fn eq(&self, other: &BindPatNode<R1>) -> bool { self.syntax == other.syntax }
223}
224impl<R: TreeRoot<RaTypes>> Eq for BindPatNode<R> {}
225impl<R: TreeRoot<RaTypes>> Hash for BindPatNode<R> {
226 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
227}
228
179impl<'a> AstNode<'a> for BindPat<'a> { 229impl<'a> AstNode<'a> for BindPat<'a> {
180 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 230 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
181 match syntax.kind() { 231 match syntax.kind() {
@@ -200,12 +250,20 @@ impl<'a> ast::NameOwner<'a> for BindPat<'a> {}
200impl<'a> BindPat<'a> {} 250impl<'a> BindPat<'a> {}
201 251
202// Block 252// Block
203#[derive(Debug, Clone, Copy)] 253#[derive(Debug, Clone, Copy,)]
204pub struct BlockNode<R: TreeRoot<RaTypes> = OwnedRoot> { 254pub struct BlockNode<R: TreeRoot<RaTypes> = OwnedRoot> {
205 syntax: SyntaxNode<R>, 255 pub(crate) syntax: SyntaxNode<R>,
206} 256}
207pub type Block<'a> = BlockNode<RefRoot<'a>>; 257pub type Block<'a> = BlockNode<RefRoot<'a>>;
208 258
259impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BlockNode<R1>> for BlockNode<R2> {
260 fn eq(&self, other: &BlockNode<R1>) -> bool { self.syntax == other.syntax }
261}
262impl<R: TreeRoot<RaTypes>> Eq for BlockNode<R> {}
263impl<R: TreeRoot<RaTypes>> Hash for BlockNode<R> {
264 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
265}
266
209impl<'a> AstNode<'a> for Block<'a> { 267impl<'a> AstNode<'a> for Block<'a> {
210 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 268 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
211 match syntax.kind() { 269 match syntax.kind() {
@@ -237,12 +295,20 @@ impl<'a> Block<'a> {
237} 295}
238 296
239// BlockExpr 297// BlockExpr
240#[derive(Debug, Clone, Copy)] 298#[derive(Debug, Clone, Copy,)]
241pub struct BlockExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 299pub struct BlockExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
242 syntax: SyntaxNode<R>, 300 pub(crate) syntax: SyntaxNode<R>,
243} 301}
244pub type BlockExpr<'a> = BlockExprNode<RefRoot<'a>>; 302pub type BlockExpr<'a> = BlockExprNode<RefRoot<'a>>;
245 303
304impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BlockExprNode<R1>> for BlockExprNode<R2> {
305 fn eq(&self, other: &BlockExprNode<R1>) -> bool { self.syntax == other.syntax }
306}
307impl<R: TreeRoot<RaTypes>> Eq for BlockExprNode<R> {}
308impl<R: TreeRoot<RaTypes>> Hash for BlockExprNode<R> {
309 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
310}
311
246impl<'a> AstNode<'a> for BlockExpr<'a> { 312impl<'a> AstNode<'a> for BlockExpr<'a> {
247 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 313 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
248 match syntax.kind() { 314 match syntax.kind() {
@@ -270,12 +336,20 @@ impl<'a> BlockExpr<'a> {
270} 336}
271 337
272// BreakExpr 338// BreakExpr
273#[derive(Debug, Clone, Copy)] 339#[derive(Debug, Clone, Copy,)]
274pub struct BreakExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 340pub struct BreakExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
275 syntax: SyntaxNode<R>, 341 pub(crate) syntax: SyntaxNode<R>,
276} 342}
277pub type BreakExpr<'a> = BreakExprNode<RefRoot<'a>>; 343pub type BreakExpr<'a> = BreakExprNode<RefRoot<'a>>;
278 344
345impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<BreakExprNode<R1>> for BreakExprNode<R2> {
346 fn eq(&self, other: &BreakExprNode<R1>) -> bool { self.syntax == other.syntax }
347}
348impl<R: TreeRoot<RaTypes>> Eq for BreakExprNode<R> {}
349impl<R: TreeRoot<RaTypes>> Hash for BreakExprNode<R> {
350 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
351}
352
279impl<'a> AstNode<'a> for BreakExpr<'a> { 353impl<'a> AstNode<'a> for BreakExpr<'a> {
280 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 354 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
281 match syntax.kind() { 355 match syntax.kind() {
@@ -299,12 +373,20 @@ impl<R: TreeRoot<RaTypes>> BreakExprNode<R> {
299impl<'a> BreakExpr<'a> {} 373impl<'a> BreakExpr<'a> {}
300 374
301// CallExpr 375// CallExpr
302#[derive(Debug, Clone, Copy)] 376#[derive(Debug, Clone, Copy,)]
303pub struct CallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 377pub struct CallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
304 syntax: SyntaxNode<R>, 378 pub(crate) syntax: SyntaxNode<R>,
305} 379}
306pub type CallExpr<'a> = CallExprNode<RefRoot<'a>>; 380pub type CallExpr<'a> = CallExprNode<RefRoot<'a>>;
307 381
382impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CallExprNode<R1>> for CallExprNode<R2> {
383 fn eq(&self, other: &CallExprNode<R1>) -> bool { self.syntax == other.syntax }
384}
385impl<R: TreeRoot<RaTypes>> Eq for CallExprNode<R> {}
386impl<R: TreeRoot<RaTypes>> Hash for CallExprNode<R> {
387 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
388}
389
308impl<'a> AstNode<'a> for CallExpr<'a> { 390impl<'a> AstNode<'a> for CallExpr<'a> {
309 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 391 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
310 match syntax.kind() { 392 match syntax.kind() {
@@ -333,12 +415,20 @@ impl<'a> CallExpr<'a> {
333} 415}
334 416
335// CastExpr 417// CastExpr
336#[derive(Debug, Clone, Copy)] 418#[derive(Debug, Clone, Copy,)]
337pub struct CastExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 419pub struct CastExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
338 syntax: SyntaxNode<R>, 420 pub(crate) syntax: SyntaxNode<R>,
339} 421}
340pub type CastExpr<'a> = CastExprNode<RefRoot<'a>>; 422pub type CastExpr<'a> = CastExprNode<RefRoot<'a>>;
341 423
424impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CastExprNode<R1>> for CastExprNode<R2> {
425 fn eq(&self, other: &CastExprNode<R1>) -> bool { self.syntax == other.syntax }
426}
427impl<R: TreeRoot<RaTypes>> Eq for CastExprNode<R> {}
428impl<R: TreeRoot<RaTypes>> Hash for CastExprNode<R> {
429 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
430}
431
342impl<'a> AstNode<'a> for CastExpr<'a> { 432impl<'a> AstNode<'a> for CastExpr<'a> {
343 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 433 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
344 match syntax.kind() { 434 match syntax.kind() {
@@ -362,12 +452,20 @@ impl<R: TreeRoot<RaTypes>> CastExprNode<R> {
362impl<'a> CastExpr<'a> {} 452impl<'a> CastExpr<'a> {}
363 453
364// Char 454// Char
365#[derive(Debug, Clone, Copy)] 455#[derive(Debug, Clone, Copy,)]
366pub struct CharNode<R: TreeRoot<RaTypes> = OwnedRoot> { 456pub struct CharNode<R: TreeRoot<RaTypes> = OwnedRoot> {
367 syntax: SyntaxNode<R>, 457 pub(crate) syntax: SyntaxNode<R>,
368} 458}
369pub type Char<'a> = CharNode<RefRoot<'a>>; 459pub type Char<'a> = CharNode<RefRoot<'a>>;
370 460
461impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CharNode<R1>> for CharNode<R2> {
462 fn eq(&self, other: &CharNode<R1>) -> bool { self.syntax == other.syntax }
463}
464impl<R: TreeRoot<RaTypes>> Eq for CharNode<R> {}
465impl<R: TreeRoot<RaTypes>> Hash for CharNode<R> {
466 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
467}
468
371impl<'a> AstNode<'a> for Char<'a> { 469impl<'a> AstNode<'a> for Char<'a> {
372 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 470 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
373 match syntax.kind() { 471 match syntax.kind() {
@@ -391,12 +489,20 @@ impl<R: TreeRoot<RaTypes>> CharNode<R> {
391impl<'a> Char<'a> {} 489impl<'a> Char<'a> {}
392 490
393// Comment 491// Comment
394#[derive(Debug, Clone, Copy)] 492#[derive(Debug, Clone, Copy,)]
395pub struct CommentNode<R: TreeRoot<RaTypes> = OwnedRoot> { 493pub struct CommentNode<R: TreeRoot<RaTypes> = OwnedRoot> {
396 syntax: SyntaxNode<R>, 494 pub(crate) syntax: SyntaxNode<R>,
397} 495}
398pub type Comment<'a> = CommentNode<RefRoot<'a>>; 496pub type Comment<'a> = CommentNode<RefRoot<'a>>;
399 497
498impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CommentNode<R1>> for CommentNode<R2> {
499 fn eq(&self, other: &CommentNode<R1>) -> bool { self.syntax == other.syntax }
500}
501impl<R: TreeRoot<RaTypes>> Eq for CommentNode<R> {}
502impl<R: TreeRoot<RaTypes>> Hash for CommentNode<R> {
503 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
504}
505
400impl<'a> AstNode<'a> for Comment<'a> { 506impl<'a> AstNode<'a> for Comment<'a> {
401 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 507 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
402 match syntax.kind() { 508 match syntax.kind() {
@@ -420,12 +526,20 @@ impl<R: TreeRoot<RaTypes>> CommentNode<R> {
420impl<'a> Comment<'a> {} 526impl<'a> Comment<'a> {}
421 527
422// Condition 528// Condition
423#[derive(Debug, Clone, Copy)] 529#[derive(Debug, Clone, Copy,)]
424pub struct ConditionNode<R: TreeRoot<RaTypes> = OwnedRoot> { 530pub struct ConditionNode<R: TreeRoot<RaTypes> = OwnedRoot> {
425 syntax: SyntaxNode<R>, 531 pub(crate) syntax: SyntaxNode<R>,
426} 532}
427pub type Condition<'a> = ConditionNode<RefRoot<'a>>; 533pub type Condition<'a> = ConditionNode<RefRoot<'a>>;
428 534
535impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ConditionNode<R1>> for ConditionNode<R2> {
536 fn eq(&self, other: &ConditionNode<R1>) -> bool { self.syntax == other.syntax }
537}
538impl<R: TreeRoot<RaTypes>> Eq for ConditionNode<R> {}
539impl<R: TreeRoot<RaTypes>> Hash for ConditionNode<R> {
540 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
541}
542
429impl<'a> AstNode<'a> for Condition<'a> { 543impl<'a> AstNode<'a> for Condition<'a> {
430 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 544 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
431 match syntax.kind() { 545 match syntax.kind() {
@@ -457,12 +571,20 @@ impl<'a> Condition<'a> {
457} 571}
458 572
459// ConstDef 573// ConstDef
460#[derive(Debug, Clone, Copy)] 574#[derive(Debug, Clone, Copy,)]
461pub struct ConstDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 575pub struct ConstDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
462 syntax: SyntaxNode<R>, 576 pub(crate) syntax: SyntaxNode<R>,
463} 577}
464pub type ConstDef<'a> = ConstDefNode<RefRoot<'a>>; 578pub type ConstDef<'a> = ConstDefNode<RefRoot<'a>>;
465 579
580impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ConstDefNode<R1>> for ConstDefNode<R2> {
581 fn eq(&self, other: &ConstDefNode<R1>) -> bool { self.syntax == other.syntax }
582}
583impl<R: TreeRoot<RaTypes>> Eq for ConstDefNode<R> {}
584impl<R: TreeRoot<RaTypes>> Hash for ConstDefNode<R> {
585 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
586}
587
466impl<'a> AstNode<'a> for ConstDef<'a> { 588impl<'a> AstNode<'a> for ConstDef<'a> {
467 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 589 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
468 match syntax.kind() { 590 match syntax.kind() {
@@ -489,12 +611,20 @@ impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {}
489impl<'a> ConstDef<'a> {} 611impl<'a> ConstDef<'a> {}
490 612
491// ContinueExpr 613// ContinueExpr
492#[derive(Debug, Clone, Copy)] 614#[derive(Debug, Clone, Copy,)]
493pub struct ContinueExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 615pub struct ContinueExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
494 syntax: SyntaxNode<R>, 616 pub(crate) syntax: SyntaxNode<R>,
495} 617}
496pub type ContinueExpr<'a> = ContinueExprNode<RefRoot<'a>>; 618pub type ContinueExpr<'a> = ContinueExprNode<RefRoot<'a>>;
497 619
620impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ContinueExprNode<R1>> for ContinueExprNode<R2> {
621 fn eq(&self, other: &ContinueExprNode<R1>) -> bool { self.syntax == other.syntax }
622}
623impl<R: TreeRoot<RaTypes>> Eq for ContinueExprNode<R> {}
624impl<R: TreeRoot<RaTypes>> Hash for ContinueExprNode<R> {
625 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
626}
627
498impl<'a> AstNode<'a> for ContinueExpr<'a> { 628impl<'a> AstNode<'a> for ContinueExpr<'a> {
499 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 629 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
500 match syntax.kind() { 630 match syntax.kind() {
@@ -518,12 +648,20 @@ impl<R: TreeRoot<RaTypes>> ContinueExprNode<R> {
518impl<'a> ContinueExpr<'a> {} 648impl<'a> ContinueExpr<'a> {}
519 649
520// DynTraitType 650// DynTraitType
521#[derive(Debug, Clone, Copy)] 651#[derive(Debug, Clone, Copy,)]
522pub struct DynTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 652pub struct DynTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
523 syntax: SyntaxNode<R>, 653 pub(crate) syntax: SyntaxNode<R>,
524} 654}
525pub type DynTraitType<'a> = DynTraitTypeNode<RefRoot<'a>>; 655pub type DynTraitType<'a> = DynTraitTypeNode<RefRoot<'a>>;
526 656
657impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<DynTraitTypeNode<R1>> for DynTraitTypeNode<R2> {
658 fn eq(&self, other: &DynTraitTypeNode<R1>) -> bool { self.syntax == other.syntax }
659}
660impl<R: TreeRoot<RaTypes>> Eq for DynTraitTypeNode<R> {}
661impl<R: TreeRoot<RaTypes>> Hash for DynTraitTypeNode<R> {
662 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
663}
664
527impl<'a> AstNode<'a> for DynTraitType<'a> { 665impl<'a> AstNode<'a> for DynTraitType<'a> {
528 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 666 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
529 match syntax.kind() { 667 match syntax.kind() {
@@ -547,12 +685,20 @@ impl<R: TreeRoot<RaTypes>> DynTraitTypeNode<R> {
547impl<'a> DynTraitType<'a> {} 685impl<'a> DynTraitType<'a> {}
548 686
549// EnumDef 687// EnumDef
550#[derive(Debug, Clone, Copy)] 688#[derive(Debug, Clone, Copy,)]
551pub struct EnumDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 689pub struct EnumDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
552 syntax: SyntaxNode<R>, 690 pub(crate) syntax: SyntaxNode<R>,
553} 691}
554pub type EnumDef<'a> = EnumDefNode<RefRoot<'a>>; 692pub type EnumDef<'a> = EnumDefNode<RefRoot<'a>>;
555 693
694impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<EnumDefNode<R1>> for EnumDefNode<R2> {
695 fn eq(&self, other: &EnumDefNode<R1>) -> bool { self.syntax == other.syntax }
696}
697impl<R: TreeRoot<RaTypes>> Eq for EnumDefNode<R> {}
698impl<R: TreeRoot<RaTypes>> Hash for EnumDefNode<R> {
699 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
700}
701
556impl<'a> AstNode<'a> for EnumDef<'a> { 702impl<'a> AstNode<'a> for EnumDef<'a> {
557 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 703 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
558 match syntax.kind() { 704 match syntax.kind() {
@@ -579,7 +725,7 @@ impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {}
579impl<'a> EnumDef<'a> {} 725impl<'a> EnumDef<'a> {}
580 726
581// Expr 727// Expr
582#[derive(Debug, Clone, Copy)] 728#[derive(Debug, Clone, Copy, PartialEq, Eq)]
583pub enum Expr<'a> { 729pub enum Expr<'a> {
584 TupleExpr(TupleExpr<'a>), 730 TupleExpr(TupleExpr<'a>),
585 ArrayExpr(ArrayExpr<'a>), 731 ArrayExpr(ArrayExpr<'a>),
@@ -694,12 +840,20 @@ impl<'a> AstNode<'a> for Expr<'a> {
694impl<'a> Expr<'a> {} 840impl<'a> Expr<'a> {}
695 841
696// ExprStmt 842// ExprStmt
697#[derive(Debug, Clone, Copy)] 843#[derive(Debug, Clone, Copy,)]
698pub struct ExprStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { 844pub struct ExprStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> {
699 syntax: SyntaxNode<R>, 845 pub(crate) syntax: SyntaxNode<R>,
700} 846}
701pub type ExprStmt<'a> = ExprStmtNode<RefRoot<'a>>; 847pub type ExprStmt<'a> = ExprStmtNode<RefRoot<'a>>;
702 848
849impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ExprStmtNode<R1>> for ExprStmtNode<R2> {
850 fn eq(&self, other: &ExprStmtNode<R1>) -> bool { self.syntax == other.syntax }
851}
852impl<R: TreeRoot<RaTypes>> Eq for ExprStmtNode<R> {}
853impl<R: TreeRoot<RaTypes>> Hash for ExprStmtNode<R> {
854 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
855}
856
703impl<'a> AstNode<'a> for ExprStmt<'a> { 857impl<'a> AstNode<'a> for ExprStmt<'a> {
704 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 858 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
705 match syntax.kind() { 859 match syntax.kind() {
@@ -727,12 +881,20 @@ impl<'a> ExprStmt<'a> {
727} 881}
728 882
729// ExternCrateItem 883// ExternCrateItem
730#[derive(Debug, Clone, Copy)] 884#[derive(Debug, Clone, Copy,)]
731pub struct ExternCrateItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 885pub struct ExternCrateItemNode<R: TreeRoot<RaTypes> = OwnedRoot> {
732 syntax: SyntaxNode<R>, 886 pub(crate) syntax: SyntaxNode<R>,
733} 887}
734pub type ExternCrateItem<'a> = ExternCrateItemNode<RefRoot<'a>>; 888pub type ExternCrateItem<'a> = ExternCrateItemNode<RefRoot<'a>>;
735 889
890impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ExternCrateItemNode<R1>> for ExternCrateItemNode<R2> {
891 fn eq(&self, other: &ExternCrateItemNode<R1>) -> bool { self.syntax == other.syntax }
892}
893impl<R: TreeRoot<RaTypes>> Eq for ExternCrateItemNode<R> {}
894impl<R: TreeRoot<RaTypes>> Hash for ExternCrateItemNode<R> {
895 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
896}
897
736impl<'a> AstNode<'a> for ExternCrateItem<'a> { 898impl<'a> AstNode<'a> for ExternCrateItem<'a> {
737 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 899 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
738 match syntax.kind() { 900 match syntax.kind() {
@@ -756,12 +918,20 @@ impl<R: TreeRoot<RaTypes>> ExternCrateItemNode<R> {
756impl<'a> ExternCrateItem<'a> {} 918impl<'a> ExternCrateItem<'a> {}
757 919
758// FieldExpr 920// FieldExpr
759#[derive(Debug, Clone, Copy)] 921#[derive(Debug, Clone, Copy,)]
760pub struct FieldExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 922pub struct FieldExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
761 syntax: SyntaxNode<R>, 923 pub(crate) syntax: SyntaxNode<R>,
762} 924}
763pub type FieldExpr<'a> = FieldExprNode<RefRoot<'a>>; 925pub type FieldExpr<'a> = FieldExprNode<RefRoot<'a>>;
764 926
927impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FieldExprNode<R1>> for FieldExprNode<R2> {
928 fn eq(&self, other: &FieldExprNode<R1>) -> bool { self.syntax == other.syntax }
929}
930impl<R: TreeRoot<RaTypes>> Eq for FieldExprNode<R> {}
931impl<R: TreeRoot<RaTypes>> Hash for FieldExprNode<R> {
932 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
933}
934
765impl<'a> AstNode<'a> for FieldExpr<'a> { 935impl<'a> AstNode<'a> for FieldExpr<'a> {
766 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 936 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
767 match syntax.kind() { 937 match syntax.kind() {
@@ -785,12 +955,20 @@ impl<R: TreeRoot<RaTypes>> FieldExprNode<R> {
785impl<'a> FieldExpr<'a> {} 955impl<'a> FieldExpr<'a> {}
786 956
787// FieldPatList 957// FieldPatList
788#[derive(Debug, Clone, Copy)] 958#[derive(Debug, Clone, Copy,)]
789pub struct FieldPatListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 959pub struct FieldPatListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
790 syntax: SyntaxNode<R>, 960 pub(crate) syntax: SyntaxNode<R>,
791} 961}
792pub type FieldPatList<'a> = FieldPatListNode<RefRoot<'a>>; 962pub type FieldPatList<'a> = FieldPatListNode<RefRoot<'a>>;
793 963
964impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FieldPatListNode<R1>> for FieldPatListNode<R2> {
965 fn eq(&self, other: &FieldPatListNode<R1>) -> bool { self.syntax == other.syntax }
966}
967impl<R: TreeRoot<RaTypes>> Eq for FieldPatListNode<R> {}
968impl<R: TreeRoot<RaTypes>> Hash for FieldPatListNode<R> {
969 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
970}
971
794impl<'a> AstNode<'a> for FieldPatList<'a> { 972impl<'a> AstNode<'a> for FieldPatList<'a> {
795 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 973 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
796 match syntax.kind() { 974 match syntax.kind() {
@@ -814,12 +992,20 @@ impl<R: TreeRoot<RaTypes>> FieldPatListNode<R> {
814impl<'a> FieldPatList<'a> {} 992impl<'a> FieldPatList<'a> {}
815 993
816// FnDef 994// FnDef
817#[derive(Debug, Clone, Copy)] 995#[derive(Debug, Clone, Copy,)]
818pub struct FnDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 996pub struct FnDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
819 syntax: SyntaxNode<R>, 997 pub(crate) syntax: SyntaxNode<R>,
820} 998}
821pub type FnDef<'a> = FnDefNode<RefRoot<'a>>; 999pub type FnDef<'a> = FnDefNode<RefRoot<'a>>;
822 1000
1001impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FnDefNode<R1>> for FnDefNode<R2> {
1002 fn eq(&self, other: &FnDefNode<R1>) -> bool { self.syntax == other.syntax }
1003}
1004impl<R: TreeRoot<RaTypes>> Eq for FnDefNode<R> {}
1005impl<R: TreeRoot<RaTypes>> Hash for FnDefNode<R> {
1006 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1007}
1008
823impl<'a> AstNode<'a> for FnDef<'a> { 1009impl<'a> AstNode<'a> for FnDef<'a> {
824 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1010 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
825 match syntax.kind() { 1011 match syntax.kind() {
@@ -859,12 +1045,20 @@ impl<'a> FnDef<'a> {
859} 1045}
860 1046
861// FnPointerType 1047// FnPointerType
862#[derive(Debug, Clone, Copy)] 1048#[derive(Debug, Clone, Copy,)]
863pub struct FnPointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1049pub struct FnPointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
864 syntax: SyntaxNode<R>, 1050 pub(crate) syntax: SyntaxNode<R>,
865} 1051}
866pub type FnPointerType<'a> = FnPointerTypeNode<RefRoot<'a>>; 1052pub type FnPointerType<'a> = FnPointerTypeNode<RefRoot<'a>>;
867 1053
1054impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FnPointerTypeNode<R1>> for FnPointerTypeNode<R2> {
1055 fn eq(&self, other: &FnPointerTypeNode<R1>) -> bool { self.syntax == other.syntax }
1056}
1057impl<R: TreeRoot<RaTypes>> Eq for FnPointerTypeNode<R> {}
1058impl<R: TreeRoot<RaTypes>> Hash for FnPointerTypeNode<R> {
1059 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1060}
1061
868impl<'a> AstNode<'a> for FnPointerType<'a> { 1062impl<'a> AstNode<'a> for FnPointerType<'a> {
869 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1063 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
870 match syntax.kind() { 1064 match syntax.kind() {
@@ -888,12 +1082,20 @@ impl<R: TreeRoot<RaTypes>> FnPointerTypeNode<R> {
888impl<'a> FnPointerType<'a> {} 1082impl<'a> FnPointerType<'a> {}
889 1083
890// ForExpr 1084// ForExpr
891#[derive(Debug, Clone, Copy)] 1085#[derive(Debug, Clone, Copy,)]
892pub struct ForExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1086pub struct ForExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
893 syntax: SyntaxNode<R>, 1087 pub(crate) syntax: SyntaxNode<R>,
894} 1088}
895pub type ForExpr<'a> = ForExprNode<RefRoot<'a>>; 1089pub type ForExpr<'a> = ForExprNode<RefRoot<'a>>;
896 1090
1091impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ForExprNode<R1>> for ForExprNode<R2> {
1092 fn eq(&self, other: &ForExprNode<R1>) -> bool { self.syntax == other.syntax }
1093}
1094impl<R: TreeRoot<RaTypes>> Eq for ForExprNode<R> {}
1095impl<R: TreeRoot<RaTypes>> Hash for ForExprNode<R> {
1096 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1097}
1098
897impl<'a> AstNode<'a> for ForExpr<'a> { 1099impl<'a> AstNode<'a> for ForExpr<'a> {
898 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1100 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
899 match syntax.kind() { 1101 match syntax.kind() {
@@ -926,12 +1128,20 @@ impl<'a> ForExpr<'a> {
926} 1128}
927 1129
928// ForType 1130// ForType
929#[derive(Debug, Clone, Copy)] 1131#[derive(Debug, Clone, Copy,)]
930pub struct ForTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1132pub struct ForTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
931 syntax: SyntaxNode<R>, 1133 pub(crate) syntax: SyntaxNode<R>,
932} 1134}
933pub type ForType<'a> = ForTypeNode<RefRoot<'a>>; 1135pub type ForType<'a> = ForTypeNode<RefRoot<'a>>;
934 1136
1137impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ForTypeNode<R1>> for ForTypeNode<R2> {
1138 fn eq(&self, other: &ForTypeNode<R1>) -> bool { self.syntax == other.syntax }
1139}
1140impl<R: TreeRoot<RaTypes>> Eq for ForTypeNode<R> {}
1141impl<R: TreeRoot<RaTypes>> Hash for ForTypeNode<R> {
1142 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1143}
1144
935impl<'a> AstNode<'a> for ForType<'a> { 1145impl<'a> AstNode<'a> for ForType<'a> {
936 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1146 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
937 match syntax.kind() { 1147 match syntax.kind() {
@@ -955,12 +1165,20 @@ impl<R: TreeRoot<RaTypes>> ForTypeNode<R> {
955impl<'a> ForType<'a> {} 1165impl<'a> ForType<'a> {}
956 1166
957// IfExpr 1167// IfExpr
958#[derive(Debug, Clone, Copy)] 1168#[derive(Debug, Clone, Copy,)]
959pub struct IfExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1169pub struct IfExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
960 syntax: SyntaxNode<R>, 1170 pub(crate) syntax: SyntaxNode<R>,
961} 1171}
962pub type IfExpr<'a> = IfExprNode<RefRoot<'a>>; 1172pub type IfExpr<'a> = IfExprNode<RefRoot<'a>>;
963 1173
1174impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<IfExprNode<R1>> for IfExprNode<R2> {
1175 fn eq(&self, other: &IfExprNode<R1>) -> bool { self.syntax == other.syntax }
1176}
1177impl<R: TreeRoot<RaTypes>> Eq for IfExprNode<R> {}
1178impl<R: TreeRoot<RaTypes>> Hash for IfExprNode<R> {
1179 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1180}
1181
964impl<'a> AstNode<'a> for IfExpr<'a> { 1182impl<'a> AstNode<'a> for IfExpr<'a> {
965 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1183 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
966 match syntax.kind() { 1184 match syntax.kind() {
@@ -988,12 +1206,20 @@ impl<'a> IfExpr<'a> {
988} 1206}
989 1207
990// ImplItem 1208// ImplItem
991#[derive(Debug, Clone, Copy)] 1209#[derive(Debug, Clone, Copy,)]
992pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1210pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> {
993 syntax: SyntaxNode<R>, 1211 pub(crate) syntax: SyntaxNode<R>,
994} 1212}
995pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; 1213pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>;
996 1214
1215impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplItemNode<R1>> for ImplItemNode<R2> {
1216 fn eq(&self, other: &ImplItemNode<R1>) -> bool { self.syntax == other.syntax }
1217}
1218impl<R: TreeRoot<RaTypes>> Eq for ImplItemNode<R> {}
1219impl<R: TreeRoot<RaTypes>> Hash for ImplItemNode<R> {
1220 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1221}
1222
997impl<'a> AstNode<'a> for ImplItem<'a> { 1223impl<'a> AstNode<'a> for ImplItem<'a> {
998 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1224 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
999 match syntax.kind() { 1225 match syntax.kind() {
@@ -1017,12 +1243,20 @@ impl<R: TreeRoot<RaTypes>> ImplItemNode<R> {
1017impl<'a> ImplItem<'a> {} 1243impl<'a> ImplItem<'a> {}
1018 1244
1019// ImplTraitType 1245// ImplTraitType
1020#[derive(Debug, Clone, Copy)] 1246#[derive(Debug, Clone, Copy,)]
1021pub struct ImplTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1247pub struct ImplTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1022 syntax: SyntaxNode<R>, 1248 pub(crate) syntax: SyntaxNode<R>,
1023} 1249}
1024pub type ImplTraitType<'a> = ImplTraitTypeNode<RefRoot<'a>>; 1250pub type ImplTraitType<'a> = ImplTraitTypeNode<RefRoot<'a>>;
1025 1251
1252impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplTraitTypeNode<R1>> for ImplTraitTypeNode<R2> {
1253 fn eq(&self, other: &ImplTraitTypeNode<R1>) -> bool { self.syntax == other.syntax }
1254}
1255impl<R: TreeRoot<RaTypes>> Eq for ImplTraitTypeNode<R> {}
1256impl<R: TreeRoot<RaTypes>> Hash for ImplTraitTypeNode<R> {
1257 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1258}
1259
1026impl<'a> AstNode<'a> for ImplTraitType<'a> { 1260impl<'a> AstNode<'a> for ImplTraitType<'a> {
1027 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1261 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1028 match syntax.kind() { 1262 match syntax.kind() {
@@ -1046,12 +1280,20 @@ impl<R: TreeRoot<RaTypes>> ImplTraitTypeNode<R> {
1046impl<'a> ImplTraitType<'a> {} 1280impl<'a> ImplTraitType<'a> {}
1047 1281
1048// IndexExpr 1282// IndexExpr
1049#[derive(Debug, Clone, Copy)] 1283#[derive(Debug, Clone, Copy,)]
1050pub struct IndexExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1284pub struct IndexExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1051 syntax: SyntaxNode<R>, 1285 pub(crate) syntax: SyntaxNode<R>,
1052} 1286}
1053pub type IndexExpr<'a> = IndexExprNode<RefRoot<'a>>; 1287pub type IndexExpr<'a> = IndexExprNode<RefRoot<'a>>;
1054 1288
1289impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<IndexExprNode<R1>> for IndexExprNode<R2> {
1290 fn eq(&self, other: &IndexExprNode<R1>) -> bool { self.syntax == other.syntax }
1291}
1292impl<R: TreeRoot<RaTypes>> Eq for IndexExprNode<R> {}
1293impl<R: TreeRoot<RaTypes>> Hash for IndexExprNode<R> {
1294 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1295}
1296
1055impl<'a> AstNode<'a> for IndexExpr<'a> { 1297impl<'a> AstNode<'a> for IndexExpr<'a> {
1056 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1298 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1057 match syntax.kind() { 1299 match syntax.kind() {
@@ -1075,12 +1317,20 @@ impl<R: TreeRoot<RaTypes>> IndexExprNode<R> {
1075impl<'a> IndexExpr<'a> {} 1317impl<'a> IndexExpr<'a> {}
1076 1318
1077// ItemList 1319// ItemList
1078#[derive(Debug, Clone, Copy)] 1320#[derive(Debug, Clone, Copy,)]
1079pub struct ItemListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1321pub struct ItemListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1080 syntax: SyntaxNode<R>, 1322 pub(crate) syntax: SyntaxNode<R>,
1081} 1323}
1082pub type ItemList<'a> = ItemListNode<RefRoot<'a>>; 1324pub type ItemList<'a> = ItemListNode<RefRoot<'a>>;
1083 1325
1326impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ItemListNode<R1>> for ItemListNode<R2> {
1327 fn eq(&self, other: &ItemListNode<R1>) -> bool { self.syntax == other.syntax }
1328}
1329impl<R: TreeRoot<RaTypes>> Eq for ItemListNode<R> {}
1330impl<R: TreeRoot<RaTypes>> Hash for ItemListNode<R> {
1331 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1332}
1333
1084impl<'a> AstNode<'a> for ItemList<'a> { 1334impl<'a> AstNode<'a> for ItemList<'a> {
1085 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1335 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1086 match syntax.kind() { 1336 match syntax.kind() {
@@ -1106,12 +1356,20 @@ impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {}
1106impl<'a> ItemList<'a> {} 1356impl<'a> ItemList<'a> {}
1107 1357
1108// Label 1358// Label
1109#[derive(Debug, Clone, Copy)] 1359#[derive(Debug, Clone, Copy,)]
1110pub struct LabelNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1360pub struct LabelNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1111 syntax: SyntaxNode<R>, 1361 pub(crate) syntax: SyntaxNode<R>,
1112} 1362}
1113pub type Label<'a> = LabelNode<RefRoot<'a>>; 1363pub type Label<'a> = LabelNode<RefRoot<'a>>;
1114 1364
1365impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LabelNode<R1>> for LabelNode<R2> {
1366 fn eq(&self, other: &LabelNode<R1>) -> bool { self.syntax == other.syntax }
1367}
1368impl<R: TreeRoot<RaTypes>> Eq for LabelNode<R> {}
1369impl<R: TreeRoot<RaTypes>> Hash for LabelNode<R> {
1370 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1371}
1372
1115impl<'a> AstNode<'a> for Label<'a> { 1373impl<'a> AstNode<'a> for Label<'a> {
1116 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1374 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1117 match syntax.kind() { 1375 match syntax.kind() {
@@ -1135,12 +1393,20 @@ impl<R: TreeRoot<RaTypes>> LabelNode<R> {
1135impl<'a> Label<'a> {} 1393impl<'a> Label<'a> {}
1136 1394
1137// LambdaExpr 1395// LambdaExpr
1138#[derive(Debug, Clone, Copy)] 1396#[derive(Debug, Clone, Copy,)]
1139pub struct LambdaExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1397pub struct LambdaExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1140 syntax: SyntaxNode<R>, 1398 pub(crate) syntax: SyntaxNode<R>,
1141} 1399}
1142pub type LambdaExpr<'a> = LambdaExprNode<RefRoot<'a>>; 1400pub type LambdaExpr<'a> = LambdaExprNode<RefRoot<'a>>;
1143 1401
1402impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LambdaExprNode<R1>> for LambdaExprNode<R2> {
1403 fn eq(&self, other: &LambdaExprNode<R1>) -> bool { self.syntax == other.syntax }
1404}
1405impl<R: TreeRoot<RaTypes>> Eq for LambdaExprNode<R> {}
1406impl<R: TreeRoot<RaTypes>> Hash for LambdaExprNode<R> {
1407 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1408}
1409
1144impl<'a> AstNode<'a> for LambdaExpr<'a> { 1410impl<'a> AstNode<'a> for LambdaExpr<'a> {
1145 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1411 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1146 match syntax.kind() { 1412 match syntax.kind() {
@@ -1172,12 +1438,20 @@ impl<'a> LambdaExpr<'a> {
1172} 1438}
1173 1439
1174// LetStmt 1440// LetStmt
1175#[derive(Debug, Clone, Copy)] 1441#[derive(Debug, Clone, Copy,)]
1176pub struct LetStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1442pub struct LetStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1177 syntax: SyntaxNode<R>, 1443 pub(crate) syntax: SyntaxNode<R>,
1178} 1444}
1179pub type LetStmt<'a> = LetStmtNode<RefRoot<'a>>; 1445pub type LetStmt<'a> = LetStmtNode<RefRoot<'a>>;
1180 1446
1447impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LetStmtNode<R1>> for LetStmtNode<R2> {
1448 fn eq(&self, other: &LetStmtNode<R1>) -> bool { self.syntax == other.syntax }
1449}
1450impl<R: TreeRoot<RaTypes>> Eq for LetStmtNode<R> {}
1451impl<R: TreeRoot<RaTypes>> Hash for LetStmtNode<R> {
1452 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1453}
1454
1181impl<'a> AstNode<'a> for LetStmt<'a> { 1455impl<'a> AstNode<'a> for LetStmt<'a> {
1182 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1456 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1183 match syntax.kind() { 1457 match syntax.kind() {
@@ -1209,12 +1483,20 @@ impl<'a> LetStmt<'a> {
1209} 1483}
1210 1484
1211// Lifetime 1485// Lifetime
1212#[derive(Debug, Clone, Copy)] 1486#[derive(Debug, Clone, Copy,)]
1213pub struct LifetimeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1487pub struct LifetimeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1214 syntax: SyntaxNode<R>, 1488 pub(crate) syntax: SyntaxNode<R>,
1215} 1489}
1216pub type Lifetime<'a> = LifetimeNode<RefRoot<'a>>; 1490pub type Lifetime<'a> = LifetimeNode<RefRoot<'a>>;
1217 1491
1492impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LifetimeNode<R1>> for LifetimeNode<R2> {
1493 fn eq(&self, other: &LifetimeNode<R1>) -> bool { self.syntax == other.syntax }
1494}
1495impl<R: TreeRoot<RaTypes>> Eq for LifetimeNode<R> {}
1496impl<R: TreeRoot<RaTypes>> Hash for LifetimeNode<R> {
1497 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1498}
1499
1218impl<'a> AstNode<'a> for Lifetime<'a> { 1500impl<'a> AstNode<'a> for Lifetime<'a> {
1219 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1501 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1220 match syntax.kind() { 1502 match syntax.kind() {
@@ -1238,12 +1520,20 @@ impl<R: TreeRoot<RaTypes>> LifetimeNode<R> {
1238impl<'a> Lifetime<'a> {} 1520impl<'a> Lifetime<'a> {}
1239 1521
1240// LifetimeParam 1522// LifetimeParam
1241#[derive(Debug, Clone, Copy)] 1523#[derive(Debug, Clone, Copy,)]
1242pub struct LifetimeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1524pub struct LifetimeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1243 syntax: SyntaxNode<R>, 1525 pub(crate) syntax: SyntaxNode<R>,
1244} 1526}
1245pub type LifetimeParam<'a> = LifetimeParamNode<RefRoot<'a>>; 1527pub type LifetimeParam<'a> = LifetimeParamNode<RefRoot<'a>>;
1246 1528
1529impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LifetimeParamNode<R1>> for LifetimeParamNode<R2> {
1530 fn eq(&self, other: &LifetimeParamNode<R1>) -> bool { self.syntax == other.syntax }
1531}
1532impl<R: TreeRoot<RaTypes>> Eq for LifetimeParamNode<R> {}
1533impl<R: TreeRoot<RaTypes>> Hash for LifetimeParamNode<R> {
1534 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1535}
1536
1247impl<'a> AstNode<'a> for LifetimeParam<'a> { 1537impl<'a> AstNode<'a> for LifetimeParam<'a> {
1248 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1538 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1249 match syntax.kind() { 1539 match syntax.kind() {
@@ -1271,12 +1561,20 @@ impl<'a> LifetimeParam<'a> {
1271} 1561}
1272 1562
1273// Literal 1563// Literal
1274#[derive(Debug, Clone, Copy)] 1564#[derive(Debug, Clone, Copy,)]
1275pub struct LiteralNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1565pub struct LiteralNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1276 syntax: SyntaxNode<R>, 1566 pub(crate) syntax: SyntaxNode<R>,
1277} 1567}
1278pub type Literal<'a> = LiteralNode<RefRoot<'a>>; 1568pub type Literal<'a> = LiteralNode<RefRoot<'a>>;
1279 1569
1570impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LiteralNode<R1>> for LiteralNode<R2> {
1571 fn eq(&self, other: &LiteralNode<R1>) -> bool { self.syntax == other.syntax }
1572}
1573impl<R: TreeRoot<RaTypes>> Eq for LiteralNode<R> {}
1574impl<R: TreeRoot<RaTypes>> Hash for LiteralNode<R> {
1575 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1576}
1577
1280impl<'a> AstNode<'a> for Literal<'a> { 1578impl<'a> AstNode<'a> for Literal<'a> {
1281 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1579 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1282 match syntax.kind() { 1580 match syntax.kind() {
@@ -1300,12 +1598,20 @@ impl<R: TreeRoot<RaTypes>> LiteralNode<R> {
1300impl<'a> Literal<'a> {} 1598impl<'a> Literal<'a> {}
1301 1599
1302// LoopExpr 1600// LoopExpr
1303#[derive(Debug, Clone, Copy)] 1601#[derive(Debug, Clone, Copy,)]
1304pub struct LoopExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1602pub struct LoopExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1305 syntax: SyntaxNode<R>, 1603 pub(crate) syntax: SyntaxNode<R>,
1306} 1604}
1307pub type LoopExpr<'a> = LoopExprNode<RefRoot<'a>>; 1605pub type LoopExpr<'a> = LoopExprNode<RefRoot<'a>>;
1308 1606
1607impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LoopExprNode<R1>> for LoopExprNode<R2> {
1608 fn eq(&self, other: &LoopExprNode<R1>) -> bool { self.syntax == other.syntax }
1609}
1610impl<R: TreeRoot<RaTypes>> Eq for LoopExprNode<R> {}
1611impl<R: TreeRoot<RaTypes>> Hash for LoopExprNode<R> {
1612 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1613}
1614
1309impl<'a> AstNode<'a> for LoopExpr<'a> { 1615impl<'a> AstNode<'a> for LoopExpr<'a> {
1310 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1616 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1311 match syntax.kind() { 1617 match syntax.kind() {
@@ -1330,12 +1636,20 @@ impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {}
1330impl<'a> LoopExpr<'a> {} 1636impl<'a> LoopExpr<'a> {}
1331 1637
1332// MatchArm 1638// MatchArm
1333#[derive(Debug, Clone, Copy)] 1639#[derive(Debug, Clone, Copy,)]
1334pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1640pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1335 syntax: SyntaxNode<R>, 1641 pub(crate) syntax: SyntaxNode<R>,
1336} 1642}
1337pub type MatchArm<'a> = MatchArmNode<RefRoot<'a>>; 1643pub type MatchArm<'a> = MatchArmNode<RefRoot<'a>>;
1338 1644
1645impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchArmNode<R1>> for MatchArmNode<R2> {
1646 fn eq(&self, other: &MatchArmNode<R1>) -> bool { self.syntax == other.syntax }
1647}
1648impl<R: TreeRoot<RaTypes>> Eq for MatchArmNode<R> {}
1649impl<R: TreeRoot<RaTypes>> Hash for MatchArmNode<R> {
1650 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1651}
1652
1339impl<'a> AstNode<'a> for MatchArm<'a> { 1653impl<'a> AstNode<'a> for MatchArm<'a> {
1340 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1654 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1341 match syntax.kind() { 1655 match syntax.kind() {
@@ -1371,12 +1685,20 @@ impl<'a> MatchArm<'a> {
1371} 1685}
1372 1686
1373// MatchArmList 1687// MatchArmList
1374#[derive(Debug, Clone, Copy)] 1688#[derive(Debug, Clone, Copy,)]
1375pub struct MatchArmListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1689pub struct MatchArmListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1376 syntax: SyntaxNode<R>, 1690 pub(crate) syntax: SyntaxNode<R>,
1377} 1691}
1378pub type MatchArmList<'a> = MatchArmListNode<RefRoot<'a>>; 1692pub type MatchArmList<'a> = MatchArmListNode<RefRoot<'a>>;
1379 1693
1694impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchArmListNode<R1>> for MatchArmListNode<R2> {
1695 fn eq(&self, other: &MatchArmListNode<R1>) -> bool { self.syntax == other.syntax }
1696}
1697impl<R: TreeRoot<RaTypes>> Eq for MatchArmListNode<R> {}
1698impl<R: TreeRoot<RaTypes>> Hash for MatchArmListNode<R> {
1699 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1700}
1701
1380impl<'a> AstNode<'a> for MatchArmList<'a> { 1702impl<'a> AstNode<'a> for MatchArmList<'a> {
1381 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1703 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1382 match syntax.kind() { 1704 match syntax.kind() {
@@ -1404,12 +1726,20 @@ impl<'a> MatchArmList<'a> {
1404} 1726}
1405 1727
1406// MatchExpr 1728// MatchExpr
1407#[derive(Debug, Clone, Copy)] 1729#[derive(Debug, Clone, Copy,)]
1408pub struct MatchExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1730pub struct MatchExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1409 syntax: SyntaxNode<R>, 1731 pub(crate) syntax: SyntaxNode<R>,
1410} 1732}
1411pub type MatchExpr<'a> = MatchExprNode<RefRoot<'a>>; 1733pub type MatchExpr<'a> = MatchExprNode<RefRoot<'a>>;
1412 1734
1735impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchExprNode<R1>> for MatchExprNode<R2> {
1736 fn eq(&self, other: &MatchExprNode<R1>) -> bool { self.syntax == other.syntax }
1737}
1738impl<R: TreeRoot<RaTypes>> Eq for MatchExprNode<R> {}
1739impl<R: TreeRoot<RaTypes>> Hash for MatchExprNode<R> {
1740 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1741}
1742
1413impl<'a> AstNode<'a> for MatchExpr<'a> { 1743impl<'a> AstNode<'a> for MatchExpr<'a> {
1414 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1744 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1415 match syntax.kind() { 1745 match syntax.kind() {
@@ -1441,12 +1771,20 @@ impl<'a> MatchExpr<'a> {
1441} 1771}
1442 1772
1443// MatchGuard 1773// MatchGuard
1444#[derive(Debug, Clone, Copy)] 1774#[derive(Debug, Clone, Copy,)]
1445pub struct MatchGuardNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1775pub struct MatchGuardNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1446 syntax: SyntaxNode<R>, 1776 pub(crate) syntax: SyntaxNode<R>,
1447} 1777}
1448pub type MatchGuard<'a> = MatchGuardNode<RefRoot<'a>>; 1778pub type MatchGuard<'a> = MatchGuardNode<RefRoot<'a>>;
1449 1779
1780impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchGuardNode<R1>> for MatchGuardNode<R2> {
1781 fn eq(&self, other: &MatchGuardNode<R1>) -> bool { self.syntax == other.syntax }
1782}
1783impl<R: TreeRoot<RaTypes>> Eq for MatchGuardNode<R> {}
1784impl<R: TreeRoot<RaTypes>> Hash for MatchGuardNode<R> {
1785 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1786}
1787
1450impl<'a> AstNode<'a> for MatchGuard<'a> { 1788impl<'a> AstNode<'a> for MatchGuard<'a> {
1451 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1789 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1452 match syntax.kind() { 1790 match syntax.kind() {
@@ -1470,12 +1808,20 @@ impl<R: TreeRoot<RaTypes>> MatchGuardNode<R> {
1470impl<'a> MatchGuard<'a> {} 1808impl<'a> MatchGuard<'a> {}
1471 1809
1472// MethodCallExpr 1810// MethodCallExpr
1473#[derive(Debug, Clone, Copy)] 1811#[derive(Debug, Clone, Copy,)]
1474pub struct MethodCallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1812pub struct MethodCallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1475 syntax: SyntaxNode<R>, 1813 pub(crate) syntax: SyntaxNode<R>,
1476} 1814}
1477pub type MethodCallExpr<'a> = MethodCallExprNode<RefRoot<'a>>; 1815pub type MethodCallExpr<'a> = MethodCallExprNode<RefRoot<'a>>;
1478 1816
1817impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MethodCallExprNode<R1>> for MethodCallExprNode<R2> {
1818 fn eq(&self, other: &MethodCallExprNode<R1>) -> bool { self.syntax == other.syntax }
1819}
1820impl<R: TreeRoot<RaTypes>> Eq for MethodCallExprNode<R> {}
1821impl<R: TreeRoot<RaTypes>> Hash for MethodCallExprNode<R> {
1822 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1823}
1824
1479impl<'a> AstNode<'a> for MethodCallExpr<'a> { 1825impl<'a> AstNode<'a> for MethodCallExpr<'a> {
1480 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1826 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1481 match syntax.kind() { 1827 match syntax.kind() {
@@ -1504,12 +1850,20 @@ impl<'a> MethodCallExpr<'a> {
1504} 1850}
1505 1851
1506// Module 1852// Module
1507#[derive(Debug, Clone, Copy)] 1853#[derive(Debug, Clone, Copy,)]
1508pub struct ModuleNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1854pub struct ModuleNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1509 syntax: SyntaxNode<R>, 1855 pub(crate) syntax: SyntaxNode<R>,
1510} 1856}
1511pub type Module<'a> = ModuleNode<RefRoot<'a>>; 1857pub type Module<'a> = ModuleNode<RefRoot<'a>>;
1512 1858
1859impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ModuleNode<R1>> for ModuleNode<R2> {
1860 fn eq(&self, other: &ModuleNode<R1>) -> bool { self.syntax == other.syntax }
1861}
1862impl<R: TreeRoot<RaTypes>> Eq for ModuleNode<R> {}
1863impl<R: TreeRoot<RaTypes>> Hash for ModuleNode<R> {
1864 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1865}
1866
1513impl<'a> AstNode<'a> for Module<'a> { 1867impl<'a> AstNode<'a> for Module<'a> {
1514 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1868 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1515 match syntax.kind() { 1869 match syntax.kind() {
@@ -1539,7 +1893,7 @@ impl<'a> Module<'a> {
1539} 1893}
1540 1894
1541// ModuleItem 1895// ModuleItem
1542#[derive(Debug, Clone, Copy)] 1896#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1543pub enum ModuleItem<'a> { 1897pub enum ModuleItem<'a> {
1544 StructDef(StructDef<'a>), 1898 StructDef(StructDef<'a>),
1545 EnumDef(EnumDef<'a>), 1899 EnumDef(EnumDef<'a>),
@@ -1591,12 +1945,20 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
1591impl<'a> ModuleItem<'a> {} 1945impl<'a> ModuleItem<'a> {}
1592 1946
1593// Name 1947// Name
1594#[derive(Debug, Clone, Copy)] 1948#[derive(Debug, Clone, Copy,)]
1595pub struct NameNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1949pub struct NameNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1596 syntax: SyntaxNode<R>, 1950 pub(crate) syntax: SyntaxNode<R>,
1597} 1951}
1598pub type Name<'a> = NameNode<RefRoot<'a>>; 1952pub type Name<'a> = NameNode<RefRoot<'a>>;
1599 1953
1954impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NameNode<R1>> for NameNode<R2> {
1955 fn eq(&self, other: &NameNode<R1>) -> bool { self.syntax == other.syntax }
1956}
1957impl<R: TreeRoot<RaTypes>> Eq for NameNode<R> {}
1958impl<R: TreeRoot<RaTypes>> Hash for NameNode<R> {
1959 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1960}
1961
1600impl<'a> AstNode<'a> for Name<'a> { 1962impl<'a> AstNode<'a> for Name<'a> {
1601 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1963 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1602 match syntax.kind() { 1964 match syntax.kind() {
@@ -1620,12 +1982,20 @@ impl<R: TreeRoot<RaTypes>> NameNode<R> {
1620impl<'a> Name<'a> {} 1982impl<'a> Name<'a> {}
1621 1983
1622// NameRef 1984// NameRef
1623#[derive(Debug, Clone, Copy)] 1985#[derive(Debug, Clone, Copy,)]
1624pub struct NameRefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1986pub struct NameRefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1625 syntax: SyntaxNode<R>, 1987 pub(crate) syntax: SyntaxNode<R>,
1626} 1988}
1627pub type NameRef<'a> = NameRefNode<RefRoot<'a>>; 1989pub type NameRef<'a> = NameRefNode<RefRoot<'a>>;
1628 1990
1991impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NameRefNode<R1>> for NameRefNode<R2> {
1992 fn eq(&self, other: &NameRefNode<R1>) -> bool { self.syntax == other.syntax }
1993}
1994impl<R: TreeRoot<RaTypes>> Eq for NameRefNode<R> {}
1995impl<R: TreeRoot<RaTypes>> Hash for NameRefNode<R> {
1996 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1997}
1998
1629impl<'a> AstNode<'a> for NameRef<'a> { 1999impl<'a> AstNode<'a> for NameRef<'a> {
1630 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2000 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1631 match syntax.kind() { 2001 match syntax.kind() {
@@ -1649,12 +2019,20 @@ impl<R: TreeRoot<RaTypes>> NameRefNode<R> {
1649impl<'a> NameRef<'a> {} 2019impl<'a> NameRef<'a> {}
1650 2020
1651// NamedField 2021// NamedField
1652#[derive(Debug, Clone, Copy)] 2022#[derive(Debug, Clone, Copy,)]
1653pub struct NamedFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2023pub struct NamedFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1654 syntax: SyntaxNode<R>, 2024 pub(crate) syntax: SyntaxNode<R>,
1655} 2025}
1656pub type NamedField<'a> = NamedFieldNode<RefRoot<'a>>; 2026pub type NamedField<'a> = NamedFieldNode<RefRoot<'a>>;
1657 2027
2028impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldNode<R1>> for NamedFieldNode<R2> {
2029 fn eq(&self, other: &NamedFieldNode<R1>) -> bool { self.syntax == other.syntax }
2030}
2031impl<R: TreeRoot<RaTypes>> Eq for NamedFieldNode<R> {}
2032impl<R: TreeRoot<RaTypes>> Hash for NamedFieldNode<R> {
2033 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2034}
2035
1658impl<'a> AstNode<'a> for NamedField<'a> { 2036impl<'a> AstNode<'a> for NamedField<'a> {
1659 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2037 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1660 match syntax.kind() { 2038 match syntax.kind() {
@@ -1678,12 +2056,20 @@ impl<R: TreeRoot<RaTypes>> NamedFieldNode<R> {
1678impl<'a> NamedField<'a> {} 2056impl<'a> NamedField<'a> {}
1679 2057
1680// NamedFieldDef 2058// NamedFieldDef
1681#[derive(Debug, Clone, Copy)] 2059#[derive(Debug, Clone, Copy,)]
1682pub struct NamedFieldDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2060pub struct NamedFieldDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1683 syntax: SyntaxNode<R>, 2061 pub(crate) syntax: SyntaxNode<R>,
1684} 2062}
1685pub type NamedFieldDef<'a> = NamedFieldDefNode<RefRoot<'a>>; 2063pub type NamedFieldDef<'a> = NamedFieldDefNode<RefRoot<'a>>;
1686 2064
2065impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldDefNode<R1>> for NamedFieldDefNode<R2> {
2066 fn eq(&self, other: &NamedFieldDefNode<R1>) -> bool { self.syntax == other.syntax }
2067}
2068impl<R: TreeRoot<RaTypes>> Eq for NamedFieldDefNode<R> {}
2069impl<R: TreeRoot<RaTypes>> Hash for NamedFieldDefNode<R> {
2070 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2071}
2072
1687impl<'a> AstNode<'a> for NamedFieldDef<'a> { 2073impl<'a> AstNode<'a> for NamedFieldDef<'a> {
1688 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2074 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1689 match syntax.kind() { 2075 match syntax.kind() {
@@ -1709,12 +2095,20 @@ impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {}
1709impl<'a> NamedFieldDef<'a> {} 2095impl<'a> NamedFieldDef<'a> {}
1710 2096
1711// NamedFieldList 2097// NamedFieldList
1712#[derive(Debug, Clone, Copy)] 2098#[derive(Debug, Clone, Copy,)]
1713pub struct NamedFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2099pub struct NamedFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1714 syntax: SyntaxNode<R>, 2100 pub(crate) syntax: SyntaxNode<R>,
1715} 2101}
1716pub type NamedFieldList<'a> = NamedFieldListNode<RefRoot<'a>>; 2102pub type NamedFieldList<'a> = NamedFieldListNode<RefRoot<'a>>;
1717 2103
2104impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldListNode<R1>> for NamedFieldListNode<R2> {
2105 fn eq(&self, other: &NamedFieldListNode<R1>) -> bool { self.syntax == other.syntax }
2106}
2107impl<R: TreeRoot<RaTypes>> Eq for NamedFieldListNode<R> {}
2108impl<R: TreeRoot<RaTypes>> Hash for NamedFieldListNode<R> {
2109 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2110}
2111
1718impl<'a> AstNode<'a> for NamedFieldList<'a> { 2112impl<'a> AstNode<'a> for NamedFieldList<'a> {
1719 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2113 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1720 match syntax.kind() { 2114 match syntax.kind() {
@@ -1738,12 +2132,20 @@ impl<R: TreeRoot<RaTypes>> NamedFieldListNode<R> {
1738impl<'a> NamedFieldList<'a> {} 2132impl<'a> NamedFieldList<'a> {}
1739 2133
1740// NeverType 2134// NeverType
1741#[derive(Debug, Clone, Copy)] 2135#[derive(Debug, Clone, Copy,)]
1742pub struct NeverTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2136pub struct NeverTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1743 syntax: SyntaxNode<R>, 2137 pub(crate) syntax: SyntaxNode<R>,
1744} 2138}
1745pub type NeverType<'a> = NeverTypeNode<RefRoot<'a>>; 2139pub type NeverType<'a> = NeverTypeNode<RefRoot<'a>>;
1746 2140
2141impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NeverTypeNode<R1>> for NeverTypeNode<R2> {
2142 fn eq(&self, other: &NeverTypeNode<R1>) -> bool { self.syntax == other.syntax }
2143}
2144impl<R: TreeRoot<RaTypes>> Eq for NeverTypeNode<R> {}
2145impl<R: TreeRoot<RaTypes>> Hash for NeverTypeNode<R> {
2146 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2147}
2148
1747impl<'a> AstNode<'a> for NeverType<'a> { 2149impl<'a> AstNode<'a> for NeverType<'a> {
1748 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2150 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1749 match syntax.kind() { 2151 match syntax.kind() {
@@ -1767,7 +2169,7 @@ impl<R: TreeRoot<RaTypes>> NeverTypeNode<R> {
1767impl<'a> NeverType<'a> {} 2169impl<'a> NeverType<'a> {}
1768 2170
1769// NominalDef 2171// NominalDef
1770#[derive(Debug, Clone, Copy)] 2172#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1771pub enum NominalDef<'a> { 2173pub enum NominalDef<'a> {
1772 StructDef(StructDef<'a>), 2174 StructDef(StructDef<'a>),
1773 EnumDef(EnumDef<'a>), 2175 EnumDef(EnumDef<'a>),
@@ -1795,12 +2197,20 @@ impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {}
1795impl<'a> NominalDef<'a> {} 2197impl<'a> NominalDef<'a> {}
1796 2198
1797// Param 2199// Param
1798#[derive(Debug, Clone, Copy)] 2200#[derive(Debug, Clone, Copy,)]
1799pub struct ParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2201pub struct ParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1800 syntax: SyntaxNode<R>, 2202 pub(crate) syntax: SyntaxNode<R>,
1801} 2203}
1802pub type Param<'a> = ParamNode<RefRoot<'a>>; 2204pub type Param<'a> = ParamNode<RefRoot<'a>>;
1803 2205
2206impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParamNode<R1>> for ParamNode<R2> {
2207 fn eq(&self, other: &ParamNode<R1>) -> bool { self.syntax == other.syntax }
2208}
2209impl<R: TreeRoot<RaTypes>> Eq for ParamNode<R> {}
2210impl<R: TreeRoot<RaTypes>> Hash for ParamNode<R> {
2211 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2212}
2213
1804impl<'a> AstNode<'a> for Param<'a> { 2214impl<'a> AstNode<'a> for Param<'a> {
1805 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2215 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1806 match syntax.kind() { 2216 match syntax.kind() {
@@ -1828,12 +2238,20 @@ impl<'a> Param<'a> {
1828} 2238}
1829 2239
1830// ParamList 2240// ParamList
1831#[derive(Debug, Clone, Copy)] 2241#[derive(Debug, Clone, Copy,)]
1832pub struct ParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2242pub struct ParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1833 syntax: SyntaxNode<R>, 2243 pub(crate) syntax: SyntaxNode<R>,
1834} 2244}
1835pub type ParamList<'a> = ParamListNode<RefRoot<'a>>; 2245pub type ParamList<'a> = ParamListNode<RefRoot<'a>>;
1836 2246
2247impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParamListNode<R1>> for ParamListNode<R2> {
2248 fn eq(&self, other: &ParamListNode<R1>) -> bool { self.syntax == other.syntax }
2249}
2250impl<R: TreeRoot<RaTypes>> Eq for ParamListNode<R> {}
2251impl<R: TreeRoot<RaTypes>> Hash for ParamListNode<R> {
2252 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2253}
2254
1837impl<'a> AstNode<'a> for ParamList<'a> { 2255impl<'a> AstNode<'a> for ParamList<'a> {
1838 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2256 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1839 match syntax.kind() { 2257 match syntax.kind() {
@@ -1865,12 +2283,20 @@ impl<'a> ParamList<'a> {
1865} 2283}
1866 2284
1867// ParenExpr 2285// ParenExpr
1868#[derive(Debug, Clone, Copy)] 2286#[derive(Debug, Clone, Copy,)]
1869pub struct ParenExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2287pub struct ParenExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1870 syntax: SyntaxNode<R>, 2288 pub(crate) syntax: SyntaxNode<R>,
1871} 2289}
1872pub type ParenExpr<'a> = ParenExprNode<RefRoot<'a>>; 2290pub type ParenExpr<'a> = ParenExprNode<RefRoot<'a>>;
1873 2291
2292impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParenExprNode<R1>> for ParenExprNode<R2> {
2293 fn eq(&self, other: &ParenExprNode<R1>) -> bool { self.syntax == other.syntax }
2294}
2295impl<R: TreeRoot<RaTypes>> Eq for ParenExprNode<R> {}
2296impl<R: TreeRoot<RaTypes>> Hash for ParenExprNode<R> {
2297 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2298}
2299
1874impl<'a> AstNode<'a> for ParenExpr<'a> { 2300impl<'a> AstNode<'a> for ParenExpr<'a> {
1875 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2301 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1876 match syntax.kind() { 2302 match syntax.kind() {
@@ -1894,12 +2320,20 @@ impl<R: TreeRoot<RaTypes>> ParenExprNode<R> {
1894impl<'a> ParenExpr<'a> {} 2320impl<'a> ParenExpr<'a> {}
1895 2321
1896// ParenType 2322// ParenType
1897#[derive(Debug, Clone, Copy)] 2323#[derive(Debug, Clone, Copy,)]
1898pub struct ParenTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2324pub struct ParenTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1899 syntax: SyntaxNode<R>, 2325 pub(crate) syntax: SyntaxNode<R>,
1900} 2326}
1901pub type ParenType<'a> = ParenTypeNode<RefRoot<'a>>; 2327pub type ParenType<'a> = ParenTypeNode<RefRoot<'a>>;
1902 2328
2329impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParenTypeNode<R1>> for ParenTypeNode<R2> {
2330 fn eq(&self, other: &ParenTypeNode<R1>) -> bool { self.syntax == other.syntax }
2331}
2332impl<R: TreeRoot<RaTypes>> Eq for ParenTypeNode<R> {}
2333impl<R: TreeRoot<RaTypes>> Hash for ParenTypeNode<R> {
2334 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2335}
2336
1903impl<'a> AstNode<'a> for ParenType<'a> { 2337impl<'a> AstNode<'a> for ParenType<'a> {
1904 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2338 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1905 match syntax.kind() { 2339 match syntax.kind() {
@@ -1923,7 +2357,7 @@ impl<R: TreeRoot<RaTypes>> ParenTypeNode<R> {
1923impl<'a> ParenType<'a> {} 2357impl<'a> ParenType<'a> {}
1924 2358
1925// Pat 2359// Pat
1926#[derive(Debug, Clone, Copy)] 2360#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1927pub enum Pat<'a> { 2361pub enum Pat<'a> {
1928 RefPat(RefPat<'a>), 2362 RefPat(RefPat<'a>),
1929 BindPat(BindPat<'a>), 2363 BindPat(BindPat<'a>),
@@ -1972,12 +2406,20 @@ impl<'a> AstNode<'a> for Pat<'a> {
1972impl<'a> Pat<'a> {} 2406impl<'a> Pat<'a> {}
1973 2407
1974// Path 2408// Path
1975#[derive(Debug, Clone, Copy)] 2409#[derive(Debug, Clone, Copy,)]
1976pub struct PathNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2410pub struct PathNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1977 syntax: SyntaxNode<R>, 2411 pub(crate) syntax: SyntaxNode<R>,
1978} 2412}
1979pub type Path<'a> = PathNode<RefRoot<'a>>; 2413pub type Path<'a> = PathNode<RefRoot<'a>>;
1980 2414
2415impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathNode<R1>> for PathNode<R2> {
2416 fn eq(&self, other: &PathNode<R1>) -> bool { self.syntax == other.syntax }
2417}
2418impl<R: TreeRoot<RaTypes>> Eq for PathNode<R> {}
2419impl<R: TreeRoot<RaTypes>> Hash for PathNode<R> {
2420 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2421}
2422
1981impl<'a> AstNode<'a> for Path<'a> { 2423impl<'a> AstNode<'a> for Path<'a> {
1982 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2424 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1983 match syntax.kind() { 2425 match syntax.kind() {
@@ -2009,12 +2451,20 @@ impl<'a> Path<'a> {
2009} 2451}
2010 2452
2011// PathExpr 2453// PathExpr
2012#[derive(Debug, Clone, Copy)] 2454#[derive(Debug, Clone, Copy,)]
2013pub struct PathExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2455pub struct PathExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2014 syntax: SyntaxNode<R>, 2456 pub(crate) syntax: SyntaxNode<R>,
2015} 2457}
2016pub type PathExpr<'a> = PathExprNode<RefRoot<'a>>; 2458pub type PathExpr<'a> = PathExprNode<RefRoot<'a>>;
2017 2459
2460impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathExprNode<R1>> for PathExprNode<R2> {
2461 fn eq(&self, other: &PathExprNode<R1>) -> bool { self.syntax == other.syntax }
2462}
2463impl<R: TreeRoot<RaTypes>> Eq for PathExprNode<R> {}
2464impl<R: TreeRoot<RaTypes>> Hash for PathExprNode<R> {
2465 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2466}
2467
2018impl<'a> AstNode<'a> for PathExpr<'a> { 2468impl<'a> AstNode<'a> for PathExpr<'a> {
2019 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2469 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2020 match syntax.kind() { 2470 match syntax.kind() {
@@ -2042,12 +2492,20 @@ impl<'a> PathExpr<'a> {
2042} 2492}
2043 2493
2044// PathPat 2494// PathPat
2045#[derive(Debug, Clone, Copy)] 2495#[derive(Debug, Clone, Copy,)]
2046pub struct PathPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2496pub struct PathPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2047 syntax: SyntaxNode<R>, 2497 pub(crate) syntax: SyntaxNode<R>,
2048} 2498}
2049pub type PathPat<'a> = PathPatNode<RefRoot<'a>>; 2499pub type PathPat<'a> = PathPatNode<RefRoot<'a>>;
2050 2500
2501impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathPatNode<R1>> for PathPatNode<R2> {
2502 fn eq(&self, other: &PathPatNode<R1>) -> bool { self.syntax == other.syntax }
2503}
2504impl<R: TreeRoot<RaTypes>> Eq for PathPatNode<R> {}
2505impl<R: TreeRoot<RaTypes>> Hash for PathPatNode<R> {
2506 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2507}
2508
2051impl<'a> AstNode<'a> for PathPat<'a> { 2509impl<'a> AstNode<'a> for PathPat<'a> {
2052 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2510 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2053 match syntax.kind() { 2511 match syntax.kind() {
@@ -2071,12 +2529,20 @@ impl<R: TreeRoot<RaTypes>> PathPatNode<R> {
2071impl<'a> PathPat<'a> {} 2529impl<'a> PathPat<'a> {}
2072 2530
2073// PathSegment 2531// PathSegment
2074#[derive(Debug, Clone, Copy)] 2532#[derive(Debug, Clone, Copy,)]
2075pub struct PathSegmentNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2533pub struct PathSegmentNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2076 syntax: SyntaxNode<R>, 2534 pub(crate) syntax: SyntaxNode<R>,
2077} 2535}
2078pub type PathSegment<'a> = PathSegmentNode<RefRoot<'a>>; 2536pub type PathSegment<'a> = PathSegmentNode<RefRoot<'a>>;
2079 2537
2538impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathSegmentNode<R1>> for PathSegmentNode<R2> {
2539 fn eq(&self, other: &PathSegmentNode<R1>) -> bool { self.syntax == other.syntax }
2540}
2541impl<R: TreeRoot<RaTypes>> Eq for PathSegmentNode<R> {}
2542impl<R: TreeRoot<RaTypes>> Hash for PathSegmentNode<R> {
2543 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2544}
2545
2080impl<'a> AstNode<'a> for PathSegment<'a> { 2546impl<'a> AstNode<'a> for PathSegment<'a> {
2081 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2547 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2082 match syntax.kind() { 2548 match syntax.kind() {
@@ -2104,12 +2570,20 @@ impl<'a> PathSegment<'a> {
2104} 2570}
2105 2571
2106// PathType 2572// PathType
2107#[derive(Debug, Clone, Copy)] 2573#[derive(Debug, Clone, Copy,)]
2108pub struct PathTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2574pub struct PathTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2109 syntax: SyntaxNode<R>, 2575 pub(crate) syntax: SyntaxNode<R>,
2110} 2576}
2111pub type PathType<'a> = PathTypeNode<RefRoot<'a>>; 2577pub type PathType<'a> = PathTypeNode<RefRoot<'a>>;
2112 2578
2579impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathTypeNode<R1>> for PathTypeNode<R2> {
2580 fn eq(&self, other: &PathTypeNode<R1>) -> bool { self.syntax == other.syntax }
2581}
2582impl<R: TreeRoot<RaTypes>> Eq for PathTypeNode<R> {}
2583impl<R: TreeRoot<RaTypes>> Hash for PathTypeNode<R> {
2584 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2585}
2586
2113impl<'a> AstNode<'a> for PathType<'a> { 2587impl<'a> AstNode<'a> for PathType<'a> {
2114 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2588 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2115 match syntax.kind() { 2589 match syntax.kind() {
@@ -2133,12 +2607,20 @@ impl<R: TreeRoot<RaTypes>> PathTypeNode<R> {
2133impl<'a> PathType<'a> {} 2607impl<'a> PathType<'a> {}
2134 2608
2135// PlaceholderPat 2609// PlaceholderPat
2136#[derive(Debug, Clone, Copy)] 2610#[derive(Debug, Clone, Copy,)]
2137pub struct PlaceholderPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2611pub struct PlaceholderPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2138 syntax: SyntaxNode<R>, 2612 pub(crate) syntax: SyntaxNode<R>,
2139} 2613}
2140pub type PlaceholderPat<'a> = PlaceholderPatNode<RefRoot<'a>>; 2614pub type PlaceholderPat<'a> = PlaceholderPatNode<RefRoot<'a>>;
2141 2615
2616impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PlaceholderPatNode<R1>> for PlaceholderPatNode<R2> {
2617 fn eq(&self, other: &PlaceholderPatNode<R1>) -> bool { self.syntax == other.syntax }
2618}
2619impl<R: TreeRoot<RaTypes>> Eq for PlaceholderPatNode<R> {}
2620impl<R: TreeRoot<RaTypes>> Hash for PlaceholderPatNode<R> {
2621 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2622}
2623
2142impl<'a> AstNode<'a> for PlaceholderPat<'a> { 2624impl<'a> AstNode<'a> for PlaceholderPat<'a> {
2143 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2625 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2144 match syntax.kind() { 2626 match syntax.kind() {
@@ -2162,12 +2644,20 @@ impl<R: TreeRoot<RaTypes>> PlaceholderPatNode<R> {
2162impl<'a> PlaceholderPat<'a> {} 2644impl<'a> PlaceholderPat<'a> {}
2163 2645
2164// PlaceholderType 2646// PlaceholderType
2165#[derive(Debug, Clone, Copy)] 2647#[derive(Debug, Clone, Copy,)]
2166pub struct PlaceholderTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2648pub struct PlaceholderTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2167 syntax: SyntaxNode<R>, 2649 pub(crate) syntax: SyntaxNode<R>,
2168} 2650}
2169pub type PlaceholderType<'a> = PlaceholderTypeNode<RefRoot<'a>>; 2651pub type PlaceholderType<'a> = PlaceholderTypeNode<RefRoot<'a>>;
2170 2652
2653impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PlaceholderTypeNode<R1>> for PlaceholderTypeNode<R2> {
2654 fn eq(&self, other: &PlaceholderTypeNode<R1>) -> bool { self.syntax == other.syntax }
2655}
2656impl<R: TreeRoot<RaTypes>> Eq for PlaceholderTypeNode<R> {}
2657impl<R: TreeRoot<RaTypes>> Hash for PlaceholderTypeNode<R> {
2658 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2659}
2660
2171impl<'a> AstNode<'a> for PlaceholderType<'a> { 2661impl<'a> AstNode<'a> for PlaceholderType<'a> {
2172 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2662 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2173 match syntax.kind() { 2663 match syntax.kind() {
@@ -2191,12 +2681,20 @@ impl<R: TreeRoot<RaTypes>> PlaceholderTypeNode<R> {
2191impl<'a> PlaceholderType<'a> {} 2681impl<'a> PlaceholderType<'a> {}
2192 2682
2193// PointerType 2683// PointerType
2194#[derive(Debug, Clone, Copy)] 2684#[derive(Debug, Clone, Copy,)]
2195pub struct PointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2685pub struct PointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2196 syntax: SyntaxNode<R>, 2686 pub(crate) syntax: SyntaxNode<R>,
2197} 2687}
2198pub type PointerType<'a> = PointerTypeNode<RefRoot<'a>>; 2688pub type PointerType<'a> = PointerTypeNode<RefRoot<'a>>;
2199 2689
2690impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PointerTypeNode<R1>> for PointerTypeNode<R2> {
2691 fn eq(&self, other: &PointerTypeNode<R1>) -> bool { self.syntax == other.syntax }
2692}
2693impl<R: TreeRoot<RaTypes>> Eq for PointerTypeNode<R> {}
2694impl<R: TreeRoot<RaTypes>> Hash for PointerTypeNode<R> {
2695 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2696}
2697
2200impl<'a> AstNode<'a> for PointerType<'a> { 2698impl<'a> AstNode<'a> for PointerType<'a> {
2201 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2699 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2202 match syntax.kind() { 2700 match syntax.kind() {
@@ -2220,12 +2718,20 @@ impl<R: TreeRoot<RaTypes>> PointerTypeNode<R> {
2220impl<'a> PointerType<'a> {} 2718impl<'a> PointerType<'a> {}
2221 2719
2222// PrefixExpr 2720// PrefixExpr
2223#[derive(Debug, Clone, Copy)] 2721#[derive(Debug, Clone, Copy,)]
2224pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2722pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2225 syntax: SyntaxNode<R>, 2723 pub(crate) syntax: SyntaxNode<R>,
2226} 2724}
2227pub type PrefixExpr<'a> = PrefixExprNode<RefRoot<'a>>; 2725pub type PrefixExpr<'a> = PrefixExprNode<RefRoot<'a>>;
2228 2726
2727impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PrefixExprNode<R1>> for PrefixExprNode<R2> {
2728 fn eq(&self, other: &PrefixExprNode<R1>) -> bool { self.syntax == other.syntax }
2729}
2730impl<R: TreeRoot<RaTypes>> Eq for PrefixExprNode<R> {}
2731impl<R: TreeRoot<RaTypes>> Hash for PrefixExprNode<R> {
2732 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2733}
2734
2229impl<'a> AstNode<'a> for PrefixExpr<'a> { 2735impl<'a> AstNode<'a> for PrefixExpr<'a> {
2230 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2736 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2231 match syntax.kind() { 2737 match syntax.kind() {
@@ -2249,12 +2755,20 @@ impl<R: TreeRoot<RaTypes>> PrefixExprNode<R> {
2249impl<'a> PrefixExpr<'a> {} 2755impl<'a> PrefixExpr<'a> {}
2250 2756
2251// RangeExpr 2757// RangeExpr
2252#[derive(Debug, Clone, Copy)] 2758#[derive(Debug, Clone, Copy,)]
2253pub struct RangeExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2759pub struct RangeExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2254 syntax: SyntaxNode<R>, 2760 pub(crate) syntax: SyntaxNode<R>,
2255} 2761}
2256pub type RangeExpr<'a> = RangeExprNode<RefRoot<'a>>; 2762pub type RangeExpr<'a> = RangeExprNode<RefRoot<'a>>;
2257 2763
2764impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RangeExprNode<R1>> for RangeExprNode<R2> {
2765 fn eq(&self, other: &RangeExprNode<R1>) -> bool { self.syntax == other.syntax }
2766}
2767impl<R: TreeRoot<RaTypes>> Eq for RangeExprNode<R> {}
2768impl<R: TreeRoot<RaTypes>> Hash for RangeExprNode<R> {
2769 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2770}
2771
2258impl<'a> AstNode<'a> for RangeExpr<'a> { 2772impl<'a> AstNode<'a> for RangeExpr<'a> {
2259 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2773 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2260 match syntax.kind() { 2774 match syntax.kind() {
@@ -2278,12 +2792,20 @@ impl<R: TreeRoot<RaTypes>> RangeExprNode<R> {
2278impl<'a> RangeExpr<'a> {} 2792impl<'a> RangeExpr<'a> {}
2279 2793
2280// RangePat 2794// RangePat
2281#[derive(Debug, Clone, Copy)] 2795#[derive(Debug, Clone, Copy,)]
2282pub struct RangePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2796pub struct RangePatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2283 syntax: SyntaxNode<R>, 2797 pub(crate) syntax: SyntaxNode<R>,
2284} 2798}
2285pub type RangePat<'a> = RangePatNode<RefRoot<'a>>; 2799pub type RangePat<'a> = RangePatNode<RefRoot<'a>>;
2286 2800
2801impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RangePatNode<R1>> for RangePatNode<R2> {
2802 fn eq(&self, other: &RangePatNode<R1>) -> bool { self.syntax == other.syntax }
2803}
2804impl<R: TreeRoot<RaTypes>> Eq for RangePatNode<R> {}
2805impl<R: TreeRoot<RaTypes>> Hash for RangePatNode<R> {
2806 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2807}
2808
2287impl<'a> AstNode<'a> for RangePat<'a> { 2809impl<'a> AstNode<'a> for RangePat<'a> {
2288 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2810 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2289 match syntax.kind() { 2811 match syntax.kind() {
@@ -2307,12 +2829,20 @@ impl<R: TreeRoot<RaTypes>> RangePatNode<R> {
2307impl<'a> RangePat<'a> {} 2829impl<'a> RangePat<'a> {}
2308 2830
2309// RefExpr 2831// RefExpr
2310#[derive(Debug, Clone, Copy)] 2832#[derive(Debug, Clone, Copy,)]
2311pub struct RefExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2833pub struct RefExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2312 syntax: SyntaxNode<R>, 2834 pub(crate) syntax: SyntaxNode<R>,
2313} 2835}
2314pub type RefExpr<'a> = RefExprNode<RefRoot<'a>>; 2836pub type RefExpr<'a> = RefExprNode<RefRoot<'a>>;
2315 2837
2838impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RefExprNode<R1>> for RefExprNode<R2> {
2839 fn eq(&self, other: &RefExprNode<R1>) -> bool { self.syntax == other.syntax }
2840}
2841impl<R: TreeRoot<RaTypes>> Eq for RefExprNode<R> {}
2842impl<R: TreeRoot<RaTypes>> Hash for RefExprNode<R> {
2843 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2844}
2845
2316impl<'a> AstNode<'a> for RefExpr<'a> { 2846impl<'a> AstNode<'a> for RefExpr<'a> {
2317 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2847 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2318 match syntax.kind() { 2848 match syntax.kind() {
@@ -2336,12 +2866,20 @@ impl<R: TreeRoot<RaTypes>> RefExprNode<R> {
2336impl<'a> RefExpr<'a> {} 2866impl<'a> RefExpr<'a> {}
2337 2867
2338// RefPat 2868// RefPat
2339#[derive(Debug, Clone, Copy)] 2869#[derive(Debug, Clone, Copy,)]
2340pub struct RefPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2870pub struct RefPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2341 syntax: SyntaxNode<R>, 2871 pub(crate) syntax: SyntaxNode<R>,
2342} 2872}
2343pub type RefPat<'a> = RefPatNode<RefRoot<'a>>; 2873pub type RefPat<'a> = RefPatNode<RefRoot<'a>>;
2344 2874
2875impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RefPatNode<R1>> for RefPatNode<R2> {
2876 fn eq(&self, other: &RefPatNode<R1>) -> bool { self.syntax == other.syntax }
2877}
2878impl<R: TreeRoot<RaTypes>> Eq for RefPatNode<R> {}
2879impl<R: TreeRoot<RaTypes>> Hash for RefPatNode<R> {
2880 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2881}
2882
2345impl<'a> AstNode<'a> for RefPat<'a> { 2883impl<'a> AstNode<'a> for RefPat<'a> {
2346 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2884 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2347 match syntax.kind() { 2885 match syntax.kind() {
@@ -2365,12 +2903,20 @@ impl<R: TreeRoot<RaTypes>> RefPatNode<R> {
2365impl<'a> RefPat<'a> {} 2903impl<'a> RefPat<'a> {}
2366 2904
2367// ReferenceType 2905// ReferenceType
2368#[derive(Debug, Clone, Copy)] 2906#[derive(Debug, Clone, Copy,)]
2369pub struct ReferenceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2907pub struct ReferenceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2370 syntax: SyntaxNode<R>, 2908 pub(crate) syntax: SyntaxNode<R>,
2371} 2909}
2372pub type ReferenceType<'a> = ReferenceTypeNode<RefRoot<'a>>; 2910pub type ReferenceType<'a> = ReferenceTypeNode<RefRoot<'a>>;
2373 2911
2912impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ReferenceTypeNode<R1>> for ReferenceTypeNode<R2> {
2913 fn eq(&self, other: &ReferenceTypeNode<R1>) -> bool { self.syntax == other.syntax }
2914}
2915impl<R: TreeRoot<RaTypes>> Eq for ReferenceTypeNode<R> {}
2916impl<R: TreeRoot<RaTypes>> Hash for ReferenceTypeNode<R> {
2917 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2918}
2919
2374impl<'a> AstNode<'a> for ReferenceType<'a> { 2920impl<'a> AstNode<'a> for ReferenceType<'a> {
2375 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2921 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2376 match syntax.kind() { 2922 match syntax.kind() {
@@ -2394,12 +2940,20 @@ impl<R: TreeRoot<RaTypes>> ReferenceTypeNode<R> {
2394impl<'a> ReferenceType<'a> {} 2940impl<'a> ReferenceType<'a> {}
2395 2941
2396// RetType 2942// RetType
2397#[derive(Debug, Clone, Copy)] 2943#[derive(Debug, Clone, Copy,)]
2398pub struct RetTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2944pub struct RetTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2399 syntax: SyntaxNode<R>, 2945 pub(crate) syntax: SyntaxNode<R>,
2400} 2946}
2401pub type RetType<'a> = RetTypeNode<RefRoot<'a>>; 2947pub type RetType<'a> = RetTypeNode<RefRoot<'a>>;
2402 2948
2949impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RetTypeNode<R1>> for RetTypeNode<R2> {
2950 fn eq(&self, other: &RetTypeNode<R1>) -> bool { self.syntax == other.syntax }
2951}
2952impl<R: TreeRoot<RaTypes>> Eq for RetTypeNode<R> {}
2953impl<R: TreeRoot<RaTypes>> Hash for RetTypeNode<R> {
2954 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2955}
2956
2403impl<'a> AstNode<'a> for RetType<'a> { 2957impl<'a> AstNode<'a> for RetType<'a> {
2404 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2958 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2405 match syntax.kind() { 2959 match syntax.kind() {
@@ -2423,12 +2977,20 @@ impl<R: TreeRoot<RaTypes>> RetTypeNode<R> {
2423impl<'a> RetType<'a> {} 2977impl<'a> RetType<'a> {}
2424 2978
2425// ReturnExpr 2979// ReturnExpr
2426#[derive(Debug, Clone, Copy)] 2980#[derive(Debug, Clone, Copy,)]
2427pub struct ReturnExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2981pub struct ReturnExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2428 syntax: SyntaxNode<R>, 2982 pub(crate) syntax: SyntaxNode<R>,
2429} 2983}
2430pub type ReturnExpr<'a> = ReturnExprNode<RefRoot<'a>>; 2984pub type ReturnExpr<'a> = ReturnExprNode<RefRoot<'a>>;
2431 2985
2986impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ReturnExprNode<R1>> for ReturnExprNode<R2> {
2987 fn eq(&self, other: &ReturnExprNode<R1>) -> bool { self.syntax == other.syntax }
2988}
2989impl<R: TreeRoot<RaTypes>> Eq for ReturnExprNode<R> {}
2990impl<R: TreeRoot<RaTypes>> Hash for ReturnExprNode<R> {
2991 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2992}
2993
2432impl<'a> AstNode<'a> for ReturnExpr<'a> { 2994impl<'a> AstNode<'a> for ReturnExpr<'a> {
2433 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2995 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2434 match syntax.kind() { 2996 match syntax.kind() {
@@ -2452,12 +3014,20 @@ impl<R: TreeRoot<RaTypes>> ReturnExprNode<R> {
2452impl<'a> ReturnExpr<'a> {} 3014impl<'a> ReturnExpr<'a> {}
2453 3015
2454// Root 3016// Root
2455#[derive(Debug, Clone, Copy)] 3017#[derive(Debug, Clone, Copy,)]
2456pub struct RootNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3018pub struct RootNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2457 syntax: SyntaxNode<R>, 3019 pub(crate) syntax: SyntaxNode<R>,
2458} 3020}
2459pub type Root<'a> = RootNode<RefRoot<'a>>; 3021pub type Root<'a> = RootNode<RefRoot<'a>>;
2460 3022
3023impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RootNode<R1>> for RootNode<R2> {
3024 fn eq(&self, other: &RootNode<R1>) -> bool { self.syntax == other.syntax }
3025}
3026impl<R: TreeRoot<RaTypes>> Eq for RootNode<R> {}
3027impl<R: TreeRoot<RaTypes>> Hash for RootNode<R> {
3028 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3029}
3030
2461impl<'a> AstNode<'a> for Root<'a> { 3031impl<'a> AstNode<'a> for Root<'a> {
2462 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3032 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2463 match syntax.kind() { 3033 match syntax.kind() {
@@ -2487,12 +3057,20 @@ impl<'a> Root<'a> {
2487} 3057}
2488 3058
2489// SelfParam 3059// SelfParam
2490#[derive(Debug, Clone, Copy)] 3060#[derive(Debug, Clone, Copy,)]
2491pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3061pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2492 syntax: SyntaxNode<R>, 3062 pub(crate) syntax: SyntaxNode<R>,
2493} 3063}
2494pub type SelfParam<'a> = SelfParamNode<RefRoot<'a>>; 3064pub type SelfParam<'a> = SelfParamNode<RefRoot<'a>>;
2495 3065
3066impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SelfParamNode<R1>> for SelfParamNode<R2> {
3067 fn eq(&self, other: &SelfParamNode<R1>) -> bool { self.syntax == other.syntax }
3068}
3069impl<R: TreeRoot<RaTypes>> Eq for SelfParamNode<R> {}
3070impl<R: TreeRoot<RaTypes>> Hash for SelfParamNode<R> {
3071 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3072}
3073
2496impl<'a> AstNode<'a> for SelfParam<'a> { 3074impl<'a> AstNode<'a> for SelfParam<'a> {
2497 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3075 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2498 match syntax.kind() { 3076 match syntax.kind() {
@@ -2516,12 +3094,20 @@ impl<R: TreeRoot<RaTypes>> SelfParamNode<R> {
2516impl<'a> SelfParam<'a> {} 3094impl<'a> SelfParam<'a> {}
2517 3095
2518// SlicePat 3096// SlicePat
2519#[derive(Debug, Clone, Copy)] 3097#[derive(Debug, Clone, Copy,)]
2520pub struct SlicePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3098pub struct SlicePatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2521 syntax: SyntaxNode<R>, 3099 pub(crate) syntax: SyntaxNode<R>,
2522} 3100}
2523pub type SlicePat<'a> = SlicePatNode<RefRoot<'a>>; 3101pub type SlicePat<'a> = SlicePatNode<RefRoot<'a>>;
2524 3102
3103impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SlicePatNode<R1>> for SlicePatNode<R2> {
3104 fn eq(&self, other: &SlicePatNode<R1>) -> bool { self.syntax == other.syntax }
3105}
3106impl<R: TreeRoot<RaTypes>> Eq for SlicePatNode<R> {}
3107impl<R: TreeRoot<RaTypes>> Hash for SlicePatNode<R> {
3108 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3109}
3110
2525impl<'a> AstNode<'a> for SlicePat<'a> { 3111impl<'a> AstNode<'a> for SlicePat<'a> {
2526 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3112 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2527 match syntax.kind() { 3113 match syntax.kind() {
@@ -2545,12 +3131,20 @@ impl<R: TreeRoot<RaTypes>> SlicePatNode<R> {
2545impl<'a> SlicePat<'a> {} 3131impl<'a> SlicePat<'a> {}
2546 3132
2547// SliceType 3133// SliceType
2548#[derive(Debug, Clone, Copy)] 3134#[derive(Debug, Clone, Copy,)]
2549pub struct SliceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3135pub struct SliceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2550 syntax: SyntaxNode<R>, 3136 pub(crate) syntax: SyntaxNode<R>,
2551} 3137}
2552pub type SliceType<'a> = SliceTypeNode<RefRoot<'a>>; 3138pub type SliceType<'a> = SliceTypeNode<RefRoot<'a>>;
2553 3139
3140impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SliceTypeNode<R1>> for SliceTypeNode<R2> {
3141 fn eq(&self, other: &SliceTypeNode<R1>) -> bool { self.syntax == other.syntax }
3142}
3143impl<R: TreeRoot<RaTypes>> Eq for SliceTypeNode<R> {}
3144impl<R: TreeRoot<RaTypes>> Hash for SliceTypeNode<R> {
3145 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3146}
3147
2554impl<'a> AstNode<'a> for SliceType<'a> { 3148impl<'a> AstNode<'a> for SliceType<'a> {
2555 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3149 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2556 match syntax.kind() { 3150 match syntax.kind() {
@@ -2574,12 +3168,20 @@ impl<R: TreeRoot<RaTypes>> SliceTypeNode<R> {
2574impl<'a> SliceType<'a> {} 3168impl<'a> SliceType<'a> {}
2575 3169
2576// StaticDef 3170// StaticDef
2577#[derive(Debug, Clone, Copy)] 3171#[derive(Debug, Clone, Copy,)]
2578pub struct StaticDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3172pub struct StaticDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2579 syntax: SyntaxNode<R>, 3173 pub(crate) syntax: SyntaxNode<R>,
2580} 3174}
2581pub type StaticDef<'a> = StaticDefNode<RefRoot<'a>>; 3175pub type StaticDef<'a> = StaticDefNode<RefRoot<'a>>;
2582 3176
3177impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StaticDefNode<R1>> for StaticDefNode<R2> {
3178 fn eq(&self, other: &StaticDefNode<R1>) -> bool { self.syntax == other.syntax }
3179}
3180impl<R: TreeRoot<RaTypes>> Eq for StaticDefNode<R> {}
3181impl<R: TreeRoot<RaTypes>> Hash for StaticDefNode<R> {
3182 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3183}
3184
2583impl<'a> AstNode<'a> for StaticDef<'a> { 3185impl<'a> AstNode<'a> for StaticDef<'a> {
2584 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3186 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2585 match syntax.kind() { 3187 match syntax.kind() {
@@ -2606,7 +3208,7 @@ impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {}
2606impl<'a> StaticDef<'a> {} 3208impl<'a> StaticDef<'a> {}
2607 3209
2608// Stmt 3210// Stmt
2609#[derive(Debug, Clone, Copy)] 3211#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2610pub enum Stmt<'a> { 3212pub enum Stmt<'a> {
2611 ExprStmt(ExprStmt<'a>), 3213 ExprStmt(ExprStmt<'a>),
2612 LetStmt(LetStmt<'a>), 3214 LetStmt(LetStmt<'a>),
@@ -2631,12 +3233,20 @@ impl<'a> AstNode<'a> for Stmt<'a> {
2631impl<'a> Stmt<'a> {} 3233impl<'a> Stmt<'a> {}
2632 3234
2633// StructDef 3235// StructDef
2634#[derive(Debug, Clone, Copy)] 3236#[derive(Debug, Clone, Copy,)]
2635pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3237pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2636 syntax: SyntaxNode<R>, 3238 pub(crate) syntax: SyntaxNode<R>,
2637} 3239}
2638pub type StructDef<'a> = StructDefNode<RefRoot<'a>>; 3240pub type StructDef<'a> = StructDefNode<RefRoot<'a>>;
2639 3241
3242impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructDefNode<R1>> for StructDefNode<R2> {
3243 fn eq(&self, other: &StructDefNode<R1>) -> bool { self.syntax == other.syntax }
3244}
3245impl<R: TreeRoot<RaTypes>> Eq for StructDefNode<R> {}
3246impl<R: TreeRoot<RaTypes>> Hash for StructDefNode<R> {
3247 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3248}
3249
2640impl<'a> AstNode<'a> for StructDef<'a> { 3250impl<'a> AstNode<'a> for StructDef<'a> {
2641 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3251 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2642 match syntax.kind() { 3252 match syntax.kind() {
@@ -2667,12 +3277,20 @@ impl<'a> StructDef<'a> {
2667} 3277}
2668 3278
2669// StructLit 3279// StructLit
2670#[derive(Debug, Clone, Copy)] 3280#[derive(Debug, Clone, Copy,)]
2671pub struct StructLitNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3281pub struct StructLitNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2672 syntax: SyntaxNode<R>, 3282 pub(crate) syntax: SyntaxNode<R>,
2673} 3283}
2674pub type StructLit<'a> = StructLitNode<RefRoot<'a>>; 3284pub type StructLit<'a> = StructLitNode<RefRoot<'a>>;
2675 3285
3286impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructLitNode<R1>> for StructLitNode<R2> {
3287 fn eq(&self, other: &StructLitNode<R1>) -> bool { self.syntax == other.syntax }
3288}
3289impl<R: TreeRoot<RaTypes>> Eq for StructLitNode<R> {}
3290impl<R: TreeRoot<RaTypes>> Hash for StructLitNode<R> {
3291 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3292}
3293
2676impl<'a> AstNode<'a> for StructLit<'a> { 3294impl<'a> AstNode<'a> for StructLit<'a> {
2677 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3295 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2678 match syntax.kind() { 3296 match syntax.kind() {
@@ -2696,12 +3314,20 @@ impl<R: TreeRoot<RaTypes>> StructLitNode<R> {
2696impl<'a> StructLit<'a> {} 3314impl<'a> StructLit<'a> {}
2697 3315
2698// StructPat 3316// StructPat
2699#[derive(Debug, Clone, Copy)] 3317#[derive(Debug, Clone, Copy,)]
2700pub struct StructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3318pub struct StructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2701 syntax: SyntaxNode<R>, 3319 pub(crate) syntax: SyntaxNode<R>,
2702} 3320}
2703pub type StructPat<'a> = StructPatNode<RefRoot<'a>>; 3321pub type StructPat<'a> = StructPatNode<RefRoot<'a>>;
2704 3322
3323impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructPatNode<R1>> for StructPatNode<R2> {
3324 fn eq(&self, other: &StructPatNode<R1>) -> bool { self.syntax == other.syntax }
3325}
3326impl<R: TreeRoot<RaTypes>> Eq for StructPatNode<R> {}
3327impl<R: TreeRoot<RaTypes>> Hash for StructPatNode<R> {
3328 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3329}
3330
2705impl<'a> AstNode<'a> for StructPat<'a> { 3331impl<'a> AstNode<'a> for StructPat<'a> {
2706 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3332 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2707 match syntax.kind() { 3333 match syntax.kind() {
@@ -2725,12 +3351,20 @@ impl<R: TreeRoot<RaTypes>> StructPatNode<R> {
2725impl<'a> StructPat<'a> {} 3351impl<'a> StructPat<'a> {}
2726 3352
2727// TokenTree 3353// TokenTree
2728#[derive(Debug, Clone, Copy)] 3354#[derive(Debug, Clone, Copy,)]
2729pub struct TokenTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3355pub struct TokenTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2730 syntax: SyntaxNode<R>, 3356 pub(crate) syntax: SyntaxNode<R>,
2731} 3357}
2732pub type TokenTree<'a> = TokenTreeNode<RefRoot<'a>>; 3358pub type TokenTree<'a> = TokenTreeNode<RefRoot<'a>>;
2733 3359
3360impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TokenTreeNode<R1>> for TokenTreeNode<R2> {
3361 fn eq(&self, other: &TokenTreeNode<R1>) -> bool { self.syntax == other.syntax }
3362}
3363impl<R: TreeRoot<RaTypes>> Eq for TokenTreeNode<R> {}
3364impl<R: TreeRoot<RaTypes>> Hash for TokenTreeNode<R> {
3365 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3366}
3367
2734impl<'a> AstNode<'a> for TokenTree<'a> { 3368impl<'a> AstNode<'a> for TokenTree<'a> {
2735 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3369 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2736 match syntax.kind() { 3370 match syntax.kind() {
@@ -2754,12 +3388,20 @@ impl<R: TreeRoot<RaTypes>> TokenTreeNode<R> {
2754impl<'a> TokenTree<'a> {} 3388impl<'a> TokenTree<'a> {}
2755 3389
2756// TraitDef 3390// TraitDef
2757#[derive(Debug, Clone, Copy)] 3391#[derive(Debug, Clone, Copy,)]
2758pub struct TraitDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3392pub struct TraitDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2759 syntax: SyntaxNode<R>, 3393 pub(crate) syntax: SyntaxNode<R>,
2760} 3394}
2761pub type TraitDef<'a> = TraitDefNode<RefRoot<'a>>; 3395pub type TraitDef<'a> = TraitDefNode<RefRoot<'a>>;
2762 3396
3397impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TraitDefNode<R1>> for TraitDefNode<R2> {
3398 fn eq(&self, other: &TraitDefNode<R1>) -> bool { self.syntax == other.syntax }
3399}
3400impl<R: TreeRoot<RaTypes>> Eq for TraitDefNode<R> {}
3401impl<R: TreeRoot<RaTypes>> Hash for TraitDefNode<R> {
3402 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3403}
3404
2763impl<'a> AstNode<'a> for TraitDef<'a> { 3405impl<'a> AstNode<'a> for TraitDef<'a> {
2764 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3406 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2765 match syntax.kind() { 3407 match syntax.kind() {
@@ -2785,12 +3427,20 @@ impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {}
2785impl<'a> TraitDef<'a> {} 3427impl<'a> TraitDef<'a> {}
2786 3428
2787// TryExpr 3429// TryExpr
2788#[derive(Debug, Clone, Copy)] 3430#[derive(Debug, Clone, Copy,)]
2789pub struct TryExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3431pub struct TryExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2790 syntax: SyntaxNode<R>, 3432 pub(crate) syntax: SyntaxNode<R>,
2791} 3433}
2792pub type TryExpr<'a> = TryExprNode<RefRoot<'a>>; 3434pub type TryExpr<'a> = TryExprNode<RefRoot<'a>>;
2793 3435
3436impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TryExprNode<R1>> for TryExprNode<R2> {
3437 fn eq(&self, other: &TryExprNode<R1>) -> bool { self.syntax == other.syntax }
3438}
3439impl<R: TreeRoot<RaTypes>> Eq for TryExprNode<R> {}
3440impl<R: TreeRoot<RaTypes>> Hash for TryExprNode<R> {
3441 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3442}
3443
2794impl<'a> AstNode<'a> for TryExpr<'a> { 3444impl<'a> AstNode<'a> for TryExpr<'a> {
2795 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3445 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2796 match syntax.kind() { 3446 match syntax.kind() {
@@ -2814,12 +3464,20 @@ impl<R: TreeRoot<RaTypes>> TryExprNode<R> {
2814impl<'a> TryExpr<'a> {} 3464impl<'a> TryExpr<'a> {}
2815 3465
2816// TupleExpr 3466// TupleExpr
2817#[derive(Debug, Clone, Copy)] 3467#[derive(Debug, Clone, Copy,)]
2818pub struct TupleExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3468pub struct TupleExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2819 syntax: SyntaxNode<R>, 3469 pub(crate) syntax: SyntaxNode<R>,
2820} 3470}
2821pub type TupleExpr<'a> = TupleExprNode<RefRoot<'a>>; 3471pub type TupleExpr<'a> = TupleExprNode<RefRoot<'a>>;
2822 3472
3473impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleExprNode<R1>> for TupleExprNode<R2> {
3474 fn eq(&self, other: &TupleExprNode<R1>) -> bool { self.syntax == other.syntax }
3475}
3476impl<R: TreeRoot<RaTypes>> Eq for TupleExprNode<R> {}
3477impl<R: TreeRoot<RaTypes>> Hash for TupleExprNode<R> {
3478 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3479}
3480
2823impl<'a> AstNode<'a> for TupleExpr<'a> { 3481impl<'a> AstNode<'a> for TupleExpr<'a> {
2824 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3482 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2825 match syntax.kind() { 3483 match syntax.kind() {
@@ -2843,12 +3501,20 @@ impl<R: TreeRoot<RaTypes>> TupleExprNode<R> {
2843impl<'a> TupleExpr<'a> {} 3501impl<'a> TupleExpr<'a> {}
2844 3502
2845// TuplePat 3503// TuplePat
2846#[derive(Debug, Clone, Copy)] 3504#[derive(Debug, Clone, Copy,)]
2847pub struct TuplePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3505pub struct TuplePatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2848 syntax: SyntaxNode<R>, 3506 pub(crate) syntax: SyntaxNode<R>,
2849} 3507}
2850pub type TuplePat<'a> = TuplePatNode<RefRoot<'a>>; 3508pub type TuplePat<'a> = TuplePatNode<RefRoot<'a>>;
2851 3509
3510impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TuplePatNode<R1>> for TuplePatNode<R2> {
3511 fn eq(&self, other: &TuplePatNode<R1>) -> bool { self.syntax == other.syntax }
3512}
3513impl<R: TreeRoot<RaTypes>> Eq for TuplePatNode<R> {}
3514impl<R: TreeRoot<RaTypes>> Hash for TuplePatNode<R> {
3515 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3516}
3517
2852impl<'a> AstNode<'a> for TuplePat<'a> { 3518impl<'a> AstNode<'a> for TuplePat<'a> {
2853 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3519 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2854 match syntax.kind() { 3520 match syntax.kind() {
@@ -2872,12 +3538,20 @@ impl<R: TreeRoot<RaTypes>> TuplePatNode<R> {
2872impl<'a> TuplePat<'a> {} 3538impl<'a> TuplePat<'a> {}
2873 3539
2874// TupleStructPat 3540// TupleStructPat
2875#[derive(Debug, Clone, Copy)] 3541#[derive(Debug, Clone, Copy,)]
2876pub struct TupleStructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3542pub struct TupleStructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2877 syntax: SyntaxNode<R>, 3543 pub(crate) syntax: SyntaxNode<R>,
2878} 3544}
2879pub type TupleStructPat<'a> = TupleStructPatNode<RefRoot<'a>>; 3545pub type TupleStructPat<'a> = TupleStructPatNode<RefRoot<'a>>;
2880 3546
3547impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleStructPatNode<R1>> for TupleStructPatNode<R2> {
3548 fn eq(&self, other: &TupleStructPatNode<R1>) -> bool { self.syntax == other.syntax }
3549}
3550impl<R: TreeRoot<RaTypes>> Eq for TupleStructPatNode<R> {}
3551impl<R: TreeRoot<RaTypes>> Hash for TupleStructPatNode<R> {
3552 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3553}
3554
2881impl<'a> AstNode<'a> for TupleStructPat<'a> { 3555impl<'a> AstNode<'a> for TupleStructPat<'a> {
2882 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3556 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2883 match syntax.kind() { 3557 match syntax.kind() {
@@ -2901,12 +3575,20 @@ impl<R: TreeRoot<RaTypes>> TupleStructPatNode<R> {
2901impl<'a> TupleStructPat<'a> {} 3575impl<'a> TupleStructPat<'a> {}
2902 3576
2903// TupleType 3577// TupleType
2904#[derive(Debug, Clone, Copy)] 3578#[derive(Debug, Clone, Copy,)]
2905pub struct TupleTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3579pub struct TupleTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2906 syntax: SyntaxNode<R>, 3580 pub(crate) syntax: SyntaxNode<R>,
2907} 3581}
2908pub type TupleType<'a> = TupleTypeNode<RefRoot<'a>>; 3582pub type TupleType<'a> = TupleTypeNode<RefRoot<'a>>;
2909 3583
3584impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleTypeNode<R1>> for TupleTypeNode<R2> {
3585 fn eq(&self, other: &TupleTypeNode<R1>) -> bool { self.syntax == other.syntax }
3586}
3587impl<R: TreeRoot<RaTypes>> Eq for TupleTypeNode<R> {}
3588impl<R: TreeRoot<RaTypes>> Hash for TupleTypeNode<R> {
3589 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3590}
3591
2910impl<'a> AstNode<'a> for TupleType<'a> { 3592impl<'a> AstNode<'a> for TupleType<'a> {
2911 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3593 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2912 match syntax.kind() { 3594 match syntax.kind() {
@@ -2930,12 +3612,20 @@ impl<R: TreeRoot<RaTypes>> TupleTypeNode<R> {
2930impl<'a> TupleType<'a> {} 3612impl<'a> TupleType<'a> {}
2931 3613
2932// TypeDef 3614// TypeDef
2933#[derive(Debug, Clone, Copy)] 3615#[derive(Debug, Clone, Copy,)]
2934pub struct TypeDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3616pub struct TypeDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2935 syntax: SyntaxNode<R>, 3617 pub(crate) syntax: SyntaxNode<R>,
2936} 3618}
2937pub type TypeDef<'a> = TypeDefNode<RefRoot<'a>>; 3619pub type TypeDef<'a> = TypeDefNode<RefRoot<'a>>;
2938 3620
3621impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeDefNode<R1>> for TypeDefNode<R2> {
3622 fn eq(&self, other: &TypeDefNode<R1>) -> bool { self.syntax == other.syntax }
3623}
3624impl<R: TreeRoot<RaTypes>> Eq for TypeDefNode<R> {}
3625impl<R: TreeRoot<RaTypes>> Hash for TypeDefNode<R> {
3626 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3627}
3628
2939impl<'a> AstNode<'a> for TypeDef<'a> { 3629impl<'a> AstNode<'a> for TypeDef<'a> {
2940 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3630 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2941 match syntax.kind() { 3631 match syntax.kind() {
@@ -2962,12 +3652,20 @@ impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {}
2962impl<'a> TypeDef<'a> {} 3652impl<'a> TypeDef<'a> {}
2963 3653
2964// TypeParam 3654// TypeParam
2965#[derive(Debug, Clone, Copy)] 3655#[derive(Debug, Clone, Copy,)]
2966pub struct TypeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3656pub struct TypeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2967 syntax: SyntaxNode<R>, 3657 pub(crate) syntax: SyntaxNode<R>,
2968} 3658}
2969pub type TypeParam<'a> = TypeParamNode<RefRoot<'a>>; 3659pub type TypeParam<'a> = TypeParamNode<RefRoot<'a>>;
2970 3660
3661impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeParamNode<R1>> for TypeParamNode<R2> {
3662 fn eq(&self, other: &TypeParamNode<R1>) -> bool { self.syntax == other.syntax }
3663}
3664impl<R: TreeRoot<RaTypes>> Eq for TypeParamNode<R> {}
3665impl<R: TreeRoot<RaTypes>> Hash for TypeParamNode<R> {
3666 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3667}
3668
2971impl<'a> AstNode<'a> for TypeParam<'a> { 3669impl<'a> AstNode<'a> for TypeParam<'a> {
2972 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3670 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2973 match syntax.kind() { 3671 match syntax.kind() {
@@ -2992,12 +3690,20 @@ impl<'a> ast::NameOwner<'a> for TypeParam<'a> {}
2992impl<'a> TypeParam<'a> {} 3690impl<'a> TypeParam<'a> {}
2993 3691
2994// TypeParamList 3692// TypeParamList
2995#[derive(Debug, Clone, Copy)] 3693#[derive(Debug, Clone, Copy,)]
2996pub struct TypeParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3694pub struct TypeParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2997 syntax: SyntaxNode<R>, 3695 pub(crate) syntax: SyntaxNode<R>,
2998} 3696}
2999pub type TypeParamList<'a> = TypeParamListNode<RefRoot<'a>>; 3697pub type TypeParamList<'a> = TypeParamListNode<RefRoot<'a>>;
3000 3698
3699impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeParamListNode<R1>> for TypeParamListNode<R2> {
3700 fn eq(&self, other: &TypeParamListNode<R1>) -> bool { self.syntax == other.syntax }
3701}
3702impl<R: TreeRoot<RaTypes>> Eq for TypeParamListNode<R> {}
3703impl<R: TreeRoot<RaTypes>> Hash for TypeParamListNode<R> {
3704 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3705}
3706
3001impl<'a> AstNode<'a> for TypeParamList<'a> { 3707impl<'a> AstNode<'a> for TypeParamList<'a> {
3002 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3708 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3003 match syntax.kind() { 3709 match syntax.kind() {
@@ -3029,7 +3735,7 @@ impl<'a> TypeParamList<'a> {
3029} 3735}
3030 3736
3031// TypeRef 3737// TypeRef
3032#[derive(Debug, Clone, Copy)] 3738#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3033pub enum TypeRef<'a> { 3739pub enum TypeRef<'a> {
3034 ParenType(ParenType<'a>), 3740 ParenType(ParenType<'a>),
3035 TupleType(TupleType<'a>), 3741 TupleType(TupleType<'a>),
@@ -3087,12 +3793,20 @@ impl<'a> AstNode<'a> for TypeRef<'a> {
3087impl<'a> TypeRef<'a> {} 3793impl<'a> TypeRef<'a> {}
3088 3794
3089// UseItem 3795// UseItem
3090#[derive(Debug, Clone, Copy)] 3796#[derive(Debug, Clone, Copy,)]
3091pub struct UseItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3797pub struct UseItemNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3092 syntax: SyntaxNode<R>, 3798 pub(crate) syntax: SyntaxNode<R>,
3093} 3799}
3094pub type UseItem<'a> = UseItemNode<RefRoot<'a>>; 3800pub type UseItem<'a> = UseItemNode<RefRoot<'a>>;
3095 3801
3802impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseItemNode<R1>> for UseItemNode<R2> {
3803 fn eq(&self, other: &UseItemNode<R1>) -> bool { self.syntax == other.syntax }
3804}
3805impl<R: TreeRoot<RaTypes>> Eq for UseItemNode<R> {}
3806impl<R: TreeRoot<RaTypes>> Hash for UseItemNode<R> {
3807 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3808}
3809
3096impl<'a> AstNode<'a> for UseItem<'a> { 3810impl<'a> AstNode<'a> for UseItem<'a> {
3097 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3811 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3098 match syntax.kind() { 3812 match syntax.kind() {
@@ -3120,12 +3834,20 @@ impl<'a> UseItem<'a> {
3120} 3834}
3121 3835
3122// UseTree 3836// UseTree
3123#[derive(Debug, Clone, Copy)] 3837#[derive(Debug, Clone, Copy,)]
3124pub struct UseTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3838pub struct UseTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3125 syntax: SyntaxNode<R>, 3839 pub(crate) syntax: SyntaxNode<R>,
3126} 3840}
3127pub type UseTree<'a> = UseTreeNode<RefRoot<'a>>; 3841pub type UseTree<'a> = UseTreeNode<RefRoot<'a>>;
3128 3842
3843impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseTreeNode<R1>> for UseTreeNode<R2> {
3844 fn eq(&self, other: &UseTreeNode<R1>) -> bool { self.syntax == other.syntax }
3845}
3846impl<R: TreeRoot<RaTypes>> Eq for UseTreeNode<R> {}
3847impl<R: TreeRoot<RaTypes>> Hash for UseTreeNode<R> {
3848 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3849}
3850
3129impl<'a> AstNode<'a> for UseTree<'a> { 3851impl<'a> AstNode<'a> for UseTree<'a> {
3130 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3852 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3131 match syntax.kind() { 3853 match syntax.kind() {
@@ -3157,12 +3879,20 @@ impl<'a> UseTree<'a> {
3157} 3879}
3158 3880
3159// UseTreeList 3881// UseTreeList
3160#[derive(Debug, Clone, Copy)] 3882#[derive(Debug, Clone, Copy,)]
3161pub struct UseTreeListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3883pub struct UseTreeListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3162 syntax: SyntaxNode<R>, 3884 pub(crate) syntax: SyntaxNode<R>,
3163} 3885}
3164pub type UseTreeList<'a> = UseTreeListNode<RefRoot<'a>>; 3886pub type UseTreeList<'a> = UseTreeListNode<RefRoot<'a>>;
3165 3887
3888impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseTreeListNode<R1>> for UseTreeListNode<R2> {
3889 fn eq(&self, other: &UseTreeListNode<R1>) -> bool { self.syntax == other.syntax }
3890}
3891impl<R: TreeRoot<RaTypes>> Eq for UseTreeListNode<R> {}
3892impl<R: TreeRoot<RaTypes>> Hash for UseTreeListNode<R> {
3893 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3894}
3895
3166impl<'a> AstNode<'a> for UseTreeList<'a> { 3896impl<'a> AstNode<'a> for UseTreeList<'a> {
3167 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3897 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3168 match syntax.kind() { 3898 match syntax.kind() {
@@ -3190,12 +3920,20 @@ impl<'a> UseTreeList<'a> {
3190} 3920}
3191 3921
3192// WhereClause 3922// WhereClause
3193#[derive(Debug, Clone, Copy)] 3923#[derive(Debug, Clone, Copy,)]
3194pub struct WhereClauseNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3924pub struct WhereClauseNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3195 syntax: SyntaxNode<R>, 3925 pub(crate) syntax: SyntaxNode<R>,
3196} 3926}
3197pub type WhereClause<'a> = WhereClauseNode<RefRoot<'a>>; 3927pub type WhereClause<'a> = WhereClauseNode<RefRoot<'a>>;
3198 3928
3929impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhereClauseNode<R1>> for WhereClauseNode<R2> {
3930 fn eq(&self, other: &WhereClauseNode<R1>) -> bool { self.syntax == other.syntax }
3931}
3932impl<R: TreeRoot<RaTypes>> Eq for WhereClauseNode<R> {}
3933impl<R: TreeRoot<RaTypes>> Hash for WhereClauseNode<R> {
3934 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3935}
3936
3199impl<'a> AstNode<'a> for WhereClause<'a> { 3937impl<'a> AstNode<'a> for WhereClause<'a> {
3200 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3938 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3201 match syntax.kind() { 3939 match syntax.kind() {
@@ -3219,12 +3957,20 @@ impl<R: TreeRoot<RaTypes>> WhereClauseNode<R> {
3219impl<'a> WhereClause<'a> {} 3957impl<'a> WhereClause<'a> {}
3220 3958
3221// WhileExpr 3959// WhileExpr
3222#[derive(Debug, Clone, Copy)] 3960#[derive(Debug, Clone, Copy,)]
3223pub struct WhileExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3961pub struct WhileExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3224 syntax: SyntaxNode<R>, 3962 pub(crate) syntax: SyntaxNode<R>,
3225} 3963}
3226pub type WhileExpr<'a> = WhileExprNode<RefRoot<'a>>; 3964pub type WhileExpr<'a> = WhileExprNode<RefRoot<'a>>;
3227 3965
3966impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhileExprNode<R1>> for WhileExprNode<R2> {
3967 fn eq(&self, other: &WhileExprNode<R1>) -> bool { self.syntax == other.syntax }
3968}
3969impl<R: TreeRoot<RaTypes>> Eq for WhileExprNode<R> {}
3970impl<R: TreeRoot<RaTypes>> Hash for WhileExprNode<R> {
3971 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3972}
3973
3228impl<'a> AstNode<'a> for WhileExpr<'a> { 3974impl<'a> AstNode<'a> for WhileExpr<'a> {
3229 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3975 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3230 match syntax.kind() { 3976 match syntax.kind() {
@@ -3253,12 +3999,20 @@ impl<'a> WhileExpr<'a> {
3253} 3999}
3254 4000
3255// Whitespace 4001// Whitespace
3256#[derive(Debug, Clone, Copy)] 4002#[derive(Debug, Clone, Copy,)]
3257pub struct WhitespaceNode<R: TreeRoot<RaTypes> = OwnedRoot> { 4003pub struct WhitespaceNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3258 syntax: SyntaxNode<R>, 4004 pub(crate) syntax: SyntaxNode<R>,
3259} 4005}
3260pub type Whitespace<'a> = WhitespaceNode<RefRoot<'a>>; 4006pub type Whitespace<'a> = WhitespaceNode<RefRoot<'a>>;
3261 4007
4008impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhitespaceNode<R1>> for WhitespaceNode<R2> {
4009 fn eq(&self, other: &WhitespaceNode<R1>) -> bool { self.syntax == other.syntax }
4010}
4011impl<R: TreeRoot<RaTypes>> Eq for WhitespaceNode<R> {}
4012impl<R: TreeRoot<RaTypes>> Hash for WhitespaceNode<R> {
4013 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
4014}
4015
3262impl<'a> AstNode<'a> for Whitespace<'a> { 4016impl<'a> AstNode<'a> for Whitespace<'a> {
3263 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 4017 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3264 match syntax.kind() { 4018 match syntax.kind() {
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index d4fc6b5bd..131ee09ec 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -11,6 +11,8 @@ the below applies to the result of this template
11 11
12#![cfg_attr(rustfmt, rustfmt_skip)] 12#![cfg_attr(rustfmt, rustfmt_skip)]
13 13
14use std::hash::{Hash, Hasher};
15
14use crate::{ 16use crate::{
15 ast, 17 ast,
16 SyntaxNode, SyntaxNodeRef, AstNode, 18 SyntaxNode, SyntaxNodeRef, AstNode,
@@ -21,7 +23,7 @@ use crate::{
21// {{ node }} 23// {{ node }}
22 24
23{%- if methods.enum %} 25{%- if methods.enum %}
24#[derive(Debug, Clone, Copy)] 26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
25pub enum {{ node }}<'a> { 27pub enum {{ node }}<'a> {
26{%- for kind in methods.enum %} 28{%- for kind in methods.enum %}
27 {{ kind }}({{ kind }}<'a>), 29 {{ kind }}({{ kind }}<'a>),
@@ -46,12 +48,20 @@ impl<'a> AstNode<'a> for {{ node }}<'a> {
46 } 48 }
47} 49}
48{% else %} 50{% else %}
49#[derive(Debug, Clone, Copy)] 51#[derive(Debug, Clone, Copy,)]
50pub struct {{ node }}Node<R: TreeRoot<RaTypes> = OwnedRoot> { 52pub struct {{ node }}Node<R: TreeRoot<RaTypes> = OwnedRoot> {
51 syntax: SyntaxNode<R>, 53 pub(crate) syntax: SyntaxNode<R>,
52} 54}
53pub type {{ node }}<'a> = {{ node }}Node<RefRoot<'a>>; 55pub type {{ node }}<'a> = {{ node }}Node<RefRoot<'a>>;
54 56
57impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<{{node}}Node<R1>> for {{node}}Node<R2> {
58 fn eq(&self, other: &{{node}}Node<R1>) -> bool { self.syntax == other.syntax }
59}
60impl<R: TreeRoot<RaTypes>> Eq for {{node}}Node<R> {}
61impl<R: TreeRoot<RaTypes>> Hash for {{node}}Node<R> {
62 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
63}
64
55impl<'a> AstNode<'a> for {{ node }}<'a> { 65impl<'a> AstNode<'a> for {{ node }}<'a> {
56 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 66 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
57 match syntax.kind() { 67 match syntax.kind() {