aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/ast/generated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_syntax/src/ast/generated.rs')
-rw-r--r--crates/ra_syntax/src/ast/generated.rs1326
1 files changed, 1099 insertions, 227 deletions
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 420d9090c..bf056131e 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() {
@@ -298,13 +372,95 @@ impl<R: TreeRoot<RaTypes>> BreakExprNode<R> {
298 372
299impl<'a> BreakExpr<'a> {} 373impl<'a> BreakExpr<'a> {}
300 374
375// Byte
376#[derive(Debug, Clone, Copy,)]
377pub struct ByteNode<R: TreeRoot<RaTypes> = OwnedRoot> {
378 pub(crate) syntax: SyntaxNode<R>,
379}
380pub type Byte<'a> = ByteNode<RefRoot<'a>>;
381
382impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ByteNode<R1>> for ByteNode<R2> {
383 fn eq(&self, other: &ByteNode<R1>) -> bool { self.syntax == other.syntax }
384}
385impl<R: TreeRoot<RaTypes>> Eq for ByteNode<R> {}
386impl<R: TreeRoot<RaTypes>> Hash for ByteNode<R> {
387 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
388}
389
390impl<'a> AstNode<'a> for Byte<'a> {
391 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
392 match syntax.kind() {
393 BYTE => Some(Byte { syntax }),
394 _ => None,
395 }
396 }
397 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
398}
399
400impl<R: TreeRoot<RaTypes>> ByteNode<R> {
401 pub fn borrowed(&self) -> Byte {
402 ByteNode { syntax: self.syntax.borrowed() }
403 }
404 pub fn owned(&self) -> ByteNode {
405 ByteNode { syntax: self.syntax.owned() }
406 }
407}
408
409
410impl<'a> Byte<'a> {}
411
412// ByteString
413#[derive(Debug, Clone, Copy,)]
414pub struct ByteStringNode<R: TreeRoot<RaTypes> = OwnedRoot> {
415 pub(crate) syntax: SyntaxNode<R>,
416}
417pub type ByteString<'a> = ByteStringNode<RefRoot<'a>>;
418
419impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ByteStringNode<R1>> for ByteStringNode<R2> {
420 fn eq(&self, other: &ByteStringNode<R1>) -> bool { self.syntax == other.syntax }
421}
422impl<R: TreeRoot<RaTypes>> Eq for ByteStringNode<R> {}
423impl<R: TreeRoot<RaTypes>> Hash for ByteStringNode<R> {
424 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
425}
426
427impl<'a> AstNode<'a> for ByteString<'a> {
428 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
429 match syntax.kind() {
430 BYTE_STRING => Some(ByteString { syntax }),
431 _ => None,
432 }
433 }
434 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
435}
436
437impl<R: TreeRoot<RaTypes>> ByteStringNode<R> {
438 pub fn borrowed(&self) -> ByteString {
439 ByteStringNode { syntax: self.syntax.borrowed() }
440 }
441 pub fn owned(&self) -> ByteStringNode {
442 ByteStringNode { syntax: self.syntax.owned() }
443 }
444}
445
446
447impl<'a> ByteString<'a> {}
448
301// CallExpr 449// CallExpr
302#[derive(Debug, Clone, Copy)] 450#[derive(Debug, Clone, Copy,)]
303pub struct CallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 451pub struct CallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
304 syntax: SyntaxNode<R>, 452 pub(crate) syntax: SyntaxNode<R>,
305} 453}
306pub type CallExpr<'a> = CallExprNode<RefRoot<'a>>; 454pub type CallExpr<'a> = CallExprNode<RefRoot<'a>>;
307 455
456impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CallExprNode<R1>> for CallExprNode<R2> {
457 fn eq(&self, other: &CallExprNode<R1>) -> bool { self.syntax == other.syntax }
458}
459impl<R: TreeRoot<RaTypes>> Eq for CallExprNode<R> {}
460impl<R: TreeRoot<RaTypes>> Hash for CallExprNode<R> {
461 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
462}
463
308impl<'a> AstNode<'a> for CallExpr<'a> { 464impl<'a> AstNode<'a> for CallExpr<'a> {
309 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 465 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
310 match syntax.kind() { 466 match syntax.kind() {
@@ -333,12 +489,20 @@ impl<'a> CallExpr<'a> {
333} 489}
334 490
335// CastExpr 491// CastExpr
336#[derive(Debug, Clone, Copy)] 492#[derive(Debug, Clone, Copy,)]
337pub struct CastExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 493pub struct CastExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
338 syntax: SyntaxNode<R>, 494 pub(crate) syntax: SyntaxNode<R>,
339} 495}
340pub type CastExpr<'a> = CastExprNode<RefRoot<'a>>; 496pub type CastExpr<'a> = CastExprNode<RefRoot<'a>>;
341 497
498impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CastExprNode<R1>> for CastExprNode<R2> {
499 fn eq(&self, other: &CastExprNode<R1>) -> bool { self.syntax == other.syntax }
500}
501impl<R: TreeRoot<RaTypes>> Eq for CastExprNode<R> {}
502impl<R: TreeRoot<RaTypes>> Hash for CastExprNode<R> {
503 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
504}
505
342impl<'a> AstNode<'a> for CastExpr<'a> { 506impl<'a> AstNode<'a> for CastExpr<'a> {
343 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 507 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
344 match syntax.kind() { 508 match syntax.kind() {
@@ -362,12 +526,20 @@ impl<R: TreeRoot<RaTypes>> CastExprNode<R> {
362impl<'a> CastExpr<'a> {} 526impl<'a> CastExpr<'a> {}
363 527
364// Char 528// Char
365#[derive(Debug, Clone, Copy)] 529#[derive(Debug, Clone, Copy,)]
366pub struct CharNode<R: TreeRoot<RaTypes> = OwnedRoot> { 530pub struct CharNode<R: TreeRoot<RaTypes> = OwnedRoot> {
367 syntax: SyntaxNode<R>, 531 pub(crate) syntax: SyntaxNode<R>,
368} 532}
369pub type Char<'a> = CharNode<RefRoot<'a>>; 533pub type Char<'a> = CharNode<RefRoot<'a>>;
370 534
535impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CharNode<R1>> for CharNode<R2> {
536 fn eq(&self, other: &CharNode<R1>) -> bool { self.syntax == other.syntax }
537}
538impl<R: TreeRoot<RaTypes>> Eq for CharNode<R> {}
539impl<R: TreeRoot<RaTypes>> Hash for CharNode<R> {
540 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
541}
542
371impl<'a> AstNode<'a> for Char<'a> { 543impl<'a> AstNode<'a> for Char<'a> {
372 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 544 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
373 match syntax.kind() { 545 match syntax.kind() {
@@ -391,12 +563,20 @@ impl<R: TreeRoot<RaTypes>> CharNode<R> {
391impl<'a> Char<'a> {} 563impl<'a> Char<'a> {}
392 564
393// Comment 565// Comment
394#[derive(Debug, Clone, Copy)] 566#[derive(Debug, Clone, Copy,)]
395pub struct CommentNode<R: TreeRoot<RaTypes> = OwnedRoot> { 567pub struct CommentNode<R: TreeRoot<RaTypes> = OwnedRoot> {
396 syntax: SyntaxNode<R>, 568 pub(crate) syntax: SyntaxNode<R>,
397} 569}
398pub type Comment<'a> = CommentNode<RefRoot<'a>>; 570pub type Comment<'a> = CommentNode<RefRoot<'a>>;
399 571
572impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<CommentNode<R1>> for CommentNode<R2> {
573 fn eq(&self, other: &CommentNode<R1>) -> bool { self.syntax == other.syntax }
574}
575impl<R: TreeRoot<RaTypes>> Eq for CommentNode<R> {}
576impl<R: TreeRoot<RaTypes>> Hash for CommentNode<R> {
577 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
578}
579
400impl<'a> AstNode<'a> for Comment<'a> { 580impl<'a> AstNode<'a> for Comment<'a> {
401 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 581 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
402 match syntax.kind() { 582 match syntax.kind() {
@@ -420,12 +600,20 @@ impl<R: TreeRoot<RaTypes>> CommentNode<R> {
420impl<'a> Comment<'a> {} 600impl<'a> Comment<'a> {}
421 601
422// Condition 602// Condition
423#[derive(Debug, Clone, Copy)] 603#[derive(Debug, Clone, Copy,)]
424pub struct ConditionNode<R: TreeRoot<RaTypes> = OwnedRoot> { 604pub struct ConditionNode<R: TreeRoot<RaTypes> = OwnedRoot> {
425 syntax: SyntaxNode<R>, 605 pub(crate) syntax: SyntaxNode<R>,
426} 606}
427pub type Condition<'a> = ConditionNode<RefRoot<'a>>; 607pub type Condition<'a> = ConditionNode<RefRoot<'a>>;
428 608
609impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ConditionNode<R1>> for ConditionNode<R2> {
610 fn eq(&self, other: &ConditionNode<R1>) -> bool { self.syntax == other.syntax }
611}
612impl<R: TreeRoot<RaTypes>> Eq for ConditionNode<R> {}
613impl<R: TreeRoot<RaTypes>> Hash for ConditionNode<R> {
614 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
615}
616
429impl<'a> AstNode<'a> for Condition<'a> { 617impl<'a> AstNode<'a> for Condition<'a> {
430 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 618 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
431 match syntax.kind() { 619 match syntax.kind() {
@@ -457,12 +645,20 @@ impl<'a> Condition<'a> {
457} 645}
458 646
459// ConstDef 647// ConstDef
460#[derive(Debug, Clone, Copy)] 648#[derive(Debug, Clone, Copy,)]
461pub struct ConstDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 649pub struct ConstDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
462 syntax: SyntaxNode<R>, 650 pub(crate) syntax: SyntaxNode<R>,
463} 651}
464pub type ConstDef<'a> = ConstDefNode<RefRoot<'a>>; 652pub type ConstDef<'a> = ConstDefNode<RefRoot<'a>>;
465 653
654impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ConstDefNode<R1>> for ConstDefNode<R2> {
655 fn eq(&self, other: &ConstDefNode<R1>) -> bool { self.syntax == other.syntax }
656}
657impl<R: TreeRoot<RaTypes>> Eq for ConstDefNode<R> {}
658impl<R: TreeRoot<RaTypes>> Hash for ConstDefNode<R> {
659 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
660}
661
466impl<'a> AstNode<'a> for ConstDef<'a> { 662impl<'a> AstNode<'a> for ConstDef<'a> {
467 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 663 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
468 match syntax.kind() { 664 match syntax.kind() {
@@ -486,15 +682,24 @@ impl<R: TreeRoot<RaTypes>> ConstDefNode<R> {
486impl<'a> ast::NameOwner<'a> for ConstDef<'a> {} 682impl<'a> ast::NameOwner<'a> for ConstDef<'a> {}
487impl<'a> ast::TypeParamsOwner<'a> for ConstDef<'a> {} 683impl<'a> ast::TypeParamsOwner<'a> for ConstDef<'a> {}
488impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {} 684impl<'a> ast::AttrsOwner<'a> for ConstDef<'a> {}
685impl<'a> ast::DocCommentsOwner<'a> for ConstDef<'a> {}
489impl<'a> ConstDef<'a> {} 686impl<'a> ConstDef<'a> {}
490 687
491// ContinueExpr 688// ContinueExpr
492#[derive(Debug, Clone, Copy)] 689#[derive(Debug, Clone, Copy,)]
493pub struct ContinueExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 690pub struct ContinueExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
494 syntax: SyntaxNode<R>, 691 pub(crate) syntax: SyntaxNode<R>,
495} 692}
496pub type ContinueExpr<'a> = ContinueExprNode<RefRoot<'a>>; 693pub type ContinueExpr<'a> = ContinueExprNode<RefRoot<'a>>;
497 694
695impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ContinueExprNode<R1>> for ContinueExprNode<R2> {
696 fn eq(&self, other: &ContinueExprNode<R1>) -> bool { self.syntax == other.syntax }
697}
698impl<R: TreeRoot<RaTypes>> Eq for ContinueExprNode<R> {}
699impl<R: TreeRoot<RaTypes>> Hash for ContinueExprNode<R> {
700 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
701}
702
498impl<'a> AstNode<'a> for ContinueExpr<'a> { 703impl<'a> AstNode<'a> for ContinueExpr<'a> {
499 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 704 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
500 match syntax.kind() { 705 match syntax.kind() {
@@ -518,12 +723,20 @@ impl<R: TreeRoot<RaTypes>> ContinueExprNode<R> {
518impl<'a> ContinueExpr<'a> {} 723impl<'a> ContinueExpr<'a> {}
519 724
520// DynTraitType 725// DynTraitType
521#[derive(Debug, Clone, Copy)] 726#[derive(Debug, Clone, Copy,)]
522pub struct DynTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 727pub struct DynTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
523 syntax: SyntaxNode<R>, 728 pub(crate) syntax: SyntaxNode<R>,
524} 729}
525pub type DynTraitType<'a> = DynTraitTypeNode<RefRoot<'a>>; 730pub type DynTraitType<'a> = DynTraitTypeNode<RefRoot<'a>>;
526 731
732impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<DynTraitTypeNode<R1>> for DynTraitTypeNode<R2> {
733 fn eq(&self, other: &DynTraitTypeNode<R1>) -> bool { self.syntax == other.syntax }
734}
735impl<R: TreeRoot<RaTypes>> Eq for DynTraitTypeNode<R> {}
736impl<R: TreeRoot<RaTypes>> Hash for DynTraitTypeNode<R> {
737 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
738}
739
527impl<'a> AstNode<'a> for DynTraitType<'a> { 740impl<'a> AstNode<'a> for DynTraitType<'a> {
528 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 741 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
529 match syntax.kind() { 742 match syntax.kind() {
@@ -547,12 +760,20 @@ impl<R: TreeRoot<RaTypes>> DynTraitTypeNode<R> {
547impl<'a> DynTraitType<'a> {} 760impl<'a> DynTraitType<'a> {}
548 761
549// EnumDef 762// EnumDef
550#[derive(Debug, Clone, Copy)] 763#[derive(Debug, Clone, Copy,)]
551pub struct EnumDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 764pub struct EnumDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
552 syntax: SyntaxNode<R>, 765 pub(crate) syntax: SyntaxNode<R>,
553} 766}
554pub type EnumDef<'a> = EnumDefNode<RefRoot<'a>>; 767pub type EnumDef<'a> = EnumDefNode<RefRoot<'a>>;
555 768
769impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<EnumDefNode<R1>> for EnumDefNode<R2> {
770 fn eq(&self, other: &EnumDefNode<R1>) -> bool { self.syntax == other.syntax }
771}
772impl<R: TreeRoot<RaTypes>> Eq for EnumDefNode<R> {}
773impl<R: TreeRoot<RaTypes>> Hash for EnumDefNode<R> {
774 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
775}
776
556impl<'a> AstNode<'a> for EnumDef<'a> { 777impl<'a> AstNode<'a> for EnumDef<'a> {
557 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 778 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
558 match syntax.kind() { 779 match syntax.kind() {
@@ -576,10 +797,11 @@ impl<R: TreeRoot<RaTypes>> EnumDefNode<R> {
576impl<'a> ast::NameOwner<'a> for EnumDef<'a> {} 797impl<'a> ast::NameOwner<'a> for EnumDef<'a> {}
577impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {} 798impl<'a> ast::TypeParamsOwner<'a> for EnumDef<'a> {}
578impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {} 799impl<'a> ast::AttrsOwner<'a> for EnumDef<'a> {}
800impl<'a> ast::DocCommentsOwner<'a> for EnumDef<'a> {}
579impl<'a> EnumDef<'a> {} 801impl<'a> EnumDef<'a> {}
580 802
581// Expr 803// Expr
582#[derive(Debug, Clone, Copy)] 804#[derive(Debug, Clone, Copy, PartialEq, Eq)]
583pub enum Expr<'a> { 805pub enum Expr<'a> {
584 TupleExpr(TupleExpr<'a>), 806 TupleExpr(TupleExpr<'a>),
585 ArrayExpr(ArrayExpr<'a>), 807 ArrayExpr(ArrayExpr<'a>),
@@ -694,12 +916,20 @@ impl<'a> AstNode<'a> for Expr<'a> {
694impl<'a> Expr<'a> {} 916impl<'a> Expr<'a> {}
695 917
696// ExprStmt 918// ExprStmt
697#[derive(Debug, Clone, Copy)] 919#[derive(Debug, Clone, Copy,)]
698pub struct ExprStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { 920pub struct ExprStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> {
699 syntax: SyntaxNode<R>, 921 pub(crate) syntax: SyntaxNode<R>,
700} 922}
701pub type ExprStmt<'a> = ExprStmtNode<RefRoot<'a>>; 923pub type ExprStmt<'a> = ExprStmtNode<RefRoot<'a>>;
702 924
925impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ExprStmtNode<R1>> for ExprStmtNode<R2> {
926 fn eq(&self, other: &ExprStmtNode<R1>) -> bool { self.syntax == other.syntax }
927}
928impl<R: TreeRoot<RaTypes>> Eq for ExprStmtNode<R> {}
929impl<R: TreeRoot<RaTypes>> Hash for ExprStmtNode<R> {
930 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
931}
932
703impl<'a> AstNode<'a> for ExprStmt<'a> { 933impl<'a> AstNode<'a> for ExprStmt<'a> {
704 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 934 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
705 match syntax.kind() { 935 match syntax.kind() {
@@ -727,12 +957,20 @@ impl<'a> ExprStmt<'a> {
727} 957}
728 958
729// ExternCrateItem 959// ExternCrateItem
730#[derive(Debug, Clone, Copy)] 960#[derive(Debug, Clone, Copy,)]
731pub struct ExternCrateItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 961pub struct ExternCrateItemNode<R: TreeRoot<RaTypes> = OwnedRoot> {
732 syntax: SyntaxNode<R>, 962 pub(crate) syntax: SyntaxNode<R>,
733} 963}
734pub type ExternCrateItem<'a> = ExternCrateItemNode<RefRoot<'a>>; 964pub type ExternCrateItem<'a> = ExternCrateItemNode<RefRoot<'a>>;
735 965
966impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ExternCrateItemNode<R1>> for ExternCrateItemNode<R2> {
967 fn eq(&self, other: &ExternCrateItemNode<R1>) -> bool { self.syntax == other.syntax }
968}
969impl<R: TreeRoot<RaTypes>> Eq for ExternCrateItemNode<R> {}
970impl<R: TreeRoot<RaTypes>> Hash for ExternCrateItemNode<R> {
971 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
972}
973
736impl<'a> AstNode<'a> for ExternCrateItem<'a> { 974impl<'a> AstNode<'a> for ExternCrateItem<'a> {
737 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 975 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
738 match syntax.kind() { 976 match syntax.kind() {
@@ -756,12 +994,20 @@ impl<R: TreeRoot<RaTypes>> ExternCrateItemNode<R> {
756impl<'a> ExternCrateItem<'a> {} 994impl<'a> ExternCrateItem<'a> {}
757 995
758// FieldExpr 996// FieldExpr
759#[derive(Debug, Clone, Copy)] 997#[derive(Debug, Clone, Copy,)]
760pub struct FieldExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 998pub struct FieldExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
761 syntax: SyntaxNode<R>, 999 pub(crate) syntax: SyntaxNode<R>,
762} 1000}
763pub type FieldExpr<'a> = FieldExprNode<RefRoot<'a>>; 1001pub type FieldExpr<'a> = FieldExprNode<RefRoot<'a>>;
764 1002
1003impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FieldExprNode<R1>> for FieldExprNode<R2> {
1004 fn eq(&self, other: &FieldExprNode<R1>) -> bool { self.syntax == other.syntax }
1005}
1006impl<R: TreeRoot<RaTypes>> Eq for FieldExprNode<R> {}
1007impl<R: TreeRoot<RaTypes>> Hash for FieldExprNode<R> {
1008 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1009}
1010
765impl<'a> AstNode<'a> for FieldExpr<'a> { 1011impl<'a> AstNode<'a> for FieldExpr<'a> {
766 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1012 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
767 match syntax.kind() { 1013 match syntax.kind() {
@@ -785,12 +1031,20 @@ impl<R: TreeRoot<RaTypes>> FieldExprNode<R> {
785impl<'a> FieldExpr<'a> {} 1031impl<'a> FieldExpr<'a> {}
786 1032
787// FieldPatList 1033// FieldPatList
788#[derive(Debug, Clone, Copy)] 1034#[derive(Debug, Clone, Copy,)]
789pub struct FieldPatListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1035pub struct FieldPatListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
790 syntax: SyntaxNode<R>, 1036 pub(crate) syntax: SyntaxNode<R>,
791} 1037}
792pub type FieldPatList<'a> = FieldPatListNode<RefRoot<'a>>; 1038pub type FieldPatList<'a> = FieldPatListNode<RefRoot<'a>>;
793 1039
1040impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FieldPatListNode<R1>> for FieldPatListNode<R2> {
1041 fn eq(&self, other: &FieldPatListNode<R1>) -> bool { self.syntax == other.syntax }
1042}
1043impl<R: TreeRoot<RaTypes>> Eq for FieldPatListNode<R> {}
1044impl<R: TreeRoot<RaTypes>> Hash for FieldPatListNode<R> {
1045 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1046}
1047
794impl<'a> AstNode<'a> for FieldPatList<'a> { 1048impl<'a> AstNode<'a> for FieldPatList<'a> {
795 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1049 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
796 match syntax.kind() { 1050 match syntax.kind() {
@@ -814,12 +1068,20 @@ impl<R: TreeRoot<RaTypes>> FieldPatListNode<R> {
814impl<'a> FieldPatList<'a> {} 1068impl<'a> FieldPatList<'a> {}
815 1069
816// FnDef 1070// FnDef
817#[derive(Debug, Clone, Copy)] 1071#[derive(Debug, Clone, Copy,)]
818pub struct FnDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1072pub struct FnDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
819 syntax: SyntaxNode<R>, 1073 pub(crate) syntax: SyntaxNode<R>,
820} 1074}
821pub type FnDef<'a> = FnDefNode<RefRoot<'a>>; 1075pub type FnDef<'a> = FnDefNode<RefRoot<'a>>;
822 1076
1077impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FnDefNode<R1>> for FnDefNode<R2> {
1078 fn eq(&self, other: &FnDefNode<R1>) -> bool { self.syntax == other.syntax }
1079}
1080impl<R: TreeRoot<RaTypes>> Eq for FnDefNode<R> {}
1081impl<R: TreeRoot<RaTypes>> Hash for FnDefNode<R> {
1082 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1083}
1084
823impl<'a> AstNode<'a> for FnDef<'a> { 1085impl<'a> AstNode<'a> for FnDef<'a> {
824 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1086 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
825 match syntax.kind() { 1087 match syntax.kind() {
@@ -859,12 +1121,20 @@ impl<'a> FnDef<'a> {
859} 1121}
860 1122
861// FnPointerType 1123// FnPointerType
862#[derive(Debug, Clone, Copy)] 1124#[derive(Debug, Clone, Copy,)]
863pub struct FnPointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1125pub struct FnPointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
864 syntax: SyntaxNode<R>, 1126 pub(crate) syntax: SyntaxNode<R>,
865} 1127}
866pub type FnPointerType<'a> = FnPointerTypeNode<RefRoot<'a>>; 1128pub type FnPointerType<'a> = FnPointerTypeNode<RefRoot<'a>>;
867 1129
1130impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<FnPointerTypeNode<R1>> for FnPointerTypeNode<R2> {
1131 fn eq(&self, other: &FnPointerTypeNode<R1>) -> bool { self.syntax == other.syntax }
1132}
1133impl<R: TreeRoot<RaTypes>> Eq for FnPointerTypeNode<R> {}
1134impl<R: TreeRoot<RaTypes>> Hash for FnPointerTypeNode<R> {
1135 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1136}
1137
868impl<'a> AstNode<'a> for FnPointerType<'a> { 1138impl<'a> AstNode<'a> for FnPointerType<'a> {
869 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1139 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
870 match syntax.kind() { 1140 match syntax.kind() {
@@ -888,12 +1158,20 @@ impl<R: TreeRoot<RaTypes>> FnPointerTypeNode<R> {
888impl<'a> FnPointerType<'a> {} 1158impl<'a> FnPointerType<'a> {}
889 1159
890// ForExpr 1160// ForExpr
891#[derive(Debug, Clone, Copy)] 1161#[derive(Debug, Clone, Copy,)]
892pub struct ForExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1162pub struct ForExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
893 syntax: SyntaxNode<R>, 1163 pub(crate) syntax: SyntaxNode<R>,
894} 1164}
895pub type ForExpr<'a> = ForExprNode<RefRoot<'a>>; 1165pub type ForExpr<'a> = ForExprNode<RefRoot<'a>>;
896 1166
1167impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ForExprNode<R1>> for ForExprNode<R2> {
1168 fn eq(&self, other: &ForExprNode<R1>) -> bool { self.syntax == other.syntax }
1169}
1170impl<R: TreeRoot<RaTypes>> Eq for ForExprNode<R> {}
1171impl<R: TreeRoot<RaTypes>> Hash for ForExprNode<R> {
1172 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1173}
1174
897impl<'a> AstNode<'a> for ForExpr<'a> { 1175impl<'a> AstNode<'a> for ForExpr<'a> {
898 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1176 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
899 match syntax.kind() { 1177 match syntax.kind() {
@@ -926,12 +1204,20 @@ impl<'a> ForExpr<'a> {
926} 1204}
927 1205
928// ForType 1206// ForType
929#[derive(Debug, Clone, Copy)] 1207#[derive(Debug, Clone, Copy,)]
930pub struct ForTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1208pub struct ForTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
931 syntax: SyntaxNode<R>, 1209 pub(crate) syntax: SyntaxNode<R>,
932} 1210}
933pub type ForType<'a> = ForTypeNode<RefRoot<'a>>; 1211pub type ForType<'a> = ForTypeNode<RefRoot<'a>>;
934 1212
1213impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ForTypeNode<R1>> for ForTypeNode<R2> {
1214 fn eq(&self, other: &ForTypeNode<R1>) -> bool { self.syntax == other.syntax }
1215}
1216impl<R: TreeRoot<RaTypes>> Eq for ForTypeNode<R> {}
1217impl<R: TreeRoot<RaTypes>> Hash for ForTypeNode<R> {
1218 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1219}
1220
935impl<'a> AstNode<'a> for ForType<'a> { 1221impl<'a> AstNode<'a> for ForType<'a> {
936 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1222 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
937 match syntax.kind() { 1223 match syntax.kind() {
@@ -955,12 +1241,20 @@ impl<R: TreeRoot<RaTypes>> ForTypeNode<R> {
955impl<'a> ForType<'a> {} 1241impl<'a> ForType<'a> {}
956 1242
957// IfExpr 1243// IfExpr
958#[derive(Debug, Clone, Copy)] 1244#[derive(Debug, Clone, Copy,)]
959pub struct IfExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1245pub struct IfExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
960 syntax: SyntaxNode<R>, 1246 pub(crate) syntax: SyntaxNode<R>,
961} 1247}
962pub type IfExpr<'a> = IfExprNode<RefRoot<'a>>; 1248pub type IfExpr<'a> = IfExprNode<RefRoot<'a>>;
963 1249
1250impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<IfExprNode<R1>> for IfExprNode<R2> {
1251 fn eq(&self, other: &IfExprNode<R1>) -> bool { self.syntax == other.syntax }
1252}
1253impl<R: TreeRoot<RaTypes>> Eq for IfExprNode<R> {}
1254impl<R: TreeRoot<RaTypes>> Hash for IfExprNode<R> {
1255 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1256}
1257
964impl<'a> AstNode<'a> for IfExpr<'a> { 1258impl<'a> AstNode<'a> for IfExpr<'a> {
965 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1259 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
966 match syntax.kind() { 1260 match syntax.kind() {
@@ -988,12 +1282,20 @@ impl<'a> IfExpr<'a> {
988} 1282}
989 1283
990// ImplItem 1284// ImplItem
991#[derive(Debug, Clone, Copy)] 1285#[derive(Debug, Clone, Copy,)]
992pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1286pub struct ImplItemNode<R: TreeRoot<RaTypes> = OwnedRoot> {
993 syntax: SyntaxNode<R>, 1287 pub(crate) syntax: SyntaxNode<R>,
994} 1288}
995pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>; 1289pub type ImplItem<'a> = ImplItemNode<RefRoot<'a>>;
996 1290
1291impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplItemNode<R1>> for ImplItemNode<R2> {
1292 fn eq(&self, other: &ImplItemNode<R1>) -> bool { self.syntax == other.syntax }
1293}
1294impl<R: TreeRoot<RaTypes>> Eq for ImplItemNode<R> {}
1295impl<R: TreeRoot<RaTypes>> Hash for ImplItemNode<R> {
1296 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1297}
1298
997impl<'a> AstNode<'a> for ImplItem<'a> { 1299impl<'a> AstNode<'a> for ImplItem<'a> {
998 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1300 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
999 match syntax.kind() { 1301 match syntax.kind() {
@@ -1017,12 +1319,20 @@ impl<R: TreeRoot<RaTypes>> ImplItemNode<R> {
1017impl<'a> ImplItem<'a> {} 1319impl<'a> ImplItem<'a> {}
1018 1320
1019// ImplTraitType 1321// ImplTraitType
1020#[derive(Debug, Clone, Copy)] 1322#[derive(Debug, Clone, Copy,)]
1021pub struct ImplTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1323pub struct ImplTraitTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1022 syntax: SyntaxNode<R>, 1324 pub(crate) syntax: SyntaxNode<R>,
1023} 1325}
1024pub type ImplTraitType<'a> = ImplTraitTypeNode<RefRoot<'a>>; 1326pub type ImplTraitType<'a> = ImplTraitTypeNode<RefRoot<'a>>;
1025 1327
1328impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ImplTraitTypeNode<R1>> for ImplTraitTypeNode<R2> {
1329 fn eq(&self, other: &ImplTraitTypeNode<R1>) -> bool { self.syntax == other.syntax }
1330}
1331impl<R: TreeRoot<RaTypes>> Eq for ImplTraitTypeNode<R> {}
1332impl<R: TreeRoot<RaTypes>> Hash for ImplTraitTypeNode<R> {
1333 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1334}
1335
1026impl<'a> AstNode<'a> for ImplTraitType<'a> { 1336impl<'a> AstNode<'a> for ImplTraitType<'a> {
1027 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1337 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1028 match syntax.kind() { 1338 match syntax.kind() {
@@ -1046,12 +1356,20 @@ impl<R: TreeRoot<RaTypes>> ImplTraitTypeNode<R> {
1046impl<'a> ImplTraitType<'a> {} 1356impl<'a> ImplTraitType<'a> {}
1047 1357
1048// IndexExpr 1358// IndexExpr
1049#[derive(Debug, Clone, Copy)] 1359#[derive(Debug, Clone, Copy,)]
1050pub struct IndexExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1360pub struct IndexExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1051 syntax: SyntaxNode<R>, 1361 pub(crate) syntax: SyntaxNode<R>,
1052} 1362}
1053pub type IndexExpr<'a> = IndexExprNode<RefRoot<'a>>; 1363pub type IndexExpr<'a> = IndexExprNode<RefRoot<'a>>;
1054 1364
1365impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<IndexExprNode<R1>> for IndexExprNode<R2> {
1366 fn eq(&self, other: &IndexExprNode<R1>) -> bool { self.syntax == other.syntax }
1367}
1368impl<R: TreeRoot<RaTypes>> Eq for IndexExprNode<R> {}
1369impl<R: TreeRoot<RaTypes>> Hash for IndexExprNode<R> {
1370 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1371}
1372
1055impl<'a> AstNode<'a> for IndexExpr<'a> { 1373impl<'a> AstNode<'a> for IndexExpr<'a> {
1056 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1374 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1057 match syntax.kind() { 1375 match syntax.kind() {
@@ -1075,12 +1393,20 @@ impl<R: TreeRoot<RaTypes>> IndexExprNode<R> {
1075impl<'a> IndexExpr<'a> {} 1393impl<'a> IndexExpr<'a> {}
1076 1394
1077// ItemList 1395// ItemList
1078#[derive(Debug, Clone, Copy)] 1396#[derive(Debug, Clone, Copy,)]
1079pub struct ItemListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1397pub struct ItemListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1080 syntax: SyntaxNode<R>, 1398 pub(crate) syntax: SyntaxNode<R>,
1081} 1399}
1082pub type ItemList<'a> = ItemListNode<RefRoot<'a>>; 1400pub type ItemList<'a> = ItemListNode<RefRoot<'a>>;
1083 1401
1402impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ItemListNode<R1>> for ItemListNode<R2> {
1403 fn eq(&self, other: &ItemListNode<R1>) -> bool { self.syntax == other.syntax }
1404}
1405impl<R: TreeRoot<RaTypes>> Eq for ItemListNode<R> {}
1406impl<R: TreeRoot<RaTypes>> Hash for ItemListNode<R> {
1407 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1408}
1409
1084impl<'a> AstNode<'a> for ItemList<'a> { 1410impl<'a> AstNode<'a> for ItemList<'a> {
1085 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1411 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1086 match syntax.kind() { 1412 match syntax.kind() {
@@ -1106,12 +1432,20 @@ impl<'a> ast::ModuleItemOwner<'a> for ItemList<'a> {}
1106impl<'a> ItemList<'a> {} 1432impl<'a> ItemList<'a> {}
1107 1433
1108// Label 1434// Label
1109#[derive(Debug, Clone, Copy)] 1435#[derive(Debug, Clone, Copy,)]
1110pub struct LabelNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1436pub struct LabelNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1111 syntax: SyntaxNode<R>, 1437 pub(crate) syntax: SyntaxNode<R>,
1112} 1438}
1113pub type Label<'a> = LabelNode<RefRoot<'a>>; 1439pub type Label<'a> = LabelNode<RefRoot<'a>>;
1114 1440
1441impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LabelNode<R1>> for LabelNode<R2> {
1442 fn eq(&self, other: &LabelNode<R1>) -> bool { self.syntax == other.syntax }
1443}
1444impl<R: TreeRoot<RaTypes>> Eq for LabelNode<R> {}
1445impl<R: TreeRoot<RaTypes>> Hash for LabelNode<R> {
1446 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1447}
1448
1115impl<'a> AstNode<'a> for Label<'a> { 1449impl<'a> AstNode<'a> for Label<'a> {
1116 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1450 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1117 match syntax.kind() { 1451 match syntax.kind() {
@@ -1135,12 +1469,20 @@ impl<R: TreeRoot<RaTypes>> LabelNode<R> {
1135impl<'a> Label<'a> {} 1469impl<'a> Label<'a> {}
1136 1470
1137// LambdaExpr 1471// LambdaExpr
1138#[derive(Debug, Clone, Copy)] 1472#[derive(Debug, Clone, Copy,)]
1139pub struct LambdaExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1473pub struct LambdaExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1140 syntax: SyntaxNode<R>, 1474 pub(crate) syntax: SyntaxNode<R>,
1141} 1475}
1142pub type LambdaExpr<'a> = LambdaExprNode<RefRoot<'a>>; 1476pub type LambdaExpr<'a> = LambdaExprNode<RefRoot<'a>>;
1143 1477
1478impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LambdaExprNode<R1>> for LambdaExprNode<R2> {
1479 fn eq(&self, other: &LambdaExprNode<R1>) -> bool { self.syntax == other.syntax }
1480}
1481impl<R: TreeRoot<RaTypes>> Eq for LambdaExprNode<R> {}
1482impl<R: TreeRoot<RaTypes>> Hash for LambdaExprNode<R> {
1483 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1484}
1485
1144impl<'a> AstNode<'a> for LambdaExpr<'a> { 1486impl<'a> AstNode<'a> for LambdaExpr<'a> {
1145 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1487 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1146 match syntax.kind() { 1488 match syntax.kind() {
@@ -1172,12 +1514,20 @@ impl<'a> LambdaExpr<'a> {
1172} 1514}
1173 1515
1174// LetStmt 1516// LetStmt
1175#[derive(Debug, Clone, Copy)] 1517#[derive(Debug, Clone, Copy,)]
1176pub struct LetStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1518pub struct LetStmtNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1177 syntax: SyntaxNode<R>, 1519 pub(crate) syntax: SyntaxNode<R>,
1178} 1520}
1179pub type LetStmt<'a> = LetStmtNode<RefRoot<'a>>; 1521pub type LetStmt<'a> = LetStmtNode<RefRoot<'a>>;
1180 1522
1523impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LetStmtNode<R1>> for LetStmtNode<R2> {
1524 fn eq(&self, other: &LetStmtNode<R1>) -> bool { self.syntax == other.syntax }
1525}
1526impl<R: TreeRoot<RaTypes>> Eq for LetStmtNode<R> {}
1527impl<R: TreeRoot<RaTypes>> Hash for LetStmtNode<R> {
1528 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1529}
1530
1181impl<'a> AstNode<'a> for LetStmt<'a> { 1531impl<'a> AstNode<'a> for LetStmt<'a> {
1182 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1532 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1183 match syntax.kind() { 1533 match syntax.kind() {
@@ -1209,12 +1559,20 @@ impl<'a> LetStmt<'a> {
1209} 1559}
1210 1560
1211// Lifetime 1561// Lifetime
1212#[derive(Debug, Clone, Copy)] 1562#[derive(Debug, Clone, Copy,)]
1213pub struct LifetimeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1563pub struct LifetimeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1214 syntax: SyntaxNode<R>, 1564 pub(crate) syntax: SyntaxNode<R>,
1215} 1565}
1216pub type Lifetime<'a> = LifetimeNode<RefRoot<'a>>; 1566pub type Lifetime<'a> = LifetimeNode<RefRoot<'a>>;
1217 1567
1568impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LifetimeNode<R1>> for LifetimeNode<R2> {
1569 fn eq(&self, other: &LifetimeNode<R1>) -> bool { self.syntax == other.syntax }
1570}
1571impl<R: TreeRoot<RaTypes>> Eq for LifetimeNode<R> {}
1572impl<R: TreeRoot<RaTypes>> Hash for LifetimeNode<R> {
1573 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1574}
1575
1218impl<'a> AstNode<'a> for Lifetime<'a> { 1576impl<'a> AstNode<'a> for Lifetime<'a> {
1219 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1577 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1220 match syntax.kind() { 1578 match syntax.kind() {
@@ -1238,12 +1596,20 @@ impl<R: TreeRoot<RaTypes>> LifetimeNode<R> {
1238impl<'a> Lifetime<'a> {} 1596impl<'a> Lifetime<'a> {}
1239 1597
1240// LifetimeParam 1598// LifetimeParam
1241#[derive(Debug, Clone, Copy)] 1599#[derive(Debug, Clone, Copy,)]
1242pub struct LifetimeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1600pub struct LifetimeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1243 syntax: SyntaxNode<R>, 1601 pub(crate) syntax: SyntaxNode<R>,
1244} 1602}
1245pub type LifetimeParam<'a> = LifetimeParamNode<RefRoot<'a>>; 1603pub type LifetimeParam<'a> = LifetimeParamNode<RefRoot<'a>>;
1246 1604
1605impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LifetimeParamNode<R1>> for LifetimeParamNode<R2> {
1606 fn eq(&self, other: &LifetimeParamNode<R1>) -> bool { self.syntax == other.syntax }
1607}
1608impl<R: TreeRoot<RaTypes>> Eq for LifetimeParamNode<R> {}
1609impl<R: TreeRoot<RaTypes>> Hash for LifetimeParamNode<R> {
1610 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1611}
1612
1247impl<'a> AstNode<'a> for LifetimeParam<'a> { 1613impl<'a> AstNode<'a> for LifetimeParam<'a> {
1248 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1614 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1249 match syntax.kind() { 1615 match syntax.kind() {
@@ -1271,12 +1637,20 @@ impl<'a> LifetimeParam<'a> {
1271} 1637}
1272 1638
1273// Literal 1639// Literal
1274#[derive(Debug, Clone, Copy)] 1640#[derive(Debug, Clone, Copy,)]
1275pub struct LiteralNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1641pub struct LiteralNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1276 syntax: SyntaxNode<R>, 1642 pub(crate) syntax: SyntaxNode<R>,
1277} 1643}
1278pub type Literal<'a> = LiteralNode<RefRoot<'a>>; 1644pub type Literal<'a> = LiteralNode<RefRoot<'a>>;
1279 1645
1646impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LiteralNode<R1>> for LiteralNode<R2> {
1647 fn eq(&self, other: &LiteralNode<R1>) -> bool { self.syntax == other.syntax }
1648}
1649impl<R: TreeRoot<RaTypes>> Eq for LiteralNode<R> {}
1650impl<R: TreeRoot<RaTypes>> Hash for LiteralNode<R> {
1651 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1652}
1653
1280impl<'a> AstNode<'a> for Literal<'a> { 1654impl<'a> AstNode<'a> for Literal<'a> {
1281 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1655 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1282 match syntax.kind() { 1656 match syntax.kind() {
@@ -1300,12 +1674,20 @@ impl<R: TreeRoot<RaTypes>> LiteralNode<R> {
1300impl<'a> Literal<'a> {} 1674impl<'a> Literal<'a> {}
1301 1675
1302// LoopExpr 1676// LoopExpr
1303#[derive(Debug, Clone, Copy)] 1677#[derive(Debug, Clone, Copy,)]
1304pub struct LoopExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1678pub struct LoopExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1305 syntax: SyntaxNode<R>, 1679 pub(crate) syntax: SyntaxNode<R>,
1306} 1680}
1307pub type LoopExpr<'a> = LoopExprNode<RefRoot<'a>>; 1681pub type LoopExpr<'a> = LoopExprNode<RefRoot<'a>>;
1308 1682
1683impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<LoopExprNode<R1>> for LoopExprNode<R2> {
1684 fn eq(&self, other: &LoopExprNode<R1>) -> bool { self.syntax == other.syntax }
1685}
1686impl<R: TreeRoot<RaTypes>> Eq for LoopExprNode<R> {}
1687impl<R: TreeRoot<RaTypes>> Hash for LoopExprNode<R> {
1688 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1689}
1690
1309impl<'a> AstNode<'a> for LoopExpr<'a> { 1691impl<'a> AstNode<'a> for LoopExpr<'a> {
1310 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1692 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1311 match syntax.kind() { 1693 match syntax.kind() {
@@ -1330,12 +1712,20 @@ impl<'a> ast::LoopBodyOwner<'a> for LoopExpr<'a> {}
1330impl<'a> LoopExpr<'a> {} 1712impl<'a> LoopExpr<'a> {}
1331 1713
1332// MatchArm 1714// MatchArm
1333#[derive(Debug, Clone, Copy)] 1715#[derive(Debug, Clone, Copy,)]
1334pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1716pub struct MatchArmNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1335 syntax: SyntaxNode<R>, 1717 pub(crate) syntax: SyntaxNode<R>,
1336} 1718}
1337pub type MatchArm<'a> = MatchArmNode<RefRoot<'a>>; 1719pub type MatchArm<'a> = MatchArmNode<RefRoot<'a>>;
1338 1720
1721impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchArmNode<R1>> for MatchArmNode<R2> {
1722 fn eq(&self, other: &MatchArmNode<R1>) -> bool { self.syntax == other.syntax }
1723}
1724impl<R: TreeRoot<RaTypes>> Eq for MatchArmNode<R> {}
1725impl<R: TreeRoot<RaTypes>> Hash for MatchArmNode<R> {
1726 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1727}
1728
1339impl<'a> AstNode<'a> for MatchArm<'a> { 1729impl<'a> AstNode<'a> for MatchArm<'a> {
1340 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1730 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1341 match syntax.kind() { 1731 match syntax.kind() {
@@ -1371,12 +1761,20 @@ impl<'a> MatchArm<'a> {
1371} 1761}
1372 1762
1373// MatchArmList 1763// MatchArmList
1374#[derive(Debug, Clone, Copy)] 1764#[derive(Debug, Clone, Copy,)]
1375pub struct MatchArmListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1765pub struct MatchArmListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1376 syntax: SyntaxNode<R>, 1766 pub(crate) syntax: SyntaxNode<R>,
1377} 1767}
1378pub type MatchArmList<'a> = MatchArmListNode<RefRoot<'a>>; 1768pub type MatchArmList<'a> = MatchArmListNode<RefRoot<'a>>;
1379 1769
1770impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchArmListNode<R1>> for MatchArmListNode<R2> {
1771 fn eq(&self, other: &MatchArmListNode<R1>) -> bool { self.syntax == other.syntax }
1772}
1773impl<R: TreeRoot<RaTypes>> Eq for MatchArmListNode<R> {}
1774impl<R: TreeRoot<RaTypes>> Hash for MatchArmListNode<R> {
1775 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1776}
1777
1380impl<'a> AstNode<'a> for MatchArmList<'a> { 1778impl<'a> AstNode<'a> for MatchArmList<'a> {
1381 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1779 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1382 match syntax.kind() { 1780 match syntax.kind() {
@@ -1404,12 +1802,20 @@ impl<'a> MatchArmList<'a> {
1404} 1802}
1405 1803
1406// MatchExpr 1804// MatchExpr
1407#[derive(Debug, Clone, Copy)] 1805#[derive(Debug, Clone, Copy,)]
1408pub struct MatchExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1806pub struct MatchExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1409 syntax: SyntaxNode<R>, 1807 pub(crate) syntax: SyntaxNode<R>,
1410} 1808}
1411pub type MatchExpr<'a> = MatchExprNode<RefRoot<'a>>; 1809pub type MatchExpr<'a> = MatchExprNode<RefRoot<'a>>;
1412 1810
1811impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchExprNode<R1>> for MatchExprNode<R2> {
1812 fn eq(&self, other: &MatchExprNode<R1>) -> bool { self.syntax == other.syntax }
1813}
1814impl<R: TreeRoot<RaTypes>> Eq for MatchExprNode<R> {}
1815impl<R: TreeRoot<RaTypes>> Hash for MatchExprNode<R> {
1816 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1817}
1818
1413impl<'a> AstNode<'a> for MatchExpr<'a> { 1819impl<'a> AstNode<'a> for MatchExpr<'a> {
1414 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1820 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1415 match syntax.kind() { 1821 match syntax.kind() {
@@ -1441,12 +1847,20 @@ impl<'a> MatchExpr<'a> {
1441} 1847}
1442 1848
1443// MatchGuard 1849// MatchGuard
1444#[derive(Debug, Clone, Copy)] 1850#[derive(Debug, Clone, Copy,)]
1445pub struct MatchGuardNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1851pub struct MatchGuardNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1446 syntax: SyntaxNode<R>, 1852 pub(crate) syntax: SyntaxNode<R>,
1447} 1853}
1448pub type MatchGuard<'a> = MatchGuardNode<RefRoot<'a>>; 1854pub type MatchGuard<'a> = MatchGuardNode<RefRoot<'a>>;
1449 1855
1856impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MatchGuardNode<R1>> for MatchGuardNode<R2> {
1857 fn eq(&self, other: &MatchGuardNode<R1>) -> bool { self.syntax == other.syntax }
1858}
1859impl<R: TreeRoot<RaTypes>> Eq for MatchGuardNode<R> {}
1860impl<R: TreeRoot<RaTypes>> Hash for MatchGuardNode<R> {
1861 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1862}
1863
1450impl<'a> AstNode<'a> for MatchGuard<'a> { 1864impl<'a> AstNode<'a> for MatchGuard<'a> {
1451 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1865 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1452 match syntax.kind() { 1866 match syntax.kind() {
@@ -1470,12 +1884,20 @@ impl<R: TreeRoot<RaTypes>> MatchGuardNode<R> {
1470impl<'a> MatchGuard<'a> {} 1884impl<'a> MatchGuard<'a> {}
1471 1885
1472// MethodCallExpr 1886// MethodCallExpr
1473#[derive(Debug, Clone, Copy)] 1887#[derive(Debug, Clone, Copy,)]
1474pub struct MethodCallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1888pub struct MethodCallExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1475 syntax: SyntaxNode<R>, 1889 pub(crate) syntax: SyntaxNode<R>,
1476} 1890}
1477pub type MethodCallExpr<'a> = MethodCallExprNode<RefRoot<'a>>; 1891pub type MethodCallExpr<'a> = MethodCallExprNode<RefRoot<'a>>;
1478 1892
1893impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<MethodCallExprNode<R1>> for MethodCallExprNode<R2> {
1894 fn eq(&self, other: &MethodCallExprNode<R1>) -> bool { self.syntax == other.syntax }
1895}
1896impl<R: TreeRoot<RaTypes>> Eq for MethodCallExprNode<R> {}
1897impl<R: TreeRoot<RaTypes>> Hash for MethodCallExprNode<R> {
1898 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1899}
1900
1479impl<'a> AstNode<'a> for MethodCallExpr<'a> { 1901impl<'a> AstNode<'a> for MethodCallExpr<'a> {
1480 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1902 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1481 match syntax.kind() { 1903 match syntax.kind() {
@@ -1504,12 +1926,20 @@ impl<'a> MethodCallExpr<'a> {
1504} 1926}
1505 1927
1506// Module 1928// Module
1507#[derive(Debug, Clone, Copy)] 1929#[derive(Debug, Clone, Copy,)]
1508pub struct ModuleNode<R: TreeRoot<RaTypes> = OwnedRoot> { 1930pub struct ModuleNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1509 syntax: SyntaxNode<R>, 1931 pub(crate) syntax: SyntaxNode<R>,
1510} 1932}
1511pub type Module<'a> = ModuleNode<RefRoot<'a>>; 1933pub type Module<'a> = ModuleNode<RefRoot<'a>>;
1512 1934
1935impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ModuleNode<R1>> for ModuleNode<R2> {
1936 fn eq(&self, other: &ModuleNode<R1>) -> bool { self.syntax == other.syntax }
1937}
1938impl<R: TreeRoot<RaTypes>> Eq for ModuleNode<R> {}
1939impl<R: TreeRoot<RaTypes>> Hash for ModuleNode<R> {
1940 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
1941}
1942
1513impl<'a> AstNode<'a> for Module<'a> { 1943impl<'a> AstNode<'a> for Module<'a> {
1514 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 1944 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1515 match syntax.kind() { 1945 match syntax.kind() {
@@ -1532,6 +1962,7 @@ impl<R: TreeRoot<RaTypes>> ModuleNode<R> {
1532 1962
1533impl<'a> ast::NameOwner<'a> for Module<'a> {} 1963impl<'a> ast::NameOwner<'a> for Module<'a> {}
1534impl<'a> ast::AttrsOwner<'a> for Module<'a> {} 1964impl<'a> ast::AttrsOwner<'a> for Module<'a> {}
1965impl<'a> ast::DocCommentsOwner<'a> for Module<'a> {}
1535impl<'a> Module<'a> { 1966impl<'a> Module<'a> {
1536 pub fn item_list(self) -> Option<ItemList<'a>> { 1967 pub fn item_list(self) -> Option<ItemList<'a>> {
1537 super::child_opt(self) 1968 super::child_opt(self)
@@ -1539,7 +1970,7 @@ impl<'a> Module<'a> {
1539} 1970}
1540 1971
1541// ModuleItem 1972// ModuleItem
1542#[derive(Debug, Clone, Copy)] 1973#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1543pub enum ModuleItem<'a> { 1974pub enum ModuleItem<'a> {
1544 StructDef(StructDef<'a>), 1975 StructDef(StructDef<'a>),
1545 EnumDef(EnumDef<'a>), 1976 EnumDef(EnumDef<'a>),
@@ -1591,12 +2022,20 @@ impl<'a> AstNode<'a> for ModuleItem<'a> {
1591impl<'a> ModuleItem<'a> {} 2022impl<'a> ModuleItem<'a> {}
1592 2023
1593// Name 2024// Name
1594#[derive(Debug, Clone, Copy)] 2025#[derive(Debug, Clone, Copy,)]
1595pub struct NameNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2026pub struct NameNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1596 syntax: SyntaxNode<R>, 2027 pub(crate) syntax: SyntaxNode<R>,
1597} 2028}
1598pub type Name<'a> = NameNode<RefRoot<'a>>; 2029pub type Name<'a> = NameNode<RefRoot<'a>>;
1599 2030
2031impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NameNode<R1>> for NameNode<R2> {
2032 fn eq(&self, other: &NameNode<R1>) -> bool { self.syntax == other.syntax }
2033}
2034impl<R: TreeRoot<RaTypes>> Eq for NameNode<R> {}
2035impl<R: TreeRoot<RaTypes>> Hash for NameNode<R> {
2036 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2037}
2038
1600impl<'a> AstNode<'a> for Name<'a> { 2039impl<'a> AstNode<'a> for Name<'a> {
1601 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2040 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1602 match syntax.kind() { 2041 match syntax.kind() {
@@ -1620,12 +2059,20 @@ impl<R: TreeRoot<RaTypes>> NameNode<R> {
1620impl<'a> Name<'a> {} 2059impl<'a> Name<'a> {}
1621 2060
1622// NameRef 2061// NameRef
1623#[derive(Debug, Clone, Copy)] 2062#[derive(Debug, Clone, Copy,)]
1624pub struct NameRefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2063pub struct NameRefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1625 syntax: SyntaxNode<R>, 2064 pub(crate) syntax: SyntaxNode<R>,
1626} 2065}
1627pub type NameRef<'a> = NameRefNode<RefRoot<'a>>; 2066pub type NameRef<'a> = NameRefNode<RefRoot<'a>>;
1628 2067
2068impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NameRefNode<R1>> for NameRefNode<R2> {
2069 fn eq(&self, other: &NameRefNode<R1>) -> bool { self.syntax == other.syntax }
2070}
2071impl<R: TreeRoot<RaTypes>> Eq for NameRefNode<R> {}
2072impl<R: TreeRoot<RaTypes>> Hash for NameRefNode<R> {
2073 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2074}
2075
1629impl<'a> AstNode<'a> for NameRef<'a> { 2076impl<'a> AstNode<'a> for NameRef<'a> {
1630 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2077 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1631 match syntax.kind() { 2078 match syntax.kind() {
@@ -1649,12 +2096,20 @@ impl<R: TreeRoot<RaTypes>> NameRefNode<R> {
1649impl<'a> NameRef<'a> {} 2096impl<'a> NameRef<'a> {}
1650 2097
1651// NamedField 2098// NamedField
1652#[derive(Debug, Clone, Copy)] 2099#[derive(Debug, Clone, Copy,)]
1653pub struct NamedFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2100pub struct NamedFieldNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1654 syntax: SyntaxNode<R>, 2101 pub(crate) syntax: SyntaxNode<R>,
1655} 2102}
1656pub type NamedField<'a> = NamedFieldNode<RefRoot<'a>>; 2103pub type NamedField<'a> = NamedFieldNode<RefRoot<'a>>;
1657 2104
2105impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldNode<R1>> for NamedFieldNode<R2> {
2106 fn eq(&self, other: &NamedFieldNode<R1>) -> bool { self.syntax == other.syntax }
2107}
2108impl<R: TreeRoot<RaTypes>> Eq for NamedFieldNode<R> {}
2109impl<R: TreeRoot<RaTypes>> Hash for NamedFieldNode<R> {
2110 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2111}
2112
1658impl<'a> AstNode<'a> for NamedField<'a> { 2113impl<'a> AstNode<'a> for NamedField<'a> {
1659 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2114 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1660 match syntax.kind() { 2115 match syntax.kind() {
@@ -1678,12 +2133,20 @@ impl<R: TreeRoot<RaTypes>> NamedFieldNode<R> {
1678impl<'a> NamedField<'a> {} 2133impl<'a> NamedField<'a> {}
1679 2134
1680// NamedFieldDef 2135// NamedFieldDef
1681#[derive(Debug, Clone, Copy)] 2136#[derive(Debug, Clone, Copy,)]
1682pub struct NamedFieldDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2137pub struct NamedFieldDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1683 syntax: SyntaxNode<R>, 2138 pub(crate) syntax: SyntaxNode<R>,
1684} 2139}
1685pub type NamedFieldDef<'a> = NamedFieldDefNode<RefRoot<'a>>; 2140pub type NamedFieldDef<'a> = NamedFieldDefNode<RefRoot<'a>>;
1686 2141
2142impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldDefNode<R1>> for NamedFieldDefNode<R2> {
2143 fn eq(&self, other: &NamedFieldDefNode<R1>) -> bool { self.syntax == other.syntax }
2144}
2145impl<R: TreeRoot<RaTypes>> Eq for NamedFieldDefNode<R> {}
2146impl<R: TreeRoot<RaTypes>> Hash for NamedFieldDefNode<R> {
2147 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2148}
2149
1687impl<'a> AstNode<'a> for NamedFieldDef<'a> { 2150impl<'a> AstNode<'a> for NamedFieldDef<'a> {
1688 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2151 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1689 match syntax.kind() { 2152 match syntax.kind() {
@@ -1709,12 +2172,20 @@ impl<'a> ast::AttrsOwner<'a> for NamedFieldDef<'a> {}
1709impl<'a> NamedFieldDef<'a> {} 2172impl<'a> NamedFieldDef<'a> {}
1710 2173
1711// NamedFieldList 2174// NamedFieldList
1712#[derive(Debug, Clone, Copy)] 2175#[derive(Debug, Clone, Copy,)]
1713pub struct NamedFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2176pub struct NamedFieldListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1714 syntax: SyntaxNode<R>, 2177 pub(crate) syntax: SyntaxNode<R>,
1715} 2178}
1716pub type NamedFieldList<'a> = NamedFieldListNode<RefRoot<'a>>; 2179pub type NamedFieldList<'a> = NamedFieldListNode<RefRoot<'a>>;
1717 2180
2181impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NamedFieldListNode<R1>> for NamedFieldListNode<R2> {
2182 fn eq(&self, other: &NamedFieldListNode<R1>) -> bool { self.syntax == other.syntax }
2183}
2184impl<R: TreeRoot<RaTypes>> Eq for NamedFieldListNode<R> {}
2185impl<R: TreeRoot<RaTypes>> Hash for NamedFieldListNode<R> {
2186 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2187}
2188
1718impl<'a> AstNode<'a> for NamedFieldList<'a> { 2189impl<'a> AstNode<'a> for NamedFieldList<'a> {
1719 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2190 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1720 match syntax.kind() { 2191 match syntax.kind() {
@@ -1738,12 +2209,20 @@ impl<R: TreeRoot<RaTypes>> NamedFieldListNode<R> {
1738impl<'a> NamedFieldList<'a> {} 2209impl<'a> NamedFieldList<'a> {}
1739 2210
1740// NeverType 2211// NeverType
1741#[derive(Debug, Clone, Copy)] 2212#[derive(Debug, Clone, Copy,)]
1742pub struct NeverTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2213pub struct NeverTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1743 syntax: SyntaxNode<R>, 2214 pub(crate) syntax: SyntaxNode<R>,
1744} 2215}
1745pub type NeverType<'a> = NeverTypeNode<RefRoot<'a>>; 2216pub type NeverType<'a> = NeverTypeNode<RefRoot<'a>>;
1746 2217
2218impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<NeverTypeNode<R1>> for NeverTypeNode<R2> {
2219 fn eq(&self, other: &NeverTypeNode<R1>) -> bool { self.syntax == other.syntax }
2220}
2221impl<R: TreeRoot<RaTypes>> Eq for NeverTypeNode<R> {}
2222impl<R: TreeRoot<RaTypes>> Hash for NeverTypeNode<R> {
2223 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2224}
2225
1747impl<'a> AstNode<'a> for NeverType<'a> { 2226impl<'a> AstNode<'a> for NeverType<'a> {
1748 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2227 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1749 match syntax.kind() { 2228 match syntax.kind() {
@@ -1767,7 +2246,7 @@ impl<R: TreeRoot<RaTypes>> NeverTypeNode<R> {
1767impl<'a> NeverType<'a> {} 2246impl<'a> NeverType<'a> {}
1768 2247
1769// NominalDef 2248// NominalDef
1770#[derive(Debug, Clone, Copy)] 2249#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1771pub enum NominalDef<'a> { 2250pub enum NominalDef<'a> {
1772 StructDef(StructDef<'a>), 2251 StructDef(StructDef<'a>),
1773 EnumDef(EnumDef<'a>), 2252 EnumDef(EnumDef<'a>),
@@ -1795,12 +2274,20 @@ impl<'a> ast::AttrsOwner<'a> for NominalDef<'a> {}
1795impl<'a> NominalDef<'a> {} 2274impl<'a> NominalDef<'a> {}
1796 2275
1797// Param 2276// Param
1798#[derive(Debug, Clone, Copy)] 2277#[derive(Debug, Clone, Copy,)]
1799pub struct ParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2278pub struct ParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1800 syntax: SyntaxNode<R>, 2279 pub(crate) syntax: SyntaxNode<R>,
1801} 2280}
1802pub type Param<'a> = ParamNode<RefRoot<'a>>; 2281pub type Param<'a> = ParamNode<RefRoot<'a>>;
1803 2282
2283impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParamNode<R1>> for ParamNode<R2> {
2284 fn eq(&self, other: &ParamNode<R1>) -> bool { self.syntax == other.syntax }
2285}
2286impl<R: TreeRoot<RaTypes>> Eq for ParamNode<R> {}
2287impl<R: TreeRoot<RaTypes>> Hash for ParamNode<R> {
2288 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2289}
2290
1804impl<'a> AstNode<'a> for Param<'a> { 2291impl<'a> AstNode<'a> for Param<'a> {
1805 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2292 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1806 match syntax.kind() { 2293 match syntax.kind() {
@@ -1828,12 +2315,20 @@ impl<'a> Param<'a> {
1828} 2315}
1829 2316
1830// ParamList 2317// ParamList
1831#[derive(Debug, Clone, Copy)] 2318#[derive(Debug, Clone, Copy,)]
1832pub struct ParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2319pub struct ParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1833 syntax: SyntaxNode<R>, 2320 pub(crate) syntax: SyntaxNode<R>,
1834} 2321}
1835pub type ParamList<'a> = ParamListNode<RefRoot<'a>>; 2322pub type ParamList<'a> = ParamListNode<RefRoot<'a>>;
1836 2323
2324impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParamListNode<R1>> for ParamListNode<R2> {
2325 fn eq(&self, other: &ParamListNode<R1>) -> bool { self.syntax == other.syntax }
2326}
2327impl<R: TreeRoot<RaTypes>> Eq for ParamListNode<R> {}
2328impl<R: TreeRoot<RaTypes>> Hash for ParamListNode<R> {
2329 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2330}
2331
1837impl<'a> AstNode<'a> for ParamList<'a> { 2332impl<'a> AstNode<'a> for ParamList<'a> {
1838 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2333 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1839 match syntax.kind() { 2334 match syntax.kind() {
@@ -1865,12 +2360,20 @@ impl<'a> ParamList<'a> {
1865} 2360}
1866 2361
1867// ParenExpr 2362// ParenExpr
1868#[derive(Debug, Clone, Copy)] 2363#[derive(Debug, Clone, Copy,)]
1869pub struct ParenExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2364pub struct ParenExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1870 syntax: SyntaxNode<R>, 2365 pub(crate) syntax: SyntaxNode<R>,
1871} 2366}
1872pub type ParenExpr<'a> = ParenExprNode<RefRoot<'a>>; 2367pub type ParenExpr<'a> = ParenExprNode<RefRoot<'a>>;
1873 2368
2369impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParenExprNode<R1>> for ParenExprNode<R2> {
2370 fn eq(&self, other: &ParenExprNode<R1>) -> bool { self.syntax == other.syntax }
2371}
2372impl<R: TreeRoot<RaTypes>> Eq for ParenExprNode<R> {}
2373impl<R: TreeRoot<RaTypes>> Hash for ParenExprNode<R> {
2374 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2375}
2376
1874impl<'a> AstNode<'a> for ParenExpr<'a> { 2377impl<'a> AstNode<'a> for ParenExpr<'a> {
1875 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2378 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1876 match syntax.kind() { 2379 match syntax.kind() {
@@ -1894,12 +2397,20 @@ impl<R: TreeRoot<RaTypes>> ParenExprNode<R> {
1894impl<'a> ParenExpr<'a> {} 2397impl<'a> ParenExpr<'a> {}
1895 2398
1896// ParenType 2399// ParenType
1897#[derive(Debug, Clone, Copy)] 2400#[derive(Debug, Clone, Copy,)]
1898pub struct ParenTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2401pub struct ParenTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1899 syntax: SyntaxNode<R>, 2402 pub(crate) syntax: SyntaxNode<R>,
1900} 2403}
1901pub type ParenType<'a> = ParenTypeNode<RefRoot<'a>>; 2404pub type ParenType<'a> = ParenTypeNode<RefRoot<'a>>;
1902 2405
2406impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ParenTypeNode<R1>> for ParenTypeNode<R2> {
2407 fn eq(&self, other: &ParenTypeNode<R1>) -> bool { self.syntax == other.syntax }
2408}
2409impl<R: TreeRoot<RaTypes>> Eq for ParenTypeNode<R> {}
2410impl<R: TreeRoot<RaTypes>> Hash for ParenTypeNode<R> {
2411 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2412}
2413
1903impl<'a> AstNode<'a> for ParenType<'a> { 2414impl<'a> AstNode<'a> for ParenType<'a> {
1904 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2415 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1905 match syntax.kind() { 2416 match syntax.kind() {
@@ -1923,7 +2434,7 @@ impl<R: TreeRoot<RaTypes>> ParenTypeNode<R> {
1923impl<'a> ParenType<'a> {} 2434impl<'a> ParenType<'a> {}
1924 2435
1925// Pat 2436// Pat
1926#[derive(Debug, Clone, Copy)] 2437#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1927pub enum Pat<'a> { 2438pub enum Pat<'a> {
1928 RefPat(RefPat<'a>), 2439 RefPat(RefPat<'a>),
1929 BindPat(BindPat<'a>), 2440 BindPat(BindPat<'a>),
@@ -1972,12 +2483,20 @@ impl<'a> AstNode<'a> for Pat<'a> {
1972impl<'a> Pat<'a> {} 2483impl<'a> Pat<'a> {}
1973 2484
1974// Path 2485// Path
1975#[derive(Debug, Clone, Copy)] 2486#[derive(Debug, Clone, Copy,)]
1976pub struct PathNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2487pub struct PathNode<R: TreeRoot<RaTypes> = OwnedRoot> {
1977 syntax: SyntaxNode<R>, 2488 pub(crate) syntax: SyntaxNode<R>,
1978} 2489}
1979pub type Path<'a> = PathNode<RefRoot<'a>>; 2490pub type Path<'a> = PathNode<RefRoot<'a>>;
1980 2491
2492impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathNode<R1>> for PathNode<R2> {
2493 fn eq(&self, other: &PathNode<R1>) -> bool { self.syntax == other.syntax }
2494}
2495impl<R: TreeRoot<RaTypes>> Eq for PathNode<R> {}
2496impl<R: TreeRoot<RaTypes>> Hash for PathNode<R> {
2497 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2498}
2499
1981impl<'a> AstNode<'a> for Path<'a> { 2500impl<'a> AstNode<'a> for Path<'a> {
1982 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2501 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
1983 match syntax.kind() { 2502 match syntax.kind() {
@@ -2009,12 +2528,20 @@ impl<'a> Path<'a> {
2009} 2528}
2010 2529
2011// PathExpr 2530// PathExpr
2012#[derive(Debug, Clone, Copy)] 2531#[derive(Debug, Clone, Copy,)]
2013pub struct PathExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2532pub struct PathExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2014 syntax: SyntaxNode<R>, 2533 pub(crate) syntax: SyntaxNode<R>,
2015} 2534}
2016pub type PathExpr<'a> = PathExprNode<RefRoot<'a>>; 2535pub type PathExpr<'a> = PathExprNode<RefRoot<'a>>;
2017 2536
2537impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathExprNode<R1>> for PathExprNode<R2> {
2538 fn eq(&self, other: &PathExprNode<R1>) -> bool { self.syntax == other.syntax }
2539}
2540impl<R: TreeRoot<RaTypes>> Eq for PathExprNode<R> {}
2541impl<R: TreeRoot<RaTypes>> Hash for PathExprNode<R> {
2542 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2543}
2544
2018impl<'a> AstNode<'a> for PathExpr<'a> { 2545impl<'a> AstNode<'a> for PathExpr<'a> {
2019 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2546 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2020 match syntax.kind() { 2547 match syntax.kind() {
@@ -2042,12 +2569,20 @@ impl<'a> PathExpr<'a> {
2042} 2569}
2043 2570
2044// PathPat 2571// PathPat
2045#[derive(Debug, Clone, Copy)] 2572#[derive(Debug, Clone, Copy,)]
2046pub struct PathPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2573pub struct PathPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2047 syntax: SyntaxNode<R>, 2574 pub(crate) syntax: SyntaxNode<R>,
2048} 2575}
2049pub type PathPat<'a> = PathPatNode<RefRoot<'a>>; 2576pub type PathPat<'a> = PathPatNode<RefRoot<'a>>;
2050 2577
2578impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathPatNode<R1>> for PathPatNode<R2> {
2579 fn eq(&self, other: &PathPatNode<R1>) -> bool { self.syntax == other.syntax }
2580}
2581impl<R: TreeRoot<RaTypes>> Eq for PathPatNode<R> {}
2582impl<R: TreeRoot<RaTypes>> Hash for PathPatNode<R> {
2583 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2584}
2585
2051impl<'a> AstNode<'a> for PathPat<'a> { 2586impl<'a> AstNode<'a> for PathPat<'a> {
2052 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2587 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2053 match syntax.kind() { 2588 match syntax.kind() {
@@ -2071,12 +2606,20 @@ impl<R: TreeRoot<RaTypes>> PathPatNode<R> {
2071impl<'a> PathPat<'a> {} 2606impl<'a> PathPat<'a> {}
2072 2607
2073// PathSegment 2608// PathSegment
2074#[derive(Debug, Clone, Copy)] 2609#[derive(Debug, Clone, Copy,)]
2075pub struct PathSegmentNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2610pub struct PathSegmentNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2076 syntax: SyntaxNode<R>, 2611 pub(crate) syntax: SyntaxNode<R>,
2077} 2612}
2078pub type PathSegment<'a> = PathSegmentNode<RefRoot<'a>>; 2613pub type PathSegment<'a> = PathSegmentNode<RefRoot<'a>>;
2079 2614
2615impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathSegmentNode<R1>> for PathSegmentNode<R2> {
2616 fn eq(&self, other: &PathSegmentNode<R1>) -> bool { self.syntax == other.syntax }
2617}
2618impl<R: TreeRoot<RaTypes>> Eq for PathSegmentNode<R> {}
2619impl<R: TreeRoot<RaTypes>> Hash for PathSegmentNode<R> {
2620 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2621}
2622
2080impl<'a> AstNode<'a> for PathSegment<'a> { 2623impl<'a> AstNode<'a> for PathSegment<'a> {
2081 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2624 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2082 match syntax.kind() { 2625 match syntax.kind() {
@@ -2104,12 +2647,20 @@ impl<'a> PathSegment<'a> {
2104} 2647}
2105 2648
2106// PathType 2649// PathType
2107#[derive(Debug, Clone, Copy)] 2650#[derive(Debug, Clone, Copy,)]
2108pub struct PathTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2651pub struct PathTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2109 syntax: SyntaxNode<R>, 2652 pub(crate) syntax: SyntaxNode<R>,
2110} 2653}
2111pub type PathType<'a> = PathTypeNode<RefRoot<'a>>; 2654pub type PathType<'a> = PathTypeNode<RefRoot<'a>>;
2112 2655
2656impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PathTypeNode<R1>> for PathTypeNode<R2> {
2657 fn eq(&self, other: &PathTypeNode<R1>) -> bool { self.syntax == other.syntax }
2658}
2659impl<R: TreeRoot<RaTypes>> Eq for PathTypeNode<R> {}
2660impl<R: TreeRoot<RaTypes>> Hash for PathTypeNode<R> {
2661 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2662}
2663
2113impl<'a> AstNode<'a> for PathType<'a> { 2664impl<'a> AstNode<'a> for PathType<'a> {
2114 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2665 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2115 match syntax.kind() { 2666 match syntax.kind() {
@@ -2133,12 +2684,20 @@ impl<R: TreeRoot<RaTypes>> PathTypeNode<R> {
2133impl<'a> PathType<'a> {} 2684impl<'a> PathType<'a> {}
2134 2685
2135// PlaceholderPat 2686// PlaceholderPat
2136#[derive(Debug, Clone, Copy)] 2687#[derive(Debug, Clone, Copy,)]
2137pub struct PlaceholderPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2688pub struct PlaceholderPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2138 syntax: SyntaxNode<R>, 2689 pub(crate) syntax: SyntaxNode<R>,
2139} 2690}
2140pub type PlaceholderPat<'a> = PlaceholderPatNode<RefRoot<'a>>; 2691pub type PlaceholderPat<'a> = PlaceholderPatNode<RefRoot<'a>>;
2141 2692
2693impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PlaceholderPatNode<R1>> for PlaceholderPatNode<R2> {
2694 fn eq(&self, other: &PlaceholderPatNode<R1>) -> bool { self.syntax == other.syntax }
2695}
2696impl<R: TreeRoot<RaTypes>> Eq for PlaceholderPatNode<R> {}
2697impl<R: TreeRoot<RaTypes>> Hash for PlaceholderPatNode<R> {
2698 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2699}
2700
2142impl<'a> AstNode<'a> for PlaceholderPat<'a> { 2701impl<'a> AstNode<'a> for PlaceholderPat<'a> {
2143 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2702 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2144 match syntax.kind() { 2703 match syntax.kind() {
@@ -2162,12 +2721,20 @@ impl<R: TreeRoot<RaTypes>> PlaceholderPatNode<R> {
2162impl<'a> PlaceholderPat<'a> {} 2721impl<'a> PlaceholderPat<'a> {}
2163 2722
2164// PlaceholderType 2723// PlaceholderType
2165#[derive(Debug, Clone, Copy)] 2724#[derive(Debug, Clone, Copy,)]
2166pub struct PlaceholderTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2725pub struct PlaceholderTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2167 syntax: SyntaxNode<R>, 2726 pub(crate) syntax: SyntaxNode<R>,
2168} 2727}
2169pub type PlaceholderType<'a> = PlaceholderTypeNode<RefRoot<'a>>; 2728pub type PlaceholderType<'a> = PlaceholderTypeNode<RefRoot<'a>>;
2170 2729
2730impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PlaceholderTypeNode<R1>> for PlaceholderTypeNode<R2> {
2731 fn eq(&self, other: &PlaceholderTypeNode<R1>) -> bool { self.syntax == other.syntax }
2732}
2733impl<R: TreeRoot<RaTypes>> Eq for PlaceholderTypeNode<R> {}
2734impl<R: TreeRoot<RaTypes>> Hash for PlaceholderTypeNode<R> {
2735 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2736}
2737
2171impl<'a> AstNode<'a> for PlaceholderType<'a> { 2738impl<'a> AstNode<'a> for PlaceholderType<'a> {
2172 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2739 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2173 match syntax.kind() { 2740 match syntax.kind() {
@@ -2191,12 +2758,20 @@ impl<R: TreeRoot<RaTypes>> PlaceholderTypeNode<R> {
2191impl<'a> PlaceholderType<'a> {} 2758impl<'a> PlaceholderType<'a> {}
2192 2759
2193// PointerType 2760// PointerType
2194#[derive(Debug, Clone, Copy)] 2761#[derive(Debug, Clone, Copy,)]
2195pub struct PointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2762pub struct PointerTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2196 syntax: SyntaxNode<R>, 2763 pub(crate) syntax: SyntaxNode<R>,
2197} 2764}
2198pub type PointerType<'a> = PointerTypeNode<RefRoot<'a>>; 2765pub type PointerType<'a> = PointerTypeNode<RefRoot<'a>>;
2199 2766
2767impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PointerTypeNode<R1>> for PointerTypeNode<R2> {
2768 fn eq(&self, other: &PointerTypeNode<R1>) -> bool { self.syntax == other.syntax }
2769}
2770impl<R: TreeRoot<RaTypes>> Eq for PointerTypeNode<R> {}
2771impl<R: TreeRoot<RaTypes>> Hash for PointerTypeNode<R> {
2772 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2773}
2774
2200impl<'a> AstNode<'a> for PointerType<'a> { 2775impl<'a> AstNode<'a> for PointerType<'a> {
2201 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2776 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2202 match syntax.kind() { 2777 match syntax.kind() {
@@ -2220,12 +2795,20 @@ impl<R: TreeRoot<RaTypes>> PointerTypeNode<R> {
2220impl<'a> PointerType<'a> {} 2795impl<'a> PointerType<'a> {}
2221 2796
2222// PrefixExpr 2797// PrefixExpr
2223#[derive(Debug, Clone, Copy)] 2798#[derive(Debug, Clone, Copy,)]
2224pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2799pub struct PrefixExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2225 syntax: SyntaxNode<R>, 2800 pub(crate) syntax: SyntaxNode<R>,
2226} 2801}
2227pub type PrefixExpr<'a> = PrefixExprNode<RefRoot<'a>>; 2802pub type PrefixExpr<'a> = PrefixExprNode<RefRoot<'a>>;
2228 2803
2804impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<PrefixExprNode<R1>> for PrefixExprNode<R2> {
2805 fn eq(&self, other: &PrefixExprNode<R1>) -> bool { self.syntax == other.syntax }
2806}
2807impl<R: TreeRoot<RaTypes>> Eq for PrefixExprNode<R> {}
2808impl<R: TreeRoot<RaTypes>> Hash for PrefixExprNode<R> {
2809 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2810}
2811
2229impl<'a> AstNode<'a> for PrefixExpr<'a> { 2812impl<'a> AstNode<'a> for PrefixExpr<'a> {
2230 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2813 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2231 match syntax.kind() { 2814 match syntax.kind() {
@@ -2249,12 +2832,20 @@ impl<R: TreeRoot<RaTypes>> PrefixExprNode<R> {
2249impl<'a> PrefixExpr<'a> {} 2832impl<'a> PrefixExpr<'a> {}
2250 2833
2251// RangeExpr 2834// RangeExpr
2252#[derive(Debug, Clone, Copy)] 2835#[derive(Debug, Clone, Copy,)]
2253pub struct RangeExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2836pub struct RangeExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2254 syntax: SyntaxNode<R>, 2837 pub(crate) syntax: SyntaxNode<R>,
2255} 2838}
2256pub type RangeExpr<'a> = RangeExprNode<RefRoot<'a>>; 2839pub type RangeExpr<'a> = RangeExprNode<RefRoot<'a>>;
2257 2840
2841impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RangeExprNode<R1>> for RangeExprNode<R2> {
2842 fn eq(&self, other: &RangeExprNode<R1>) -> bool { self.syntax == other.syntax }
2843}
2844impl<R: TreeRoot<RaTypes>> Eq for RangeExprNode<R> {}
2845impl<R: TreeRoot<RaTypes>> Hash for RangeExprNode<R> {
2846 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2847}
2848
2258impl<'a> AstNode<'a> for RangeExpr<'a> { 2849impl<'a> AstNode<'a> for RangeExpr<'a> {
2259 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2850 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2260 match syntax.kind() { 2851 match syntax.kind() {
@@ -2278,12 +2869,20 @@ impl<R: TreeRoot<RaTypes>> RangeExprNode<R> {
2278impl<'a> RangeExpr<'a> {} 2869impl<'a> RangeExpr<'a> {}
2279 2870
2280// RangePat 2871// RangePat
2281#[derive(Debug, Clone, Copy)] 2872#[derive(Debug, Clone, Copy,)]
2282pub struct RangePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2873pub struct RangePatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2283 syntax: SyntaxNode<R>, 2874 pub(crate) syntax: SyntaxNode<R>,
2284} 2875}
2285pub type RangePat<'a> = RangePatNode<RefRoot<'a>>; 2876pub type RangePat<'a> = RangePatNode<RefRoot<'a>>;
2286 2877
2878impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RangePatNode<R1>> for RangePatNode<R2> {
2879 fn eq(&self, other: &RangePatNode<R1>) -> bool { self.syntax == other.syntax }
2880}
2881impl<R: TreeRoot<RaTypes>> Eq for RangePatNode<R> {}
2882impl<R: TreeRoot<RaTypes>> Hash for RangePatNode<R> {
2883 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2884}
2885
2287impl<'a> AstNode<'a> for RangePat<'a> { 2886impl<'a> AstNode<'a> for RangePat<'a> {
2288 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2887 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2289 match syntax.kind() { 2888 match syntax.kind() {
@@ -2307,12 +2906,20 @@ impl<R: TreeRoot<RaTypes>> RangePatNode<R> {
2307impl<'a> RangePat<'a> {} 2906impl<'a> RangePat<'a> {}
2308 2907
2309// RefExpr 2908// RefExpr
2310#[derive(Debug, Clone, Copy)] 2909#[derive(Debug, Clone, Copy,)]
2311pub struct RefExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2910pub struct RefExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2312 syntax: SyntaxNode<R>, 2911 pub(crate) syntax: SyntaxNode<R>,
2313} 2912}
2314pub type RefExpr<'a> = RefExprNode<RefRoot<'a>>; 2913pub type RefExpr<'a> = RefExprNode<RefRoot<'a>>;
2315 2914
2915impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RefExprNode<R1>> for RefExprNode<R2> {
2916 fn eq(&self, other: &RefExprNode<R1>) -> bool { self.syntax == other.syntax }
2917}
2918impl<R: TreeRoot<RaTypes>> Eq for RefExprNode<R> {}
2919impl<R: TreeRoot<RaTypes>> Hash for RefExprNode<R> {
2920 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2921}
2922
2316impl<'a> AstNode<'a> for RefExpr<'a> { 2923impl<'a> AstNode<'a> for RefExpr<'a> {
2317 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2924 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2318 match syntax.kind() { 2925 match syntax.kind() {
@@ -2336,12 +2943,20 @@ impl<R: TreeRoot<RaTypes>> RefExprNode<R> {
2336impl<'a> RefExpr<'a> {} 2943impl<'a> RefExpr<'a> {}
2337 2944
2338// RefPat 2945// RefPat
2339#[derive(Debug, Clone, Copy)] 2946#[derive(Debug, Clone, Copy,)]
2340pub struct RefPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2947pub struct RefPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2341 syntax: SyntaxNode<R>, 2948 pub(crate) syntax: SyntaxNode<R>,
2342} 2949}
2343pub type RefPat<'a> = RefPatNode<RefRoot<'a>>; 2950pub type RefPat<'a> = RefPatNode<RefRoot<'a>>;
2344 2951
2952impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RefPatNode<R1>> for RefPatNode<R2> {
2953 fn eq(&self, other: &RefPatNode<R1>) -> bool { self.syntax == other.syntax }
2954}
2955impl<R: TreeRoot<RaTypes>> Eq for RefPatNode<R> {}
2956impl<R: TreeRoot<RaTypes>> Hash for RefPatNode<R> {
2957 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2958}
2959
2345impl<'a> AstNode<'a> for RefPat<'a> { 2960impl<'a> AstNode<'a> for RefPat<'a> {
2346 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2961 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2347 match syntax.kind() { 2962 match syntax.kind() {
@@ -2365,12 +2980,20 @@ impl<R: TreeRoot<RaTypes>> RefPatNode<R> {
2365impl<'a> RefPat<'a> {} 2980impl<'a> RefPat<'a> {}
2366 2981
2367// ReferenceType 2982// ReferenceType
2368#[derive(Debug, Clone, Copy)] 2983#[derive(Debug, Clone, Copy,)]
2369pub struct ReferenceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 2984pub struct ReferenceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2370 syntax: SyntaxNode<R>, 2985 pub(crate) syntax: SyntaxNode<R>,
2371} 2986}
2372pub type ReferenceType<'a> = ReferenceTypeNode<RefRoot<'a>>; 2987pub type ReferenceType<'a> = ReferenceTypeNode<RefRoot<'a>>;
2373 2988
2989impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ReferenceTypeNode<R1>> for ReferenceTypeNode<R2> {
2990 fn eq(&self, other: &ReferenceTypeNode<R1>) -> bool { self.syntax == other.syntax }
2991}
2992impl<R: TreeRoot<RaTypes>> Eq for ReferenceTypeNode<R> {}
2993impl<R: TreeRoot<RaTypes>> Hash for ReferenceTypeNode<R> {
2994 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
2995}
2996
2374impl<'a> AstNode<'a> for ReferenceType<'a> { 2997impl<'a> AstNode<'a> for ReferenceType<'a> {
2375 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 2998 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2376 match syntax.kind() { 2999 match syntax.kind() {
@@ -2394,12 +3017,20 @@ impl<R: TreeRoot<RaTypes>> ReferenceTypeNode<R> {
2394impl<'a> ReferenceType<'a> {} 3017impl<'a> ReferenceType<'a> {}
2395 3018
2396// RetType 3019// RetType
2397#[derive(Debug, Clone, Copy)] 3020#[derive(Debug, Clone, Copy,)]
2398pub struct RetTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3021pub struct RetTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2399 syntax: SyntaxNode<R>, 3022 pub(crate) syntax: SyntaxNode<R>,
2400} 3023}
2401pub type RetType<'a> = RetTypeNode<RefRoot<'a>>; 3024pub type RetType<'a> = RetTypeNode<RefRoot<'a>>;
2402 3025
3026impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<RetTypeNode<R1>> for RetTypeNode<R2> {
3027 fn eq(&self, other: &RetTypeNode<R1>) -> bool { self.syntax == other.syntax }
3028}
3029impl<R: TreeRoot<RaTypes>> Eq for RetTypeNode<R> {}
3030impl<R: TreeRoot<RaTypes>> Hash for RetTypeNode<R> {
3031 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3032}
3033
2403impl<'a> AstNode<'a> for RetType<'a> { 3034impl<'a> AstNode<'a> for RetType<'a> {
2404 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3035 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2405 match syntax.kind() { 3036 match syntax.kind() {
@@ -2423,12 +3054,20 @@ impl<R: TreeRoot<RaTypes>> RetTypeNode<R> {
2423impl<'a> RetType<'a> {} 3054impl<'a> RetType<'a> {}
2424 3055
2425// ReturnExpr 3056// ReturnExpr
2426#[derive(Debug, Clone, Copy)] 3057#[derive(Debug, Clone, Copy,)]
2427pub struct ReturnExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3058pub struct ReturnExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2428 syntax: SyntaxNode<R>, 3059 pub(crate) syntax: SyntaxNode<R>,
2429} 3060}
2430pub type ReturnExpr<'a> = ReturnExprNode<RefRoot<'a>>; 3061pub type ReturnExpr<'a> = ReturnExprNode<RefRoot<'a>>;
2431 3062
3063impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<ReturnExprNode<R1>> for ReturnExprNode<R2> {
3064 fn eq(&self, other: &ReturnExprNode<R1>) -> bool { self.syntax == other.syntax }
3065}
3066impl<R: TreeRoot<RaTypes>> Eq for ReturnExprNode<R> {}
3067impl<R: TreeRoot<RaTypes>> Hash for ReturnExprNode<R> {
3068 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3069}
3070
2432impl<'a> AstNode<'a> for ReturnExpr<'a> { 3071impl<'a> AstNode<'a> for ReturnExpr<'a> {
2433 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3072 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2434 match syntax.kind() { 3073 match syntax.kind() {
@@ -2451,48 +3090,21 @@ impl<R: TreeRoot<RaTypes>> ReturnExprNode<R> {
2451 3090
2452impl<'a> ReturnExpr<'a> {} 3091impl<'a> ReturnExpr<'a> {}
2453 3092
2454// Root
2455#[derive(Debug, Clone, Copy)]
2456pub struct RootNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2457 syntax: SyntaxNode<R>,
2458}
2459pub type Root<'a> = RootNode<RefRoot<'a>>;
2460
2461impl<'a> AstNode<'a> for Root<'a> {
2462 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2463 match syntax.kind() {
2464 ROOT => Some(Root { syntax }),
2465 _ => None,
2466 }
2467 }
2468 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
2469}
2470
2471impl<R: TreeRoot<RaTypes>> RootNode<R> {
2472 pub fn borrowed(&self) -> Root {
2473 RootNode { syntax: self.syntax.borrowed() }
2474 }
2475 pub fn owned(&self) -> RootNode {
2476 RootNode { syntax: self.syntax.owned() }
2477 }
2478}
2479
2480
2481impl<'a> ast::ModuleItemOwner<'a> for Root<'a> {}
2482impl<'a> ast::FnDefOwner<'a> for Root<'a> {}
2483impl<'a> Root<'a> {
2484 pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a {
2485 super::children(self)
2486 }
2487}
2488
2489// SelfParam 3093// SelfParam
2490#[derive(Debug, Clone, Copy)] 3094#[derive(Debug, Clone, Copy,)]
2491pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3095pub struct SelfParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2492 syntax: SyntaxNode<R>, 3096 pub(crate) syntax: SyntaxNode<R>,
2493} 3097}
2494pub type SelfParam<'a> = SelfParamNode<RefRoot<'a>>; 3098pub type SelfParam<'a> = SelfParamNode<RefRoot<'a>>;
2495 3099
3100impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SelfParamNode<R1>> for SelfParamNode<R2> {
3101 fn eq(&self, other: &SelfParamNode<R1>) -> bool { self.syntax == other.syntax }
3102}
3103impl<R: TreeRoot<RaTypes>> Eq for SelfParamNode<R> {}
3104impl<R: TreeRoot<RaTypes>> Hash for SelfParamNode<R> {
3105 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3106}
3107
2496impl<'a> AstNode<'a> for SelfParam<'a> { 3108impl<'a> AstNode<'a> for SelfParam<'a> {
2497 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3109 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2498 match syntax.kind() { 3110 match syntax.kind() {
@@ -2516,12 +3128,20 @@ impl<R: TreeRoot<RaTypes>> SelfParamNode<R> {
2516impl<'a> SelfParam<'a> {} 3128impl<'a> SelfParam<'a> {}
2517 3129
2518// SlicePat 3130// SlicePat
2519#[derive(Debug, Clone, Copy)] 3131#[derive(Debug, Clone, Copy,)]
2520pub struct SlicePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3132pub struct SlicePatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2521 syntax: SyntaxNode<R>, 3133 pub(crate) syntax: SyntaxNode<R>,
2522} 3134}
2523pub type SlicePat<'a> = SlicePatNode<RefRoot<'a>>; 3135pub type SlicePat<'a> = SlicePatNode<RefRoot<'a>>;
2524 3136
3137impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SlicePatNode<R1>> for SlicePatNode<R2> {
3138 fn eq(&self, other: &SlicePatNode<R1>) -> bool { self.syntax == other.syntax }
3139}
3140impl<R: TreeRoot<RaTypes>> Eq for SlicePatNode<R> {}
3141impl<R: TreeRoot<RaTypes>> Hash for SlicePatNode<R> {
3142 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3143}
3144
2525impl<'a> AstNode<'a> for SlicePat<'a> { 3145impl<'a> AstNode<'a> for SlicePat<'a> {
2526 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3146 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2527 match syntax.kind() { 3147 match syntax.kind() {
@@ -2545,12 +3165,20 @@ impl<R: TreeRoot<RaTypes>> SlicePatNode<R> {
2545impl<'a> SlicePat<'a> {} 3165impl<'a> SlicePat<'a> {}
2546 3166
2547// SliceType 3167// SliceType
2548#[derive(Debug, Clone, Copy)] 3168#[derive(Debug, Clone, Copy,)]
2549pub struct SliceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3169pub struct SliceTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2550 syntax: SyntaxNode<R>, 3170 pub(crate) syntax: SyntaxNode<R>,
2551} 3171}
2552pub type SliceType<'a> = SliceTypeNode<RefRoot<'a>>; 3172pub type SliceType<'a> = SliceTypeNode<RefRoot<'a>>;
2553 3173
3174impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SliceTypeNode<R1>> for SliceTypeNode<R2> {
3175 fn eq(&self, other: &SliceTypeNode<R1>) -> bool { self.syntax == other.syntax }
3176}
3177impl<R: TreeRoot<RaTypes>> Eq for SliceTypeNode<R> {}
3178impl<R: TreeRoot<RaTypes>> Hash for SliceTypeNode<R> {
3179 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3180}
3181
2554impl<'a> AstNode<'a> for SliceType<'a> { 3182impl<'a> AstNode<'a> for SliceType<'a> {
2555 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3183 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2556 match syntax.kind() { 3184 match syntax.kind() {
@@ -2573,13 +3201,64 @@ impl<R: TreeRoot<RaTypes>> SliceTypeNode<R> {
2573 3201
2574impl<'a> SliceType<'a> {} 3202impl<'a> SliceType<'a> {}
2575 3203
3204// SourceFile
3205#[derive(Debug, Clone, Copy,)]
3206pub struct SourceFileNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3207 pub(crate) syntax: SyntaxNode<R>,
3208}
3209pub type SourceFile<'a> = SourceFileNode<RefRoot<'a>>;
3210
3211impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<SourceFileNode<R1>> for SourceFileNode<R2> {
3212 fn eq(&self, other: &SourceFileNode<R1>) -> bool { self.syntax == other.syntax }
3213}
3214impl<R: TreeRoot<RaTypes>> Eq for SourceFileNode<R> {}
3215impl<R: TreeRoot<RaTypes>> Hash for SourceFileNode<R> {
3216 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3217}
3218
3219impl<'a> AstNode<'a> for SourceFile<'a> {
3220 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3221 match syntax.kind() {
3222 SOURCE_FILE => Some(SourceFile { syntax }),
3223 _ => None,
3224 }
3225 }
3226 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
3227}
3228
3229impl<R: TreeRoot<RaTypes>> SourceFileNode<R> {
3230 pub fn borrowed(&self) -> SourceFile {
3231 SourceFileNode { syntax: self.syntax.borrowed() }
3232 }
3233 pub fn owned(&self) -> SourceFileNode {
3234 SourceFileNode { syntax: self.syntax.owned() }
3235 }
3236}
3237
3238
3239impl<'a> ast::ModuleItemOwner<'a> for SourceFile<'a> {}
3240impl<'a> ast::FnDefOwner<'a> for SourceFile<'a> {}
3241impl<'a> SourceFile<'a> {
3242 pub fn modules(self) -> impl Iterator<Item = Module<'a>> + 'a {
3243 super::children(self)
3244 }
3245}
3246
2576// StaticDef 3247// StaticDef
2577#[derive(Debug, Clone, Copy)] 3248#[derive(Debug, Clone, Copy,)]
2578pub struct StaticDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3249pub struct StaticDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2579 syntax: SyntaxNode<R>, 3250 pub(crate) syntax: SyntaxNode<R>,
2580} 3251}
2581pub type StaticDef<'a> = StaticDefNode<RefRoot<'a>>; 3252pub type StaticDef<'a> = StaticDefNode<RefRoot<'a>>;
2582 3253
3254impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StaticDefNode<R1>> for StaticDefNode<R2> {
3255 fn eq(&self, other: &StaticDefNode<R1>) -> bool { self.syntax == other.syntax }
3256}
3257impl<R: TreeRoot<RaTypes>> Eq for StaticDefNode<R> {}
3258impl<R: TreeRoot<RaTypes>> Hash for StaticDefNode<R> {
3259 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3260}
3261
2583impl<'a> AstNode<'a> for StaticDef<'a> { 3262impl<'a> AstNode<'a> for StaticDef<'a> {
2584 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3263 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2585 match syntax.kind() { 3264 match syntax.kind() {
@@ -2603,10 +3282,11 @@ impl<R: TreeRoot<RaTypes>> StaticDefNode<R> {
2603impl<'a> ast::NameOwner<'a> for StaticDef<'a> {} 3282impl<'a> ast::NameOwner<'a> for StaticDef<'a> {}
2604impl<'a> ast::TypeParamsOwner<'a> for StaticDef<'a> {} 3283impl<'a> ast::TypeParamsOwner<'a> for StaticDef<'a> {}
2605impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {} 3284impl<'a> ast::AttrsOwner<'a> for StaticDef<'a> {}
3285impl<'a> ast::DocCommentsOwner<'a> for StaticDef<'a> {}
2606impl<'a> StaticDef<'a> {} 3286impl<'a> StaticDef<'a> {}
2607 3287
2608// Stmt 3288// Stmt
2609#[derive(Debug, Clone, Copy)] 3289#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2610pub enum Stmt<'a> { 3290pub enum Stmt<'a> {
2611 ExprStmt(ExprStmt<'a>), 3291 ExprStmt(ExprStmt<'a>),
2612 LetStmt(LetStmt<'a>), 3292 LetStmt(LetStmt<'a>),
@@ -2630,13 +3310,58 @@ impl<'a> AstNode<'a> for Stmt<'a> {
2630 3310
2631impl<'a> Stmt<'a> {} 3311impl<'a> Stmt<'a> {}
2632 3312
3313// String
3314#[derive(Debug, Clone, Copy,)]
3315pub struct StringNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3316 pub(crate) syntax: SyntaxNode<R>,
3317}
3318pub type String<'a> = StringNode<RefRoot<'a>>;
3319
3320impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StringNode<R1>> for StringNode<R2> {
3321 fn eq(&self, other: &StringNode<R1>) -> bool { self.syntax == other.syntax }
3322}
3323impl<R: TreeRoot<RaTypes>> Eq for StringNode<R> {}
3324impl<R: TreeRoot<RaTypes>> Hash for StringNode<R> {
3325 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3326}
3327
3328impl<'a> AstNode<'a> for String<'a> {
3329 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3330 match syntax.kind() {
3331 STRING => Some(String { syntax }),
3332 _ => None,
3333 }
3334 }
3335 fn syntax(self) -> SyntaxNodeRef<'a> { self.syntax }
3336}
3337
3338impl<R: TreeRoot<RaTypes>> StringNode<R> {
3339 pub fn borrowed(&self) -> String {
3340 StringNode { syntax: self.syntax.borrowed() }
3341 }
3342 pub fn owned(&self) -> StringNode {
3343 StringNode { syntax: self.syntax.owned() }
3344 }
3345}
3346
3347
3348impl<'a> String<'a> {}
3349
2633// StructDef 3350// StructDef
2634#[derive(Debug, Clone, Copy)] 3351#[derive(Debug, Clone, Copy,)]
2635pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3352pub struct StructDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2636 syntax: SyntaxNode<R>, 3353 pub(crate) syntax: SyntaxNode<R>,
2637} 3354}
2638pub type StructDef<'a> = StructDefNode<RefRoot<'a>>; 3355pub type StructDef<'a> = StructDefNode<RefRoot<'a>>;
2639 3356
3357impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructDefNode<R1>> for StructDefNode<R2> {
3358 fn eq(&self, other: &StructDefNode<R1>) -> bool { self.syntax == other.syntax }
3359}
3360impl<R: TreeRoot<RaTypes>> Eq for StructDefNode<R> {}
3361impl<R: TreeRoot<RaTypes>> Hash for StructDefNode<R> {
3362 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3363}
3364
2640impl<'a> AstNode<'a> for StructDef<'a> { 3365impl<'a> AstNode<'a> for StructDef<'a> {
2641 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3366 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2642 match syntax.kind() { 3367 match syntax.kind() {
@@ -2660,6 +3385,7 @@ impl<R: TreeRoot<RaTypes>> StructDefNode<R> {
2660impl<'a> ast::NameOwner<'a> for StructDef<'a> {} 3385impl<'a> ast::NameOwner<'a> for StructDef<'a> {}
2661impl<'a> ast::TypeParamsOwner<'a> for StructDef<'a> {} 3386impl<'a> ast::TypeParamsOwner<'a> for StructDef<'a> {}
2662impl<'a> ast::AttrsOwner<'a> for StructDef<'a> {} 3387impl<'a> ast::AttrsOwner<'a> for StructDef<'a> {}
3388impl<'a> ast::DocCommentsOwner<'a> for StructDef<'a> {}
2663impl<'a> StructDef<'a> { 3389impl<'a> StructDef<'a> {
2664 pub fn fields(self) -> impl Iterator<Item = NamedFieldDef<'a>> + 'a { 3390 pub fn fields(self) -> impl Iterator<Item = NamedFieldDef<'a>> + 'a {
2665 super::children(self) 3391 super::children(self)
@@ -2667,12 +3393,20 @@ impl<'a> StructDef<'a> {
2667} 3393}
2668 3394
2669// StructLit 3395// StructLit
2670#[derive(Debug, Clone, Copy)] 3396#[derive(Debug, Clone, Copy,)]
2671pub struct StructLitNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3397pub struct StructLitNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2672 syntax: SyntaxNode<R>, 3398 pub(crate) syntax: SyntaxNode<R>,
2673} 3399}
2674pub type StructLit<'a> = StructLitNode<RefRoot<'a>>; 3400pub type StructLit<'a> = StructLitNode<RefRoot<'a>>;
2675 3401
3402impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructLitNode<R1>> for StructLitNode<R2> {
3403 fn eq(&self, other: &StructLitNode<R1>) -> bool { self.syntax == other.syntax }
3404}
3405impl<R: TreeRoot<RaTypes>> Eq for StructLitNode<R> {}
3406impl<R: TreeRoot<RaTypes>> Hash for StructLitNode<R> {
3407 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3408}
3409
2676impl<'a> AstNode<'a> for StructLit<'a> { 3410impl<'a> AstNode<'a> for StructLit<'a> {
2677 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3411 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2678 match syntax.kind() { 3412 match syntax.kind() {
@@ -2696,12 +3430,20 @@ impl<R: TreeRoot<RaTypes>> StructLitNode<R> {
2696impl<'a> StructLit<'a> {} 3430impl<'a> StructLit<'a> {}
2697 3431
2698// StructPat 3432// StructPat
2699#[derive(Debug, Clone, Copy)] 3433#[derive(Debug, Clone, Copy,)]
2700pub struct StructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3434pub struct StructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2701 syntax: SyntaxNode<R>, 3435 pub(crate) syntax: SyntaxNode<R>,
2702} 3436}
2703pub type StructPat<'a> = StructPatNode<RefRoot<'a>>; 3437pub type StructPat<'a> = StructPatNode<RefRoot<'a>>;
2704 3438
3439impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<StructPatNode<R1>> for StructPatNode<R2> {
3440 fn eq(&self, other: &StructPatNode<R1>) -> bool { self.syntax == other.syntax }
3441}
3442impl<R: TreeRoot<RaTypes>> Eq for StructPatNode<R> {}
3443impl<R: TreeRoot<RaTypes>> Hash for StructPatNode<R> {
3444 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3445}
3446
2705impl<'a> AstNode<'a> for StructPat<'a> { 3447impl<'a> AstNode<'a> for StructPat<'a> {
2706 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3448 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2707 match syntax.kind() { 3449 match syntax.kind() {
@@ -2725,12 +3467,20 @@ impl<R: TreeRoot<RaTypes>> StructPatNode<R> {
2725impl<'a> StructPat<'a> {} 3467impl<'a> StructPat<'a> {}
2726 3468
2727// TokenTree 3469// TokenTree
2728#[derive(Debug, Clone, Copy)] 3470#[derive(Debug, Clone, Copy,)]
2729pub struct TokenTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3471pub struct TokenTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2730 syntax: SyntaxNode<R>, 3472 pub(crate) syntax: SyntaxNode<R>,
2731} 3473}
2732pub type TokenTree<'a> = TokenTreeNode<RefRoot<'a>>; 3474pub type TokenTree<'a> = TokenTreeNode<RefRoot<'a>>;
2733 3475
3476impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TokenTreeNode<R1>> for TokenTreeNode<R2> {
3477 fn eq(&self, other: &TokenTreeNode<R1>) -> bool { self.syntax == other.syntax }
3478}
3479impl<R: TreeRoot<RaTypes>> Eq for TokenTreeNode<R> {}
3480impl<R: TreeRoot<RaTypes>> Hash for TokenTreeNode<R> {
3481 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3482}
3483
2734impl<'a> AstNode<'a> for TokenTree<'a> { 3484impl<'a> AstNode<'a> for TokenTree<'a> {
2735 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3485 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2736 match syntax.kind() { 3486 match syntax.kind() {
@@ -2754,12 +3504,20 @@ impl<R: TreeRoot<RaTypes>> TokenTreeNode<R> {
2754impl<'a> TokenTree<'a> {} 3504impl<'a> TokenTree<'a> {}
2755 3505
2756// TraitDef 3506// TraitDef
2757#[derive(Debug, Clone, Copy)] 3507#[derive(Debug, Clone, Copy,)]
2758pub struct TraitDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3508pub struct TraitDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2759 syntax: SyntaxNode<R>, 3509 pub(crate) syntax: SyntaxNode<R>,
2760} 3510}
2761pub type TraitDef<'a> = TraitDefNode<RefRoot<'a>>; 3511pub type TraitDef<'a> = TraitDefNode<RefRoot<'a>>;
2762 3512
3513impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TraitDefNode<R1>> for TraitDefNode<R2> {
3514 fn eq(&self, other: &TraitDefNode<R1>) -> bool { self.syntax == other.syntax }
3515}
3516impl<R: TreeRoot<RaTypes>> Eq for TraitDefNode<R> {}
3517impl<R: TreeRoot<RaTypes>> Hash for TraitDefNode<R> {
3518 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3519}
3520
2763impl<'a> AstNode<'a> for TraitDef<'a> { 3521impl<'a> AstNode<'a> for TraitDef<'a> {
2764 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3522 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2765 match syntax.kind() { 3523 match syntax.kind() {
@@ -2782,15 +3540,24 @@ impl<R: TreeRoot<RaTypes>> TraitDefNode<R> {
2782 3540
2783impl<'a> ast::NameOwner<'a> for TraitDef<'a> {} 3541impl<'a> ast::NameOwner<'a> for TraitDef<'a> {}
2784impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {} 3542impl<'a> ast::AttrsOwner<'a> for TraitDef<'a> {}
3543impl<'a> ast::DocCommentsOwner<'a> for TraitDef<'a> {}
2785impl<'a> TraitDef<'a> {} 3544impl<'a> TraitDef<'a> {}
2786 3545
2787// TryExpr 3546// TryExpr
2788#[derive(Debug, Clone, Copy)] 3547#[derive(Debug, Clone, Copy,)]
2789pub struct TryExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3548pub struct TryExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2790 syntax: SyntaxNode<R>, 3549 pub(crate) syntax: SyntaxNode<R>,
2791} 3550}
2792pub type TryExpr<'a> = TryExprNode<RefRoot<'a>>; 3551pub type TryExpr<'a> = TryExprNode<RefRoot<'a>>;
2793 3552
3553impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TryExprNode<R1>> for TryExprNode<R2> {
3554 fn eq(&self, other: &TryExprNode<R1>) -> bool { self.syntax == other.syntax }
3555}
3556impl<R: TreeRoot<RaTypes>> Eq for TryExprNode<R> {}
3557impl<R: TreeRoot<RaTypes>> Hash for TryExprNode<R> {
3558 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3559}
3560
2794impl<'a> AstNode<'a> for TryExpr<'a> { 3561impl<'a> AstNode<'a> for TryExpr<'a> {
2795 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3562 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2796 match syntax.kind() { 3563 match syntax.kind() {
@@ -2814,12 +3581,20 @@ impl<R: TreeRoot<RaTypes>> TryExprNode<R> {
2814impl<'a> TryExpr<'a> {} 3581impl<'a> TryExpr<'a> {}
2815 3582
2816// TupleExpr 3583// TupleExpr
2817#[derive(Debug, Clone, Copy)] 3584#[derive(Debug, Clone, Copy,)]
2818pub struct TupleExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3585pub struct TupleExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2819 syntax: SyntaxNode<R>, 3586 pub(crate) syntax: SyntaxNode<R>,
2820} 3587}
2821pub type TupleExpr<'a> = TupleExprNode<RefRoot<'a>>; 3588pub type TupleExpr<'a> = TupleExprNode<RefRoot<'a>>;
2822 3589
3590impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleExprNode<R1>> for TupleExprNode<R2> {
3591 fn eq(&self, other: &TupleExprNode<R1>) -> bool { self.syntax == other.syntax }
3592}
3593impl<R: TreeRoot<RaTypes>> Eq for TupleExprNode<R> {}
3594impl<R: TreeRoot<RaTypes>> Hash for TupleExprNode<R> {
3595 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3596}
3597
2823impl<'a> AstNode<'a> for TupleExpr<'a> { 3598impl<'a> AstNode<'a> for TupleExpr<'a> {
2824 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3599 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2825 match syntax.kind() { 3600 match syntax.kind() {
@@ -2843,12 +3618,20 @@ impl<R: TreeRoot<RaTypes>> TupleExprNode<R> {
2843impl<'a> TupleExpr<'a> {} 3618impl<'a> TupleExpr<'a> {}
2844 3619
2845// TuplePat 3620// TuplePat
2846#[derive(Debug, Clone, Copy)] 3621#[derive(Debug, Clone, Copy,)]
2847pub struct TuplePatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3622pub struct TuplePatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2848 syntax: SyntaxNode<R>, 3623 pub(crate) syntax: SyntaxNode<R>,
2849} 3624}
2850pub type TuplePat<'a> = TuplePatNode<RefRoot<'a>>; 3625pub type TuplePat<'a> = TuplePatNode<RefRoot<'a>>;
2851 3626
3627impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TuplePatNode<R1>> for TuplePatNode<R2> {
3628 fn eq(&self, other: &TuplePatNode<R1>) -> bool { self.syntax == other.syntax }
3629}
3630impl<R: TreeRoot<RaTypes>> Eq for TuplePatNode<R> {}
3631impl<R: TreeRoot<RaTypes>> Hash for TuplePatNode<R> {
3632 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3633}
3634
2852impl<'a> AstNode<'a> for TuplePat<'a> { 3635impl<'a> AstNode<'a> for TuplePat<'a> {
2853 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3636 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2854 match syntax.kind() { 3637 match syntax.kind() {
@@ -2872,12 +3655,20 @@ impl<R: TreeRoot<RaTypes>> TuplePatNode<R> {
2872impl<'a> TuplePat<'a> {} 3655impl<'a> TuplePat<'a> {}
2873 3656
2874// TupleStructPat 3657// TupleStructPat
2875#[derive(Debug, Clone, Copy)] 3658#[derive(Debug, Clone, Copy,)]
2876pub struct TupleStructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3659pub struct TupleStructPatNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2877 syntax: SyntaxNode<R>, 3660 pub(crate) syntax: SyntaxNode<R>,
2878} 3661}
2879pub type TupleStructPat<'a> = TupleStructPatNode<RefRoot<'a>>; 3662pub type TupleStructPat<'a> = TupleStructPatNode<RefRoot<'a>>;
2880 3663
3664impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleStructPatNode<R1>> for TupleStructPatNode<R2> {
3665 fn eq(&self, other: &TupleStructPatNode<R1>) -> bool { self.syntax == other.syntax }
3666}
3667impl<R: TreeRoot<RaTypes>> Eq for TupleStructPatNode<R> {}
3668impl<R: TreeRoot<RaTypes>> Hash for TupleStructPatNode<R> {
3669 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3670}
3671
2881impl<'a> AstNode<'a> for TupleStructPat<'a> { 3672impl<'a> AstNode<'a> for TupleStructPat<'a> {
2882 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3673 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2883 match syntax.kind() { 3674 match syntax.kind() {
@@ -2901,12 +3692,20 @@ impl<R: TreeRoot<RaTypes>> TupleStructPatNode<R> {
2901impl<'a> TupleStructPat<'a> {} 3692impl<'a> TupleStructPat<'a> {}
2902 3693
2903// TupleType 3694// TupleType
2904#[derive(Debug, Clone, Copy)] 3695#[derive(Debug, Clone, Copy,)]
2905pub struct TupleTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3696pub struct TupleTypeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2906 syntax: SyntaxNode<R>, 3697 pub(crate) syntax: SyntaxNode<R>,
2907} 3698}
2908pub type TupleType<'a> = TupleTypeNode<RefRoot<'a>>; 3699pub type TupleType<'a> = TupleTypeNode<RefRoot<'a>>;
2909 3700
3701impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TupleTypeNode<R1>> for TupleTypeNode<R2> {
3702 fn eq(&self, other: &TupleTypeNode<R1>) -> bool { self.syntax == other.syntax }
3703}
3704impl<R: TreeRoot<RaTypes>> Eq for TupleTypeNode<R> {}
3705impl<R: TreeRoot<RaTypes>> Hash for TupleTypeNode<R> {
3706 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3707}
3708
2910impl<'a> AstNode<'a> for TupleType<'a> { 3709impl<'a> AstNode<'a> for TupleType<'a> {
2911 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3710 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2912 match syntax.kind() { 3711 match syntax.kind() {
@@ -2930,12 +3729,20 @@ impl<R: TreeRoot<RaTypes>> TupleTypeNode<R> {
2930impl<'a> TupleType<'a> {} 3729impl<'a> TupleType<'a> {}
2931 3730
2932// TypeDef 3731// TypeDef
2933#[derive(Debug, Clone, Copy)] 3732#[derive(Debug, Clone, Copy,)]
2934pub struct TypeDefNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3733pub struct TypeDefNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2935 syntax: SyntaxNode<R>, 3734 pub(crate) syntax: SyntaxNode<R>,
2936} 3735}
2937pub type TypeDef<'a> = TypeDefNode<RefRoot<'a>>; 3736pub type TypeDef<'a> = TypeDefNode<RefRoot<'a>>;
2938 3737
3738impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeDefNode<R1>> for TypeDefNode<R2> {
3739 fn eq(&self, other: &TypeDefNode<R1>) -> bool { self.syntax == other.syntax }
3740}
3741impl<R: TreeRoot<RaTypes>> Eq for TypeDefNode<R> {}
3742impl<R: TreeRoot<RaTypes>> Hash for TypeDefNode<R> {
3743 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3744}
3745
2939impl<'a> AstNode<'a> for TypeDef<'a> { 3746impl<'a> AstNode<'a> for TypeDef<'a> {
2940 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3747 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2941 match syntax.kind() { 3748 match syntax.kind() {
@@ -2959,15 +3766,24 @@ impl<R: TreeRoot<RaTypes>> TypeDefNode<R> {
2959impl<'a> ast::NameOwner<'a> for TypeDef<'a> {} 3766impl<'a> ast::NameOwner<'a> for TypeDef<'a> {}
2960impl<'a> ast::TypeParamsOwner<'a> for TypeDef<'a> {} 3767impl<'a> ast::TypeParamsOwner<'a> for TypeDef<'a> {}
2961impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {} 3768impl<'a> ast::AttrsOwner<'a> for TypeDef<'a> {}
3769impl<'a> ast::DocCommentsOwner<'a> for TypeDef<'a> {}
2962impl<'a> TypeDef<'a> {} 3770impl<'a> TypeDef<'a> {}
2963 3771
2964// TypeParam 3772// TypeParam
2965#[derive(Debug, Clone, Copy)] 3773#[derive(Debug, Clone, Copy,)]
2966pub struct TypeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3774pub struct TypeParamNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2967 syntax: SyntaxNode<R>, 3775 pub(crate) syntax: SyntaxNode<R>,
2968} 3776}
2969pub type TypeParam<'a> = TypeParamNode<RefRoot<'a>>; 3777pub type TypeParam<'a> = TypeParamNode<RefRoot<'a>>;
2970 3778
3779impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeParamNode<R1>> for TypeParamNode<R2> {
3780 fn eq(&self, other: &TypeParamNode<R1>) -> bool { self.syntax == other.syntax }
3781}
3782impl<R: TreeRoot<RaTypes>> Eq for TypeParamNode<R> {}
3783impl<R: TreeRoot<RaTypes>> Hash for TypeParamNode<R> {
3784 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3785}
3786
2971impl<'a> AstNode<'a> for TypeParam<'a> { 3787impl<'a> AstNode<'a> for TypeParam<'a> {
2972 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3788 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
2973 match syntax.kind() { 3789 match syntax.kind() {
@@ -2992,12 +3808,20 @@ impl<'a> ast::NameOwner<'a> for TypeParam<'a> {}
2992impl<'a> TypeParam<'a> {} 3808impl<'a> TypeParam<'a> {}
2993 3809
2994// TypeParamList 3810// TypeParamList
2995#[derive(Debug, Clone, Copy)] 3811#[derive(Debug, Clone, Copy,)]
2996pub struct TypeParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3812pub struct TypeParamListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
2997 syntax: SyntaxNode<R>, 3813 pub(crate) syntax: SyntaxNode<R>,
2998} 3814}
2999pub type TypeParamList<'a> = TypeParamListNode<RefRoot<'a>>; 3815pub type TypeParamList<'a> = TypeParamListNode<RefRoot<'a>>;
3000 3816
3817impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<TypeParamListNode<R1>> for TypeParamListNode<R2> {
3818 fn eq(&self, other: &TypeParamListNode<R1>) -> bool { self.syntax == other.syntax }
3819}
3820impl<R: TreeRoot<RaTypes>> Eq for TypeParamListNode<R> {}
3821impl<R: TreeRoot<RaTypes>> Hash for TypeParamListNode<R> {
3822 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3823}
3824
3001impl<'a> AstNode<'a> for TypeParamList<'a> { 3825impl<'a> AstNode<'a> for TypeParamList<'a> {
3002 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3826 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3003 match syntax.kind() { 3827 match syntax.kind() {
@@ -3029,7 +3853,7 @@ impl<'a> TypeParamList<'a> {
3029} 3853}
3030 3854
3031// TypeRef 3855// TypeRef
3032#[derive(Debug, Clone, Copy)] 3856#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3033pub enum TypeRef<'a> { 3857pub enum TypeRef<'a> {
3034 ParenType(ParenType<'a>), 3858 ParenType(ParenType<'a>),
3035 TupleType(TupleType<'a>), 3859 TupleType(TupleType<'a>),
@@ -3087,12 +3911,20 @@ impl<'a> AstNode<'a> for TypeRef<'a> {
3087impl<'a> TypeRef<'a> {} 3911impl<'a> TypeRef<'a> {}
3088 3912
3089// UseItem 3913// UseItem
3090#[derive(Debug, Clone, Copy)] 3914#[derive(Debug, Clone, Copy,)]
3091pub struct UseItemNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3915pub struct UseItemNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3092 syntax: SyntaxNode<R>, 3916 pub(crate) syntax: SyntaxNode<R>,
3093} 3917}
3094pub type UseItem<'a> = UseItemNode<RefRoot<'a>>; 3918pub type UseItem<'a> = UseItemNode<RefRoot<'a>>;
3095 3919
3920impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseItemNode<R1>> for UseItemNode<R2> {
3921 fn eq(&self, other: &UseItemNode<R1>) -> bool { self.syntax == other.syntax }
3922}
3923impl<R: TreeRoot<RaTypes>> Eq for UseItemNode<R> {}
3924impl<R: TreeRoot<RaTypes>> Hash for UseItemNode<R> {
3925 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3926}
3927
3096impl<'a> AstNode<'a> for UseItem<'a> { 3928impl<'a> AstNode<'a> for UseItem<'a> {
3097 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3929 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3098 match syntax.kind() { 3930 match syntax.kind() {
@@ -3120,12 +3952,20 @@ impl<'a> UseItem<'a> {
3120} 3952}
3121 3953
3122// UseTree 3954// UseTree
3123#[derive(Debug, Clone, Copy)] 3955#[derive(Debug, Clone, Copy,)]
3124pub struct UseTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> { 3956pub struct UseTreeNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3125 syntax: SyntaxNode<R>, 3957 pub(crate) syntax: SyntaxNode<R>,
3126} 3958}
3127pub type UseTree<'a> = UseTreeNode<RefRoot<'a>>; 3959pub type UseTree<'a> = UseTreeNode<RefRoot<'a>>;
3128 3960
3961impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseTreeNode<R1>> for UseTreeNode<R2> {
3962 fn eq(&self, other: &UseTreeNode<R1>) -> bool { self.syntax == other.syntax }
3963}
3964impl<R: TreeRoot<RaTypes>> Eq for UseTreeNode<R> {}
3965impl<R: TreeRoot<RaTypes>> Hash for UseTreeNode<R> {
3966 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
3967}
3968
3129impl<'a> AstNode<'a> for UseTree<'a> { 3969impl<'a> AstNode<'a> for UseTree<'a> {
3130 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 3970 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3131 match syntax.kind() { 3971 match syntax.kind() {
@@ -3157,12 +3997,20 @@ impl<'a> UseTree<'a> {
3157} 3997}
3158 3998
3159// UseTreeList 3999// UseTreeList
3160#[derive(Debug, Clone, Copy)] 4000#[derive(Debug, Clone, Copy,)]
3161pub struct UseTreeListNode<R: TreeRoot<RaTypes> = OwnedRoot> { 4001pub struct UseTreeListNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3162 syntax: SyntaxNode<R>, 4002 pub(crate) syntax: SyntaxNode<R>,
3163} 4003}
3164pub type UseTreeList<'a> = UseTreeListNode<RefRoot<'a>>; 4004pub type UseTreeList<'a> = UseTreeListNode<RefRoot<'a>>;
3165 4005
4006impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<UseTreeListNode<R1>> for UseTreeListNode<R2> {
4007 fn eq(&self, other: &UseTreeListNode<R1>) -> bool { self.syntax == other.syntax }
4008}
4009impl<R: TreeRoot<RaTypes>> Eq for UseTreeListNode<R> {}
4010impl<R: TreeRoot<RaTypes>> Hash for UseTreeListNode<R> {
4011 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
4012}
4013
3166impl<'a> AstNode<'a> for UseTreeList<'a> { 4014impl<'a> AstNode<'a> for UseTreeList<'a> {
3167 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 4015 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3168 match syntax.kind() { 4016 match syntax.kind() {
@@ -3190,12 +4038,20 @@ impl<'a> UseTreeList<'a> {
3190} 4038}
3191 4039
3192// WhereClause 4040// WhereClause
3193#[derive(Debug, Clone, Copy)] 4041#[derive(Debug, Clone, Copy,)]
3194pub struct WhereClauseNode<R: TreeRoot<RaTypes> = OwnedRoot> { 4042pub struct WhereClauseNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3195 syntax: SyntaxNode<R>, 4043 pub(crate) syntax: SyntaxNode<R>,
3196} 4044}
3197pub type WhereClause<'a> = WhereClauseNode<RefRoot<'a>>; 4045pub type WhereClause<'a> = WhereClauseNode<RefRoot<'a>>;
3198 4046
4047impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhereClauseNode<R1>> for WhereClauseNode<R2> {
4048 fn eq(&self, other: &WhereClauseNode<R1>) -> bool { self.syntax == other.syntax }
4049}
4050impl<R: TreeRoot<RaTypes>> Eq for WhereClauseNode<R> {}
4051impl<R: TreeRoot<RaTypes>> Hash for WhereClauseNode<R> {
4052 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
4053}
4054
3199impl<'a> AstNode<'a> for WhereClause<'a> { 4055impl<'a> AstNode<'a> for WhereClause<'a> {
3200 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 4056 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3201 match syntax.kind() { 4057 match syntax.kind() {
@@ -3219,12 +4075,20 @@ impl<R: TreeRoot<RaTypes>> WhereClauseNode<R> {
3219impl<'a> WhereClause<'a> {} 4075impl<'a> WhereClause<'a> {}
3220 4076
3221// WhileExpr 4077// WhileExpr
3222#[derive(Debug, Clone, Copy)] 4078#[derive(Debug, Clone, Copy,)]
3223pub struct WhileExprNode<R: TreeRoot<RaTypes> = OwnedRoot> { 4079pub struct WhileExprNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3224 syntax: SyntaxNode<R>, 4080 pub(crate) syntax: SyntaxNode<R>,
3225} 4081}
3226pub type WhileExpr<'a> = WhileExprNode<RefRoot<'a>>; 4082pub type WhileExpr<'a> = WhileExprNode<RefRoot<'a>>;
3227 4083
4084impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhileExprNode<R1>> for WhileExprNode<R2> {
4085 fn eq(&self, other: &WhileExprNode<R1>) -> bool { self.syntax == other.syntax }
4086}
4087impl<R: TreeRoot<RaTypes>> Eq for WhileExprNode<R> {}
4088impl<R: TreeRoot<RaTypes>> Hash for WhileExprNode<R> {
4089 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
4090}
4091
3228impl<'a> AstNode<'a> for WhileExpr<'a> { 4092impl<'a> AstNode<'a> for WhileExpr<'a> {
3229 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 4093 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3230 match syntax.kind() { 4094 match syntax.kind() {
@@ -3253,12 +4117,20 @@ impl<'a> WhileExpr<'a> {
3253} 4117}
3254 4118
3255// Whitespace 4119// Whitespace
3256#[derive(Debug, Clone, Copy)] 4120#[derive(Debug, Clone, Copy,)]
3257pub struct WhitespaceNode<R: TreeRoot<RaTypes> = OwnedRoot> { 4121pub struct WhitespaceNode<R: TreeRoot<RaTypes> = OwnedRoot> {
3258 syntax: SyntaxNode<R>, 4122 pub(crate) syntax: SyntaxNode<R>,
3259} 4123}
3260pub type Whitespace<'a> = WhitespaceNode<RefRoot<'a>>; 4124pub type Whitespace<'a> = WhitespaceNode<RefRoot<'a>>;
3261 4125
4126impl<R1: TreeRoot<RaTypes>, R2: TreeRoot<RaTypes>> PartialEq<WhitespaceNode<R1>> for WhitespaceNode<R2> {
4127 fn eq(&self, other: &WhitespaceNode<R1>) -> bool { self.syntax == other.syntax }
4128}
4129impl<R: TreeRoot<RaTypes>> Eq for WhitespaceNode<R> {}
4130impl<R: TreeRoot<RaTypes>> Hash for WhitespaceNode<R> {
4131 fn hash<H: Hasher>(&self, state: &mut H) { self.syntax.hash(state) }
4132}
4133
3262impl<'a> AstNode<'a> for Whitespace<'a> { 4134impl<'a> AstNode<'a> for Whitespace<'a> {
3263 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> { 4135 fn cast(syntax: SyntaxNodeRef<'a>) -> Option<Self> {
3264 match syntax.kind() { 4136 match syntax.kind() {