aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_hir/src/code_model_api.rs5
-rw-r--r--crates/ra_hir/src/ids.rs6
-rw-r--r--crates/ra_hir/src/impl_block.rs2
-rw-r--r--crates/ra_hir/src/nameres/lower.rs2
-rw-r--r--crates/ra_ide_api/src/completion.rs2
-rw-r--r--crates/ra_ide_api/src/goto_definition.rs4
-rw-r--r--crates/ra_ide_api/src/hover.rs4
-rw-r--r--crates/ra_ide_api/src/symbol_index.rs4
-rw-r--r--crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap2
-rw-r--r--crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new182
-rw-r--r--crates/ra_ide_api_light/src/structure.rs2
-rw-r--r--crates/ra_lsp_server/src/conv.rs2
-rw-r--r--crates/ra_parser/src/grammar/items.rs2
-rw-r--r--crates/ra_parser/src/syntax_kind/generated.rs4
-rw-r--r--crates/ra_syntax/src/ast/generated.rs94
-rw-r--r--crates/ra_syntax/src/grammar.ron8
-rw-r--r--crates/ra_syntax/src/parsing/text_tree_sink.rs2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0004_value_parameters_no_patterns.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0012_type_item_where_clause.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0013_pointer_type_mut.txt4
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0014_never_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0017_array_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0023_placeholder_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0025_slice_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0028_impl_trait_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0032_fn_pointer_type.txt6
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0033_reference_type;.txt6
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0037_qual_paths.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0039_type_arg.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0046_singleton_tuple_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0051_unit_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0052_path_type.txt8
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0065_dyn_trait_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0073_type_item_type_params.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0078_type_item.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0081_for_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0084_paren_type.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0092_fn_pointer_type_with_ret.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0104_path_fn_trait_args.txt2
-rw-r--r--crates/ra_syntax/tests/data/parser/inline/ok/0117_macro_call_type.txt4
45 files changed, 293 insertions, 108 deletions
diff --git a/crates/ra_hir/src/code_model_api.rs b/crates/ra_hir/src/code_model_api.rs
index 278407504..9a44aaa43 100644
--- a/crates/ra_hir/src/code_model_api.rs
+++ b/crates/ra_hir/src/code_model_api.rs
@@ -619,7 +619,10 @@ pub struct TypeAlias {
619} 619}
620 620
621impl TypeAlias { 621impl TypeAlias {
622 pub fn source(&self, db: &impl PersistentHirDatabase) -> (HirFileId, TreeArc<ast::TypeDef>) { 622 pub fn source(
623 &self,
624 db: &impl PersistentHirDatabase,
625 ) -> (HirFileId, TreeArc<ast::TypeAliasDef>) {
623 self.id.source(db) 626 self.id.source(db)
624 } 627 }
625 628
diff --git a/crates/ra_hir/src/ids.rs b/crates/ra_hir/src/ids.rs
index 6df037859..5b00330c6 100644
--- a/crates/ra_hir/src/ids.rs
+++ b/crates/ra_hir/src/ids.rs
@@ -22,7 +22,7 @@ pub struct HirInterner {
22 consts: LocationIntener<ItemLoc<ast::ConstDef>, ConstId>, 22 consts: LocationIntener<ItemLoc<ast::ConstDef>, ConstId>,
23 statics: LocationIntener<ItemLoc<ast::StaticDef>, StaticId>, 23 statics: LocationIntener<ItemLoc<ast::StaticDef>, StaticId>,
24 traits: LocationIntener<ItemLoc<ast::TraitDef>, TraitId>, 24 traits: LocationIntener<ItemLoc<ast::TraitDef>, TraitId>,
25 types: LocationIntener<ItemLoc<ast::TypeDef>, TypeId>, 25 types: LocationIntener<ItemLoc<ast::TypeAliasDef>, TypeId>,
26} 26}
27 27
28impl HirInterner { 28impl HirInterner {
@@ -278,8 +278,8 @@ impl AstItemDef<ast::TraitDef> for TraitId {
278#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] 278#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
279pub struct TypeId(RawId); 279pub struct TypeId(RawId);
280impl_arena_id!(TypeId); 280impl_arena_id!(TypeId);
281impl AstItemDef<ast::TypeDef> for TypeId { 281impl AstItemDef<ast::TypeAliasDef> for TypeId {
282 fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TypeDef>, Self> { 282 fn interner(interner: &HirInterner) -> &LocationIntener<ItemLoc<ast::TypeAliasDef>, Self> {
283 &interner.types 283 &interner.types
284 } 284 }
285} 285}
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 2f3c916fd..eb2d4ed8d 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -137,7 +137,7 @@ impl ImplData {
137 .map(|item_node| match item_node.kind() { 137 .map(|item_node| match item_node.kind() {
138 ast::ImplItemKind::FnDef(it) => Function { id: ctx.to_def(it) }.into(), 138 ast::ImplItemKind::FnDef(it) => Function { id: ctx.to_def(it) }.into(),
139 ast::ImplItemKind::ConstDef(it) => Const { id: ctx.to_def(it) }.into(), 139 ast::ImplItemKind::ConstDef(it) => Const { id: ctx.to_def(it) }.into(),
140 ast::ImplItemKind::TypeDef(it) => TypeAlias { id: ctx.to_def(it) }.into(), 140 ast::ImplItemKind::TypeAliasDef(it) => TypeAlias { id: ctx.to_def(it) }.into(),
141 }) 141 })
142 .collect() 142 .collect()
143 } else { 143 } else {
diff --git a/crates/ra_hir/src/nameres/lower.rs b/crates/ra_hir/src/nameres/lower.rs
index 522f13b44..2bc3eb60c 100644
--- a/crates/ra_hir/src/nameres/lower.rs
+++ b/crates/ra_hir/src/nameres/lower.rs
@@ -167,7 +167,7 @@ impl LoweredModule {
167 self.declarations.insert(name.as_name(), PerNs::types(t.into())); 167 self.declarations.insert(name.as_name(), PerNs::types(t.into()));
168 } 168 }
169 } 169 }
170 ast::ModuleItemKind::TypeDef(it) => { 170 ast::ModuleItemKind::TypeAliasDef(it) => {
171 if let Some(name) = it.name() { 171 if let Some(name) = it.name() {
172 let t = TypeAlias { id: ctx.to_def(it) }; 172 let t = TypeAlias { id: ctx.to_def(it) };
173 self.declarations.insert(name.as_name(), PerNs::types(t.into())); 173 self.declarations.insert(name.as_name(), PerNs::types(t.into()));
diff --git a/crates/ra_ide_api/src/completion.rs b/crates/ra_ide_api/src/completion.rs
index c8022f94f..639942f7b 100644
--- a/crates/ra_ide_api/src/completion.rs
+++ b/crates/ra_ide_api/src/completion.rs
@@ -102,7 +102,7 @@ pub fn const_label(node: &ast::ConstDef) -> String {
102 label.trim().to_owned() 102 label.trim().to_owned()
103} 103}
104 104
105pub fn type_label(node: &ast::TypeDef) -> String { 105pub fn type_label(node: &ast::TypeAliasDef) -> String {
106 let label: String = node 106 let label: String = node
107 .syntax() 107 .syntax()
108 .children() 108 .children()
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs
index 4dac96bfe..1833e57d5 100644
--- a/crates/ra_ide_api/src/goto_definition.rs
+++ b/crates/ra_ide_api/src/goto_definition.rs
@@ -141,7 +141,7 @@ fn named_target(file_id: FileId, node: &SyntaxNode) -> Option<NavigationTarget>
141 .visit(|node: &ast::EnumDef| NavigationTarget::from_named(file_id, node)) 141 .visit(|node: &ast::EnumDef| NavigationTarget::from_named(file_id, node))
142 .visit(|node: &ast::EnumVariant| NavigationTarget::from_named(file_id, node)) 142 .visit(|node: &ast::EnumVariant| NavigationTarget::from_named(file_id, node))
143 .visit(|node: &ast::FnDef| NavigationTarget::from_named(file_id, node)) 143 .visit(|node: &ast::FnDef| NavigationTarget::from_named(file_id, node))
144 .visit(|node: &ast::TypeDef| NavigationTarget::from_named(file_id, node)) 144 .visit(|node: &ast::TypeAliasDef| NavigationTarget::from_named(file_id, node))
145 .visit(|node: &ast::ConstDef| NavigationTarget::from_named(file_id, node)) 145 .visit(|node: &ast::ConstDef| NavigationTarget::from_named(file_id, node))
146 .visit(|node: &ast::StaticDef| NavigationTarget::from_named(file_id, node)) 146 .visit(|node: &ast::StaticDef| NavigationTarget::from_named(file_id, node))
147 .visit(|node: &ast::TraitDef| NavigationTarget::from_named(file_id, node)) 147 .visit(|node: &ast::TraitDef| NavigationTarget::from_named(file_id, node))
@@ -327,7 +327,7 @@ mod tests {
327 //- /lib.rs 327 //- /lib.rs
328 type Thing<|> = Option<()>; 328 type Thing<|> = Option<()>;
329 "#, 329 "#,
330 "Thing TYPE_DEF FileId(1) [0; 24) [5; 10)", 330 "Thing TYPE_ALIAS_DEF FileId(1) [0; 24) [5; 10)",
331 ); 331 );
332 332
333 check_goto( 333 check_goto(
diff --git a/crates/ra_ide_api/src/hover.rs b/crates/ra_ide_api/src/hover.rs
index c62683ad4..364bf9f74 100644
--- a/crates/ra_ide_api/src/hover.rs
+++ b/crates/ra_ide_api/src/hover.rs
@@ -105,7 +105,7 @@ impl NavigationTarget {
105 .visit(doc_comments::<ast::EnumDef>) 105 .visit(doc_comments::<ast::EnumDef>)
106 .visit(doc_comments::<ast::TraitDef>) 106 .visit(doc_comments::<ast::TraitDef>)
107 .visit(doc_comments::<ast::Module>) 107 .visit(doc_comments::<ast::Module>)
108 .visit(doc_comments::<ast::TypeDef>) 108 .visit(doc_comments::<ast::TypeAliasDef>)
109 .visit(doc_comments::<ast::ConstDef>) 109 .visit(doc_comments::<ast::ConstDef>)
110 .visit(doc_comments::<ast::StaticDef>) 110 .visit(doc_comments::<ast::StaticDef>)
111 .accept(&node)? 111 .accept(&node)?
@@ -135,7 +135,7 @@ impl NavigationTarget {
135 .visit(|node: &ast::EnumDef| visit_node(node, "enum ")) 135 .visit(|node: &ast::EnumDef| visit_node(node, "enum "))
136 .visit(|node: &ast::TraitDef| visit_node(node, "trait ")) 136 .visit(|node: &ast::TraitDef| visit_node(node, "trait "))
137 .visit(|node: &ast::Module| visit_node(node, "mod ")) 137 .visit(|node: &ast::Module| visit_node(node, "mod "))
138 .visit(|node: &ast::TypeDef| visit_node(node, "type ")) 138 .visit(|node: &ast::TypeAliasDef| visit_node(node, "type "))
139 .visit(|node: &ast::ConstDef| visit_node(node, "const ")) 139 .visit(|node: &ast::ConstDef| visit_node(node, "const "))
140 .visit(|node: &ast::StaticDef| visit_node(node, "static ")) 140 .visit(|node: &ast::StaticDef| visit_node(node, "static "))
141 .accept(&node)? 141 .accept(&node)?
diff --git a/crates/ra_ide_api/src/symbol_index.rs b/crates/ra_ide_api/src/symbol_index.rs
index 93bdf05d8..414327ac2 100644
--- a/crates/ra_ide_api/src/symbol_index.rs
+++ b/crates/ra_ide_api/src/symbol_index.rs
@@ -196,7 +196,7 @@ impl Query {
196 196
197fn is_type(kind: SyntaxKind) -> bool { 197fn is_type(kind: SyntaxKind) -> bool {
198 match kind { 198 match kind {
199 STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_DEF => true, 199 STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF => true,
200 _ => false, 200 _ => false,
201 } 201 }
202} 202}
@@ -253,7 +253,7 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> {
253 .visit(decl::<ast::EnumDef>) 253 .visit(decl::<ast::EnumDef>)
254 .visit(decl::<ast::TraitDef>) 254 .visit(decl::<ast::TraitDef>)
255 .visit(decl::<ast::Module>) 255 .visit(decl::<ast::Module>)
256 .visit(decl::<ast::TypeDef>) 256 .visit(decl::<ast::TypeAliasDef>)
257 .visit(decl::<ast::ConstDef>) 257 .visit(decl::<ast::ConstDef>)
258 .visit(decl::<ast::StaticDef>) 258 .visit(decl::<ast::StaticDef>)
259 .accept(node)? 259 .accept(node)?
diff --git a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap
index 413f4a5ff..8e4184b31 100644
--- a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap
+++ b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap
@@ -111,7 +111,7 @@ expression: structure
111 label: "T", 111 label: "T",
112 navigation_range: [186; 187), 112 navigation_range: [186; 187),
113 node_range: [181; 193), 113 node_range: [181; 193),
114 kind: TYPE_DEF, 114 kind: TYPE_ALIAS_DEF,
115 detail: Some( 115 detail: Some(
116 "()" 116 "()"
117 ), 117 ),
diff --git a/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new
new file mode 100644
index 000000000..a3c6cd9ce
--- /dev/null
+++ b/crates/ra_ide_api_light/src/snapshots/tests__file_structure.snap.new
@@ -0,0 +1,182 @@
1---
2created: "2019-02-25T10:38:16.909647631Z"
3creator: [email protected]
4source: crates/ra_ide_api_light/src/structure.rs
5expression: structure
6---
7[
8 StructureNode {
9 parent: None,
10 label: "Foo",
11 navigation_range: [8; 11),
12 node_range: [1; 26),
13 kind: STRUCT_DEF,
14 detail: None,
15 deprecated: false
16 },
17 StructureNode {
18 parent: Some(
19 0
20 ),
21 label: "x",
22 navigation_range: [18; 19),
23 node_range: [18; 24),
24 kind: NAMED_FIELD_DEF,
25 detail: Some(
26 "i32"
27 ),
28 deprecated: false
29 },
30 StructureNode {
31 parent: None,
32 label: "m",
33 navigation_range: [32; 33),
34 node_range: [28; 158),
35 kind: MODULE,
36 detail: None,
37 deprecated: false
38 },
39 StructureNode {
40 parent: Some(
41 2
42 ),
43 label: "bar1",
44 navigation_range: [43; 47),
45 node_range: [40; 52),
46 kind: FN_DEF,
47 detail: Some(
48 "fn()"
49 ),
50 deprecated: false
51 },
52 StructureNode {
53 parent: Some(
54 2
55 ),
56 label: "bar2",
57 navigation_range: [60; 64),
58 node_range: [57; 81),
59 kind: FN_DEF,
60 detail: Some(
61 "fn<T>(t: T) -> T"
62 ),
63 deprecated: false
64 },
65 StructureNode {
66 parent: Some(
67 2
68 ),
69 label: "bar3",
70 navigation_range: [89; 93),
71 node_range: [86; 156),
72 kind: FN_DEF,
73 detail: Some(
74 "fn<A, B>(a: A, b: B) -> Vec< u32 >"
75 ),
76 deprecated: false
77 },
78 StructureNode {
79 parent: None,
80 label: "E",
81 navigation_range: [165; 166),
82 node_range: [160; 180),
83 kind: ENUM_DEF,
84 detail: None,
85 deprecated: false
86 },
87 StructureNode {
88 parent: Some(
89 6
90 ),
91 label: "X",
92 navigation_range: [169; 170),
93 node_range: [169; 170),
94 kind: ENUM_VARIANT,
95 detail: None,
96 deprecated: false
97 },
98 StructureNode {
99 parent: Some(
100 6
101 ),
102 label: "Y",
103 navigation_range: [172; 173),
104 node_range: [172; 178),
105 kind: ENUM_VARIANT,
106 detail: None,
107 deprecated: false
108 },
109 StructureNode {
110 parent: None,
111 label: "T",
112 navigation_range: [186; 187),
113 node_range: [181; 193),
114 kind: TYPE_ALIAS_DEF,
115 detail: Some(
116 "()"
117 ),
118 deprecated: false
119 },
120 StructureNode {
121 parent: None,
122 label: "S",
123 navigation_range: [201; 202),
124 node_range: [194; 213),
125 kind: STATIC_DEF,
126 detail: Some(
127 "i32"
128 ),
129 deprecated: false
130 },
131 StructureNode {
132 parent: None,
133 label: "C",
134 navigation_range: [220; 221),
135 node_range: [214; 232),
136 kind: CONST_DEF,
137 detail: Some(
138 "i32"
139 ),
140 deprecated: false
141 },
142 StructureNode {
143 parent: None,
144 label: "impl E",
145 navigation_range: [239; 240),
146 node_range: [234; 243),
147 kind: IMPL_BLOCK,
148 detail: None,
149 deprecated: false
150 },
151 StructureNode {
152 parent: None,
153 label: "impl fmt::Debug for E",
154 navigation_range: [265; 266),
155 node_range: [245; 269),
156 kind: IMPL_BLOCK,
157 detail: None,
158 deprecated: false
159 },
160 StructureNode {
161 parent: None,
162 label: "obsolete",
163 navigation_range: [288; 296),
164 node_range: [271; 301),
165 kind: FN_DEF,
166 detail: Some(
167 "fn()"
168 ),
169 deprecated: true
170 },
171 StructureNode {
172 parent: None,
173 label: "very_obsolete",
174 navigation_range: [341; 354),
175 node_range: [303; 359),
176 kind: FN_DEF,
177 detail: Some(
178 "fn()"
179 ),
180 deprecated: true
181 }
182]
diff --git a/crates/ra_ide_api_light/src/structure.rs b/crates/ra_ide_api_light/src/structure.rs
index 75afd1181..dea494daa 100644
--- a/crates/ra_ide_api_light/src/structure.rs
+++ b/crates/ra_ide_api_light/src/structure.rs
@@ -112,7 +112,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
112 .visit(decl::<ast::EnumVariant>) 112 .visit(decl::<ast::EnumVariant>)
113 .visit(decl::<ast::TraitDef>) 113 .visit(decl::<ast::TraitDef>)
114 .visit(decl::<ast::Module>) 114 .visit(decl::<ast::Module>)
115 .visit(|td: &ast::TypeDef| decl_with_type_ref(td, td.type_ref())) 115 .visit(|td: &ast::TypeAliasDef| decl_with_type_ref(td, td.type_ref()))
116 .visit(|cd: &ast::ConstDef| decl_with_type_ref(cd, cd.type_ref())) 116 .visit(|cd: &ast::ConstDef| decl_with_type_ref(cd, cd.type_ref()))
117 .visit(|sd: &ast::StaticDef| decl_with_type_ref(sd, sd.type_ref())) 117 .visit(|sd: &ast::StaticDef| decl_with_type_ref(sd, sd.type_ref()))
118 .visit(|im: &ast::ImplBlock| { 118 .visit(|im: &ast::ImplBlock| {
diff --git a/crates/ra_lsp_server/src/conv.rs b/crates/ra_lsp_server/src/conv.rs
index f0f67b663..41f78e58d 100644
--- a/crates/ra_lsp_server/src/conv.rs
+++ b/crates/ra_lsp_server/src/conv.rs
@@ -41,7 +41,7 @@ impl Conv for SyntaxKind {
41 SyntaxKind::ENUM_DEF => SymbolKind::Enum, 41 SyntaxKind::ENUM_DEF => SymbolKind::Enum,
42 SyntaxKind::TRAIT_DEF => SymbolKind::Interface, 42 SyntaxKind::TRAIT_DEF => SymbolKind::Interface,
43 SyntaxKind::MODULE => SymbolKind::Module, 43 SyntaxKind::MODULE => SymbolKind::Module,
44 SyntaxKind::TYPE_DEF => SymbolKind::TypeParameter, 44 SyntaxKind::TYPE_ALIAS_DEF => SymbolKind::TypeParameter,
45 SyntaxKind::STATIC_DEF => SymbolKind::Constant, 45 SyntaxKind::STATIC_DEF => SymbolKind::Constant,
46 SyntaxKind::CONST_DEF => SymbolKind::Constant, 46 SyntaxKind::CONST_DEF => SymbolKind::Constant,
47 SyntaxKind::IMPL_BLOCK => SymbolKind::Object, 47 SyntaxKind::IMPL_BLOCK => SymbolKind::Object,
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 4b962c1f3..ab9d2de90 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -173,7 +173,7 @@ fn items_without_modifiers(p: &mut Parser) -> Option<SyntaxKind> {
173 } 173 }
174 TYPE_KW => { 174 TYPE_KW => {
175 type_def(p); 175 type_def(p);
176 TYPE_DEF 176 TYPE_ALIAS_DEF
177 } 177 }
178 MOD_KW => { 178 MOD_KW => {
179 mod_item(p); 179 mod_item(p);
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs
index 1d8f988ae..0eed44ecf 100644
--- a/crates/ra_parser/src/syntax_kind/generated.rs
+++ b/crates/ra_parser/src/syntax_kind/generated.rs
@@ -130,7 +130,7 @@ pub enum SyntaxKind {
130 CONST_DEF, 130 CONST_DEF,
131 TRAIT_DEF, 131 TRAIT_DEF,
132 IMPL_BLOCK, 132 IMPL_BLOCK,
133 TYPE_DEF, 133 TYPE_ALIAS_DEF,
134 MACRO_CALL, 134 MACRO_CALL,
135 TOKEN_TREE, 135 TOKEN_TREE,
136 PAREN_TYPE, 136 PAREN_TYPE,
@@ -467,7 +467,7 @@ impl SyntaxKind {
467 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" }, 467 CONST_DEF => &SyntaxInfo { name: "CONST_DEF" },
468 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" }, 468 TRAIT_DEF => &SyntaxInfo { name: "TRAIT_DEF" },
469 IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" }, 469 IMPL_BLOCK => &SyntaxInfo { name: "IMPL_BLOCK" },
470 TYPE_DEF => &SyntaxInfo { name: "TYPE_DEF" }, 470 TYPE_ALIAS_DEF => &SyntaxInfo { name: "TYPE_ALIAS_DEF" },
471 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" }, 471 MACRO_CALL => &SyntaxInfo { name: "MACRO_CALL" },
472 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" }, 472 TOKEN_TREE => &SyntaxInfo { name: "TOKEN_TREE" },
473 PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" }, 473 PAREN_TYPE => &SyntaxInfo { name: "PAREN_TYPE" },
diff --git a/crates/ra_syntax/src/ast/generated.rs b/crates/ra_syntax/src/ast/generated.rs
index aa88b1e28..4e2705d09 100644
--- a/crates/ra_syntax/src/ast/generated.rs
+++ b/crates/ra_syntax/src/ast/generated.rs
@@ -1508,7 +1508,7 @@ unsafe impl TransparentNewType for ImplItem {
1508#[derive(Debug, Clone, Copy, PartialEq, Eq)] 1508#[derive(Debug, Clone, Copy, PartialEq, Eq)]
1509pub enum ImplItemKind<'a> { 1509pub enum ImplItemKind<'a> {
1510 FnDef(&'a FnDef), 1510 FnDef(&'a FnDef),
1511 TypeDef(&'a TypeDef), 1511 TypeAliasDef(&'a TypeAliasDef),
1512 ConstDef(&'a ConstDef), 1512 ConstDef(&'a ConstDef),
1513} 1513}
1514impl<'a> From<&'a FnDef> for &'a ImplItem { 1514impl<'a> From<&'a FnDef> for &'a ImplItem {
@@ -1516,8 +1516,8 @@ impl<'a> From<&'a FnDef> for &'a ImplItem {
1516 ImplItem::cast(&n.syntax).unwrap() 1516 ImplItem::cast(&n.syntax).unwrap()
1517 } 1517 }
1518} 1518}
1519impl<'a> From<&'a TypeDef> for &'a ImplItem { 1519impl<'a> From<&'a TypeAliasDef> for &'a ImplItem {
1520 fn from(n: &'a TypeDef) -> &'a ImplItem { 1520 fn from(n: &'a TypeAliasDef) -> &'a ImplItem {
1521 ImplItem::cast(&n.syntax).unwrap() 1521 ImplItem::cast(&n.syntax).unwrap()
1522 } 1522 }
1523} 1523}
@@ -1532,7 +1532,7 @@ impl AstNode for ImplItem {
1532 fn cast(syntax: &SyntaxNode) -> Option<&Self> { 1532 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
1533 match syntax.kind() { 1533 match syntax.kind() {
1534 | FN_DEF 1534 | FN_DEF
1535 | TYPE_DEF 1535 | TYPE_ALIAS_DEF
1536 | CONST_DEF => Some(ImplItem::from_repr(syntax.into_repr())), 1536 | CONST_DEF => Some(ImplItem::from_repr(syntax.into_repr())),
1537 _ => None, 1537 _ => None,
1538 } 1538 }
@@ -1549,7 +1549,7 @@ impl ImplItem {
1549 pub fn kind(&self) -> ImplItemKind { 1549 pub fn kind(&self) -> ImplItemKind {
1550 match self.syntax.kind() { 1550 match self.syntax.kind() {
1551 FN_DEF => ImplItemKind::FnDef(FnDef::cast(&self.syntax).unwrap()), 1551 FN_DEF => ImplItemKind::FnDef(FnDef::cast(&self.syntax).unwrap()),
1552 TYPE_DEF => ImplItemKind::TypeDef(TypeDef::cast(&self.syntax).unwrap()), 1552 TYPE_ALIAS_DEF => ImplItemKind::TypeAliasDef(TypeAliasDef::cast(&self.syntax).unwrap()),
1553 CONST_DEF => ImplItemKind::ConstDef(ConstDef::cast(&self.syntax).unwrap()), 1553 CONST_DEF => ImplItemKind::ConstDef(ConstDef::cast(&self.syntax).unwrap()),
1554 _ => unreachable!(), 1554 _ => unreachable!(),
1555 } 1555 }
@@ -2359,7 +2359,7 @@ pub enum ModuleItemKind<'a> {
2359 EnumDef(&'a EnumDef), 2359 EnumDef(&'a EnumDef),
2360 FnDef(&'a FnDef), 2360 FnDef(&'a FnDef),
2361 TraitDef(&'a TraitDef), 2361 TraitDef(&'a TraitDef),
2362 TypeDef(&'a TypeDef), 2362 TypeAliasDef(&'a TypeAliasDef),
2363 ImplBlock(&'a ImplBlock), 2363 ImplBlock(&'a ImplBlock),
2364 UseItem(&'a UseItem), 2364 UseItem(&'a UseItem),
2365 ExternCrateItem(&'a ExternCrateItem), 2365 ExternCrateItem(&'a ExternCrateItem),
@@ -2387,8 +2387,8 @@ impl<'a> From<&'a TraitDef> for &'a ModuleItem {
2387 ModuleItem::cast(&n.syntax).unwrap() 2387 ModuleItem::cast(&n.syntax).unwrap()
2388 } 2388 }
2389} 2389}
2390impl<'a> From<&'a TypeDef> for &'a ModuleItem { 2390impl<'a> From<&'a TypeAliasDef> for &'a ModuleItem {
2391 fn from(n: &'a TypeDef) -> &'a ModuleItem { 2391 fn from(n: &'a TypeAliasDef) -> &'a ModuleItem {
2392 ModuleItem::cast(&n.syntax).unwrap() 2392 ModuleItem::cast(&n.syntax).unwrap()
2393 } 2393 }
2394} 2394}
@@ -2431,7 +2431,7 @@ impl AstNode for ModuleItem {
2431 | ENUM_DEF 2431 | ENUM_DEF
2432 | FN_DEF 2432 | FN_DEF
2433 | TRAIT_DEF 2433 | TRAIT_DEF
2434 | TYPE_DEF 2434 | TYPE_ALIAS_DEF
2435 | IMPL_BLOCK 2435 | IMPL_BLOCK
2436 | USE_ITEM 2436 | USE_ITEM
2437 | EXTERN_CRATE_ITEM 2437 | EXTERN_CRATE_ITEM
@@ -2456,7 +2456,7 @@ impl ModuleItem {
2456 ENUM_DEF => ModuleItemKind::EnumDef(EnumDef::cast(&self.syntax).unwrap()), 2456 ENUM_DEF => ModuleItemKind::EnumDef(EnumDef::cast(&self.syntax).unwrap()),
2457 FN_DEF => ModuleItemKind::FnDef(FnDef::cast(&self.syntax).unwrap()), 2457 FN_DEF => ModuleItemKind::FnDef(FnDef::cast(&self.syntax).unwrap()),
2458 TRAIT_DEF => ModuleItemKind::TraitDef(TraitDef::cast(&self.syntax).unwrap()), 2458 TRAIT_DEF => ModuleItemKind::TraitDef(TraitDef::cast(&self.syntax).unwrap()),
2459 TYPE_DEF => ModuleItemKind::TypeDef(TypeDef::cast(&self.syntax).unwrap()), 2459 TYPE_ALIAS_DEF => ModuleItemKind::TypeAliasDef(TypeAliasDef::cast(&self.syntax).unwrap()),
2460 IMPL_BLOCK => ModuleItemKind::ImplBlock(ImplBlock::cast(&self.syntax).unwrap()), 2460 IMPL_BLOCK => ModuleItemKind::ImplBlock(ImplBlock::cast(&self.syntax).unwrap()),
2461 USE_ITEM => ModuleItemKind::UseItem(UseItem::cast(&self.syntax).unwrap()), 2461 USE_ITEM => ModuleItemKind::UseItem(UseItem::cast(&self.syntax).unwrap()),
2462 EXTERN_CRATE_ITEM => ModuleItemKind::ExternCrateItem(ExternCrateItem::cast(&self.syntax).unwrap()), 2462 EXTERN_CRATE_ITEM => ModuleItemKind::ExternCrateItem(ExternCrateItem::cast(&self.syntax).unwrap()),
@@ -4273,6 +4273,43 @@ impl TupleType {
4273 } 4273 }
4274} 4274}
4275 4275
4276// TypeAliasDef
4277#[derive(Debug, PartialEq, Eq, Hash)]
4278#[repr(transparent)]
4279pub struct TypeAliasDef {
4280 pub(crate) syntax: SyntaxNode,
4281}
4282unsafe impl TransparentNewType for TypeAliasDef {
4283 type Repr = rowan::SyntaxNode<RaTypes>;
4284}
4285
4286impl AstNode for TypeAliasDef {
4287 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4288 match syntax.kind() {
4289 TYPE_ALIAS_DEF => Some(TypeAliasDef::from_repr(syntax.into_repr())),
4290 _ => None,
4291 }
4292 }
4293 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4294}
4295
4296impl ToOwned for TypeAliasDef {
4297 type Owned = TreeArc<TypeAliasDef>;
4298 fn to_owned(&self) -> TreeArc<TypeAliasDef> { TreeArc::cast(self.syntax.to_owned()) }
4299}
4300
4301
4302impl ast::VisibilityOwner for TypeAliasDef {}
4303impl ast::NameOwner for TypeAliasDef {}
4304impl ast::TypeParamsOwner for TypeAliasDef {}
4305impl ast::AttrsOwner for TypeAliasDef {}
4306impl ast::DocCommentsOwner for TypeAliasDef {}
4307impl TypeAliasDef {
4308 pub fn type_ref(&self) -> Option<&TypeRef> {
4309 super::child_opt(self)
4310 }
4311}
4312
4276// TypeArg 4313// TypeArg
4277#[derive(Debug, PartialEq, Eq, Hash)] 4314#[derive(Debug, PartialEq, Eq, Hash)]
4278#[repr(transparent)] 4315#[repr(transparent)]
@@ -4345,43 +4382,6 @@ impl TypeArgList {
4345 } 4382 }
4346} 4383}
4347 4384
4348// TypeDef
4349#[derive(Debug, PartialEq, Eq, Hash)]
4350#[repr(transparent)]
4351pub struct TypeDef {
4352 pub(crate) syntax: SyntaxNode,
4353}
4354unsafe impl TransparentNewType for TypeDef {
4355 type Repr = rowan::SyntaxNode<RaTypes>;
4356}
4357
4358impl AstNode for TypeDef {
4359 fn cast(syntax: &SyntaxNode) -> Option<&Self> {
4360 match syntax.kind() {
4361 TYPE_DEF => Some(TypeDef::from_repr(syntax.into_repr())),
4362 _ => None,
4363 }
4364 }
4365 fn syntax(&self) -> &SyntaxNode { &self.syntax }
4366}
4367
4368impl ToOwned for TypeDef {
4369 type Owned = TreeArc<TypeDef>;
4370 fn to_owned(&self) -> TreeArc<TypeDef> { TreeArc::cast(self.syntax.to_owned()) }
4371}
4372
4373
4374impl ast::VisibilityOwner for TypeDef {}
4375impl ast::NameOwner for TypeDef {}
4376impl ast::TypeParamsOwner for TypeDef {}
4377impl ast::AttrsOwner for TypeDef {}
4378impl ast::DocCommentsOwner for TypeDef {}
4379impl TypeDef {
4380 pub fn type_ref(&self) -> Option<&TypeRef> {
4381 super::child_opt(self)
4382 }
4383}
4384
4385// TypeParam 4385// TypeParam
4386#[derive(Debug, PartialEq, Eq, Hash)] 4386#[derive(Debug, PartialEq, Eq, Hash)]
4387#[repr(transparent)] 4387#[repr(transparent)]
diff --git a/crates/ra_syntax/src/grammar.ron b/crates/ra_syntax/src/grammar.ron
index b1775d0f8..c7acbbd6c 100644
--- a/crates/ra_syntax/src/grammar.ron
+++ b/crates/ra_syntax/src/grammar.ron
@@ -132,7 +132,7 @@ Grammar(
132 "CONST_DEF", 132 "CONST_DEF",
133 "TRAIT_DEF", 133 "TRAIT_DEF",
134 "IMPL_BLOCK", 134 "IMPL_BLOCK",
135 "TYPE_DEF", 135 "TYPE_ALIAS_DEF",
136 "MACRO_CALL", 136 "MACRO_CALL",
137 "TOKEN_TREE", 137 "TOKEN_TREE",
138 138
@@ -312,7 +312,7 @@ Grammar(
312 ], 312 ],
313 options: ["TypeRef"] 313 options: ["TypeRef"]
314 ), 314 ),
315 "TypeDef": ( 315 "TypeAliasDef": (
316 traits: [ 316 traits: [
317 "VisibilityOwner", 317 "VisibilityOwner",
318 "NameOwner", 318 "NameOwner",
@@ -363,11 +363,11 @@ Grammar(
363 ], 363 ],
364 ), 364 ),
365 "ModuleItem": ( 365 "ModuleItem": (
366 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeDef", "ImplBlock", 366 enum: ["StructDef", "EnumDef", "FnDef", "TraitDef", "TypeAliasDef", "ImplBlock",
367 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ] 367 "UseItem", "ExternCrateItem", "ConstDef", "StaticDef", "Module" ]
368 ), 368 ),
369 "ImplItem": ( 369 "ImplItem": (
370 enum: ["FnDef", "TypeDef", "ConstDef"] 370 enum: ["FnDef", "TypeAliasDef", "ConstDef"]
371 ), 371 ),
372 372
373 "TupleExpr": ( 373 "TupleExpr": (
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs
index 961a91d41..b17d06c61 100644
--- a/crates/ra_syntax/src/parsing/text_tree_sink.rs
+++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs
@@ -143,7 +143,7 @@ fn n_attached_trivias<'a>(
143 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, 143 trivias: impl Iterator<Item = (SyntaxKind, &'a str)>,
144) -> usize { 144) -> usize {
145 match kind { 145 match kind {
146 CONST_DEF | TYPE_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF 146 CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | TRAIT_DEF
147 | MODULE | NAMED_FIELD_DEF => { 147 | MODULE | NAMED_FIELD_DEF => {
148 let mut res = 0; 148 let mut res = 0;
149 for (i, (kind, text)) in trivias.enumerate() { 149 for (i, (kind, text)) in trivias.enumerate() {
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt b/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt
index 036363587..f02027972 100644
--- a/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0001_array_type_missing_semi.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 18) 1SOURCE_FILE@[0; 18)
2 TYPE_DEF@[0; 12) 2 TYPE_ALIAS_DEF@[0; 12)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt b/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt
index 189aa563e..b11171fd0 100644
--- a/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0003_pointer_type_no_mutability.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 14) 1SOURCE_FILE@[0; 14)
2 TYPE_DEF@[0; 13) 2 TYPE_ALIAS_DEF@[0; 13)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt b/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt
index f97db4bff..ab879db03 100644
--- a/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/err/0005_fn_pointer_type_missing_fn.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 20) 1SOURCE_FILE@[0; 20)
2 TYPE_DEF@[0; 15) 2 TYPE_ALIAS_DEF@[0; 15)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt
index de7df7312..7c9e1e621 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0001_trait_item_list.txt
@@ -11,7 +11,7 @@ SOURCE_FILE@[0; 83)
11 ITEM_LIST@[7; 82) 11 ITEM_LIST@[7; 82)
12 L_CURLY@[7; 8) 12 L_CURLY@[7; 8)
13 WHITESPACE@[8; 13) 13 WHITESPACE@[8; 13)
14 TYPE_DEF@[13; 27) 14 TYPE_ALIAS_DEF@[13; 27)
15 TYPE_KW@[13; 17) 15 TYPE_KW@[13; 17)
16 WHITESPACE@[17; 18) 16 WHITESPACE@[17; 18)
17 NAME@[18; 19) 17 NAME@[18; 19)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0004_value_parameters_no_patterns.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0004_value_parameters_no_patterns.txt
index f2d7e866b..90284a2aa 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0004_value_parameters_no_patterns.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0004_value_parameters_no_patterns.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 54) 1SOURCE_FILE@[0; 54)
2 TYPE_DEF@[0; 53) 2 TYPE_ALIAS_DEF@[0; 53)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0012_type_item_where_clause.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0012_type_item_where_clause.txt
index dbb705acf..9a5f46bab 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0012_type_item_where_clause.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0012_type_item_where_clause.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 31) 1SOURCE_FILE@[0; 31)
2 TYPE_DEF@[0; 30) 2 TYPE_ALIAS_DEF@[0; 30)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 8) 5 NAME@[5; 8)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0013_pointer_type_mut.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0013_pointer_type_mut.txt
index 149cd571d..8f1d9ca98 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0013_pointer_type_mut.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0013_pointer_type_mut.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 36) 1SOURCE_FILE@[0; 36)
2 TYPE_DEF@[0; 17) 2 TYPE_ALIAS_DEF@[0; 17)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
@@ -16,7 +16,7 @@ SOURCE_FILE@[0; 36)
16 R_PAREN@[15; 16) 16 R_PAREN@[15; 16)
17 SEMI@[16; 17) 17 SEMI@[16; 17)
18 WHITESPACE@[17; 18) 18 WHITESPACE@[17; 18)
19 TYPE_DEF@[18; 35) 19 TYPE_ALIAS_DEF@[18; 35)
20 TYPE_KW@[18; 22) 20 TYPE_KW@[18; 22)
21 WHITESPACE@[22; 23) 21 WHITESPACE@[22; 23)
22 NAME@[23; 24) 22 NAME@[23; 24)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0014_never_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0014_never_type.txt
index e0cae644d..eaa6eb1c0 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0014_never_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0014_never_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 16) 1SOURCE_FILE@[0; 16)
2 TYPE_DEF@[0; 15) 2 TYPE_ALIAS_DEF@[0; 15)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 10) 5 NAME@[5; 10)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0017_array_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0017_array_type.txt
index 2c2b615fc..de09902bb 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0017_array_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0017_array_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 19) 1SOURCE_FILE@[0; 19)
2 TYPE_DEF@[0; 18) 2 TYPE_ALIAS_DEF@[0; 18)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt
index 50426bdfe..08a0b786d 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0021_impl_item_list.txt
@@ -11,7 +11,7 @@ SOURCE_FILE@[0; 89)
11 ITEM_LIST@[7; 88) 11 ITEM_LIST@[7; 88)
12 L_CURLY@[7; 8) 12 L_CURLY@[7; 8)
13 WHITESPACE@[8; 13) 13 WHITESPACE@[8; 13)
14 TYPE_DEF@[13; 26) 14 TYPE_ALIAS_DEF@[13; 26)
15 TYPE_KW@[13; 17) 15 TYPE_KW@[13; 17)
16 WHITESPACE@[17; 18) 16 WHITESPACE@[17; 18)
17 NAME@[18; 19) 17 NAME@[18; 19)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0023_placeholder_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0023_placeholder_type.txt
index 43ada95d4..bb9bb57ea 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0023_placeholder_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0023_placeholder_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 22) 1SOURCE_FILE@[0; 22)
2 TYPE_DEF@[0; 21) 2 TYPE_ALIAS_DEF@[0; 21)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 16) 5 NAME@[5; 16)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0025_slice_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0025_slice_type.txt
index db18c7139..c5f70ca3a 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0025_slice_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0025_slice_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 15) 1SOURCE_FILE@[0; 15)
2 TYPE_DEF@[0; 14) 2 TYPE_ALIAS_DEF@[0; 14)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0028_impl_trait_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0028_impl_trait_type.txt
index efd4dd42a..3b676fb4c 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0028_impl_trait_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0028_impl_trait_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 43) 1SOURCE_FILE@[0; 43)
2 TYPE_DEF@[0; 42) 2 TYPE_ALIAS_DEF@[0; 42)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0032_fn_pointer_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0032_fn_pointer_type.txt
index 0c508ec27..d0aa429fd 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0032_fn_pointer_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0032_fn_pointer_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 70) 1SOURCE_FILE@[0; 70)
2 TYPE_DEF@[0; 14) 2 TYPE_ALIAS_DEF@[0; 14)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 70)
14 R_PAREN@[12; 13) 14 R_PAREN@[12; 13)
15 SEMI@[13; 14) 15 SEMI@[13; 14)
16 WHITESPACE@[14; 15) 16 WHITESPACE@[14; 15)
17 TYPE_DEF@[15; 36) 17 TYPE_ALIAS_DEF@[15; 36)
18 TYPE_KW@[15; 19) 18 TYPE_KW@[15; 19)
19 WHITESPACE@[19; 20) 19 WHITESPACE@[19; 20)
20 NAME@[20; 21) 20 NAME@[20; 21)
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 70)
31 R_PAREN@[34; 35) 31 R_PAREN@[34; 35)
32 SEMI@[35; 36) 32 SEMI@[35; 36)
33 WHITESPACE@[36; 37) 33 WHITESPACE@[36; 37)
34 TYPE_DEF@[37; 69) 34 TYPE_ALIAS_DEF@[37; 69)
35 TYPE_KW@[37; 41) 35 TYPE_KW@[37; 41)
36 WHITESPACE@[41; 42) 36 WHITESPACE@[41; 42)
37 NAME@[42; 43) 37 NAME@[42; 43)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0033_reference_type;.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0033_reference_type;.txt
index 7f35254d1..c015dddeb 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0033_reference_type;.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0033_reference_type;.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 54) 1SOURCE_FILE@[0; 54)
2 TYPE_DEF@[0; 13) 2 TYPE_ALIAS_DEF@[0; 13)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 54)
14 R_PAREN@[11; 12) 14 R_PAREN@[11; 12)
15 SEMI@[12; 13) 15 SEMI@[12; 13)
16 WHITESPACE@[13; 14) 16 WHITESPACE@[13; 14)
17 TYPE_DEF@[14; 35) 17 TYPE_ALIAS_DEF@[14; 35)
18 TYPE_KW@[14; 18) 18 TYPE_KW@[14; 18)
19 WHITESPACE@[18; 19) 19 WHITESPACE@[18; 19)
20 NAME@[19; 20) 20 NAME@[19; 20)
@@ -31,7 +31,7 @@ SOURCE_FILE@[0; 54)
31 R_PAREN@[33; 34) 31 R_PAREN@[33; 34)
32 SEMI@[34; 35) 32 SEMI@[34; 35)
33 WHITESPACE@[35; 36) 33 WHITESPACE@[35; 36)
34 TYPE_DEF@[36; 53) 34 TYPE_ALIAS_DEF@[36; 53)
35 TYPE_KW@[36; 40) 35 TYPE_KW@[36; 40)
36 WHITESPACE@[40; 41) 36 WHITESPACE@[40; 41)
37 NAME@[41; 42) 37 NAME@[41; 42)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0037_qual_paths.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0037_qual_paths.txt
index 394fc7f5b..fbc548695 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0037_qual_paths.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0037_qual_paths.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 71) 1SOURCE_FILE@[0; 71)
2 TYPE_DEF@[0; 26) 2 TYPE_ALIAS_DEF@[0; 26)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0039_type_arg.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0039_type_arg.txt
index ccef7188f..cef13b6aa 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0039_type_arg.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0039_type_arg.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 36) 1SOURCE_FILE@[0; 36)
2 TYPE_DEF@[0; 35) 2 TYPE_ALIAS_DEF@[0; 35)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0046_singleton_tuple_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0046_singleton_tuple_type.txt
index 173c325d0..33549028b 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0046_singleton_tuple_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0046_singleton_tuple_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 17) 1SOURCE_FILE@[0; 17)
2 TYPE_DEF@[0; 16) 2 TYPE_ALIAS_DEF@[0; 16)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0051_unit_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0051_unit_type.txt
index 9fd19ba4a..5a6a2a829 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0051_unit_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0051_unit_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 13) 1SOURCE_FILE@[0; 13)
2 TYPE_DEF@[0; 12) 2 TYPE_ALIAS_DEF@[0; 12)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0052_path_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0052_path_type.txt
index b72b96e95..0531b8fba 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0052_path_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0052_path_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 71) 1SOURCE_FILE@[0; 71)
2 TYPE_DEF@[0; 13) 2 TYPE_ALIAS_DEF@[0; 13)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
@@ -14,7 +14,7 @@ SOURCE_FILE@[0; 71)
14 IDENT@[9; 12) "Foo" 14 IDENT@[9; 12) "Foo"
15 SEMI@[12; 13) 15 SEMI@[12; 13)
16 WHITESPACE@[13; 14) 16 WHITESPACE@[13; 14)
17 TYPE_DEF@[14; 29) 17 TYPE_ALIAS_DEF@[14; 29)
18 TYPE_KW@[14; 18) 18 TYPE_KW@[14; 18)
19 WHITESPACE@[18; 19) 19 WHITESPACE@[18; 19)
20 NAME@[19; 20) 20 NAME@[19; 20)
@@ -30,7 +30,7 @@ SOURCE_FILE@[0; 71)
30 IDENT@[25; 28) "Foo" 30 IDENT@[25; 28) "Foo"
31 SEMI@[28; 29) 31 SEMI@[28; 29)
32 WHITESPACE@[29; 30) 32 WHITESPACE@[29; 30)
33 TYPE_DEF@[30; 49) 33 TYPE_ALIAS_DEF@[30; 49)
34 TYPE_KW@[30; 34) 34 TYPE_KW@[30; 34)
35 WHITESPACE@[34; 35) 35 WHITESPACE@[34; 35)
36 NAME@[35; 36) 36 NAME@[35; 36)
@@ -49,7 +49,7 @@ SOURCE_FILE@[0; 71)
49 IDENT@[45; 48) "Foo" 49 IDENT@[45; 48) "Foo"
50 SEMI@[48; 49) 50 SEMI@[48; 49)
51 WHITESPACE@[49; 50) 51 WHITESPACE@[49; 50)
52 TYPE_DEF@[50; 70) 52 TYPE_ALIAS_DEF@[50; 70)
53 TYPE_KW@[50; 54) 53 TYPE_KW@[50; 54)
54 WHITESPACE@[54; 55) 54 WHITESPACE@[54; 55)
55 NAME@[55; 56) 55 NAME@[55; 56)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0065_dyn_trait_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0065_dyn_trait_type.txt
index d07fe70b2..f6a0967f2 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0065_dyn_trait_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0065_dyn_trait_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 42) 1SOURCE_FILE@[0; 42)
2 TYPE_DEF@[0; 41) 2 TYPE_ALIAS_DEF@[0; 41)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0073_type_item_type_params.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0073_type_item_type_params.txt
index 89b34d4f1..49ce9ad5e 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0073_type_item_type_params.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0073_type_item_type_params.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 21) 1SOURCE_FILE@[0; 21)
2 TYPE_DEF@[0; 20) 2 TYPE_ALIAS_DEF@[0; 20)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 11) 5 NAME@[5; 11)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0078_type_item.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0078_type_item.txt
index 4b66a05a6..a62a9d1e7 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0078_type_item.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0078_type_item.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 16) 1SOURCE_FILE@[0; 16)
2 TYPE_DEF@[0; 15) 2 TYPE_ALIAS_DEF@[0; 15)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 8) 5 NAME@[5; 8)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0081_for_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0081_for_type.txt
index 843cc4973..6e7e6bda1 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0081_for_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0081_for_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 29) 1SOURCE_FILE@[0; 29)
2 TYPE_DEF@[0; 28) 2 TYPE_ALIAS_DEF@[0; 28)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0084_paren_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0084_paren_type.txt
index bd5feb6b3..76b52bf89 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0084_paren_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0084_paren_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 16) 1SOURCE_FILE@[0; 16)
2 TYPE_DEF@[0; 15) 2 TYPE_ALIAS_DEF@[0; 15)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0092_fn_pointer_type_with_ret.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0092_fn_pointer_type_with_ret.txt
index f092c6df7..dc42a5c00 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0092_fn_pointer_type_with_ret.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0092_fn_pointer_type_with_ret.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 21) 1SOURCE_FILE@[0; 21)
2 TYPE_DEF@[0; 20) 2 TYPE_ALIAS_DEF@[0; 20)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0104_path_fn_trait_args.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0104_path_fn_trait_args.txt
index ba1163c2d..0254c998d 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0104_path_fn_trait_args.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0104_path_fn_trait_args.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 32) 1SOURCE_FILE@[0; 32)
2 TYPE_DEF@[0; 31) 2 TYPE_ALIAS_DEF@[0; 31)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0117_macro_call_type.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0117_macro_call_type.txt
index b2d95451c..608b4a5f0 100644
--- a/crates/ra_syntax/tests/data/parser/inline/ok/0117_macro_call_type.txt
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0117_macro_call_type.txt
@@ -1,5 +1,5 @@
1SOURCE_FILE@[0; 41) 1SOURCE_FILE@[0; 41)
2 TYPE_DEF@[0; 16) 2 TYPE_ALIAS_DEF@[0; 16)
3 TYPE_KW@[0; 4) 3 TYPE_KW@[0; 4)
4 WHITESPACE@[4; 5) 4 WHITESPACE@[4; 5)
5 NAME@[5; 6) 5 NAME@[5; 6)
@@ -18,7 +18,7 @@ SOURCE_FILE@[0; 41)
18 R_PAREN@[14; 15) 18 R_PAREN@[14; 15)
19 SEMI@[15; 16) 19 SEMI@[15; 16)
20 WHITESPACE@[16; 17) 20 WHITESPACE@[16; 17)
21 TYPE_DEF@[17; 40) 21 TYPE_ALIAS_DEF@[17; 40)
22 TYPE_KW@[17; 21) 22 TYPE_KW@[17; 21)
23 WHITESPACE@[21; 22) 23 WHITESPACE@[21; 22)
24 NAME@[22; 23) 24 NAME@[22; 23)