aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-04-08 23:06:30 +0100
committerAleksey Kladov <[email protected]>2019-04-09 08:26:51 +0100
commitfaf526e021e09770cae28f8d7c8ee88a54d6574d (patch)
tree9fb5bbab15472c7d5b870a65c0ec34256b13c428 /crates
parentac6ab0758731d0555fbf1b1a918abd3e12c8169d (diff)
migrate to untyped rowan
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs18
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs.tera18
-rw-r--r--crates/ra_syntax/Cargo.toml2
-rw-r--r--crates/ra_syntax/src/ast.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated.rs230
-rw-r--r--crates/ra_syntax/src/ast/generated.rs.tera6
-rw-r--r--crates/ra_syntax/src/lib.rs2
-rw-r--r--crates/ra_syntax/src/parsing/reparsing.rs2
-rw-r--r--crates/ra_syntax/src/syntax_node.rs62
9 files changed, 189 insertions, 155 deletions
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 547af1b27..b8350266f 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -7,6 +7,7 @@ use super::SyntaxInfo;
7 7
8/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. 8/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
9#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 9#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
10#[repr(u16)]
10pub enum SyntaxKind { 11pub enum SyntaxKind {
11 // Technical SyntaxKinds: they appear temporally during parsing, 12 // Technical SyntaxKinds: they appear temporally during parsing,
12 // but never end up in the final tree 13 // but never end up in the final tree
@@ -230,9 +231,25 @@ pub enum SyntaxKind {
230 ARG_LIST, 231 ARG_LIST,
231 TYPE_BOUND, 232 TYPE_BOUND,
232 TYPE_BOUND_LIST, 233 TYPE_BOUND_LIST,
234 // Technical kind so that we can cast from u16 safely
235 #[doc(hidden)]
236 __LAST,
233} 237}
234use self::SyntaxKind::*; 238use self::SyntaxKind::*;
235 239
240impl From<u16> for SyntaxKind {
241 fn from(d: u16) -> SyntaxKind {
242 assert!(d <= (__LAST as u16));
243 unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
244 }
245}
246
247impl From<SyntaxKind> for u16 {
248 fn from(k: SyntaxKind) -> u16 {
249 k as u16
250 }
251}
252
236impl SyntaxKind { 253impl SyntaxKind {
237 pub fn is_keyword(self) -> bool { 254 pub fn is_keyword(self) -> bool {
238 match self { 255 match self {
@@ -573,6 +590,7 @@ impl SyntaxKind {
573 TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" }, 590 TYPE_BOUND_LIST => &SyntaxInfo { name: "TYPE_BOUND_LIST" },
574 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, 591 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
575 EOF => &SyntaxInfo { name: "EOF" }, 592 EOF => &SyntaxInfo { name: "EOF" },
593 __LAST => &SyntaxInfo { name: "__LAST" },
576 } 594 }
577 } 595 }
578 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> { 596 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs.tera b/crates/ra_parser/src/syntax_kind/generated.rs.tera
index f241a21a0..5b9ff21af 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs.tera
+++ b/crates/ra_parser/src/syntax_kind/generated.rs.tera
@@ -9,6 +9,7 @@ use super::SyntaxInfo;
9 9
10/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. 10/// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`.
11#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] 11#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[repr(u16)]
12pub enum SyntaxKind { 13pub enum SyntaxKind {
13 // Technical SyntaxKinds: they appear temporally during parsing, 14 // Technical SyntaxKinds: they appear temporally during parsing,
14 // but never end up in the final tree 15 // but never end up in the final tree
@@ -26,9 +27,25 @@ pub enum SyntaxKind {
26{% for t in concat(a=literals, b=tokens, c=nodes) %} 27{% for t in concat(a=literals, b=tokens, c=nodes) %}
27 {{t}}, 28 {{t}},
28{%- endfor %} 29{%- endfor %}
30 // Technical kind so that we can cast from u16 safely
31 #[doc(hidden)]
32 __LAST,
29} 33}
30use self::SyntaxKind::*; 34use self::SyntaxKind::*;
31 35
36impl From<u16> for SyntaxKind {
37 fn from(d: u16) -> SyntaxKind {
38 assert!(d <= (__LAST as u16));
39 unsafe { std::mem::transmute::<u16, SyntaxKind>(d) }
40 }
41}
42
43impl From<SyntaxKind> for u16 {
44 fn from(k: SyntaxKind) -> u16 {
45 k as u16
46 }
47}
48
32impl SyntaxKind { 49impl SyntaxKind {
33 pub fn is_keyword(self) -> bool { 50 pub fn is_keyword(self) -> bool {
34 match self { 51 match self {
@@ -72,6 +89,7 @@ impl SyntaxKind {
72{%- endfor %} 89{%- endfor %}
73 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" }, 90 TOMBSTONE => &SyntaxInfo { name: "TOMBSTONE" },
74 EOF => &SyntaxInfo { name: "EOF" }, 91 EOF => &SyntaxInfo { name: "EOF" },
92 __LAST => &SyntaxInfo { name: "__LAST" },
75 } 93 }
76 } 94 }
77 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> { 95 pub fn from_keyword(ident: &str) -> Option<SyntaxKind> {
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml
index 1a763fb47..1f3981f5a 100644
--- a/crates/ra_syntax/Cargo.toml
+++ b/crates/ra_syntax/Cargo.toml
@@ -13,7 +13,7 @@ unicode-xid = "0.1.0"
13itertools = "0.8.0" 13itertools = "0.8.0"
14drop_bomb = "0.1.4" 14drop_bomb = "0.1.4"
15parking_lot = "0.7.0" 15parking_lot = "0.7.0"
16rowan = "0.4.0" 16rowan = "0.5.0"
17 17
18# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here 18# ideally, `serde` should be enabled by `ra_lsp_server`, but we enable it here
19# to reduce number of compilations 19# to reduce number of compilations
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs
index c2ab19d97..f7e33366e 100644
--- a/crates/ra_syntax/src/ast.rs
+++ b/crates/ra_syntax/src/ast.rs
@@ -9,7 +9,7 @@ mod expr_extensions;
9use std::marker::PhantomData; 9use std::marker::PhantomData;
10 10
11use crate::{ 11use crate::{
12 syntax_node::{SyntaxNode, SyntaxNodeChildren, TreeArc, RaTypes, SyntaxToken}, 12 syntax_node::{SyntaxNode, SyntaxNodeChildren, TreeArc, SyntaxToken},
13 SmolStr, 13 SmolStr,
14}; 14};
15 15
@@ -26,7 +26,7 @@ pub use self::{
26/// the same representation: a pointer to the tree root and a pointer to the 26/// the same representation: a pointer to the tree root and a pointer to the
27/// node itself. 27/// node itself.
28pub trait AstNode: 28pub trait AstNode:
29 rowan::TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> + ToOwned<Owned = TreeArc<Self>> 29 rowan::TransparentNewType<Repr = rowan::SyntaxNode> + ToOwned<Owned = TreeArc<Self>>
30{ 30{
31 fn cast(syntax: &SyntaxNode) -> Option<&Self> 31 fn cast(syntax: &SyntaxNode) -> Option<&Self>
32 where 32 where
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index 0376c91c8..774d9bcc8 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -13,7 +13,7 @@ use rowan::TransparentNewType;
13 13
14use crate::{ 14use crate::{
15 SyntaxNode, SyntaxKind::*, 15 SyntaxNode, SyntaxKind::*,
16 syntax_node::{RaTypes, TreeArc}, 16 syntax_node::{TreeArc},
17 ast::{self, AstNode}, 17 ast::{self, AstNode},
18}; 18};
19 19
@@ -24,7 +24,7 @@ pub struct Alias {
24 pub(crate) syntax: SyntaxNode, 24 pub(crate) syntax: SyntaxNode,
25} 25}
26unsafe impl TransparentNewType for Alias { 26unsafe impl TransparentNewType for Alias {
27 type Repr = rowan::SyntaxNode<RaTypes>; 27 type Repr = rowan::SyntaxNode;
28} 28}
29 29
30impl AstNode for Alias { 30impl AstNode for Alias {
@@ -53,7 +53,7 @@ pub struct ArgList {
53 pub(crate) syntax: SyntaxNode, 53 pub(crate) syntax: SyntaxNode,
54} 54}
55unsafe impl TransparentNewType for ArgList { 55unsafe impl TransparentNewType for ArgList {
56 type Repr = rowan::SyntaxNode<RaTypes>; 56 type Repr = rowan::SyntaxNode;
57} 57}
58 58
59impl AstNode for ArgList { 59impl AstNode for ArgList {
@@ -85,7 +85,7 @@ pub struct ArrayExpr {
85 pub(crate) syntax: SyntaxNode, 85 pub(crate) syntax: SyntaxNode,
86} 86}
87unsafe impl TransparentNewType for ArrayExpr { 87unsafe impl TransparentNewType for ArrayExpr {
88 type Repr = rowan::SyntaxNode<RaTypes>; 88 type Repr = rowan::SyntaxNode;
89} 89}
90 90
91impl AstNode for ArrayExpr { 91impl AstNode for ArrayExpr {
@@ -117,7 +117,7 @@ pub struct ArrayType {
117 pub(crate) syntax: SyntaxNode, 117 pub(crate) syntax: SyntaxNode,
118} 118}
119unsafe impl TransparentNewType for ArrayType { 119unsafe impl TransparentNewType for ArrayType {
120 type Repr = rowan::SyntaxNode<RaTypes>; 120 type Repr = rowan::SyntaxNode;
121} 121}
122 122
123impl AstNode for ArrayType { 123impl AstNode for ArrayType {
@@ -153,7 +153,7 @@ pub struct AssocTypeArg {
153 pub(crate) syntax: SyntaxNode, 153 pub(crate) syntax: SyntaxNode,
154} 154}
155unsafe impl TransparentNewType for AssocTypeArg { 155unsafe impl TransparentNewType for AssocTypeArg {
156 type Repr = rowan::SyntaxNode<RaTypes>; 156 type Repr = rowan::SyntaxNode;
157} 157}
158 158
159impl AstNode for AssocTypeArg { 159impl AstNode for AssocTypeArg {
@@ -189,7 +189,7 @@ pub struct Attr {
189 pub(crate) syntax: SyntaxNode, 189 pub(crate) syntax: SyntaxNode,
190} 190}
191unsafe impl TransparentNewType for Attr { 191unsafe impl TransparentNewType for Attr {
192 type Repr = rowan::SyntaxNode<RaTypes>; 192 type Repr = rowan::SyntaxNode;
193} 193}
194 194
195impl AstNode for Attr { 195impl AstNode for Attr {
@@ -221,7 +221,7 @@ pub struct BinExpr {
221 pub(crate) syntax: SyntaxNode, 221 pub(crate) syntax: SyntaxNode,
222} 222}
223unsafe impl TransparentNewType for BinExpr { 223unsafe impl TransparentNewType for BinExpr {
224 type Repr = rowan::SyntaxNode<RaTypes>; 224 type Repr = rowan::SyntaxNode;
225} 225}
226 226
227impl AstNode for BinExpr { 227impl AstNode for BinExpr {
@@ -249,7 +249,7 @@ pub struct BindPat {
249 pub(crate) syntax: SyntaxNode, 249 pub(crate) syntax: SyntaxNode,
250} 250}
251unsafe impl TransparentNewType for BindPat { 251unsafe impl TransparentNewType for BindPat {
252 type Repr = rowan::SyntaxNode<RaTypes>; 252 type Repr = rowan::SyntaxNode;
253} 253}
254 254
255impl AstNode for BindPat { 255impl AstNode for BindPat {
@@ -282,7 +282,7 @@ pub struct Block {
282 pub(crate) syntax: SyntaxNode, 282 pub(crate) syntax: SyntaxNode,
283} 283}
284unsafe impl TransparentNewType for Block { 284unsafe impl TransparentNewType for Block {
285 type Repr = rowan::SyntaxNode<RaTypes>; 285 type Repr = rowan::SyntaxNode;
286} 286}
287 287
288impl AstNode for Block { 288impl AstNode for Block {
@@ -319,7 +319,7 @@ pub struct BlockExpr {
319 pub(crate) syntax: SyntaxNode, 319 pub(crate) syntax: SyntaxNode,
320} 320}
321unsafe impl TransparentNewType for BlockExpr { 321unsafe impl TransparentNewType for BlockExpr {
322 type Repr = rowan::SyntaxNode<RaTypes>; 322 type Repr = rowan::SyntaxNode;
323} 323}
324 324
325impl AstNode for BlockExpr { 325impl AstNode for BlockExpr {
@@ -351,7 +351,7 @@ pub struct BreakExpr {
351 pub(crate) syntax: SyntaxNode, 351 pub(crate) syntax: SyntaxNode,
352} 352}
353unsafe impl TransparentNewType for BreakExpr { 353unsafe impl TransparentNewType for BreakExpr {
354 type Repr = rowan::SyntaxNode<RaTypes>; 354 type Repr = rowan::SyntaxNode;
355} 355}
356 356
357impl AstNode for BreakExpr { 357impl AstNode for BreakExpr {
@@ -383,7 +383,7 @@ pub struct CallExpr {
383 pub(crate) syntax: SyntaxNode, 383 pub(crate) syntax: SyntaxNode,
384} 384}
385unsafe impl TransparentNewType for CallExpr { 385unsafe impl TransparentNewType for CallExpr {
386 type Repr = rowan::SyntaxNode<RaTypes>; 386 type Repr = rowan::SyntaxNode;
387} 387}
388 388
389impl AstNode for CallExpr { 389impl AstNode for CallExpr {
@@ -416,7 +416,7 @@ pub struct CastExpr {
416 pub(crate) syntax: SyntaxNode, 416 pub(crate) syntax: SyntaxNode,
417} 417}
418unsafe impl TransparentNewType for CastExpr { 418unsafe impl TransparentNewType for CastExpr {
419 type Repr = rowan::SyntaxNode<RaTypes>; 419 type Repr = rowan::SyntaxNode;
420} 420}
421 421
422impl AstNode for CastExpr { 422impl AstNode for CastExpr {
@@ -452,7 +452,7 @@ pub struct Condition {
452 pub(crate) syntax: SyntaxNode, 452 pub(crate) syntax: SyntaxNode,
453} 453}
454unsafe impl TransparentNewType for Condition { 454unsafe impl TransparentNewType for Condition {
455 type Repr = rowan::SyntaxNode<RaTypes>; 455 type Repr = rowan::SyntaxNode;
456} 456}
457 457
458impl AstNode for Condition { 458impl AstNode for Condition {
@@ -488,7 +488,7 @@ pub struct ConstDef {
488 pub(crate) syntax: SyntaxNode, 488 pub(crate) syntax: SyntaxNode,
489} 489}
490unsafe impl TransparentNewType for ConstDef { 490unsafe impl TransparentNewType for ConstDef {
491 type Repr = rowan::SyntaxNode<RaTypes>; 491 type Repr = rowan::SyntaxNode;
492} 492}
493 493
494impl AstNode for ConstDef { 494impl AstNode for ConstDef {
@@ -526,7 +526,7 @@ pub struct ContinueExpr {
526 pub(crate) syntax: SyntaxNode, 526 pub(crate) syntax: SyntaxNode,
527} 527}
528unsafe impl TransparentNewType for ContinueExpr { 528unsafe impl TransparentNewType for ContinueExpr {
529 type Repr = rowan::SyntaxNode<RaTypes>; 529 type Repr = rowan::SyntaxNode;
530} 530}
531 531
532impl AstNode for ContinueExpr { 532impl AstNode for ContinueExpr {
@@ -554,7 +554,7 @@ pub struct DynTraitType {
554 pub(crate) syntax: SyntaxNode, 554 pub(crate) syntax: SyntaxNode,
555} 555}
556unsafe impl TransparentNewType for DynTraitType { 556unsafe impl TransparentNewType for DynTraitType {
557 type Repr = rowan::SyntaxNode<RaTypes>; 557 type Repr = rowan::SyntaxNode;
558} 558}
559 559
560impl AstNode for DynTraitType { 560impl AstNode for DynTraitType {
@@ -583,7 +583,7 @@ pub struct EnumDef {
583 pub(crate) syntax: SyntaxNode, 583 pub(crate) syntax: SyntaxNode,
584} 584}
585unsafe impl TransparentNewType for EnumDef { 585unsafe impl TransparentNewType for EnumDef {
586 type Repr = rowan::SyntaxNode<RaTypes>; 586 type Repr = rowan::SyntaxNode;
587} 587}
588 588
589impl AstNode for EnumDef { 589impl AstNode for EnumDef {
@@ -620,7 +620,7 @@ pub struct EnumVariant {
620 pub(crate) syntax: SyntaxNode, 620 pub(crate) syntax: SyntaxNode,
621} 621}
622unsafe impl TransparentNewType for EnumVariant { 622unsafe impl TransparentNewType for EnumVariant {
623 type Repr = rowan::SyntaxNode<RaTypes>; 623 type Repr = rowan::SyntaxNode;
624} 624}
625 625
626impl AstNode for EnumVariant { 626impl AstNode for EnumVariant {
@@ -655,7 +655,7 @@ pub struct EnumVariantList {
655 pub(crate) syntax: SyntaxNode, 655 pub(crate) syntax: SyntaxNode,
656} 656}
657unsafe impl TransparentNewType for EnumVariantList { 657unsafe impl TransparentNewType for EnumVariantList {
658 type Repr = rowan::SyntaxNode<RaTypes>; 658 type Repr = rowan::SyntaxNode;
659} 659}
660 660
661impl AstNode for EnumVariantList { 661impl AstNode for EnumVariantList {
@@ -687,7 +687,7 @@ pub struct Expr {
687 pub(crate) syntax: SyntaxNode, 687 pub(crate) syntax: SyntaxNode,
688} 688}
689unsafe impl TransparentNewType for Expr { 689unsafe impl TransparentNewType for Expr {
690 type Repr = rowan::SyntaxNode<RaTypes>; 690 type Repr = rowan::SyntaxNode;
691} 691}
692 692
693#[derive(Debug, Clone, Copy, PartialEq, Eq)] 693#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -950,7 +950,7 @@ pub struct ExprStmt {
950 pub(crate) syntax: SyntaxNode, 950 pub(crate) syntax: SyntaxNode,
951} 951}
952unsafe impl TransparentNewType for ExprStmt { 952unsafe impl TransparentNewType for ExprStmt {
953 type Repr = rowan::SyntaxNode<RaTypes>; 953 type Repr = rowan::SyntaxNode;
954} 954}
955 955
956impl AstNode for ExprStmt { 956impl AstNode for ExprStmt {
@@ -982,7 +982,7 @@ pub struct ExternCrateItem {
982 pub(crate) syntax: SyntaxNode, 982 pub(crate) syntax: SyntaxNode,
983} 983}
984unsafe impl TransparentNewType for ExternCrateItem { 984unsafe impl TransparentNewType for ExternCrateItem {
985 type Repr = rowan::SyntaxNode<RaTypes>; 985 type Repr = rowan::SyntaxNode;
986} 986}
987 987
988impl AstNode for ExternCrateItem { 988impl AstNode for ExternCrateItem {
@@ -1018,7 +1018,7 @@ pub struct FieldExpr {
1018 pub(crate) syntax: SyntaxNode, 1018 pub(crate) syntax: SyntaxNode,
1019} 1019}
1020unsafe impl TransparentNewType for FieldExpr { 1020unsafe impl TransparentNewType for FieldExpr {
1021 type Repr = rowan::SyntaxNode<RaTypes>; 1021 type Repr = rowan::SyntaxNode;
1022} 1022}
1023 1023
1024impl AstNode for FieldExpr { 1024impl AstNode for FieldExpr {
@@ -1054,7 +1054,7 @@ pub struct FieldPat {
1054 pub(crate) syntax: SyntaxNode, 1054 pub(crate) syntax: SyntaxNode,
1055} 1055}
1056unsafe impl TransparentNewType for FieldPat { 1056unsafe impl TransparentNewType for FieldPat {
1057 type Repr = rowan::SyntaxNode<RaTypes>; 1057 type Repr = rowan::SyntaxNode;
1058} 1058}
1059 1059
1060impl AstNode for FieldPat { 1060impl AstNode for FieldPat {
@@ -1087,7 +1087,7 @@ pub struct FieldPatList {
1087 pub(crate) syntax: SyntaxNode, 1087 pub(crate) syntax: SyntaxNode,
1088} 1088}
1089unsafe impl TransparentNewType for FieldPatList { 1089unsafe impl TransparentNewType for FieldPatList {
1090 type Repr = rowan::SyntaxNode<RaTypes>; 1090 type Repr = rowan::SyntaxNode;
1091} 1091}
1092 1092
1093impl AstNode for FieldPatList { 1093impl AstNode for FieldPatList {
@@ -1123,7 +1123,7 @@ pub struct FnDef {
1123 pub(crate) syntax: SyntaxNode, 1123 pub(crate) syntax: SyntaxNode,
1124} 1124}
1125unsafe impl TransparentNewType for FnDef { 1125unsafe impl TransparentNewType for FnDef {
1126 type Repr = rowan::SyntaxNode<RaTypes>; 1126 type Repr = rowan::SyntaxNode;
1127} 1127}
1128 1128
1129impl AstNode for FnDef { 1129impl AstNode for FnDef {
@@ -1168,7 +1168,7 @@ pub struct FnPointerType {
1168 pub(crate) syntax: SyntaxNode, 1168 pub(crate) syntax: SyntaxNode,
1169} 1169}
1170unsafe impl TransparentNewType for FnPointerType { 1170unsafe impl TransparentNewType for FnPointerType {
1171 type Repr = rowan::SyntaxNode<RaTypes>; 1171 type Repr = rowan::SyntaxNode;
1172} 1172}
1173 1173
1174impl AstNode for FnPointerType { 1174impl AstNode for FnPointerType {
@@ -1204,7 +1204,7 @@ pub struct ForExpr {
1204 pub(crate) syntax: SyntaxNode, 1204 pub(crate) syntax: SyntaxNode,
1205} 1205}
1206unsafe impl TransparentNewType for ForExpr { 1206unsafe impl TransparentNewType for ForExpr {
1207 type Repr = rowan::SyntaxNode<RaTypes>; 1207 type Repr = rowan::SyntaxNode;
1208} 1208}
1209 1209
1210impl AstNode for ForExpr { 1210impl AstNode for ForExpr {
@@ -1241,7 +1241,7 @@ pub struct ForType {
1241 pub(crate) syntax: SyntaxNode, 1241 pub(crate) syntax: SyntaxNode,
1242} 1242}
1243unsafe impl TransparentNewType for ForType { 1243unsafe impl TransparentNewType for ForType {
1244 type Repr = rowan::SyntaxNode<RaTypes>; 1244 type Repr = rowan::SyntaxNode;
1245} 1245}
1246 1246
1247impl AstNode for ForType { 1247impl AstNode for ForType {
@@ -1273,7 +1273,7 @@ pub struct IfExpr {
1273 pub(crate) syntax: SyntaxNode, 1273 pub(crate) syntax: SyntaxNode,
1274} 1274}
1275unsafe impl TransparentNewType for IfExpr { 1275unsafe impl TransparentNewType for IfExpr {
1276 type Repr = rowan::SyntaxNode<RaTypes>; 1276 type Repr = rowan::SyntaxNode;
1277} 1277}
1278 1278
1279impl AstNode for IfExpr { 1279impl AstNode for IfExpr {
@@ -1305,7 +1305,7 @@ pub struct ImplBlock {
1305 pub(crate) syntax: SyntaxNode, 1305 pub(crate) syntax: SyntaxNode,
1306} 1306}
1307unsafe impl TransparentNewType for ImplBlock { 1307unsafe impl TransparentNewType for ImplBlock {
1308 type Repr = rowan::SyntaxNode<RaTypes>; 1308 type Repr = rowan::SyntaxNode;
1309} 1309}
1310 1310
1311impl AstNode for ImplBlock { 1311impl AstNode for ImplBlock {
@@ -1338,7 +1338,7 @@ pub struct ImplItem {
1338 pub(crate) syntax: SyntaxNode, 1338 pub(crate) syntax: SyntaxNode,
1339} 1339}
1340unsafe impl TransparentNewType for ImplItem { 1340unsafe impl TransparentNewType for ImplItem {
1341 type Repr = rowan::SyntaxNode<RaTypes>; 1341 type Repr = rowan::SyntaxNode;
1342} 1342}
1343 1343
1344#[derive(Debug, Clone, Copy, PartialEq, Eq)] 1344#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -1401,7 +1401,7 @@ pub struct ImplTraitType {
1401 pub(crate) syntax: SyntaxNode, 1401 pub(crate) syntax: SyntaxNode,
1402} 1402}
1403unsafe impl TransparentNewType for ImplTraitType { 1403unsafe impl TransparentNewType for ImplTraitType {
1404 type Repr = rowan::SyntaxNode<RaTypes>; 1404 type Repr = rowan::SyntaxNode;
1405} 1405}
1406 1406
1407impl AstNode for ImplTraitType { 1407impl AstNode for ImplTraitType {
@@ -1430,7 +1430,7 @@ pub struct IndexExpr {
1430 pub(crate) syntax: SyntaxNode, 1430 pub(crate) syntax: SyntaxNode,
1431} 1431}
1432unsafe impl TransparentNewType for IndexExpr { 1432unsafe impl TransparentNewType for IndexExpr {
1433 type Repr = rowan::SyntaxNode<RaTypes>; 1433 type Repr = rowan::SyntaxNode;
1434} 1434}
1435 1435
1436impl AstNode for IndexExpr { 1436impl AstNode for IndexExpr {
@@ -1458,7 +1458,7 @@ pub struct ItemList {
1458 pub(crate) syntax: SyntaxNode, 1458 pub(crate) syntax: SyntaxNode,
1459} 1459}
1460unsafe impl TransparentNewType for ItemList { 1460unsafe impl TransparentNewType for ItemList {
1461 type Repr = rowan::SyntaxNode<RaTypes>; 1461 type Repr = rowan::SyntaxNode;
1462} 1462}
1463 1463
1464impl AstNode for ItemList { 1464impl AstNode for ItemList {
@@ -1492,7 +1492,7 @@ pub struct Label {
1492 pub(crate) syntax: SyntaxNode, 1492 pub(crate) syntax: SyntaxNode,
1493} 1493}
1494unsafe impl TransparentNewType for Label { 1494unsafe impl TransparentNewType for Label {
1495 type Repr = rowan::SyntaxNode<RaTypes>; 1495 type Repr = rowan::SyntaxNode;
1496} 1496}
1497 1497
1498impl AstNode for Label { 1498impl AstNode for Label {
@@ -1520,7 +1520,7 @@ pub struct LambdaExpr {
1520 pub(crate) syntax: SyntaxNode, 1520 pub(crate) syntax: SyntaxNode,
1521} 1521}
1522unsafe impl TransparentNewType for LambdaExpr { 1522unsafe impl TransparentNewType for LambdaExpr {
1523 type Repr = rowan::SyntaxNode<RaTypes>; 1523 type Repr = rowan::SyntaxNode;
1524} 1524}
1525 1525
1526impl AstNode for LambdaExpr { 1526impl AstNode for LambdaExpr {
@@ -1556,7 +1556,7 @@ pub struct LetStmt {
1556 pub(crate) syntax: SyntaxNode, 1556 pub(crate) syntax: SyntaxNode,
1557} 1557}
1558unsafe impl TransparentNewType for LetStmt { 1558unsafe impl TransparentNewType for LetStmt {
1559 type Repr = rowan::SyntaxNode<RaTypes>; 1559 type Repr = rowan::SyntaxNode;
1560} 1560}
1561 1561
1562impl AstNode for LetStmt { 1562impl AstNode for LetStmt {
@@ -1593,7 +1593,7 @@ pub struct LifetimeArg {
1593 pub(crate) syntax: SyntaxNode, 1593 pub(crate) syntax: SyntaxNode,
1594} 1594}
1595unsafe impl TransparentNewType for LifetimeArg { 1595unsafe impl TransparentNewType for LifetimeArg {
1596 type Repr = rowan::SyntaxNode<RaTypes>; 1596 type Repr = rowan::SyntaxNode;
1597} 1597}
1598 1598
1599impl AstNode for LifetimeArg { 1599impl AstNode for LifetimeArg {
@@ -1621,7 +1621,7 @@ pub struct LifetimeParam {
1621 pub(crate) syntax: SyntaxNode, 1621 pub(crate) syntax: SyntaxNode,
1622} 1622}
1623unsafe impl TransparentNewType for LifetimeParam { 1623unsafe impl TransparentNewType for LifetimeParam {
1624 type Repr = rowan::SyntaxNode<RaTypes>; 1624 type Repr = rowan::SyntaxNode;
1625} 1625}
1626 1626
1627impl AstNode for LifetimeParam { 1627impl AstNode for LifetimeParam {
@@ -1650,7 +1650,7 @@ pub struct Literal {
1650 pub(crate) syntax: SyntaxNode, 1650 pub(crate) syntax: SyntaxNode,
1651} 1651}
1652unsafe impl TransparentNewType for Literal { 1652unsafe impl TransparentNewType for Literal {
1653 type Repr = rowan::SyntaxNode<RaTypes>; 1653 type Repr = rowan::SyntaxNode;
1654} 1654}
1655 1655
1656impl AstNode for Literal { 1656impl AstNode for Literal {
@@ -1678,7 +1678,7 @@ pub struct LiteralPat {
1678 pub(crate) syntax: SyntaxNode, 1678 pub(crate) syntax: SyntaxNode,
1679} 1679}
1680unsafe impl TransparentNewType for LiteralPat { 1680unsafe impl TransparentNewType for LiteralPat {
1681 type Repr = rowan::SyntaxNode<RaTypes>; 1681 type Repr = rowan::SyntaxNode;
1682} 1682}
1683 1683
1684impl AstNode for LiteralPat { 1684impl AstNode for LiteralPat {
@@ -1710,7 +1710,7 @@ pub struct LoopExpr {
1710 pub(crate) syntax: SyntaxNode, 1710 pub(crate) syntax: SyntaxNode,
1711} 1711}
1712unsafe impl TransparentNewType for LoopExpr { 1712unsafe impl TransparentNewType for LoopExpr {
1713 type Repr = rowan::SyntaxNode<RaTypes>; 1713 type Repr = rowan::SyntaxNode;
1714} 1714}
1715 1715
1716impl AstNode for LoopExpr { 1716impl AstNode for LoopExpr {
@@ -1739,7 +1739,7 @@ pub struct MacroCall {
1739 pub(crate) syntax: SyntaxNode, 1739 pub(crate) syntax: SyntaxNode,
1740} 1740}
1741unsafe impl TransparentNewType for MacroCall { 1741unsafe impl TransparentNewType for MacroCall {
1742 type Repr = rowan::SyntaxNode<RaTypes>; 1742 type Repr = rowan::SyntaxNode;
1743} 1743}
1744 1744
1745impl AstNode for MacroCall { 1745impl AstNode for MacroCall {
@@ -1777,7 +1777,7 @@ pub struct MatchArm {
1777 pub(crate) syntax: SyntaxNode, 1777 pub(crate) syntax: SyntaxNode,
1778} 1778}
1779unsafe impl TransparentNewType for MatchArm { 1779unsafe impl TransparentNewType for MatchArm {
1780 type Repr = rowan::SyntaxNode<RaTypes>; 1780 type Repr = rowan::SyntaxNode;
1781} 1781}
1782 1782
1783impl AstNode for MatchArm { 1783impl AstNode for MatchArm {
@@ -1818,7 +1818,7 @@ pub struct MatchArmList {
1818 pub(crate) syntax: SyntaxNode, 1818 pub(crate) syntax: SyntaxNode,
1819} 1819}
1820unsafe impl TransparentNewType for MatchArmList { 1820unsafe impl TransparentNewType for MatchArmList {
1821 type Repr = rowan::SyntaxNode<RaTypes>; 1821 type Repr = rowan::SyntaxNode;
1822} 1822}
1823 1823
1824impl AstNode for MatchArmList { 1824impl AstNode for MatchArmList {
@@ -1851,7 +1851,7 @@ pub struct MatchExpr {
1851 pub(crate) syntax: SyntaxNode, 1851 pub(crate) syntax: SyntaxNode,
1852} 1852}
1853unsafe impl TransparentNewType for MatchExpr { 1853unsafe impl TransparentNewType for MatchExpr {
1854 type Repr = rowan::SyntaxNode<RaTypes>; 1854 type Repr = rowan::SyntaxNode;
1855} 1855}
1856 1856
1857impl AstNode for MatchExpr { 1857impl AstNode for MatchExpr {
@@ -1887,7 +1887,7 @@ pub struct MatchGuard {
1887 pub(crate) syntax: SyntaxNode, 1887 pub(crate) syntax: SyntaxNode,
1888} 1888}
1889unsafe impl TransparentNewType for MatchGuard { 1889unsafe impl TransparentNewType for MatchGuard {
1890 type Repr = rowan::SyntaxNode<RaTypes>; 1890 type Repr = rowan::SyntaxNode;
1891} 1891}
1892 1892
1893impl AstNode for MatchGuard { 1893impl AstNode for MatchGuard {
@@ -1919,7 +1919,7 @@ pub struct MethodCallExpr {
1919 pub(crate) syntax: SyntaxNode, 1919 pub(crate) syntax: SyntaxNode,
1920} 1920}
1921unsafe impl TransparentNewType for MethodCallExpr { 1921unsafe impl TransparentNewType for MethodCallExpr {
1922 type Repr = rowan::SyntaxNode<RaTypes>; 1922 type Repr = rowan::SyntaxNode;
1923} 1923}
1924 1924
1925impl AstNode for MethodCallExpr { 1925impl AstNode for MethodCallExpr {
@@ -1960,7 +1960,7 @@ pub struct Module {
1960 pub(crate) syntax: SyntaxNode, 1960 pub(crate) syntax: SyntaxNode,
1961} 1961}
1962unsafe impl TransparentNewType for Module { 1962unsafe impl TransparentNewType for Module {
1963 type Repr = rowan::SyntaxNode<RaTypes>; 1963 type Repr = rowan::SyntaxNode;
1964} 1964}
1965 1965
1966impl AstNode for Module { 1966impl AstNode for Module {
@@ -1996,7 +1996,7 @@ pub struct ModuleItem {
1996 pub(crate) syntax: SyntaxNode, 1996 pub(crate) syntax: SyntaxNode,
1997} 1997}
1998unsafe impl TransparentNewType for ModuleItem { 1998unsafe impl TransparentNewType for ModuleItem {
1999 type Repr = rowan::SyntaxNode<RaTypes>; 1999 type Repr = rowan::SyntaxNode;
2000} 2000}
2001 2001
2002#[derive(Debug, Clone, Copy, PartialEq, Eq)] 2002#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -2123,7 +2123,7 @@ pub struct Name {
2123 pub(crate) syntax: SyntaxNode, 2123 pub(crate) syntax: SyntaxNode,
2124} 2124}
2125unsafe impl TransparentNewType for Name { 2125unsafe impl TransparentNewType for Name {
2126 type Repr = rowan::SyntaxNode<RaTypes>; 2126 type Repr = rowan::SyntaxNode;
2127} 2127}
2128 2128
2129impl AstNode for Name { 2129impl AstNode for Name {
@@ -2151,7 +2151,7 @@ pub struct NameRef {
2151 pub(crate) syntax: SyntaxNode, 2151 pub(crate) syntax: SyntaxNode,
2152} 2152}
2153unsafe impl TransparentNewType for NameRef { 2153unsafe impl TransparentNewType for NameRef {
2154 type Repr = rowan::SyntaxNode<RaTypes>; 2154 type Repr = rowan::SyntaxNode;
2155} 2155}
2156 2156
2157impl AstNode for NameRef { 2157impl AstNode for NameRef {
@@ -2179,7 +2179,7 @@ pub struct NamedField {
2179 pub(crate) syntax: SyntaxNode, 2179 pub(crate) syntax: SyntaxNode,
2180} 2180}
2181unsafe impl TransparentNewType for NamedField { 2181unsafe impl TransparentNewType for NamedField {
2182 type Repr = rowan::SyntaxNode<RaTypes>; 2182 type Repr = rowan::SyntaxNode;
2183} 2183}
2184 2184
2185impl AstNode for NamedField { 2185impl AstNode for NamedField {
@@ -2215,7 +2215,7 @@ pub struct NamedFieldDef {
2215 pub(crate) syntax: SyntaxNode, 2215 pub(crate) syntax: SyntaxNode,
2216} 2216}
2217unsafe impl TransparentNewType for NamedFieldDef { 2217unsafe impl TransparentNewType for NamedFieldDef {
2218 type Repr = rowan::SyntaxNode<RaTypes>; 2218 type Repr = rowan::SyntaxNode;
2219} 2219}
2220 2220
2221impl AstNode for NamedFieldDef { 2221impl AstNode for NamedFieldDef {
@@ -2248,7 +2248,7 @@ pub struct NamedFieldDefList {
2248 pub(crate) syntax: SyntaxNode, 2248 pub(crate) syntax: SyntaxNode,
2249} 2249}
2250unsafe impl TransparentNewType for NamedFieldDefList { 2250unsafe impl TransparentNewType for NamedFieldDefList {
2251 type Repr = rowan::SyntaxNode<RaTypes>; 2251 type Repr = rowan::SyntaxNode;
2252} 2252}
2253 2253
2254impl AstNode for NamedFieldDefList { 2254impl AstNode for NamedFieldDefList {
@@ -2280,7 +2280,7 @@ pub struct NamedFieldList {
2280 pub(crate) syntax: SyntaxNode, 2280 pub(crate) syntax: SyntaxNode,
2281} 2281}
2282unsafe impl TransparentNewType for NamedFieldList { 2282unsafe impl TransparentNewType for NamedFieldList {
2283 type Repr = rowan::SyntaxNode<RaTypes>; 2283 type Repr = rowan::SyntaxNode;
2284} 2284}
2285 2285
2286impl AstNode for NamedFieldList { 2286impl AstNode for NamedFieldList {
@@ -2312,7 +2312,7 @@ pub struct NeverType {
2312 pub(crate) syntax: SyntaxNode, 2312 pub(crate) syntax: SyntaxNode,
2313} 2313}
2314unsafe impl TransparentNewType for NeverType { 2314unsafe impl TransparentNewType for NeverType {
2315 type Repr = rowan::SyntaxNode<RaTypes>; 2315 type Repr = rowan::SyntaxNode;
2316} 2316}
2317 2317
2318impl AstNode for NeverType { 2318impl AstNode for NeverType {
@@ -2340,7 +2340,7 @@ pub struct NominalDef {
2340 pub(crate) syntax: SyntaxNode, 2340 pub(crate) syntax: SyntaxNode,
2341} 2341}
2342unsafe impl TransparentNewType for NominalDef { 2342unsafe impl TransparentNewType for NominalDef {
2343 type Repr = rowan::SyntaxNode<RaTypes>; 2343 type Repr = rowan::SyntaxNode;
2344} 2344}
2345 2345
2346#[derive(Debug, Clone, Copy, PartialEq, Eq)] 2346#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -2398,7 +2398,7 @@ pub struct Param {
2398 pub(crate) syntax: SyntaxNode, 2398 pub(crate) syntax: SyntaxNode,
2399} 2399}
2400unsafe impl TransparentNewType for Param { 2400unsafe impl TransparentNewType for Param {
2401 type Repr = rowan::SyntaxNode<RaTypes>; 2401 type Repr = rowan::SyntaxNode;
2402} 2402}
2403 2403
2404impl AstNode for Param { 2404impl AstNode for Param {
@@ -2431,7 +2431,7 @@ pub struct ParamList {
2431 pub(crate) syntax: SyntaxNode, 2431 pub(crate) syntax: SyntaxNode,
2432} 2432}
2433unsafe impl TransparentNewType for ParamList { 2433unsafe impl TransparentNewType for ParamList {
2434 type Repr = rowan::SyntaxNode<RaTypes>; 2434 type Repr = rowan::SyntaxNode;
2435} 2435}
2436 2436
2437impl AstNode for ParamList { 2437impl AstNode for ParamList {
@@ -2467,7 +2467,7 @@ pub struct ParenExpr {
2467 pub(crate) syntax: SyntaxNode, 2467 pub(crate) syntax: SyntaxNode,
2468} 2468}
2469unsafe impl TransparentNewType for ParenExpr { 2469unsafe impl TransparentNewType for ParenExpr {
2470 type Repr = rowan::SyntaxNode<RaTypes>; 2470 type Repr = rowan::SyntaxNode;
2471} 2471}
2472 2472
2473impl AstNode for ParenExpr { 2473impl AstNode for ParenExpr {
@@ -2499,7 +2499,7 @@ pub struct ParenType {
2499 pub(crate) syntax: SyntaxNode, 2499 pub(crate) syntax: SyntaxNode,
2500} 2500}
2501unsafe impl TransparentNewType for ParenType { 2501unsafe impl TransparentNewType for ParenType {
2502 type Repr = rowan::SyntaxNode<RaTypes>; 2502 type Repr = rowan::SyntaxNode;
2503} 2503}
2504 2504
2505impl AstNode for ParenType { 2505impl AstNode for ParenType {
@@ -2531,7 +2531,7 @@ pub struct Pat {
2531 pub(crate) syntax: SyntaxNode, 2531 pub(crate) syntax: SyntaxNode,
2532} 2532}
2533unsafe impl TransparentNewType for Pat { 2533unsafe impl TransparentNewType for Pat {
2534 type Repr = rowan::SyntaxNode<RaTypes>; 2534 type Repr = rowan::SyntaxNode;
2535} 2535}
2536 2536
2537#[derive(Debug, Clone, Copy, PartialEq, Eq)] 2537#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -2650,7 +2650,7 @@ pub struct Path {
2650 pub(crate) syntax: SyntaxNode, 2650 pub(crate) syntax: SyntaxNode,
2651} 2651}
2652unsafe impl TransparentNewType for Path { 2652unsafe impl TransparentNewType for Path {
2653 type Repr = rowan::SyntaxNode<RaTypes>; 2653 type Repr = rowan::SyntaxNode;
2654} 2654}
2655 2655
2656impl AstNode for Path { 2656impl AstNode for Path {
@@ -2686,7 +2686,7 @@ pub struct PathExpr {
2686 pub(crate) syntax: SyntaxNode, 2686 pub(crate) syntax: SyntaxNode,
2687} 2687}
2688unsafe impl TransparentNewType for PathExpr { 2688unsafe impl TransparentNewType for PathExpr {
2689 type Repr = rowan::SyntaxNode<RaTypes>; 2689 type Repr = rowan::SyntaxNode;
2690} 2690}
2691 2691
2692impl AstNode for PathExpr { 2692impl AstNode for PathExpr {
@@ -2718,7 +2718,7 @@ pub struct PathPat {
2718 pub(crate) syntax: SyntaxNode, 2718 pub(crate) syntax: SyntaxNode,
2719} 2719}
2720unsafe impl TransparentNewType for PathPat { 2720unsafe impl TransparentNewType for PathPat {
2721 type Repr = rowan::SyntaxNode<RaTypes>; 2721 type Repr = rowan::SyntaxNode;
2722} 2722}
2723 2723
2724impl AstNode for PathPat { 2724impl AstNode for PathPat {
@@ -2750,7 +2750,7 @@ pub struct PathSegment {
2750 pub(crate) syntax: SyntaxNode, 2750 pub(crate) syntax: SyntaxNode,
2751} 2751}
2752unsafe impl TransparentNewType for PathSegment { 2752unsafe impl TransparentNewType for PathSegment {
2753 type Repr = rowan::SyntaxNode<RaTypes>; 2753 type Repr = rowan::SyntaxNode;
2754} 2754}
2755 2755
2756impl AstNode for PathSegment { 2756impl AstNode for PathSegment {
@@ -2786,7 +2786,7 @@ pub struct PathType {
2786 pub(crate) syntax: SyntaxNode, 2786 pub(crate) syntax: SyntaxNode,
2787} 2787}
2788unsafe impl TransparentNewType for PathType { 2788unsafe impl TransparentNewType for PathType {
2789 type Repr = rowan::SyntaxNode<RaTypes>; 2789 type Repr = rowan::SyntaxNode;
2790} 2790}
2791 2791
2792impl AstNode for PathType { 2792impl AstNode for PathType {
@@ -2818,7 +2818,7 @@ pub struct PlaceholderPat {
2818 pub(crate) syntax: SyntaxNode, 2818 pub(crate) syntax: SyntaxNode,
2819} 2819}
2820unsafe impl TransparentNewType for PlaceholderPat { 2820unsafe impl TransparentNewType for PlaceholderPat {
2821 type Repr = rowan::SyntaxNode<RaTypes>; 2821 type Repr = rowan::SyntaxNode;
2822} 2822}
2823 2823
2824impl AstNode for PlaceholderPat { 2824impl AstNode for PlaceholderPat {
@@ -2846,7 +2846,7 @@ pub struct PlaceholderType {
2846 pub(crate) syntax: SyntaxNode, 2846 pub(crate) syntax: SyntaxNode,
2847} 2847}
2848unsafe impl TransparentNewType for PlaceholderType { 2848unsafe impl TransparentNewType for PlaceholderType {
2849 type Repr = rowan::SyntaxNode<RaTypes>; 2849 type Repr = rowan::SyntaxNode;
2850} 2850}
2851 2851
2852impl AstNode for PlaceholderType { 2852impl AstNode for PlaceholderType {
@@ -2874,7 +2874,7 @@ pub struct PointerType {
2874 pub(crate) syntax: SyntaxNode, 2874 pub(crate) syntax: SyntaxNode,
2875} 2875}
2876unsafe impl TransparentNewType for PointerType { 2876unsafe impl TransparentNewType for PointerType {
2877 type Repr = rowan::SyntaxNode<RaTypes>; 2877 type Repr = rowan::SyntaxNode;
2878} 2878}
2879 2879
2880impl AstNode for PointerType { 2880impl AstNode for PointerType {
@@ -2906,7 +2906,7 @@ pub struct PosFieldDef {
2906 pub(crate) syntax: SyntaxNode, 2906 pub(crate) syntax: SyntaxNode,
2907} 2907}
2908unsafe impl TransparentNewType for PosFieldDef { 2908unsafe impl TransparentNewType for PosFieldDef {
2909 type Repr = rowan::SyntaxNode<RaTypes>; 2909 type Repr = rowan::SyntaxNode;
2910} 2910}
2911 2911
2912impl AstNode for PosFieldDef { 2912impl AstNode for PosFieldDef {
@@ -2940,7 +2940,7 @@ pub struct PosFieldDefList {
2940 pub(crate) syntax: SyntaxNode, 2940 pub(crate) syntax: SyntaxNode,
2941} 2941}
2942unsafe impl TransparentNewType for PosFieldDefList { 2942unsafe impl TransparentNewType for PosFieldDefList {
2943 type Repr = rowan::SyntaxNode<RaTypes>; 2943 type Repr = rowan::SyntaxNode;
2944} 2944}
2945 2945
2946impl AstNode for PosFieldDefList { 2946impl AstNode for PosFieldDefList {
@@ -2972,7 +2972,7 @@ pub struct PrefixExpr {
2972 pub(crate) syntax: SyntaxNode, 2972 pub(crate) syntax: SyntaxNode,
2973} 2973}
2974unsafe impl TransparentNewType for PrefixExpr { 2974unsafe impl TransparentNewType for PrefixExpr {
2975 type Repr = rowan::SyntaxNode<RaTypes>; 2975 type Repr = rowan::SyntaxNode;
2976} 2976}
2977 2977
2978impl AstNode for PrefixExpr { 2978impl AstNode for PrefixExpr {
@@ -3004,7 +3004,7 @@ pub struct RangeExpr {
3004 pub(crate) syntax: SyntaxNode, 3004 pub(crate) syntax: SyntaxNode,
3005} 3005}
3006unsafe impl TransparentNewType for RangeExpr { 3006unsafe impl TransparentNewType for RangeExpr {
3007 type Repr = rowan::SyntaxNode<RaTypes>; 3007 type Repr = rowan::SyntaxNode;
3008} 3008}
3009 3009
3010impl AstNode for RangeExpr { 3010impl AstNode for RangeExpr {
@@ -3032,7 +3032,7 @@ pub struct RangePat {
3032 pub(crate) syntax: SyntaxNode, 3032 pub(crate) syntax: SyntaxNode,
3033} 3033}
3034unsafe impl TransparentNewType for RangePat { 3034unsafe impl TransparentNewType for RangePat {
3035 type Repr = rowan::SyntaxNode<RaTypes>; 3035 type Repr = rowan::SyntaxNode;
3036} 3036}
3037 3037
3038impl AstNode for RangePat { 3038impl AstNode for RangePat {
@@ -3060,7 +3060,7 @@ pub struct RefExpr {
3060 pub(crate) syntax: SyntaxNode, 3060 pub(crate) syntax: SyntaxNode,
3061} 3061}
3062unsafe impl TransparentNewType for RefExpr { 3062unsafe impl TransparentNewType for RefExpr {
3063 type Repr = rowan::SyntaxNode<RaTypes>; 3063 type Repr = rowan::SyntaxNode;
3064} 3064}
3065 3065
3066impl AstNode for RefExpr { 3066impl AstNode for RefExpr {
@@ -3092,7 +3092,7 @@ pub struct RefPat {
3092 pub(crate) syntax: SyntaxNode, 3092 pub(crate) syntax: SyntaxNode,
3093} 3093}
3094unsafe impl TransparentNewType for RefPat { 3094unsafe impl TransparentNewType for RefPat {
3095 type Repr = rowan::SyntaxNode<RaTypes>; 3095 type Repr = rowan::SyntaxNode;
3096} 3096}
3097 3097
3098impl AstNode for RefPat { 3098impl AstNode for RefPat {
@@ -3124,7 +3124,7 @@ pub struct ReferenceType {
3124 pub(crate) syntax: SyntaxNode, 3124 pub(crate) syntax: SyntaxNode,
3125} 3125}
3126unsafe impl TransparentNewType for ReferenceType { 3126unsafe impl TransparentNewType for ReferenceType {
3127 type Repr = rowan::SyntaxNode<RaTypes>; 3127 type Repr = rowan::SyntaxNode;
3128} 3128}
3129 3129
3130impl AstNode for ReferenceType { 3130impl AstNode for ReferenceType {
@@ -3156,7 +3156,7 @@ pub struct RetType {
3156 pub(crate) syntax: SyntaxNode, 3156 pub(crate) syntax: SyntaxNode,
3157} 3157}
3158unsafe impl TransparentNewType for RetType { 3158unsafe impl TransparentNewType for RetType {
3159 type Repr = rowan::SyntaxNode<RaTypes>; 3159 type Repr = rowan::SyntaxNode;
3160} 3160}
3161 3161
3162impl AstNode for RetType { 3162impl AstNode for RetType {
@@ -3188,7 +3188,7 @@ pub struct ReturnExpr {
3188 pub(crate) syntax: SyntaxNode, 3188 pub(crate) syntax: SyntaxNode,
3189} 3189}
3190unsafe impl TransparentNewType for ReturnExpr { 3190unsafe impl TransparentNewType for ReturnExpr {
3191 type Repr = rowan::SyntaxNode<RaTypes>; 3191 type Repr = rowan::SyntaxNode;
3192} 3192}
3193 3193
3194impl AstNode for ReturnExpr { 3194impl AstNode for ReturnExpr {
@@ -3220,7 +3220,7 @@ pub struct SelfParam {
3220 pub(crate) syntax: SyntaxNode, 3220 pub(crate) syntax: SyntaxNode,
3221} 3221}
3222unsafe impl TransparentNewType for SelfParam { 3222unsafe impl TransparentNewType for SelfParam {
3223 type Repr = rowan::SyntaxNode<RaTypes>; 3223 type Repr = rowan::SyntaxNode;
3224} 3224}
3225 3225
3226impl AstNode for SelfParam { 3226impl AstNode for SelfParam {
@@ -3249,7 +3249,7 @@ pub struct SlicePat {
3249 pub(crate) syntax: SyntaxNode, 3249 pub(crate) syntax: SyntaxNode,
3250} 3250}
3251unsafe impl TransparentNewType for SlicePat { 3251unsafe impl TransparentNewType for SlicePat {
3252 type Repr = rowan::SyntaxNode<RaTypes>; 3252 type Repr = rowan::SyntaxNode;
3253} 3253}
3254 3254
3255impl AstNode for SlicePat { 3255impl AstNode for SlicePat {
@@ -3277,7 +3277,7 @@ pub struct SliceType {
3277 pub(crate) syntax: SyntaxNode, 3277 pub(crate) syntax: SyntaxNode,
3278} 3278}
3279unsafe impl TransparentNewType for SliceType { 3279unsafe impl TransparentNewType for SliceType {
3280 type Repr = rowan::SyntaxNode<RaTypes>; 3280 type Repr = rowan::SyntaxNode;
3281} 3281}
3282 3282
3283impl AstNode for SliceType { 3283impl AstNode for SliceType {
@@ -3309,7 +3309,7 @@ pub struct SourceFile {
3309 pub(crate) syntax: SyntaxNode, 3309 pub(crate) syntax: SyntaxNode,
3310} 3310}
3311unsafe impl TransparentNewType for SourceFile { 3311unsafe impl TransparentNewType for SourceFile {
3312 type Repr = rowan::SyntaxNode<RaTypes>; 3312 type Repr = rowan::SyntaxNode;
3313} 3313}
3314 3314
3315impl AstNode for SourceFile { 3315impl AstNode for SourceFile {
@@ -3343,7 +3343,7 @@ pub struct StaticDef {
3343 pub(crate) syntax: SyntaxNode, 3343 pub(crate) syntax: SyntaxNode,
3344} 3344}
3345unsafe impl TransparentNewType for StaticDef { 3345unsafe impl TransparentNewType for StaticDef {
3346 type Repr = rowan::SyntaxNode<RaTypes>; 3346 type Repr = rowan::SyntaxNode;
3347} 3347}
3348 3348
3349impl AstNode for StaticDef { 3349impl AstNode for StaticDef {
@@ -3381,7 +3381,7 @@ pub struct Stmt {
3381 pub(crate) syntax: SyntaxNode, 3381 pub(crate) syntax: SyntaxNode,
3382} 3382}
3383unsafe impl TransparentNewType for Stmt { 3383unsafe impl TransparentNewType for Stmt {
3384 type Repr = rowan::SyntaxNode<RaTypes>; 3384 type Repr = rowan::SyntaxNode;
3385} 3385}
3386 3386
3387#[derive(Debug, Clone, Copy, PartialEq, Eq)] 3387#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -3436,7 +3436,7 @@ pub struct StructDef {
3436 pub(crate) syntax: SyntaxNode, 3436 pub(crate) syntax: SyntaxNode,
3437} 3437}
3438unsafe impl TransparentNewType for StructDef { 3438unsafe impl TransparentNewType for StructDef {
3439 type Repr = rowan::SyntaxNode<RaTypes>; 3439 type Repr = rowan::SyntaxNode;
3440} 3440}
3441 3441
3442impl AstNode for StructDef { 3442impl AstNode for StructDef {
@@ -3469,7 +3469,7 @@ pub struct StructLit {
3469 pub(crate) syntax: SyntaxNode, 3469 pub(crate) syntax: SyntaxNode,
3470} 3470}
3471unsafe impl TransparentNewType for StructLit { 3471unsafe impl TransparentNewType for StructLit {
3472 type Repr = rowan::SyntaxNode<RaTypes>; 3472 type Repr = rowan::SyntaxNode;
3473} 3473}
3474 3474
3475impl AstNode for StructLit { 3475impl AstNode for StructLit {
@@ -3509,7 +3509,7 @@ pub struct StructPat {
3509 pub(crate) syntax: SyntaxNode, 3509 pub(crate) syntax: SyntaxNode,
3510} 3510}
3511unsafe impl TransparentNewType for StructPat { 3511unsafe impl TransparentNewType for StructPat {
3512 type Repr = rowan::SyntaxNode<RaTypes>; 3512 type Repr = rowan::SyntaxNode;
3513} 3513}
3514 3514
3515impl AstNode for StructPat { 3515impl AstNode for StructPat {
@@ -3545,7 +3545,7 @@ pub struct TokenTree {
3545 pub(crate) syntax: SyntaxNode, 3545 pub(crate) syntax: SyntaxNode,
3546} 3546}
3547unsafe impl TransparentNewType for TokenTree { 3547unsafe impl TransparentNewType for TokenTree {
3548 type Repr = rowan::SyntaxNode<RaTypes>; 3548 type Repr = rowan::SyntaxNode;
3549} 3549}
3550 3550
3551impl AstNode for TokenTree { 3551impl AstNode for TokenTree {
@@ -3573,7 +3573,7 @@ pub struct TraitDef {
3573 pub(crate) syntax: SyntaxNode, 3573 pub(crate) syntax: SyntaxNode,
3574} 3574}
3575unsafe impl TransparentNewType for TraitDef { 3575unsafe impl TransparentNewType for TraitDef {
3576 type Repr = rowan::SyntaxNode<RaTypes>; 3576 type Repr = rowan::SyntaxNode;
3577} 3577}
3578 3578
3579impl AstNode for TraitDef { 3579impl AstNode for TraitDef {
@@ -3611,7 +3611,7 @@ pub struct TryExpr {
3611 pub(crate) syntax: SyntaxNode, 3611 pub(crate) syntax: SyntaxNode,
3612} 3612}
3613unsafe impl TransparentNewType for TryExpr { 3613unsafe impl TransparentNewType for TryExpr {
3614 type Repr = rowan::SyntaxNode<RaTypes>; 3614 type Repr = rowan::SyntaxNode;
3615} 3615}
3616 3616
3617impl AstNode for TryExpr { 3617impl AstNode for TryExpr {
@@ -3643,7 +3643,7 @@ pub struct TupleExpr {
3643 pub(crate) syntax: SyntaxNode, 3643 pub(crate) syntax: SyntaxNode,
3644} 3644}
3645unsafe impl TransparentNewType for TupleExpr { 3645unsafe impl TransparentNewType for TupleExpr {
3646 type Repr = rowan::SyntaxNode<RaTypes>; 3646 type Repr = rowan::SyntaxNode;
3647} 3647}
3648 3648
3649impl AstNode for TupleExpr { 3649impl AstNode for TupleExpr {
@@ -3675,7 +3675,7 @@ pub struct TuplePat {
3675 pub(crate) syntax: SyntaxNode, 3675 pub(crate) syntax: SyntaxNode,
3676} 3676}
3677unsafe impl TransparentNewType for TuplePat { 3677unsafe impl TransparentNewType for TuplePat {
3678 type Repr = rowan::SyntaxNode<RaTypes>; 3678 type Repr = rowan::SyntaxNode;
3679} 3679}
3680 3680
3681impl AstNode for TuplePat { 3681impl AstNode for TuplePat {
@@ -3707,7 +3707,7 @@ pub struct TupleStructPat {
3707 pub(crate) syntax: SyntaxNode, 3707 pub(crate) syntax: SyntaxNode,
3708} 3708}
3709unsafe impl TransparentNewType for TupleStructPat { 3709unsafe impl TransparentNewType for TupleStructPat {
3710 type Repr = rowan::SyntaxNode<RaTypes>; 3710 type Repr = rowan::SyntaxNode;
3711} 3711}
3712 3712
3713impl AstNode for TupleStructPat { 3713impl AstNode for TupleStructPat {
@@ -3743,7 +3743,7 @@ pub struct TupleType {
3743 pub(crate) syntax: SyntaxNode, 3743 pub(crate) syntax: SyntaxNode,
3744} 3744}
3745unsafe impl TransparentNewType for TupleType { 3745unsafe impl TransparentNewType for TupleType {
3746 type Repr = rowan::SyntaxNode<RaTypes>; 3746 type Repr = rowan::SyntaxNode;
3747} 3747}
3748 3748
3749impl AstNode for TupleType { 3749impl AstNode for TupleType {
@@ -3775,7 +3775,7 @@ pub struct TypeAliasDef {
3775 pub(crate) syntax: SyntaxNode, 3775 pub(crate) syntax: SyntaxNode,
3776} 3776}
3777unsafe impl TransparentNewType for TypeAliasDef { 3777unsafe impl TransparentNewType for TypeAliasDef {
3778 type Repr = rowan::SyntaxNode<RaTypes>; 3778 type Repr = rowan::SyntaxNode;
3779} 3779}
3780 3780
3781impl AstNode for TypeAliasDef { 3781impl AstNode for TypeAliasDef {
@@ -3813,7 +3813,7 @@ pub struct TypeArg {
3813 pub(crate) syntax: SyntaxNode, 3813 pub(crate) syntax: SyntaxNode,
3814} 3814}
3815unsafe impl TransparentNewType for TypeArg { 3815unsafe impl TransparentNewType for TypeArg {
3816 type Repr = rowan::SyntaxNode<RaTypes>; 3816 type Repr = rowan::SyntaxNode;
3817} 3817}
3818 3818
3819impl AstNode for TypeArg { 3819impl AstNode for TypeArg {
@@ -3845,7 +3845,7 @@ pub struct TypeArgList {
3845 pub(crate) syntax: SyntaxNode, 3845 pub(crate) syntax: SyntaxNode,
3846} 3846}
3847unsafe impl TransparentNewType for TypeArgList { 3847unsafe impl TransparentNewType for TypeArgList {
3848 type Repr = rowan::SyntaxNode<RaTypes>; 3848 type Repr = rowan::SyntaxNode;
3849} 3849}
3850 3850
3851impl AstNode for TypeArgList { 3851impl AstNode for TypeArgList {
@@ -3885,7 +3885,7 @@ pub struct TypeBound {
3885 pub(crate) syntax: SyntaxNode, 3885 pub(crate) syntax: SyntaxNode,
3886} 3886}
3887unsafe impl TransparentNewType for TypeBound { 3887unsafe impl TransparentNewType for TypeBound {
3888 type Repr = rowan::SyntaxNode<RaTypes>; 3888 type Repr = rowan::SyntaxNode;
3889} 3889}
3890 3890
3891impl AstNode for TypeBound { 3891impl AstNode for TypeBound {
@@ -3917,7 +3917,7 @@ pub struct TypeBoundList {
3917 pub(crate) syntax: SyntaxNode, 3917 pub(crate) syntax: SyntaxNode,
3918} 3918}
3919unsafe impl TransparentNewType for TypeBoundList { 3919unsafe impl TransparentNewType for TypeBoundList {
3920 type Repr = rowan::SyntaxNode<RaTypes>; 3920 type Repr = rowan::SyntaxNode;
3921} 3921}
3922 3922
3923impl AstNode for TypeBoundList { 3923impl AstNode for TypeBoundList {
@@ -3949,7 +3949,7 @@ pub struct TypeParam {
3949 pub(crate) syntax: SyntaxNode, 3949 pub(crate) syntax: SyntaxNode,
3950} 3950}
3951unsafe impl TransparentNewType for TypeParam { 3951unsafe impl TransparentNewType for TypeParam {
3952 type Repr = rowan::SyntaxNode<RaTypes>; 3952 type Repr = rowan::SyntaxNode;
3953} 3953}
3954 3954
3955impl AstNode for TypeParam { 3955impl AstNode for TypeParam {
@@ -3980,7 +3980,7 @@ pub struct TypeParamList {
3980 pub(crate) syntax: SyntaxNode, 3980 pub(crate) syntax: SyntaxNode,
3981} 3981}
3982unsafe impl TransparentNewType for TypeParamList { 3982unsafe impl TransparentNewType for TypeParamList {
3983 type Repr = rowan::SyntaxNode<RaTypes>; 3983 type Repr = rowan::SyntaxNode;
3984} 3984}
3985 3985
3986impl AstNode for TypeParamList { 3986impl AstNode for TypeParamList {
@@ -4016,7 +4016,7 @@ pub struct TypeRef {
4016 pub(crate) syntax: SyntaxNode, 4016 pub(crate) syntax: SyntaxNode,
4017} 4017}
4018unsafe impl TransparentNewType for TypeRef { 4018unsafe impl TransparentNewType for TypeRef {
4019 type Repr = rowan::SyntaxNode<RaTypes>; 4019 type Repr = rowan::SyntaxNode;
4020} 4020}
4021 4021
4022#[derive(Debug, Clone, Copy, PartialEq, Eq)] 4022#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -4159,7 +4159,7 @@ pub struct UseItem {
4159 pub(crate) syntax: SyntaxNode, 4159 pub(crate) syntax: SyntaxNode,
4160} 4160}
4161unsafe impl TransparentNewType for UseItem { 4161unsafe impl TransparentNewType for UseItem {
4162 type Repr = rowan::SyntaxNode<RaTypes>; 4162 type Repr = rowan::SyntaxNode;
4163} 4163}
4164 4164
4165impl AstNode for UseItem { 4165impl AstNode for UseItem {
@@ -4192,7 +4192,7 @@ pub struct UseTree {
4192 pub(crate) syntax: SyntaxNode, 4192 pub(crate) syntax: SyntaxNode,
4193} 4193}
4194unsafe impl TransparentNewType for UseTree { 4194unsafe impl TransparentNewType for UseTree {
4195 type Repr = rowan::SyntaxNode<RaTypes>; 4195 type Repr = rowan::SyntaxNode;
4196} 4196}
4197 4197
4198impl AstNode for UseTree { 4198impl AstNode for UseTree {
@@ -4232,7 +4232,7 @@ pub struct UseTreeList {
4232 pub(crate) syntax: SyntaxNode, 4232 pub(crate) syntax: SyntaxNode,
4233} 4233}
4234unsafe impl TransparentNewType for UseTreeList { 4234unsafe impl TransparentNewType for UseTreeList {
4235 type Repr = rowan::SyntaxNode<RaTypes>; 4235 type Repr = rowan::SyntaxNode;
4236} 4236}
4237 4237
4238impl AstNode for UseTreeList { 4238impl AstNode for UseTreeList {
@@ -4264,7 +4264,7 @@ pub struct Visibility {
4264 pub(crate) syntax: SyntaxNode, 4264 pub(crate) syntax: SyntaxNode,
4265} 4265}
4266unsafe impl TransparentNewType for Visibility { 4266unsafe impl TransparentNewType for Visibility {
4267 type Repr = rowan::SyntaxNode<RaTypes>; 4267 type Repr = rowan::SyntaxNode;
4268} 4268}
4269 4269
4270impl AstNode for Visibility { 4270impl AstNode for Visibility {
@@ -4292,7 +4292,7 @@ pub struct WhereClause {
4292 pub(crate) syntax: SyntaxNode, 4292 pub(crate) syntax: SyntaxNode,
4293} 4293}
4294unsafe impl TransparentNewType for WhereClause { 4294unsafe impl TransparentNewType for WhereClause {
4295 type Repr = rowan::SyntaxNode<RaTypes>; 4295 type Repr = rowan::SyntaxNode;
4296} 4296}
4297 4297
4298impl AstNode for WhereClause { 4298impl AstNode for WhereClause {
@@ -4324,7 +4324,7 @@ pub struct WherePred {
4324 pub(crate) syntax: SyntaxNode, 4324 pub(crate) syntax: SyntaxNode,
4325} 4325}
4326unsafe impl TransparentNewType for WherePred { 4326unsafe impl TransparentNewType for WherePred {
4327 type Repr = rowan::SyntaxNode<RaTypes>; 4327 type Repr = rowan::SyntaxNode;
4328} 4328}
4329 4329
4330impl AstNode for WherePred { 4330impl AstNode for WherePred {
@@ -4357,7 +4357,7 @@ pub struct WhileExpr {
4357 pub(crate) syntax: SyntaxNode, 4357 pub(crate) syntax: SyntaxNode,
4358} 4358}
4359unsafe impl TransparentNewType for WhileExpr { 4359unsafe impl TransparentNewType for WhileExpr {
4360 type Repr = rowan::SyntaxNode<RaTypes>; 4360 type Repr = rowan::SyntaxNode;
4361} 4361}
4362 4362
4363impl AstNode for WhileExpr { 4363impl AstNode for WhileExpr {
diff --git a/crates/ra_syntax/src/ast/generated.rs.tera b/crates/ra_syntax/src/ast/generated.rs.tera
index e2d4856cf..c8a13fc5f 100644
--- a/crates/ra_syntax/src/ast/generated.rs.tera
+++ b/crates/ra_syntax/src/ast/generated.rs.tera
@@ -15,7 +15,7 @@ use rowan::TransparentNewType;
15 15
16use crate::{ 16use crate::{
17 SyntaxNode, SyntaxKind::*, 17 SyntaxNode, SyntaxKind::*,
18 syntax_node::{RaTypes, TreeArc}, 18 syntax_node::{TreeArc},
19 ast::{self, AstNode}, 19 ast::{self, AstNode},
20}; 20};
21{% for node, methods in ast %} 21{% for node, methods in ast %}
@@ -28,7 +28,7 @@ pub struct {{ node }} {
28 pub(crate) syntax: SyntaxNode, 28 pub(crate) syntax: SyntaxNode,
29} 29}
30unsafe impl TransparentNewType for {{ node }} { 30unsafe impl TransparentNewType for {{ node }} {
31 type Repr = rowan::SyntaxNode<RaTypes>; 31 type Repr = rowan::SyntaxNode;
32} 32}
33 33
34#[derive(Debug, Clone, Copy, PartialEq, Eq)] 34#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -81,7 +81,7 @@ pub struct {{ node }} {
81 pub(crate) syntax: SyntaxNode, 81 pub(crate) syntax: SyntaxNode,
82} 82}
83unsafe impl TransparentNewType for {{ node }} { 83unsafe impl TransparentNewType for {{ node }} {
84 type Repr = rowan::SyntaxNode<RaTypes>; 84 type Repr = rowan::SyntaxNode;
85} 85}
86 86
87impl AstNode for {{ node }} { 87impl AstNode for {{ node }} {
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs
index c56bc9f16..a6ce14f06 100644
--- a/crates/ra_syntax/src/lib.rs
+++ b/crates/ra_syntax/src/lib.rs
@@ -79,7 +79,7 @@ impl SourceFile {
79 } 79 }
80 80
81 pub fn errors(&self) -> Vec<SyntaxError> { 81 pub fn errors(&self) -> Vec<SyntaxError> {
82 let mut errors = self.syntax.root_data().clone(); 82 let mut errors = self.syntax.root_data().to_vec();
83 errors.extend(validation::validate(self)); 83 errors.extend(validation::validate(self));
84 errors 84 errors
85 } 85 }
diff --git a/crates/ra_syntax/src/parsing/reparsing.rs b/crates/ra_syntax/src/parsing/reparsing.rs
index 69887f500..434f850d1 100644
--- a/crates/ra_syntax/src/parsing/reparsing.rs
+++ b/crates/ra_syntax/src/parsing/reparsing.rs
@@ -67,7 +67,7 @@ fn reparse_token<'node>(
67 } 67 }
68 } 68 }
69 69
70 let new_token = GreenToken::new(token.kind(), text.into()); 70 let new_token = GreenToken::new(rowan::SyntaxKind(token.kind().into()), text.into());
71 Some((token.replace_with(new_token), token.range())) 71 Some((token.replace_with(new_token), token.range()))
72 } 72 }
73 _ => None, 73 _ => None,
diff --git a/crates/ra_syntax/src/syntax_node.rs b/crates/ra_syntax/src/syntax_node.rs
index a88a348ad..64d884287 100644
--- a/crates/ra_syntax/src/syntax_node.rs
+++ b/crates/ra_syntax/src/syntax_node.rs
@@ -8,11 +8,12 @@
8 8
9use std::{ 9use std::{
10 fmt::{self, Write}, 10 fmt::{self, Write},
11 any::Any,
11 borrow::Borrow, 12 borrow::Borrow,
12}; 13};
13 14
14use ra_parser::ParseError; 15use ra_parser::ParseError;
15use rowan::{Types, TransparentNewType, GreenNodeBuilder}; 16use rowan::{TransparentNewType, GreenNodeBuilder};
16 17
17use crate::{ 18use crate::{
18 SmolStr, SyntaxKind, TextUnit, TextRange, SyntaxText, SourceFile, AstNode, 19 SmolStr, SyntaxKind, TextUnit, TextRange, SyntaxText, SourceFile, AstNode,
@@ -20,26 +21,15 @@ use crate::{
20}; 21};
21 22
22pub use rowan::WalkEvent; 23pub use rowan::WalkEvent;
23 24pub(crate) use rowan::{GreenNode, GreenToken};
24#[derive(Debug, Clone, Copy)]
25pub enum RaTypes {}
26impl Types for RaTypes {
27 type Kind = SyntaxKind;
28 type RootData = Vec<SyntaxError>;
29}
30
31pub(crate) type GreenNode = rowan::GreenNode<RaTypes>;
32pub(crate) type GreenToken = rowan::GreenToken<RaTypes>;
33#[allow(unused)]
34pub(crate) type GreenElement = rowan::GreenElement<RaTypes>;
35 25
36/// Marker trait for CST and AST nodes 26/// Marker trait for CST and AST nodes
37pub trait SyntaxNodeWrapper: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>> {} 27pub trait SyntaxNodeWrapper: TransparentNewType<Repr = rowan::SyntaxNode> {}
38impl<T: TransparentNewType<Repr = rowan::SyntaxNode<RaTypes>>> SyntaxNodeWrapper for T {} 28impl<T: TransparentNewType<Repr = rowan::SyntaxNode>> SyntaxNodeWrapper for T {}
39 29
40/// An owning smart pointer for CST or AST node. 30/// An owning smart pointer for CST or AST node.
41#[derive(PartialEq, Eq, Hash)] 31#[derive(PartialEq, Eq, Hash)]
42pub struct TreeArc<T: SyntaxNodeWrapper>(pub(crate) rowan::TreeArc<RaTypes, T>); 32pub struct TreeArc<T: SyntaxNodeWrapper>(pub(crate) rowan::TreeArc<T>);
43 33
44impl<T: SyntaxNodeWrapper> Borrow<T> for TreeArc<T> { 34impl<T: SyntaxNodeWrapper> Borrow<T> for TreeArc<T> {
45 fn borrow(&self) -> &T { 35 fn borrow(&self) -> &T {
@@ -101,9 +91,9 @@ where
101 91
102#[derive(PartialEq, Eq, Hash)] 92#[derive(PartialEq, Eq, Hash)]
103#[repr(transparent)] 93#[repr(transparent)]
104pub struct SyntaxNode(pub(crate) rowan::SyntaxNode<RaTypes>); 94pub struct SyntaxNode(pub(crate) rowan::SyntaxNode);
105unsafe impl TransparentNewType for SyntaxNode { 95unsafe impl TransparentNewType for SyntaxNode {
106 type Repr = rowan::SyntaxNode<RaTypes>; 96 type Repr = rowan::SyntaxNode;
107} 97}
108 98
109impl ToOwned for SyntaxNode { 99impl ToOwned for SyntaxNode {
@@ -134,12 +124,14 @@ pub enum Direction {
134 124
135impl SyntaxNode { 125impl SyntaxNode {
136 pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> { 126 pub(crate) fn new(green: GreenNode, errors: Vec<SyntaxError>) -> TreeArc<SyntaxNode> {
127 let errors: Option<Box<Any + Send + Sync>> =
128 if errors.is_empty() { None } else { Some(Box::new(errors)) };
137 let ptr = TreeArc(rowan::SyntaxNode::new(green, errors)); 129 let ptr = TreeArc(rowan::SyntaxNode::new(green, errors));
138 TreeArc::cast(ptr) 130 TreeArc::cast(ptr)
139 } 131 }
140 132
141 pub fn kind(&self) -> SyntaxKind { 133 pub fn kind(&self) -> SyntaxKind {
142 self.0.kind() 134 self.0.kind().0.into()
143 } 135 }
144 136
145 pub fn range(&self) -> TextRange { 137 pub fn range(&self) -> TextRange {
@@ -303,8 +295,14 @@ impl SyntaxNode {
303 buf 295 buf
304 } 296 }
305 297
306 pub(crate) fn root_data(&self) -> &Vec<SyntaxError> { 298 pub(crate) fn root_data(&self) -> &[SyntaxError] {
307 self.0.root_data() 299 match self.0.root_data() {
300 None => &[],
301 Some(data) => {
302 let data: &Vec<SyntaxError> = std::any::Any::downcast_ref(data).unwrap();
303 data.as_slice()
304 }
305 }
308 } 306 }
309 307
310 pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode { 308 pub(crate) fn replace_with(&self, replacement: GreenNode) -> GreenNode {
@@ -313,7 +311,7 @@ impl SyntaxNode {
313} 311}
314 312
315#[derive(Clone, Copy, PartialEq, Eq, Hash)] 313#[derive(Clone, Copy, PartialEq, Eq, Hash)]
316pub struct SyntaxToken<'a>(pub(crate) rowan::SyntaxToken<'a, RaTypes>); 314pub struct SyntaxToken<'a>(pub(crate) rowan::SyntaxToken<'a>);
317 315
318//FIXME: always output text 316//FIXME: always output text
319impl<'a> fmt::Debug for SyntaxToken<'a> { 317impl<'a> fmt::Debug for SyntaxToken<'a> {
@@ -339,15 +337,15 @@ impl<'a> fmt::Display for SyntaxToken<'a> {
339 } 337 }
340} 338}
341 339
342impl<'a> From<rowan::SyntaxToken<'a, RaTypes>> for SyntaxToken<'a> { 340impl<'a> From<rowan::SyntaxToken<'a>> for SyntaxToken<'a> {
343 fn from(t: rowan::SyntaxToken<'a, RaTypes>) -> Self { 341 fn from(t: rowan::SyntaxToken<'a>) -> Self {
344 SyntaxToken(t) 342 SyntaxToken(t)
345 } 343 }
346} 344}
347 345
348impl<'a> SyntaxToken<'a> { 346impl<'a> SyntaxToken<'a> {
349 pub fn kind(&self) -> SyntaxKind { 347 pub fn kind(&self) -> SyntaxKind {
350 self.0.kind() 348 self.0.kind().0.into()
351 } 349 }
352 350
353 pub fn text(&self) -> &'a SmolStr { 351 pub fn text(&self) -> &'a SmolStr {
@@ -454,8 +452,8 @@ impl<'a> SyntaxElement<'a> {
454 } 452 }
455} 453}
456 454
457impl<'a> From<rowan::SyntaxElement<'a, RaTypes>> for SyntaxElement<'a> { 455impl<'a> From<rowan::SyntaxElement<'a>> for SyntaxElement<'a> {
458 fn from(el: rowan::SyntaxElement<'a, RaTypes>) -> Self { 456 fn from(el: rowan::SyntaxElement<'a>) -> Self {
459 match el { 457 match el {
460 rowan::SyntaxElement::Node(n) => SyntaxElement::Node(SyntaxNode::from_repr(n)), 458 rowan::SyntaxElement::Node(n) => SyntaxElement::Node(SyntaxNode::from_repr(n)),
461 rowan::SyntaxElement::Token(t) => SyntaxElement::Token(t.into()), 459 rowan::SyntaxElement::Token(t) => SyntaxElement::Token(t.into()),
@@ -485,7 +483,7 @@ impl<'a> SyntaxElement<'a> {
485} 483}
486 484
487#[derive(Debug)] 485#[derive(Debug)]
488pub struct SyntaxNodeChildren<'a>(rowan::SyntaxNodeChildren<'a, RaTypes>); 486pub struct SyntaxNodeChildren<'a>(rowan::SyntaxNodeChildren<'a>);
489 487
490impl<'a> Iterator for SyntaxNodeChildren<'a> { 488impl<'a> Iterator for SyntaxNodeChildren<'a> {
491 type Item = &'a SyntaxNode; 489 type Item = &'a SyntaxNode;
@@ -496,7 +494,7 @@ impl<'a> Iterator for SyntaxNodeChildren<'a> {
496} 494}
497 495
498#[derive(Debug)] 496#[derive(Debug)]
499pub struct SyntaxElementChildren<'a>(rowan::SyntaxElementChildren<'a, RaTypes>); 497pub struct SyntaxElementChildren<'a>(rowan::SyntaxElementChildren<'a>);
500 498
501impl<'a> Iterator for SyntaxElementChildren<'a> { 499impl<'a> Iterator for SyntaxElementChildren<'a> {
502 type Item = SyntaxElement<'a>; 500 type Item = SyntaxElement<'a>;
@@ -508,7 +506,7 @@ impl<'a> Iterator for SyntaxElementChildren<'a> {
508 506
509pub struct SyntaxTreeBuilder { 507pub struct SyntaxTreeBuilder {
510 errors: Vec<SyntaxError>, 508 errors: Vec<SyntaxError>,
511 inner: GreenNodeBuilder<RaTypes>, 509 inner: GreenNodeBuilder,
512} 510}
513 511
514impl Default for SyntaxTreeBuilder { 512impl Default for SyntaxTreeBuilder {
@@ -533,11 +531,11 @@ impl SyntaxTreeBuilder {
533 } 531 }
534 532
535 pub fn token(&mut self, kind: SyntaxKind, text: SmolStr) { 533 pub fn token(&mut self, kind: SyntaxKind, text: SmolStr) {
536 self.inner.token(kind, text) 534 self.inner.token(rowan::SyntaxKind(kind.into()), text)
537 } 535 }
538 536
539 pub fn start_node(&mut self, kind: SyntaxKind) { 537 pub fn start_node(&mut self, kind: SyntaxKind) {
540 self.inner.start_node(kind) 538 self.inner.start_node(rowan::SyntaxKind(kind.into()))
541 } 539 }
542 540
543 pub fn finish_node(&mut self) { 541 pub fn finish_node(&mut self) {