diff options
372 files changed, 2800 insertions, 2863 deletions
diff --git a/Cargo.lock b/Cargo.lock index e63dcc530..234c31406 100644 --- a/Cargo.lock +++ b/Cargo.lock | |||
@@ -125,9 +125,9 @@ checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | |||
125 | 125 | ||
126 | [[package]] | 126 | [[package]] |
127 | name = "chalk-derive" | 127 | name = "chalk-derive" |
128 | version = "0.18.0" | 128 | version = "0.19.0" |
129 | source = "registry+https://github.com/rust-lang/crates.io-index" | 129 | source = "registry+https://github.com/rust-lang/crates.io-index" |
130 | checksum = "eea3a22f0c30b2504ac4ab58934dac0d00b92a4d7788df32795cabca24c3f929" | 130 | checksum = "654c611946ba2629c5028cb7708687af975faf2c29d731824cb294c873df4697" |
131 | dependencies = [ | 131 | dependencies = [ |
132 | "proc-macro2", | 132 | "proc-macro2", |
133 | "quote", | 133 | "quote", |
@@ -137,9 +137,9 @@ dependencies = [ | |||
137 | 137 | ||
138 | [[package]] | 138 | [[package]] |
139 | name = "chalk-ir" | 139 | name = "chalk-ir" |
140 | version = "0.18.0" | 140 | version = "0.19.0" |
141 | source = "registry+https://github.com/rust-lang/crates.io-index" | 141 | source = "registry+https://github.com/rust-lang/crates.io-index" |
142 | checksum = "fb617b643e145e3b151502799e91a9625dd5daf1cf05dc2cb821bc75ae0c9cbd" | 142 | checksum = "0a5341fbc654ca886b73b804a36aebf0e621057ccc1a68e9815b5b39b3ac9ae8" |
143 | dependencies = [ | 143 | dependencies = [ |
144 | "chalk-derive", | 144 | "chalk-derive", |
145 | "lazy_static", | 145 | "lazy_static", |
@@ -147,9 +147,9 @@ dependencies = [ | |||
147 | 147 | ||
148 | [[package]] | 148 | [[package]] |
149 | name = "chalk-recursive" | 149 | name = "chalk-recursive" |
150 | version = "0.18.0" | 150 | version = "0.19.0" |
151 | source = "registry+https://github.com/rust-lang/crates.io-index" | 151 | source = "registry+https://github.com/rust-lang/crates.io-index" |
152 | checksum = "d280565c8eefbf9b2bc615df49c7dfd971faad37774bf65734e626fd23864bd6" | 152 | checksum = "4484807b155b5a411e6135d330295f9ba5042e2920b8712c6574ca6ea91e9ee5" |
153 | dependencies = [ | 153 | dependencies = [ |
154 | "chalk-derive", | 154 | "chalk-derive", |
155 | "chalk-ir", | 155 | "chalk-ir", |
@@ -160,9 +160,9 @@ dependencies = [ | |||
160 | 160 | ||
161 | [[package]] | 161 | [[package]] |
162 | name = "chalk-solve" | 162 | name = "chalk-solve" |
163 | version = "0.18.0" | 163 | version = "0.19.0" |
164 | source = "registry+https://github.com/rust-lang/crates.io-index" | 164 | source = "registry+https://github.com/rust-lang/crates.io-index" |
165 | checksum = "be906fbca3f3077dce0e76d9864771d0f450c946af0d86b569fb9504148a065a" | 165 | checksum = "281f82facd2538997fbe52132b1941ed213d266748215c31d15f62a8664429ad" |
166 | dependencies = [ | 166 | dependencies = [ |
167 | "chalk-derive", | 167 | "chalk-derive", |
168 | "chalk-ir", | 168 | "chalk-ir", |
@@ -607,9 +607,9 @@ dependencies = [ | |||
607 | 607 | ||
608 | [[package]] | 608 | [[package]] |
609 | name = "lsp-types" | 609 | name = "lsp-types" |
610 | version = "0.78.0" | 610 | version = "0.79.0" |
611 | source = "registry+https://github.com/rust-lang/crates.io-index" | 611 | source = "registry+https://github.com/rust-lang/crates.io-index" |
612 | checksum = "d2e6cf68e3492cfa2035f0382c1da1b6ab045db0320feca505b86b4f13d66c27" | 612 | checksum = "7f1f86677fdbe8df5f88b99131b1424e50aad27bbe3e5900d221bc414bd72e9b" |
613 | dependencies = [ | 613 | dependencies = [ |
614 | "base64", | 614 | "base64", |
615 | "bitflags", | 615 | "bitflags", |
@@ -842,9 +842,9 @@ checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" | |||
842 | 842 | ||
843 | [[package]] | 843 | [[package]] |
844 | name = "perf-event" | 844 | name = "perf-event" |
845 | version = "0.4.3" | 845 | version = "0.4.4" |
846 | source = "registry+https://github.com/rust-lang/crates.io-index" | 846 | source = "registry+https://github.com/rust-lang/crates.io-index" |
847 | checksum = "0cb38a2f363560fb3cfcb47f28848b245a41c7e0d63e0b190918b712b6bf6803" | 847 | checksum = "76c42ba5d85a2f4472b99f475fb60cf336d9b4c85b1ea8bb300fef2e3c7c8f89" |
848 | dependencies = [ | 848 | dependencies = [ |
849 | "libc", | 849 | "libc", |
850 | "perf-event-open-sys", | 850 | "perf-event-open-sys", |
@@ -1344,9 +1344,9 @@ dependencies = [ | |||
1344 | 1344 | ||
1345 | [[package]] | 1345 | [[package]] |
1346 | name = "rustc-ap-rustc_lexer" | 1346 | name = "rustc-ap-rustc_lexer" |
1347 | version = "669.0.0" | 1347 | version = "671.0.0" |
1348 | source = "registry+https://github.com/rust-lang/crates.io-index" | 1348 | source = "registry+https://github.com/rust-lang/crates.io-index" |
1349 | checksum = "456af5f09c006cf6c22c1a433ee0232c4bb74bdc6c647a010166a47c94ed2a63" | 1349 | checksum = "22e1221f3bfa2943c942cf8da319ab2346887f8757778c29c7f1822cd27b521f" |
1350 | dependencies = [ | 1350 | dependencies = [ |
1351 | "unicode-xid", | 1351 | "unicode-xid", |
1352 | ] | 1352 | ] |
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs index 01adb834c..5ea4f9f5b 100644 --- a/crates/ra_assists/src/ast_transform.rs +++ b/crates/ra_assists/src/ast_transform.rs | |||
@@ -41,7 +41,7 @@ impl<'a> SubstituteTypeParams<'a> { | |||
41 | source_scope: &'a SemanticsScope<'a>, | 41 | source_scope: &'a SemanticsScope<'a>, |
42 | // FIXME: there's implicit invariant that `trait_` and `source_scope` match... | 42 | // FIXME: there's implicit invariant that `trait_` and `source_scope` match... |
43 | trait_: hir::Trait, | 43 | trait_: hir::Trait, |
44 | impl_def: ast::ImplDef, | 44 | impl_def: ast::Impl, |
45 | ) -> SubstituteTypeParams<'a> { | 45 | ) -> SubstituteTypeParams<'a> { |
46 | let substs = get_syntactic_substs(impl_def).unwrap_or_default(); | 46 | let substs = get_syntactic_substs(impl_def).unwrap_or_default(); |
47 | let generic_def: hir::GenericDef = trait_.into(); | 47 | let generic_def: hir::GenericDef = trait_.into(); |
@@ -80,7 +80,7 @@ impl<'a> SubstituteTypeParams<'a> { | |||
80 | 80 | ||
81 | // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the | 81 | // FIXME: It would probably be nicer if we could get this via HIR (i.e. get the |
82 | // trait ref, and then go from the types in the substs back to the syntax) | 82 | // trait ref, and then go from the types in the substs back to the syntax) |
83 | fn get_syntactic_substs(impl_def: ast::ImplDef) -> Option<Vec<ast::TypeRef>> { | 83 | fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::TypeRef>> { |
84 | let target_trait = impl_def.target_trait()?; | 84 | let target_trait = impl_def.target_trait()?; |
85 | let path_type = match target_trait { | 85 | let path_type = match target_trait { |
86 | ast::TypeRef::PathType(path) => path, | 86 | ast::TypeRef::PathType(path) => path, |
diff --git a/crates/ra_assists/src/handlers/add_custom_impl.rs b/crates/ra_assists/src/handlers/add_custom_impl.rs index acb07e36a..b67438b6b 100644 --- a/crates/ra_assists/src/handlers/add_custom_impl.rs +++ b/crates/ra_assists/src/handlers/add_custom_impl.rs | |||
@@ -29,8 +29,8 @@ use crate::{ | |||
29 | // } | 29 | // } |
30 | // ``` | 30 | // ``` |
31 | pub(crate) fn add_custom_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 31 | pub(crate) fn add_custom_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
32 | let input = ctx.find_node_at_offset::<ast::AttrInput>()?; | 32 | let attr = ctx.find_node_at_offset::<ast::Attr>()?; |
33 | let attr = input.syntax().parent().and_then(ast::Attr::cast)?; | 33 | let input = attr.token_tree()?; |
34 | 34 | ||
35 | let attr_name = attr | 35 | let attr_name = attr |
36 | .syntax() | 36 | .syntax() |
diff --git a/crates/ra_assists/src/handlers/add_explicit_type.rs b/crates/ra_assists/src/handlers/add_explicit_type.rs index 39a5321d1..e69f0a89b 100644 --- a/crates/ra_assists/src/handlers/add_explicit_type.rs +++ b/crates/ra_assists/src/handlers/add_explicit_type.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use hir::HirDisplay; | 1 | use hir::HirDisplay; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | ast::{self, AstNode, LetStmt, NameOwner, TypeAscriptionOwner}, | 3 | ast::{self, AstNode, LetStmt, NameOwner}, |
4 | TextRange, | 4 | TextRange, |
5 | }; | 5 | }; |
6 | 6 | ||
@@ -22,11 +22,11 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
22 | // } | 22 | // } |
23 | // ``` | 23 | // ``` |
24 | pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 24 | pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
25 | let stmt = ctx.find_node_at_offset::<LetStmt>()?; | 25 | let let_stmt = ctx.find_node_at_offset::<LetStmt>()?; |
26 | let module = ctx.sema.scope(stmt.syntax()).module()?; | 26 | let module = ctx.sema.scope(let_stmt.syntax()).module()?; |
27 | let expr = stmt.initializer()?; | 27 | let expr = let_stmt.initializer()?; |
28 | // Must be a binding | 28 | // Must be a binding |
29 | let pat = match stmt.pat()? { | 29 | let pat = match let_stmt.pat()? { |
30 | ast::Pat::BindPat(bind_pat) => bind_pat, | 30 | ast::Pat::BindPat(bind_pat) => bind_pat, |
31 | _ => return None, | 31 | _ => return None, |
32 | }; | 32 | }; |
@@ -34,8 +34,8 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio | |||
34 | // The binding must have a name | 34 | // The binding must have a name |
35 | let name = pat.name()?; | 35 | let name = pat.name()?; |
36 | let name_range = name.syntax().text_range(); | 36 | let name_range = name.syntax().text_range(); |
37 | let stmt_range = stmt.syntax().text_range(); | 37 | let stmt_range = let_stmt.syntax().text_range(); |
38 | let eq_range = stmt.eq_token()?.text_range(); | 38 | let eq_range = let_stmt.eq_token()?.text_range(); |
39 | // Assist should only be applicable if cursor is between 'let' and '=' | 39 | // Assist should only be applicable if cursor is between 'let' and '=' |
40 | let let_range = TextRange::new(stmt_range.start(), eq_range.start()); | 40 | let let_range = TextRange::new(stmt_range.start(), eq_range.start()); |
41 | let cursor_in_range = let_range.contains_range(ctx.frange.range); | 41 | let cursor_in_range = let_range.contains_range(ctx.frange.range); |
@@ -44,7 +44,7 @@ pub(crate) fn add_explicit_type(acc: &mut Assists, ctx: &AssistContext) -> Optio | |||
44 | } | 44 | } |
45 | // Assist not applicable if the type has already been specified | 45 | // Assist not applicable if the type has already been specified |
46 | // and it has no placeholders | 46 | // and it has no placeholders |
47 | let ascribed_ty = stmt.ascribed_type(); | 47 | let ascribed_ty = let_stmt.ty(); |
48 | if let Some(ty) = &ascribed_ty { | 48 | if let Some(ty) = &ascribed_ty { |
49 | if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() { | 49 | if ty.syntax().descendants().find_map(ast::PlaceholderType::cast).is_none() { |
50 | return None; | 50 | return None; |
diff --git a/crates/ra_assists/src/handlers/add_missing_impl_members.rs b/crates/ra_assists/src/handlers/add_missing_impl_members.rs index a2d9006e4..95a750aee 100644 --- a/crates/ra_assists/src/handlers/add_missing_impl_members.rs +++ b/crates/ra_assists/src/handlers/add_missing_impl_members.rs | |||
@@ -111,16 +111,16 @@ fn add_missing_impl_members_inner( | |||
111 | label: &'static str, | 111 | label: &'static str, |
112 | ) -> Option<()> { | 112 | ) -> Option<()> { |
113 | let _p = ra_prof::profile("add_missing_impl_members_inner"); | 113 | let _p = ra_prof::profile("add_missing_impl_members_inner"); |
114 | let impl_def = ctx.find_node_at_offset::<ast::ImplDef>()?; | 114 | let impl_def = ctx.find_node_at_offset::<ast::Impl>()?; |
115 | let impl_item_list = impl_def.assoc_item_list()?; | 115 | let impl_item_list = impl_def.assoc_item_list()?; |
116 | 116 | ||
117 | let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?; | 117 | let trait_ = resolve_target_trait(&ctx.sema, &impl_def)?; |
118 | 118 | ||
119 | let def_name = |item: &ast::AssocItem| -> Option<SmolStr> { | 119 | let def_name = |item: &ast::AssocItem| -> Option<SmolStr> { |
120 | match item { | 120 | match item { |
121 | ast::AssocItem::FnDef(def) => def.name(), | 121 | ast::AssocItem::Fn(def) => def.name(), |
122 | ast::AssocItem::TypeAliasDef(def) => def.name(), | 122 | ast::AssocItem::TypeAlias(def) => def.name(), |
123 | ast::AssocItem::ConstDef(def) => def.name(), | 123 | ast::AssocItem::Const(def) => def.name(), |
124 | ast::AssocItem::MacroCall(_) => None, | 124 | ast::AssocItem::MacroCall(_) => None, |
125 | } | 125 | } |
126 | .map(|it| it.text().clone()) | 126 | .map(|it| it.text().clone()) |
@@ -129,13 +129,13 @@ fn add_missing_impl_members_inner( | |||
129 | let missing_items = get_missing_assoc_items(&ctx.sema, &impl_def) | 129 | let missing_items = get_missing_assoc_items(&ctx.sema, &impl_def) |
130 | .iter() | 130 | .iter() |
131 | .map(|i| match i { | 131 | .map(|i| match i { |
132 | hir::AssocItem::Function(i) => ast::AssocItem::FnDef(i.source(ctx.db()).value), | 132 | hir::AssocItem::Function(i) => ast::AssocItem::Fn(i.source(ctx.db()).value), |
133 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAliasDef(i.source(ctx.db()).value), | 133 | hir::AssocItem::TypeAlias(i) => ast::AssocItem::TypeAlias(i.source(ctx.db()).value), |
134 | hir::AssocItem::Const(i) => ast::AssocItem::ConstDef(i.source(ctx.db()).value), | 134 | hir::AssocItem::Const(i) => ast::AssocItem::Const(i.source(ctx.db()).value), |
135 | }) | 135 | }) |
136 | .filter(|t| def_name(&t).is_some()) | 136 | .filter(|t| def_name(&t).is_some()) |
137 | .filter(|t| match t { | 137 | .filter(|t| match t { |
138 | ast::AssocItem::FnDef(def) => match mode { | 138 | ast::AssocItem::Fn(def) => match mode { |
139 | AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(), | 139 | AddMissingImplMembersMode::DefaultMethodsOnly => def.body().is_some(), |
140 | AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(), | 140 | AddMissingImplMembersMode::NoDefaultMethods => def.body().is_none(), |
141 | }, | 141 | }, |
@@ -158,10 +158,8 @@ fn add_missing_impl_members_inner( | |||
158 | .into_iter() | 158 | .into_iter() |
159 | .map(|it| ast_transform::apply(&*ast_transform, it)) | 159 | .map(|it| ast_transform::apply(&*ast_transform, it)) |
160 | .map(|it| match it { | 160 | .map(|it| match it { |
161 | ast::AssocItem::FnDef(def) => ast::AssocItem::FnDef(add_body(def)), | 161 | ast::AssocItem::Fn(def) => ast::AssocItem::Fn(add_body(def)), |
162 | ast::AssocItem::TypeAliasDef(def) => { | 162 | ast::AssocItem::TypeAlias(def) => ast::AssocItem::TypeAlias(def.remove_bounds()), |
163 | ast::AssocItem::TypeAliasDef(def.remove_bounds()) | ||
164 | } | ||
165 | _ => it, | 163 | _ => it, |
166 | }) | 164 | }) |
167 | .map(|it| edit::remove_attrs_and_docs(&it)); | 165 | .map(|it| edit::remove_attrs_and_docs(&it)); |
@@ -174,7 +172,7 @@ fn add_missing_impl_members_inner( | |||
174 | Some(cap) => { | 172 | Some(cap) => { |
175 | let mut cursor = Cursor::Before(first_new_item.syntax()); | 173 | let mut cursor = Cursor::Before(first_new_item.syntax()); |
176 | let placeholder; | 174 | let placeholder; |
177 | if let ast::AssocItem::FnDef(func) = &first_new_item { | 175 | if let ast::AssocItem::Fn(func) = &first_new_item { |
178 | if let Some(m) = func.syntax().descendants().find_map(ast::MacroCall::cast) { | 176 | if let Some(m) = func.syntax().descendants().find_map(ast::MacroCall::cast) { |
179 | if m.syntax().text() == "todo!()" { | 177 | if m.syntax().text() == "todo!()" { |
180 | placeholder = m; | 178 | placeholder = m; |
@@ -192,7 +190,7 @@ fn add_missing_impl_members_inner( | |||
192 | }) | 190 | }) |
193 | } | 191 | } |
194 | 192 | ||
195 | fn add_body(fn_def: ast::FnDef) -> ast::FnDef { | 193 | fn add_body(fn_def: ast::Fn) -> ast::Fn { |
196 | if fn_def.body().is_some() { | 194 | if fn_def.body().is_some() { |
197 | return fn_def; | 195 | return fn_def; |
198 | } | 196 | } |
diff --git a/crates/ra_assists/src/handlers/change_return_type_to_result.rs b/crates/ra_assists/src/handlers/change_return_type_to_result.rs index def00f7d8..167e162d8 100644 --- a/crates/ra_assists/src/handlers/change_return_type_to_result.rs +++ b/crates/ra_assists/src/handlers/change_return_type_to_result.rs | |||
@@ -20,9 +20,9 @@ use test_utils::mark; | |||
20 | pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 20 | pub(crate) fn change_return_type_to_result(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
21 | let ret_type = ctx.find_node_at_offset::<ast::RetType>()?; | 21 | let ret_type = ctx.find_node_at_offset::<ast::RetType>()?; |
22 | // FIXME: extend to lambdas as well | 22 | // FIXME: extend to lambdas as well |
23 | let fn_def = ret_type.syntax().parent().and_then(ast::FnDef::cast)?; | 23 | let fn_def = ret_type.syntax().parent().and_then(ast::Fn::cast)?; |
24 | 24 | ||
25 | let type_ref = &ret_type.type_ref()?; | 25 | let type_ref = &ret_type.ty()?; |
26 | let ret_type_str = type_ref.syntax().text().to_string(); | 26 | let ret_type_str = type_ref.syntax().text().to_string(); |
27 | let first_part_ret_type = ret_type_str.splitn(2, '<').next(); | 27 | let first_part_ret_type = ret_type_str.splitn(2, '<').next(); |
28 | if let Some(ret_type_first_part) = first_part_ret_type { | 28 | if let Some(ret_type_first_part) = first_part_ret_type { |
@@ -240,7 +240,7 @@ fn get_tail_expr_from_block(expr: &Expr) -> Option<Vec<NodeType>> { | |||
240 | Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 240 | Expr::ParenExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
241 | Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 241 | Expr::PathExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
242 | Expr::Label(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 242 | Expr::Label(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
243 | Expr::RecordLit(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 243 | Expr::RecordExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
244 | Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 244 | Expr::IndexExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
245 | Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 245 | Expr::MethodCallExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
246 | Expr::AwaitExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), | 246 | Expr::AwaitExpr(expr) => Some(vec![NodeType::Leaf(expr.syntax().clone())]), |
diff --git a/crates/ra_assists/src/handlers/change_visibility.rs b/crates/ra_assists/src/handlers/change_visibility.rs index 4343b423c..724daa93f 100644 --- a/crates/ra_assists/src/handlers/change_visibility.rs +++ b/crates/ra_assists/src/handlers/change_visibility.rs | |||
@@ -1,9 +1,7 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, NameOwner, VisibilityOwner}, | 2 | ast::{self, NameOwner, VisibilityOwner}, |
3 | AstNode, | 3 | AstNode, |
4 | SyntaxKind::{ | 4 | SyntaxKind::{CONST, ENUM, FN, MODULE, STATIC, STRUCT, TRAIT, VISIBILITY}, |
5 | CONST_DEF, ENUM_DEF, FN_DEF, MODULE, STATIC_DEF, STRUCT_DEF, TRAIT_DEF, VISIBILITY, | ||
6 | }, | ||
7 | T, | 5 | T, |
8 | }; | 6 | }; |
9 | use test_utils::mark; | 7 | use test_utils::mark; |
@@ -38,7 +36,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
38 | 36 | ||
39 | let (offset, target) = if let Some(keyword) = item_keyword { | 37 | let (offset, target) = if let Some(keyword) = item_keyword { |
40 | let parent = keyword.parent(); | 38 | let parent = keyword.parent(); |
41 | let def_kws = vec![CONST_DEF, STATIC_DEF, FN_DEF, MODULE, STRUCT_DEF, ENUM_DEF, TRAIT_DEF]; | 39 | let def_kws = vec![CONST, STATIC, FN, MODULE, STRUCT, ENUM, TRAIT]; |
42 | // Parent is not a definition, can't add visibility | 40 | // Parent is not a definition, can't add visibility |
43 | if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { | 41 | if !def_kws.iter().any(|&def_kw| def_kw == parent.kind()) { |
44 | return None; | 42 | return None; |
@@ -49,7 +47,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
49 | } | 47 | } |
50 | (vis_offset(&parent), keyword.text_range()) | 48 | (vis_offset(&parent), keyword.text_range()) |
51 | } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { | 49 | } else if let Some(field_name) = ctx.find_node_at_offset::<ast::Name>() { |
52 | let field = field_name.syntax().ancestors().find_map(ast::RecordFieldDef::cast)?; | 50 | let field = field_name.syntax().ancestors().find_map(ast::RecordField::cast)?; |
53 | if field.name()? != field_name { | 51 | if field.name()? != field_name { |
54 | mark::hit!(change_visibility_field_false_positive); | 52 | mark::hit!(change_visibility_field_false_positive); |
55 | return None; | 53 | return None; |
@@ -58,7 +56,7 @@ fn add_vis(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
58 | return None; | 56 | return None; |
59 | } | 57 | } |
60 | (vis_offset(field.syntax()), field_name.syntax().text_range()) | 58 | (vis_offset(field.syntax()), field_name.syntax().text_range()) |
61 | } else if let Some(field) = ctx.find_node_at_offset::<ast::TupleFieldDef>() { | 59 | } else if let Some(field) = ctx.find_node_at_offset::<ast::TupleField>() { |
62 | if field.visibility().is_some() { | 60 | if field.visibility().is_some() { |
63 | return None; | 61 | return None; |
64 | } | 62 | } |
diff --git a/crates/ra_assists/src/handlers/early_return.rs b/crates/ra_assists/src/handlers/early_return.rs index 330459f3c..3650289fd 100644 --- a/crates/ra_assists/src/handlers/early_return.rs +++ b/crates/ra_assists/src/handlers/early_return.rs | |||
@@ -8,7 +8,7 @@ use ra_syntax::{ | |||
8 | make, | 8 | make, |
9 | }, | 9 | }, |
10 | AstNode, | 10 | AstNode, |
11 | SyntaxKind::{FN_DEF, LOOP_EXPR, L_CURLY, R_CURLY, WHILE_EXPR, WHITESPACE}, | 11 | SyntaxKind::{FN, LOOP_EXPR, L_CURLY, R_CURLY, WHILE_EXPR, WHITESPACE}, |
12 | SyntaxNode, | 12 | SyntaxNode, |
13 | }; | 13 | }; |
14 | 14 | ||
@@ -88,7 +88,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext) | |||
88 | 88 | ||
89 | let early_expression: ast::Expr = match parent_container.kind() { | 89 | let early_expression: ast::Expr = match parent_container.kind() { |
90 | WHILE_EXPR | LOOP_EXPR => make::expr_continue(), | 90 | WHILE_EXPR | LOOP_EXPR => make::expr_continue(), |
91 | FN_DEF => make::expr_return(), | 91 | FN => make::expr_return(), |
92 | _ => return None, | 92 | _ => return None, |
93 | }; | 93 | }; |
94 | 94 | ||
diff --git a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs index 2b8e273b3..ccec688ca 100644 --- a/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/ra_assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -31,7 +31,7 @@ pub(crate) fn extract_struct_from_enum_variant( | |||
31 | acc: &mut Assists, | 31 | acc: &mut Assists, |
32 | ctx: &AssistContext, | 32 | ctx: &AssistContext, |
33 | ) -> Option<()> { | 33 | ) -> Option<()> { |
34 | let variant = ctx.find_node_at_offset::<ast::EnumVariant>()?; | 34 | let variant = ctx.find_node_at_offset::<ast::Variant>()?; |
35 | let field_list = match variant.kind() { | 35 | let field_list = match variant.kind() { |
36 | ast::StructKind::Tuple(field_list) => field_list, | 36 | ast::StructKind::Tuple(field_list) => field_list, |
37 | _ => return None, | 37 | _ => return None, |
diff --git a/crates/ra_assists/src/handlers/extract_variable.rs b/crates/ra_assists/src/handlers/extract_variable.rs index 098adf078..b925a2884 100644 --- a/crates/ra_assists/src/handlers/extract_variable.rs +++ b/crates/ra_assists/src/handlers/extract_variable.rs | |||
@@ -45,7 +45,7 @@ pub(crate) fn extract_variable(acc: &mut Assists, ctx: &AssistContext) -> Option | |||
45 | target, | 45 | target, |
46 | move |edit| { | 46 | move |edit| { |
47 | let field_shorthand = | 47 | let field_shorthand = |
48 | match to_extract.syntax().parent().and_then(ast::RecordField::cast) { | 48 | match to_extract.syntax().parent().and_then(ast::RecordExprField::cast) { |
49 | Some(field) => field.name_ref(), | 49 | Some(field) => field.name_ref(), |
50 | None => None, | 50 | None => None, |
51 | }; | 51 | }; |
diff --git a/crates/ra_assists/src/handlers/fix_visibility.rs b/crates/ra_assists/src/handlers/fix_visibility.rs index 1d3ed3c6a..1aefa79cc 100644 --- a/crates/ra_assists/src/handlers/fix_visibility.rs +++ b/crates/ra_assists/src/handlers/fix_visibility.rs | |||
@@ -82,7 +82,7 @@ fn add_vis_to_referenced_module_def(acc: &mut Assists, ctx: &AssistContext) -> O | |||
82 | } | 82 | } |
83 | 83 | ||
84 | fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 84 | fn add_vis_to_referenced_record_field(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
85 | let record_field: ast::RecordField = ctx.find_node_at_offset()?; | 85 | let record_field: ast::RecordExprField = ctx.find_node_at_offset()?; |
86 | let (record_field_def, _) = ctx.sema.resolve_record_field(&record_field)?; | 86 | let (record_field_def, _) = ctx.sema.resolve_record_field(&record_field)?; |
87 | 87 | ||
88 | let current_module = ctx.sema.scope(record_field.syntax()).module()?; | 88 | let current_module = ctx.sema.scope(record_field.syntax()).module()?; |
diff --git a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs index a347e3c2e..9da23640a 100644 --- a/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ra_assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -22,7 +22,7 @@ use crate::{utils::FamousDefs, AssistContext, AssistId, AssistKind, Assists}; | |||
22 | // } | 22 | // } |
23 | // ``` | 23 | // ``` |
24 | pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 24 | pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
25 | let variant = ctx.find_node_at_offset::<ast::EnumVariant>()?; | 25 | let variant = ctx.find_node_at_offset::<ast::Variant>()?; |
26 | let variant_name = variant.name()?; | 26 | let variant_name = variant.name()?; |
27 | let enum_name = variant.parent_enum().name()?; | 27 | let enum_name = variant.parent_enum().name()?; |
28 | let field_list = match variant.kind() { | 28 | let field_list = match variant.kind() { |
@@ -32,7 +32,7 @@ pub(crate) fn generate_from_impl_for_enum(acc: &mut Assists, ctx: &AssistContext | |||
32 | if field_list.fields().count() != 1 { | 32 | if field_list.fields().count() != 1 { |
33 | return None; | 33 | return None; |
34 | } | 34 | } |
35 | let field_type = field_list.fields().next()?.type_ref()?; | 35 | let field_type = field_list.fields().next()?.ty()?; |
36 | let path = match field_type { | 36 | let path = match field_type { |
37 | ast::TypeRef::PathType(it) => it, | 37 | ast::TypeRef::PathType(it) => it, |
38 | _ => return None, | 38 | _ => return None, |
@@ -69,7 +69,7 @@ impl From<{0}> for {1} {{ | |||
69 | 69 | ||
70 | fn existing_from_impl( | 70 | fn existing_from_impl( |
71 | sema: &'_ hir::Semantics<'_, RootDatabase>, | 71 | sema: &'_ hir::Semantics<'_, RootDatabase>, |
72 | variant: &ast::EnumVariant, | 72 | variant: &ast::Variant, |
73 | ) -> Option<()> { | 73 | ) -> Option<()> { |
74 | let variant = sema.to_def(variant)?; | 74 | let variant = sema.to_def(variant)?; |
75 | let enum_ = variant.parent_enum(sema.db); | 75 | let enum_ = variant.parent_enum(sema.db); |
diff --git a/crates/ra_assists/src/handlers/generate_function.rs b/crates/ra_assists/src/handlers/generate_function.rs index b721b96bb..56510861d 100644 --- a/crates/ra_assists/src/handlers/generate_function.rs +++ b/crates/ra_assists/src/handlers/generate_function.rs | |||
@@ -82,7 +82,7 @@ struct FunctionTemplate { | |||
82 | insert_offset: TextSize, | 82 | insert_offset: TextSize, |
83 | placeholder_expr: ast::MacroCall, | 83 | placeholder_expr: ast::MacroCall, |
84 | leading_ws: String, | 84 | leading_ws: String, |
85 | fn_def: ast::FnDef, | 85 | fn_def: ast::Fn, |
86 | trailing_ws: String, | 86 | trailing_ws: String, |
87 | file: FileId, | 87 | file: FileId, |
88 | } | 88 | } |
@@ -104,7 +104,7 @@ impl FunctionTemplate { | |||
104 | struct FunctionBuilder { | 104 | struct FunctionBuilder { |
105 | target: GeneratedFunctionTarget, | 105 | target: GeneratedFunctionTarget, |
106 | fn_name: ast::Name, | 106 | fn_name: ast::Name, |
107 | type_params: Option<ast::TypeParamList>, | 107 | type_params: Option<ast::GenericParamList>, |
108 | params: ast::ParamList, | 108 | params: ast::ParamList, |
109 | file: FileId, | 109 | file: FileId, |
110 | needs_pub: bool, | 110 | needs_pub: bool, |
@@ -200,7 +200,7 @@ fn fn_args( | |||
200 | ctx: &AssistContext, | 200 | ctx: &AssistContext, |
201 | target_module: hir::Module, | 201 | target_module: hir::Module, |
202 | call: &ast::CallExpr, | 202 | call: &ast::CallExpr, |
203 | ) -> Option<(Option<ast::TypeParamList>, ast::ParamList)> { | 203 | ) -> Option<(Option<ast::GenericParamList>, ast::ParamList)> { |
204 | let mut arg_names = Vec::new(); | 204 | let mut arg_names = Vec::new(); |
205 | let mut arg_types = Vec::new(); | 205 | let mut arg_types = Vec::new(); |
206 | for arg in call.arg_list()?.args() { | 206 | for arg in call.arg_list()?.args() { |
diff --git a/crates/ra_assists/src/handlers/generate_impl.rs b/crates/ra_assists/src/handlers/generate_impl.rs index 42eb4defa..d9b87c9c0 100644 --- a/crates/ra_assists/src/handlers/generate_impl.rs +++ b/crates/ra_assists/src/handlers/generate_impl.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | use ra_syntax::ast::{self, AstNode, NameOwner, TypeParamsOwner}; | 1 | use ra_syntax::ast::{self, AstNode, GenericParamsOwner, NameOwner}; |
2 | use stdx::{format_to, SepBy}; | 2 | use stdx::{format_to, SepBy}; |
3 | 3 | ||
4 | use crate::{AssistContext, AssistId, AssistKind, Assists}; | 4 | use crate::{AssistContext, AssistId, AssistKind, Assists}; |
@@ -31,7 +31,7 @@ pub(crate) fn generate_impl(acc: &mut Assists, ctx: &AssistContext) -> Option<() | |||
31 | format!("Generate impl for `{}`", name), | 31 | format!("Generate impl for `{}`", name), |
32 | target, | 32 | target, |
33 | |edit| { | 33 | |edit| { |
34 | let type_params = nominal.type_param_list(); | 34 | let type_params = nominal.generic_param_list(); |
35 | let start_offset = nominal.syntax().text_range().end(); | 35 | let start_offset = nominal.syntax().text_range().end(); |
36 | let mut buf = String::new(); | 36 | let mut buf = String::new(); |
37 | buf.push_str("\n\nimpl"); | 37 | buf.push_str("\n\nimpl"); |
diff --git a/crates/ra_assists/src/handlers/generate_new.rs b/crates/ra_assists/src/handlers/generate_new.rs index 25bc171bf..b84aa24b6 100644 --- a/crates/ra_assists/src/handlers/generate_new.rs +++ b/crates/ra_assists/src/handlers/generate_new.rs | |||
@@ -1,8 +1,6 @@ | |||
1 | use hir::Adt; | 1 | use hir::Adt; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | ast::{ | 3 | ast::{self, AstNode, GenericParamsOwner, NameOwner, StructKind, VisibilityOwner}, |
4 | self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner, | ||
5 | }, | ||
6 | T, | 4 | T, |
7 | }; | 5 | }; |
8 | use stdx::{format_to, SepBy}; | 6 | use stdx::{format_to, SepBy}; |
@@ -30,7 +28,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
30 | // | 28 | // |
31 | // ``` | 29 | // ``` |
32 | pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 30 | pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
33 | let strukt = ctx.find_node_at_offset::<ast::StructDef>()?; | 31 | let strukt = ctx.find_node_at_offset::<ast::Struct>()?; |
34 | 32 | ||
35 | // We want to only apply this to non-union structs with named fields | 33 | // We want to only apply this to non-union structs with named fields |
36 | let field_list = match strukt.kind() { | 34 | let field_list = match strukt.kind() { |
@@ -53,9 +51,7 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
53 | 51 | ||
54 | let params = field_list | 52 | let params = field_list |
55 | .fields() | 53 | .fields() |
56 | .filter_map(|f| { | 54 | .filter_map(|f| Some(format!("{}: {}", f.name()?.syntax(), f.ty()?.syntax()))) |
57 | Some(format!("{}: {}", f.name()?.syntax(), f.ascribed_type()?.syntax())) | ||
58 | }) | ||
59 | .sep_by(", "); | 55 | .sep_by(", "); |
60 | let fields = field_list.fields().filter_map(|f| f.name()).sep_by(", "); | 56 | let fields = field_list.fields().filter_map(|f| f.name()).sep_by(", "); |
61 | 57 | ||
@@ -90,8 +86,8 @@ pub(crate) fn generate_new(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
90 | 86 | ||
91 | // Generates the surrounding `impl Type { <code> }` including type and lifetime | 87 | // Generates the surrounding `impl Type { <code> }` including type and lifetime |
92 | // parameters | 88 | // parameters |
93 | fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { | 89 | fn generate_impl_text(strukt: &ast::Struct, code: &str) -> String { |
94 | let type_params = strukt.type_param_list(); | 90 | let type_params = strukt.generic_param_list(); |
95 | let mut buf = String::with_capacity(code.len()); | 91 | let mut buf = String::with_capacity(code.len()); |
96 | buf.push_str("\n\nimpl"); | 92 | buf.push_str("\n\nimpl"); |
97 | if let Some(type_params) = &type_params { | 93 | if let Some(type_params) = &type_params { |
@@ -121,7 +117,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { | |||
121 | // | 117 | // |
122 | // FIXME: change the new fn checking to a more semantic approach when that's more | 118 | // FIXME: change the new fn checking to a more semantic approach when that's more |
123 | // viable (e.g. we process proc macros, etc) | 119 | // viable (e.g. we process proc macros, etc) |
124 | fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Option<ast::ImplDef>> { | 120 | fn find_struct_impl(ctx: &AssistContext, strukt: &ast::Struct) -> Option<Option<ast::Impl>> { |
125 | let db = ctx.db(); | 121 | let db = ctx.db(); |
126 | let module = strukt.syntax().ancestors().find(|node| { | 122 | let module = strukt.syntax().ancestors().find(|node| { |
127 | ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) | 123 | ast::Module::can_cast(node.kind()) || ast::SourceFile::can_cast(node.kind()) |
@@ -129,7 +125,7 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Opti | |||
129 | 125 | ||
130 | let struct_def = ctx.sema.to_def(strukt)?; | 126 | let struct_def = ctx.sema.to_def(strukt)?; |
131 | 127 | ||
132 | let block = module.descendants().filter_map(ast::ImplDef::cast).find_map(|impl_blk| { | 128 | let block = module.descendants().filter_map(ast::Impl::cast).find_map(|impl_blk| { |
133 | let blk = ctx.sema.to_def(&impl_blk)?; | 129 | let blk = ctx.sema.to_def(&impl_blk)?; |
134 | 130 | ||
135 | // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}` | 131 | // FIXME: handle e.g. `struct S<T>; impl<U> S<U> {}` |
@@ -157,10 +153,10 @@ fn find_struct_impl(ctx: &AssistContext, strukt: &ast::StructDef) -> Option<Opti | |||
157 | Some(block) | 153 | Some(block) |
158 | } | 154 | } |
159 | 155 | ||
160 | fn has_new_fn(imp: &ast::ImplDef) -> bool { | 156 | fn has_new_fn(imp: &ast::Impl) -> bool { |
161 | if let Some(il) = imp.assoc_item_list() { | 157 | if let Some(il) = imp.assoc_item_list() { |
162 | for item in il.assoc_items() { | 158 | for item in il.assoc_items() { |
163 | if let ast::AssocItem::FnDef(f) = item { | 159 | if let ast::AssocItem::Fn(f) = item { |
164 | if let Some(name) = f.name() { | 160 | if let Some(name) = f.name() { |
165 | if name.text().eq_ignore_ascii_case("new") { | 161 | if name.text().eq_ignore_ascii_case("new") { |
166 | return true; | 162 | return true; |
diff --git a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs index 967593031..c3134f64d 100644 --- a/crates/ra_assists/src/handlers/introduce_named_lifetime.rs +++ b/crates/ra_assists/src/handlers/introduce_named_lifetime.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, NameOwner, TypeAscriptionOwner, TypeParamsOwner}, | 2 | ast::{self, GenericParamsOwner, NameOwner}, |
3 | AstNode, SyntaxKind, TextRange, TextSize, | 3 | AstNode, SyntaxKind, TextRange, TextSize, |
4 | }; | 4 | }; |
5 | use rustc_hash::FxHashSet; | 5 | use rustc_hash::FxHashSet; |
@@ -38,9 +38,9 @@ pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) - | |||
38 | let lifetime_token = ctx | 38 | let lifetime_token = ctx |
39 | .find_token_at_offset(SyntaxKind::LIFETIME) | 39 | .find_token_at_offset(SyntaxKind::LIFETIME) |
40 | .filter(|lifetime| lifetime.text() == "'_")?; | 40 | .filter(|lifetime| lifetime.text() == "'_")?; |
41 | if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::FnDef::cast) { | 41 | if let Some(fn_def) = lifetime_token.ancestors().find_map(ast::Fn::cast) { |
42 | generate_fn_def_assist(acc, &fn_def, lifetime_token.text_range()) | 42 | generate_fn_def_assist(acc, &fn_def, lifetime_token.text_range()) |
43 | } else if let Some(impl_def) = lifetime_token.ancestors().find_map(ast::ImplDef::cast) { | 43 | } else if let Some(impl_def) = lifetime_token.ancestors().find_map(ast::Impl::cast) { |
44 | generate_impl_def_assist(acc, &impl_def, lifetime_token.text_range()) | 44 | generate_impl_def_assist(acc, &impl_def, lifetime_token.text_range()) |
45 | } else { | 45 | } else { |
46 | None | 46 | None |
@@ -50,11 +50,11 @@ pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) - | |||
50 | /// Generate the assist for the fn def case | 50 | /// Generate the assist for the fn def case |
51 | fn generate_fn_def_assist( | 51 | fn generate_fn_def_assist( |
52 | acc: &mut Assists, | 52 | acc: &mut Assists, |
53 | fn_def: &ast::FnDef, | 53 | fn_def: &ast::Fn, |
54 | lifetime_loc: TextRange, | 54 | lifetime_loc: TextRange, |
55 | ) -> Option<()> { | 55 | ) -> Option<()> { |
56 | let param_list: ast::ParamList = fn_def.param_list()?; | 56 | let param_list: ast::ParamList = fn_def.param_list()?; |
57 | let new_lifetime_param = generate_unique_lifetime_param_name(&fn_def.type_param_list())?; | 57 | let new_lifetime_param = generate_unique_lifetime_param_name(&fn_def.generic_param_list())?; |
58 | let end_of_fn_ident = fn_def.name()?.ident_token()?.text_range().end(); | 58 | let end_of_fn_ident = fn_def.name()?.ident_token()?.text_range().end(); |
59 | let self_param = | 59 | let self_param = |
60 | // use the self if it's a reference and has no explicit lifetime | 60 | // use the self if it's a reference and has no explicit lifetime |
@@ -67,7 +67,7 @@ fn generate_fn_def_assist( | |||
67 | // otherwise, if there's a single reference parameter without a named liftime, use that | 67 | // otherwise, if there's a single reference parameter without a named liftime, use that |
68 | let fn_params_without_lifetime: Vec<_> = param_list | 68 | let fn_params_without_lifetime: Vec<_> = param_list |
69 | .params() | 69 | .params() |
70 | .filter_map(|param| match param.ascribed_type() { | 70 | .filter_map(|param| match param.ty() { |
71 | Some(ast::TypeRef::ReferenceType(ascribed_type)) | 71 | Some(ast::TypeRef::ReferenceType(ascribed_type)) |
72 | if ascribed_type.lifetime_token() == None => | 72 | if ascribed_type.lifetime_token() == None => |
73 | { | 73 | { |
@@ -93,10 +93,10 @@ fn generate_fn_def_assist( | |||
93 | /// Generate the assist for the impl def case | 93 | /// Generate the assist for the impl def case |
94 | fn generate_impl_def_assist( | 94 | fn generate_impl_def_assist( |
95 | acc: &mut Assists, | 95 | acc: &mut Assists, |
96 | impl_def: &ast::ImplDef, | 96 | impl_def: &ast::Impl, |
97 | lifetime_loc: TextRange, | 97 | lifetime_loc: TextRange, |
98 | ) -> Option<()> { | 98 | ) -> Option<()> { |
99 | let new_lifetime_param = generate_unique_lifetime_param_name(&impl_def.type_param_list())?; | 99 | let new_lifetime_param = generate_unique_lifetime_param_name(&impl_def.generic_param_list())?; |
100 | let end_of_impl_kw = impl_def.impl_token()?.text_range().end(); | 100 | let end_of_impl_kw = impl_def.impl_token()?.text_range().end(); |
101 | acc.add(AssistId(ASSIST_NAME, AssistKind::Refactor), ASSIST_LABEL, lifetime_loc, |builder| { | 101 | acc.add(AssistId(ASSIST_NAME, AssistKind::Refactor), ASSIST_LABEL, lifetime_loc, |builder| { |
102 | add_lifetime_param(impl_def, builder, end_of_impl_kw, new_lifetime_param); | 102 | add_lifetime_param(impl_def, builder, end_of_impl_kw, new_lifetime_param); |
@@ -107,7 +107,7 @@ fn generate_impl_def_assist( | |||
107 | /// Given a type parameter list, generate a unique lifetime parameter name | 107 | /// Given a type parameter list, generate a unique lifetime parameter name |
108 | /// which is not in the list | 108 | /// which is not in the list |
109 | fn generate_unique_lifetime_param_name( | 109 | fn generate_unique_lifetime_param_name( |
110 | existing_type_param_list: &Option<ast::TypeParamList>, | 110 | existing_type_param_list: &Option<ast::GenericParamList>, |
111 | ) -> Option<char> { | 111 | ) -> Option<char> { |
112 | match existing_type_param_list { | 112 | match existing_type_param_list { |
113 | Some(type_params) => { | 113 | Some(type_params) => { |
@@ -123,13 +123,13 @@ fn generate_unique_lifetime_param_name( | |||
123 | 123 | ||
124 | /// Add the lifetime param to `builder`. If there are type parameters in `type_params_owner`, add it to the end. Otherwise | 124 | /// Add the lifetime param to `builder`. If there are type parameters in `type_params_owner`, add it to the end. Otherwise |
125 | /// add new type params brackets with the lifetime parameter at `new_type_params_loc`. | 125 | /// add new type params brackets with the lifetime parameter at `new_type_params_loc`. |
126 | fn add_lifetime_param<TypeParamsOwner: ast::TypeParamsOwner>( | 126 | fn add_lifetime_param<TypeParamsOwner: ast::GenericParamsOwner>( |
127 | type_params_owner: &TypeParamsOwner, | 127 | type_params_owner: &TypeParamsOwner, |
128 | builder: &mut AssistBuilder, | 128 | builder: &mut AssistBuilder, |
129 | new_type_params_loc: TextSize, | 129 | new_type_params_loc: TextSize, |
130 | new_lifetime_param: char, | 130 | new_lifetime_param: char, |
131 | ) { | 131 | ) { |
132 | match type_params_owner.type_param_list() { | 132 | match type_params_owner.generic_param_list() { |
133 | // add the new lifetime parameter to an existing type param list | 133 | // add the new lifetime parameter to an existing type param list |
134 | Some(type_params) => { | 134 | Some(type_params) => { |
135 | builder.insert( | 135 | builder.insert( |
diff --git a/crates/ra_assists/src/handlers/move_bounds.rs b/crates/ra_assists/src/handlers/move_bounds.rs index 6b73fff44..6d394443e 100644 --- a/crates/ra_assists/src/handlers/move_bounds.rs +++ b/crates/ra_assists/src/handlers/move_bounds.rs | |||
@@ -23,7 +23,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
23 | // } | 23 | // } |
24 | // ``` | 24 | // ``` |
25 | pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 25 | pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
26 | let type_param_list = ctx.find_node_at_offset::<ast::TypeParamList>()?; | 26 | let type_param_list = ctx.find_node_at_offset::<ast::GenericParamList>()?; |
27 | 27 | ||
28 | let mut type_params = type_param_list.type_params(); | 28 | let mut type_params = type_param_list.type_params(); |
29 | if type_params.all(|p| p.type_bound_list().is_none()) { | 29 | if type_params.all(|p| p.type_bound_list().is_none()) { |
@@ -37,13 +37,13 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext | |||
37 | 37 | ||
38 | let anchor = match_ast! { | 38 | let anchor = match_ast! { |
39 | match parent { | 39 | match parent { |
40 | ast::FnDef(it) => it.body()?.syntax().clone().into(), | 40 | ast::Fn(it) => it.body()?.syntax().clone().into(), |
41 | ast::TraitDef(it) => it.assoc_item_list()?.syntax().clone().into(), | 41 | ast::Trait(it) => it.assoc_item_list()?.syntax().clone().into(), |
42 | ast::ImplDef(it) => it.assoc_item_list()?.syntax().clone().into(), | 42 | ast::Impl(it) => it.assoc_item_list()?.syntax().clone().into(), |
43 | ast::EnumDef(it) => it.variant_list()?.syntax().clone().into(), | 43 | ast::Enum(it) => it.variant_list()?.syntax().clone().into(), |
44 | ast::StructDef(it) => { | 44 | ast::Struct(it) => { |
45 | it.syntax().children_with_tokens() | 45 | it.syntax().children_with_tokens() |
46 | .find(|it| it.kind() == RECORD_FIELD_DEF_LIST || it.kind() == T![;])? | 46 | .find(|it| it.kind() == RECORD_FIELD_LIST || it.kind() == T![;])? |
47 | }, | 47 | }, |
48 | _ => return None | 48 | _ => return None |
49 | } | 49 | } |
diff --git a/crates/ra_assists/src/handlers/reorder_fields.rs b/crates/ra_assists/src/handlers/reorder_fields.rs index 2ac1c56cf..120250e79 100644 --- a/crates/ra_assists/src/handlers/reorder_fields.rs +++ b/crates/ra_assists/src/handlers/reorder_fields.rs | |||
@@ -23,7 +23,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
23 | // ``` | 23 | // ``` |
24 | // | 24 | // |
25 | pub(crate) fn reorder_fields(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 25 | pub(crate) fn reorder_fields(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
26 | reorder::<ast::RecordLit>(acc, ctx).or_else(|| reorder::<ast::RecordPat>(acc, ctx)) | 26 | reorder::<ast::RecordExpr>(acc, ctx).or_else(|| reorder::<ast::RecordPat>(acc, ctx)) |
27 | } | 27 | } |
28 | 28 | ||
29 | fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 29 | fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
@@ -56,7 +56,7 @@ fn reorder<R: AstNode>(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
56 | 56 | ||
57 | fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> { | 57 | fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> { |
58 | match node.kind() { | 58 | match node.kind() { |
59 | RECORD_LIT => vec![RECORD_FIELD], | 59 | RECORD_EXPR => vec![RECORD_EXPR_FIELD], |
60 | RECORD_PAT => vec![RECORD_FIELD_PAT, BIND_PAT], | 60 | RECORD_PAT => vec![RECORD_FIELD_PAT, BIND_PAT], |
61 | _ => vec![], | 61 | _ => vec![], |
62 | } | 62 | } |
@@ -65,7 +65,7 @@ fn get_fields_kind(node: &SyntaxNode) -> Vec<SyntaxKind> { | |||
65 | fn get_field_name(node: &SyntaxNode) -> String { | 65 | fn get_field_name(node: &SyntaxNode) -> String { |
66 | let res = match_ast! { | 66 | let res = match_ast! { |
67 | match node { | 67 | match node { |
68 | ast::RecordField(field) => field.field_name().map(|it| it.to_string()), | 68 | ast::RecordExprField(field) => field.field_name().map(|it| it.to_string()), |
69 | ast::RecordFieldPat(field) => field.field_name().map(|it| it.to_string()), | 69 | ast::RecordFieldPat(field) => field.field_name().map(|it| it.to_string()), |
70 | _ => None, | 70 | _ => None, |
71 | } | 71 | } |
diff --git a/crates/ra_assists/src/utils.rs b/crates/ra_assists/src/utils.rs index 27c33df23..bb16ebd4e 100644 --- a/crates/ra_assists/src/utils.rs +++ b/crates/ra_assists/src/utils.rs | |||
@@ -56,7 +56,7 @@ pub(crate) fn render_snippet(_cap: SnippetCap, node: &SyntaxNode, cursor: Cursor | |||
56 | 56 | ||
57 | pub fn get_missing_assoc_items( | 57 | pub fn get_missing_assoc_items( |
58 | sema: &Semantics<RootDatabase>, | 58 | sema: &Semantics<RootDatabase>, |
59 | impl_def: &ast::ImplDef, | 59 | impl_def: &ast::Impl, |
60 | ) -> Vec<hir::AssocItem> { | 60 | ) -> Vec<hir::AssocItem> { |
61 | // Names must be unique between constants and functions. However, type aliases | 61 | // Names must be unique between constants and functions. However, type aliases |
62 | // may share the same name as a function or constant. | 62 | // may share the same name as a function or constant. |
@@ -66,19 +66,19 @@ pub fn get_missing_assoc_items( | |||
66 | if let Some(item_list) = impl_def.assoc_item_list() { | 66 | if let Some(item_list) = impl_def.assoc_item_list() { |
67 | for item in item_list.assoc_items() { | 67 | for item in item_list.assoc_items() { |
68 | match item { | 68 | match item { |
69 | ast::AssocItem::FnDef(f) => { | 69 | ast::AssocItem::Fn(f) => { |
70 | if let Some(n) = f.name() { | 70 | if let Some(n) = f.name() { |
71 | impl_fns_consts.insert(n.syntax().to_string()); | 71 | impl_fns_consts.insert(n.syntax().to_string()); |
72 | } | 72 | } |
73 | } | 73 | } |
74 | 74 | ||
75 | ast::AssocItem::TypeAliasDef(t) => { | 75 | ast::AssocItem::TypeAlias(t) => { |
76 | if let Some(n) = t.name() { | 76 | if let Some(n) = t.name() { |
77 | impl_type.insert(n.syntax().to_string()); | 77 | impl_type.insert(n.syntax().to_string()); |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | ast::AssocItem::ConstDef(c) => { | 81 | ast::AssocItem::Const(c) => { |
82 | if let Some(n) = c.name() { | 82 | if let Some(n) = c.name() { |
83 | impl_fns_consts.insert(n.syntax().to_string()); | 83 | impl_fns_consts.insert(n.syntax().to_string()); |
84 | } | 84 | } |
@@ -109,7 +109,7 @@ pub fn get_missing_assoc_items( | |||
109 | 109 | ||
110 | pub(crate) fn resolve_target_trait( | 110 | pub(crate) fn resolve_target_trait( |
111 | sema: &Semantics<RootDatabase>, | 111 | sema: &Semantics<RootDatabase>, |
112 | impl_def: &ast::ImplDef, | 112 | impl_def: &ast::Impl, |
113 | ) -> Option<hir::Trait> { | 113 | ) -> Option<hir::Trait> { |
114 | let ast_path = impl_def | 114 | let ast_path = impl_def |
115 | .target_trait() | 115 | .target_trait() |
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 859bdfb3b..36c0bdc9e 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -361,8 +361,8 @@ pub struct Field { | |||
361 | 361 | ||
362 | #[derive(Debug, PartialEq, Eq)] | 362 | #[derive(Debug, PartialEq, Eq)] |
363 | pub enum FieldSource { | 363 | pub enum FieldSource { |
364 | Named(ast::RecordFieldDef), | 364 | Named(ast::RecordField), |
365 | Pos(ast::TupleFieldDef), | 365 | Pos(ast::TupleField), |
366 | } | 366 | } |
367 | 367 | ||
368 | impl Field { | 368 | impl Field { |
diff --git a/crates/ra_hir/src/has_source.rs b/crates/ra_hir/src/has_source.rs index 76c32fc17..1c691d961 100644 --- a/crates/ra_hir/src/has_source.rs +++ b/crates/ra_hir/src/has_source.rs | |||
@@ -57,56 +57,56 @@ impl HasSource for Field { | |||
57 | } | 57 | } |
58 | } | 58 | } |
59 | impl HasSource for Struct { | 59 | impl HasSource for Struct { |
60 | type Ast = ast::StructDef; | 60 | type Ast = ast::Struct; |
61 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::StructDef> { | 61 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Struct> { |
62 | self.id.lookup(db.upcast()).source(db.upcast()) | 62 | self.id.lookup(db.upcast()).source(db.upcast()) |
63 | } | 63 | } |
64 | } | 64 | } |
65 | impl HasSource for Union { | 65 | impl HasSource for Union { |
66 | type Ast = ast::UnionDef; | 66 | type Ast = ast::Union; |
67 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::UnionDef> { | 67 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Union> { |
68 | self.id.lookup(db.upcast()).source(db.upcast()) | 68 | self.id.lookup(db.upcast()).source(db.upcast()) |
69 | } | 69 | } |
70 | } | 70 | } |
71 | impl HasSource for Enum { | 71 | impl HasSource for Enum { |
72 | type Ast = ast::EnumDef; | 72 | type Ast = ast::Enum; |
73 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::EnumDef> { | 73 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Enum> { |
74 | self.id.lookup(db.upcast()).source(db.upcast()) | 74 | self.id.lookup(db.upcast()).source(db.upcast()) |
75 | } | 75 | } |
76 | } | 76 | } |
77 | impl HasSource for EnumVariant { | 77 | impl HasSource for EnumVariant { |
78 | type Ast = ast::EnumVariant; | 78 | type Ast = ast::Variant; |
79 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::EnumVariant> { | 79 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Variant> { |
80 | self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone()) | 80 | self.parent.id.child_source(db.upcast()).map(|map| map[self.id].clone()) |
81 | } | 81 | } |
82 | } | 82 | } |
83 | impl HasSource for Function { | 83 | impl HasSource for Function { |
84 | type Ast = ast::FnDef; | 84 | type Ast = ast::Fn; |
85 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::FnDef> { | 85 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Fn> { |
86 | self.id.lookup(db.upcast()).source(db.upcast()) | 86 | self.id.lookup(db.upcast()).source(db.upcast()) |
87 | } | 87 | } |
88 | } | 88 | } |
89 | impl HasSource for Const { | 89 | impl HasSource for Const { |
90 | type Ast = ast::ConstDef; | 90 | type Ast = ast::Const; |
91 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::ConstDef> { | 91 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Const> { |
92 | self.id.lookup(db.upcast()).source(db.upcast()) | 92 | self.id.lookup(db.upcast()).source(db.upcast()) |
93 | } | 93 | } |
94 | } | 94 | } |
95 | impl HasSource for Static { | 95 | impl HasSource for Static { |
96 | type Ast = ast::StaticDef; | 96 | type Ast = ast::Static; |
97 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::StaticDef> { | 97 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Static> { |
98 | self.id.lookup(db.upcast()).source(db.upcast()) | 98 | self.id.lookup(db.upcast()).source(db.upcast()) |
99 | } | 99 | } |
100 | } | 100 | } |
101 | impl HasSource for Trait { | 101 | impl HasSource for Trait { |
102 | type Ast = ast::TraitDef; | 102 | type Ast = ast::Trait; |
103 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::TraitDef> { | 103 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Trait> { |
104 | self.id.lookup(db.upcast()).source(db.upcast()) | 104 | self.id.lookup(db.upcast()).source(db.upcast()) |
105 | } | 105 | } |
106 | } | 106 | } |
107 | impl HasSource for TypeAlias { | 107 | impl HasSource for TypeAlias { |
108 | type Ast = ast::TypeAliasDef; | 108 | type Ast = ast::TypeAlias; |
109 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAliasDef> { | 109 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::TypeAlias> { |
110 | self.id.lookup(db.upcast()).source(db.upcast()) | 110 | self.id.lookup(db.upcast()).source(db.upcast()) |
111 | } | 111 | } |
112 | } | 112 | } |
@@ -120,14 +120,14 @@ impl HasSource for MacroDef { | |||
120 | } | 120 | } |
121 | } | 121 | } |
122 | impl HasSource for ImplDef { | 122 | impl HasSource for ImplDef { |
123 | type Ast = ast::ImplDef; | 123 | type Ast = ast::Impl; |
124 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::ImplDef> { | 124 | fn source(self, db: &dyn HirDatabase) -> InFile<ast::Impl> { |
125 | self.id.lookup(db.upcast()).source(db.upcast()) | 125 | self.id.lookup(db.upcast()).source(db.upcast()) |
126 | } | 126 | } |
127 | } | 127 | } |
128 | 128 | ||
129 | impl HasSource for TypeParam { | 129 | impl HasSource for TypeParam { |
130 | type Ast = Either<ast::TraitDef, ast::TypeParam>; | 130 | type Ast = Either<ast::Trait, ast::TypeParam>; |
131 | fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { | 131 | fn source(self, db: &dyn HirDatabase) -> InFile<Self::Ast> { |
132 | let child_source = self.id.parent.child_source(db.upcast()); | 132 | let child_source = self.id.parent.child_source(db.upcast()); |
133 | child_source.map(|it| it[self.id.local_id].clone()) | 133 | child_source.map(|it| it[self.id.local_id].clone()) |
diff --git a/crates/ra_hir/src/semantics.rs b/crates/ra_hir/src/semantics.rs index 1436b1afe..6f3b3dc9a 100644 --- a/crates/ra_hir/src/semantics.rs +++ b/crates/ra_hir/src/semantics.rs | |||
@@ -209,7 +209,10 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
209 | self.imp.resolve_field(field) | 209 | self.imp.resolve_field(field) |
210 | } | 210 | } |
211 | 211 | ||
212 | pub fn resolve_record_field(&self, field: &ast::RecordField) -> Option<(Field, Option<Local>)> { | 212 | pub fn resolve_record_field( |
213 | &self, | ||
214 | field: &ast::RecordExprField, | ||
215 | ) -> Option<(Field, Option<Local>)> { | ||
213 | self.imp.resolve_record_field(field) | 216 | self.imp.resolve_record_field(field) |
214 | } | 217 | } |
215 | 218 | ||
@@ -225,7 +228,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
225 | self.imp.resolve_path(path) | 228 | self.imp.resolve_path(path) |
226 | } | 229 | } |
227 | 230 | ||
228 | pub fn resolve_variant(&self, record_lit: ast::RecordLit) -> Option<VariantDef> { | 231 | pub fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option<VariantDef> { |
229 | self.imp.resolve_variant(record_lit).map(VariantDef::from) | 232 | self.imp.resolve_variant(record_lit).map(VariantDef::from) |
230 | } | 233 | } |
231 | 234 | ||
@@ -240,7 +243,7 @@ impl<'db, DB: HirDatabase> Semantics<'db, DB> { | |||
240 | // FIXME: use this instead? | 243 | // FIXME: use this instead? |
241 | // pub fn resolve_name_ref(&self, name_ref: &ast::NameRef) -> Option<???>; | 244 | // pub fn resolve_name_ref(&self, name_ref: &ast::NameRef) -> Option<???>; |
242 | 245 | ||
243 | pub fn record_literal_missing_fields(&self, literal: &ast::RecordLit) -> Vec<(Field, Type)> { | 246 | pub fn record_literal_missing_fields(&self, literal: &ast::RecordExpr) -> Vec<(Field, Type)> { |
244 | self.imp.record_literal_missing_fields(literal) | 247 | self.imp.record_literal_missing_fields(literal) |
245 | } | 248 | } |
246 | 249 | ||
@@ -422,7 +425,7 @@ impl<'db> SemanticsImpl<'db> { | |||
422 | self.analyze(field.syntax()).resolve_field(self.db, field) | 425 | self.analyze(field.syntax()).resolve_field(self.db, field) |
423 | } | 426 | } |
424 | 427 | ||
425 | fn resolve_record_field(&self, field: &ast::RecordField) -> Option<(Field, Option<Local>)> { | 428 | fn resolve_record_field(&self, field: &ast::RecordExprField) -> Option<(Field, Option<Local>)> { |
426 | self.analyze(field.syntax()).resolve_record_field(self.db, field) | 429 | self.analyze(field.syntax()).resolve_record_field(self.db, field) |
427 | } | 430 | } |
428 | 431 | ||
@@ -440,7 +443,7 @@ impl<'db> SemanticsImpl<'db> { | |||
440 | self.analyze(path.syntax()).resolve_path(self.db, path) | 443 | self.analyze(path.syntax()).resolve_path(self.db, path) |
441 | } | 444 | } |
442 | 445 | ||
443 | fn resolve_variant(&self, record_lit: ast::RecordLit) -> Option<VariantId> { | 446 | fn resolve_variant(&self, record_lit: ast::RecordExpr) -> Option<VariantId> { |
444 | self.analyze(record_lit.syntax()).resolve_variant(self.db, record_lit) | 447 | self.analyze(record_lit.syntax()).resolve_variant(self.db, record_lit) |
445 | } | 448 | } |
446 | 449 | ||
@@ -453,7 +456,7 @@ impl<'db> SemanticsImpl<'db> { | |||
453 | self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) | 456 | self.analyze(pat.syntax()).resolve_bind_pat_to_const(self.db, pat) |
454 | } | 457 | } |
455 | 458 | ||
456 | fn record_literal_missing_fields(&self, literal: &ast::RecordLit) -> Vec<(Field, Type)> { | 459 | fn record_literal_missing_fields(&self, literal: &ast::RecordExpr) -> Vec<(Field, Type)> { |
457 | self.analyze(literal.syntax()) | 460 | self.analyze(literal.syntax()) |
458 | .record_literal_missing_fields(self.db, literal) | 461 | .record_literal_missing_fields(self.db, literal) |
459 | .unwrap_or_default() | 462 | .unwrap_or_default() |
@@ -577,18 +580,18 @@ macro_rules! to_def_impls { | |||
577 | 580 | ||
578 | to_def_impls![ | 581 | to_def_impls![ |
579 | (crate::Module, ast::Module, module_to_def), | 582 | (crate::Module, ast::Module, module_to_def), |
580 | (crate::Struct, ast::StructDef, struct_to_def), | 583 | (crate::Struct, ast::Struct, struct_to_def), |
581 | (crate::Enum, ast::EnumDef, enum_to_def), | 584 | (crate::Enum, ast::Enum, enum_to_def), |
582 | (crate::Union, ast::UnionDef, union_to_def), | 585 | (crate::Union, ast::Union, union_to_def), |
583 | (crate::Trait, ast::TraitDef, trait_to_def), | 586 | (crate::Trait, ast::Trait, trait_to_def), |
584 | (crate::ImplDef, ast::ImplDef, impl_to_def), | 587 | (crate::ImplDef, ast::Impl, impl_to_def), |
585 | (crate::TypeAlias, ast::TypeAliasDef, type_alias_to_def), | 588 | (crate::TypeAlias, ast::TypeAlias, type_alias_to_def), |
586 | (crate::Const, ast::ConstDef, const_to_def), | 589 | (crate::Const, ast::Const, const_to_def), |
587 | (crate::Static, ast::StaticDef, static_to_def), | 590 | (crate::Static, ast::Static, static_to_def), |
588 | (crate::Function, ast::FnDef, fn_to_def), | 591 | (crate::Function, ast::Fn, fn_to_def), |
589 | (crate::Field, ast::RecordFieldDef, record_field_to_def), | 592 | (crate::Field, ast::RecordField, record_field_to_def), |
590 | (crate::Field, ast::TupleFieldDef, tuple_field_to_def), | 593 | (crate::Field, ast::TupleField, tuple_field_to_def), |
591 | (crate::EnumVariant, ast::EnumVariant, enum_variant_to_def), | 594 | (crate::EnumVariant, ast::Variant, enum_variant_to_def), |
592 | (crate::TypeParam, ast::TypeParam, type_param_to_def), | 595 | (crate::TypeParam, ast::TypeParam, type_param_to_def), |
593 | (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros | 596 | (crate::MacroDef, ast::MacroCall, macro_call_to_def), // this one is dubious, not all calls are macros |
594 | (crate::Local, ast::BindPat, bind_pat_to_def), | 597 | (crate::Local, ast::BindPat, bind_pat_to_def), |
diff --git a/crates/ra_hir/src/semantics/source_to_def.rs b/crates/ra_hir/src/semantics/source_to_def.rs index 42e5a1bdb..d1994e2e7 100644 --- a/crates/ra_hir/src/semantics/source_to_def.rs +++ b/crates/ra_hir/src/semantics/source_to_def.rs | |||
@@ -65,53 +65,44 @@ impl SourceToDefCtx<'_, '_> { | |||
65 | Some(ModuleId { krate: parent_module.krate, local_id: child_id }) | 65 | Some(ModuleId { krate: parent_module.krate, local_id: child_id }) |
66 | } | 66 | } |
67 | 67 | ||
68 | pub(super) fn trait_to_def(&mut self, src: InFile<ast::TraitDef>) -> Option<TraitId> { | 68 | pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> Option<TraitId> { |
69 | self.to_def(src, keys::TRAIT) | 69 | self.to_def(src, keys::TRAIT) |
70 | } | 70 | } |
71 | pub(super) fn impl_to_def(&mut self, src: InFile<ast::ImplDef>) -> Option<ImplId> { | 71 | pub(super) fn impl_to_def(&mut self, src: InFile<ast::Impl>) -> Option<ImplId> { |
72 | self.to_def(src, keys::IMPL) | 72 | self.to_def(src, keys::IMPL) |
73 | } | 73 | } |
74 | pub(super) fn fn_to_def(&mut self, src: InFile<ast::FnDef>) -> Option<FunctionId> { | 74 | pub(super) fn fn_to_def(&mut self, src: InFile<ast::Fn>) -> Option<FunctionId> { |
75 | self.to_def(src, keys::FUNCTION) | 75 | self.to_def(src, keys::FUNCTION) |
76 | } | 76 | } |
77 | pub(super) fn struct_to_def(&mut self, src: InFile<ast::StructDef>) -> Option<StructId> { | 77 | pub(super) fn struct_to_def(&mut self, src: InFile<ast::Struct>) -> Option<StructId> { |
78 | self.to_def(src, keys::STRUCT) | 78 | self.to_def(src, keys::STRUCT) |
79 | } | 79 | } |
80 | pub(super) fn enum_to_def(&mut self, src: InFile<ast::EnumDef>) -> Option<EnumId> { | 80 | pub(super) fn enum_to_def(&mut self, src: InFile<ast::Enum>) -> Option<EnumId> { |
81 | self.to_def(src, keys::ENUM) | 81 | self.to_def(src, keys::ENUM) |
82 | } | 82 | } |
83 | pub(super) fn union_to_def(&mut self, src: InFile<ast::UnionDef>) -> Option<UnionId> { | 83 | pub(super) fn union_to_def(&mut self, src: InFile<ast::Union>) -> Option<UnionId> { |
84 | self.to_def(src, keys::UNION) | 84 | self.to_def(src, keys::UNION) |
85 | } | 85 | } |
86 | pub(super) fn static_to_def(&mut self, src: InFile<ast::StaticDef>) -> Option<StaticId> { | 86 | pub(super) fn static_to_def(&mut self, src: InFile<ast::Static>) -> Option<StaticId> { |
87 | self.to_def(src, keys::STATIC) | 87 | self.to_def(src, keys::STATIC) |
88 | } | 88 | } |
89 | pub(super) fn const_to_def(&mut self, src: InFile<ast::ConstDef>) -> Option<ConstId> { | 89 | pub(super) fn const_to_def(&mut self, src: InFile<ast::Const>) -> Option<ConstId> { |
90 | self.to_def(src, keys::CONST) | 90 | self.to_def(src, keys::CONST) |
91 | } | 91 | } |
92 | pub(super) fn type_alias_to_def( | 92 | pub(super) fn type_alias_to_def(&mut self, src: InFile<ast::TypeAlias>) -> Option<TypeAliasId> { |
93 | &mut self, | ||
94 | src: InFile<ast::TypeAliasDef>, | ||
95 | ) -> Option<TypeAliasId> { | ||
96 | self.to_def(src, keys::TYPE_ALIAS) | 93 | self.to_def(src, keys::TYPE_ALIAS) |
97 | } | 94 | } |
98 | pub(super) fn record_field_to_def( | 95 | pub(super) fn record_field_to_def(&mut self, src: InFile<ast::RecordField>) -> Option<FieldId> { |
99 | &mut self, | ||
100 | src: InFile<ast::RecordFieldDef>, | ||
101 | ) -> Option<FieldId> { | ||
102 | self.to_def(src, keys::RECORD_FIELD) | 96 | self.to_def(src, keys::RECORD_FIELD) |
103 | } | 97 | } |
104 | pub(super) fn tuple_field_to_def( | 98 | pub(super) fn tuple_field_to_def(&mut self, src: InFile<ast::TupleField>) -> Option<FieldId> { |
105 | &mut self, | ||
106 | src: InFile<ast::TupleFieldDef>, | ||
107 | ) -> Option<FieldId> { | ||
108 | self.to_def(src, keys::TUPLE_FIELD) | 99 | self.to_def(src, keys::TUPLE_FIELD) |
109 | } | 100 | } |
110 | pub(super) fn enum_variant_to_def( | 101 | pub(super) fn enum_variant_to_def( |
111 | &mut self, | 102 | &mut self, |
112 | src: InFile<ast::EnumVariant>, | 103 | src: InFile<ast::Variant>, |
113 | ) -> Option<EnumVariantId> { | 104 | ) -> Option<EnumVariantId> { |
114 | self.to_def(src, keys::ENUM_VARIANT) | 105 | self.to_def(src, keys::VARIANT) |
115 | } | 106 | } |
116 | pub(super) fn bind_pat_to_def( | 107 | pub(super) fn bind_pat_to_def( |
117 | &mut self, | 108 | &mut self, |
@@ -163,39 +154,39 @@ impl SourceToDefCtx<'_, '_> { | |||
163 | let def = self.module_to_def(container.with_value(it))?; | 154 | let def = self.module_to_def(container.with_value(it))?; |
164 | def.into() | 155 | def.into() |
165 | }, | 156 | }, |
166 | ast::TraitDef(it) => { | 157 | ast::Trait(it) => { |
167 | let def = self.trait_to_def(container.with_value(it))?; | 158 | let def = self.trait_to_def(container.with_value(it))?; |
168 | def.into() | 159 | def.into() |
169 | }, | 160 | }, |
170 | ast::ImplDef(it) => { | 161 | ast::Impl(it) => { |
171 | let def = self.impl_to_def(container.with_value(it))?; | 162 | let def = self.impl_to_def(container.with_value(it))?; |
172 | def.into() | 163 | def.into() |
173 | }, | 164 | }, |
174 | ast::FnDef(it) => { | 165 | ast::Fn(it) => { |
175 | let def = self.fn_to_def(container.with_value(it))?; | 166 | let def = self.fn_to_def(container.with_value(it))?; |
176 | DefWithBodyId::from(def).into() | 167 | DefWithBodyId::from(def).into() |
177 | }, | 168 | }, |
178 | ast::StructDef(it) => { | 169 | ast::Struct(it) => { |
179 | let def = self.struct_to_def(container.with_value(it))?; | 170 | let def = self.struct_to_def(container.with_value(it))?; |
180 | VariantId::from(def).into() | 171 | VariantId::from(def).into() |
181 | }, | 172 | }, |
182 | ast::EnumDef(it) => { | 173 | ast::Enum(it) => { |
183 | let def = self.enum_to_def(container.with_value(it))?; | 174 | let def = self.enum_to_def(container.with_value(it))?; |
184 | def.into() | 175 | def.into() |
185 | }, | 176 | }, |
186 | ast::UnionDef(it) => { | 177 | ast::Union(it) => { |
187 | let def = self.union_to_def(container.with_value(it))?; | 178 | let def = self.union_to_def(container.with_value(it))?; |
188 | VariantId::from(def).into() | 179 | VariantId::from(def).into() |
189 | }, | 180 | }, |
190 | ast::StaticDef(it) => { | 181 | ast::Static(it) => { |
191 | let def = self.static_to_def(container.with_value(it))?; | 182 | let def = self.static_to_def(container.with_value(it))?; |
192 | DefWithBodyId::from(def).into() | 183 | DefWithBodyId::from(def).into() |
193 | }, | 184 | }, |
194 | ast::ConstDef(it) => { | 185 | ast::Const(it) => { |
195 | let def = self.const_to_def(container.with_value(it))?; | 186 | let def = self.const_to_def(container.with_value(it))?; |
196 | DefWithBodyId::from(def).into() | 187 | DefWithBodyId::from(def).into() |
197 | }, | 188 | }, |
198 | ast::TypeAliasDef(it) => { | 189 | ast::TypeAlias(it) => { |
199 | let def = self.type_alias_to_def(container.with_value(it))?; | 190 | let def = self.type_alias_to_def(container.with_value(it))?; |
200 | def.into() | 191 | def.into() |
201 | }, | 192 | }, |
@@ -213,12 +204,12 @@ impl SourceToDefCtx<'_, '_> { | |||
213 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { | 204 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { |
214 | let res: GenericDefId = match_ast! { | 205 | let res: GenericDefId = match_ast! { |
215 | match (container.value) { | 206 | match (container.value) { |
216 | ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(), | 207 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), |
217 | ast::StructDef(it) => self.struct_to_def(container.with_value(it))?.into(), | 208 | ast::Struct(it) => self.struct_to_def(container.with_value(it))?.into(), |
218 | ast::EnumDef(it) => self.enum_to_def(container.with_value(it))?.into(), | 209 | ast::Enum(it) => self.enum_to_def(container.with_value(it))?.into(), |
219 | ast::TraitDef(it) => self.trait_to_def(container.with_value(it))?.into(), | 210 | ast::Trait(it) => self.trait_to_def(container.with_value(it))?.into(), |
220 | ast::TypeAliasDef(it) => self.type_alias_to_def(container.with_value(it))?.into(), | 211 | ast::TypeAlias(it) => self.type_alias_to_def(container.with_value(it))?.into(), |
221 | ast::ImplDef(it) => self.impl_to_def(container.with_value(it))?.into(), | 212 | ast::Impl(it) => self.impl_to_def(container.with_value(it))?.into(), |
222 | _ => continue, | 213 | _ => continue, |
223 | } | 214 | } |
224 | }; | 215 | }; |
@@ -231,9 +222,9 @@ impl SourceToDefCtx<'_, '_> { | |||
231 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { | 222 | for container in src.cloned().ancestors_with_macros(self.db.upcast()).skip(1) { |
232 | let res: DefWithBodyId = match_ast! { | 223 | let res: DefWithBodyId = match_ast! { |
233 | match (container.value) { | 224 | match (container.value) { |
234 | ast::ConstDef(it) => self.const_to_def(container.with_value(it))?.into(), | 225 | ast::Const(it) => self.const_to_def(container.with_value(it))?.into(), |
235 | ast::StaticDef(it) => self.static_to_def(container.with_value(it))?.into(), | 226 | ast::Static(it) => self.static_to_def(container.with_value(it))?.into(), |
236 | ast::FnDef(it) => self.fn_to_def(container.with_value(it))?.into(), | 227 | ast::Fn(it) => self.fn_to_def(container.with_value(it))?.into(), |
237 | _ => continue, | 228 | _ => continue, |
238 | } | 229 | } |
239 | }; | 230 | }; |
diff --git a/crates/ra_hir/src/source_analyzer.rs b/crates/ra_hir/src/source_analyzer.rs index 86a47a9e5..f2e630ef1 100644 --- a/crates/ra_hir/src/source_analyzer.rs +++ b/crates/ra_hir/src/source_analyzer.rs | |||
@@ -159,7 +159,7 @@ impl SourceAnalyzer { | |||
159 | pub(crate) fn resolve_record_field( | 159 | pub(crate) fn resolve_record_field( |
160 | &self, | 160 | &self, |
161 | db: &dyn HirDatabase, | 161 | db: &dyn HirDatabase, |
162 | field: &ast::RecordField, | 162 | field: &ast::RecordExprField, |
163 | ) -> Option<(Field, Option<Local>)> { | 163 | ) -> Option<(Field, Option<Local>)> { |
164 | let expr = field.expr()?; | 164 | let expr = field.expr()?; |
165 | let expr_id = self.expr_id(db, &expr)?; | 165 | let expr_id = self.expr_id(db, &expr)?; |
@@ -246,7 +246,7 @@ impl SourceAnalyzer { | |||
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | if let Some(rec_lit) = path.syntax().parent().and_then(ast::RecordLit::cast) { | 249 | if let Some(rec_lit) = path.syntax().parent().and_then(ast::RecordExpr::cast) { |
250 | let expr_id = self.expr_id(db, &rec_lit.into())?; | 250 | let expr_id = self.expr_id(db, &rec_lit.into())?; |
251 | if let Some(VariantId::EnumVariantId(variant)) = | 251 | if let Some(VariantId::EnumVariantId(variant)) = |
252 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) | 252 | self.infer.as_ref()?.variant_resolution_for_expr(expr_id) |
@@ -284,7 +284,7 @@ impl SourceAnalyzer { | |||
284 | pub(crate) fn record_literal_missing_fields( | 284 | pub(crate) fn record_literal_missing_fields( |
285 | &self, | 285 | &self, |
286 | db: &dyn HirDatabase, | 286 | db: &dyn HirDatabase, |
287 | literal: &ast::RecordLit, | 287 | literal: &ast::RecordExpr, |
288 | ) -> Option<Vec<(Field, Type)>> { | 288 | ) -> Option<Vec<(Field, Type)>> { |
289 | let krate = self.resolver.krate()?; | 289 | let krate = self.resolver.krate()?; |
290 | let body = self.body.as_ref()?; | 290 | let body = self.body.as_ref()?; |
@@ -358,7 +358,7 @@ impl SourceAnalyzer { | |||
358 | pub(crate) fn resolve_variant( | 358 | pub(crate) fn resolve_variant( |
359 | &self, | 359 | &self, |
360 | db: &dyn HirDatabase, | 360 | db: &dyn HirDatabase, |
361 | record_lit: ast::RecordLit, | 361 | record_lit: ast::RecordExpr, |
362 | ) -> Option<VariantId> { | 362 | ) -> Option<VariantId> { |
363 | let infer = self.infer.as_ref()?; | 363 | let infer = self.infer.as_ref()?; |
364 | let expr_id = self.expr_id(db, &record_lit.into())?; | 364 | let expr_id = self.expr_id(db, &record_lit.into())?; |
@@ -405,8 +405,7 @@ fn scope_for_offset( | |||
405 | ) | 405 | ) |
406 | }) | 406 | }) |
407 | .map(|(expr_range, scope)| { | 407 | .map(|(expr_range, scope)| { |
408 | adjust(db, scopes, source_map, expr_range, offset.file_id, offset.value) | 408 | adjust(db, scopes, source_map, expr_range, offset).unwrap_or(*scope) |
409 | .unwrap_or(*scope) | ||
410 | }) | 409 | }) |
411 | } | 410 | } |
412 | 411 | ||
@@ -417,8 +416,7 @@ fn adjust( | |||
417 | scopes: &ExprScopes, | 416 | scopes: &ExprScopes, |
418 | source_map: &BodySourceMap, | 417 | source_map: &BodySourceMap, |
419 | expr_range: TextRange, | 418 | expr_range: TextRange, |
420 | file_id: HirFileId, | 419 | offset: InFile<TextSize>, |
421 | offset: TextSize, | ||
422 | ) -> Option<ScopeId> { | 420 | ) -> Option<ScopeId> { |
423 | let child_scopes = scopes | 421 | let child_scopes = scopes |
424 | .scope_by_expr() | 422 | .scope_by_expr() |
@@ -426,7 +424,7 @@ fn adjust( | |||
426 | .filter_map(|(id, scope)| { | 424 | .filter_map(|(id, scope)| { |
427 | let source = source_map.expr_syntax(*id).ok()?; | 425 | let source = source_map.expr_syntax(*id).ok()?; |
428 | // FIXME: correctly handle macro expansion | 426 | // FIXME: correctly handle macro expansion |
429 | if source.file_id != file_id { | 427 | if source.file_id != offset.file_id { |
430 | return None; | 428 | return None; |
431 | } | 429 | } |
432 | let root = source.file_syntax(db.upcast()); | 430 | let root = source.file_syntax(db.upcast()); |
@@ -434,7 +432,7 @@ fn adjust( | |||
434 | Some((node.syntax().text_range(), scope)) | 432 | Some((node.syntax().text_range(), scope)) |
435 | }) | 433 | }) |
436 | .filter(|&(range, _)| { | 434 | .filter(|&(range, _)| { |
437 | range.start() <= offset && expr_range.contains_range(range) && range != expr_range | 435 | range.start() <= offset.value && expr_range.contains_range(range) && range != expr_range |
438 | }); | 436 | }); |
439 | 437 | ||
440 | child_scopes | 438 | child_scopes |
diff --git a/crates/ra_hir_def/src/adt.rs b/crates/ra_hir_def/src/adt.rs index 4994a2125..6cb56a1cd 100644 --- a/crates/ra_hir_def/src/adt.rs +++ b/crates/ra_hir_def/src/adt.rs | |||
@@ -8,7 +8,7 @@ use hir_expand::{ | |||
8 | InFile, | 8 | InFile, |
9 | }; | 9 | }; |
10 | use ra_arena::{map::ArenaMap, Arena}; | 10 | use ra_arena::{map::ArenaMap, Arena}; |
11 | use ra_syntax::ast::{self, NameOwner, TypeAscriptionOwner, VisibilityOwner}; | 11 | use ra_syntax::ast::{self, NameOwner, VisibilityOwner}; |
12 | 12 | ||
13 | use crate::{ | 13 | use crate::{ |
14 | body::{CfgExpander, LowerCtx}, | 14 | body::{CfgExpander, LowerCtx}, |
@@ -112,7 +112,7 @@ impl EnumData { | |||
112 | 112 | ||
113 | impl HasChildSource for EnumId { | 113 | impl HasChildSource for EnumId { |
114 | type ChildId = LocalEnumVariantId; | 114 | type ChildId = LocalEnumVariantId; |
115 | type Value = ast::EnumVariant; | 115 | type Value = ast::Variant; |
116 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { | 116 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
117 | let src = self.lookup(db).source(db); | 117 | let src = self.lookup(db).source(db); |
118 | let mut trace = Trace::new_for_map(); | 118 | let mut trace = Trace::new_for_map(); |
@@ -123,8 +123,8 @@ impl HasChildSource for EnumId { | |||
123 | 123 | ||
124 | fn lower_enum( | 124 | fn lower_enum( |
125 | db: &dyn DefDatabase, | 125 | db: &dyn DefDatabase, |
126 | trace: &mut Trace<EnumVariantData, ast::EnumVariant>, | 126 | trace: &mut Trace<EnumVariantData, ast::Variant>, |
127 | ast: &InFile<ast::EnumDef>, | 127 | ast: &InFile<ast::Enum>, |
128 | module_id: ModuleId, | 128 | module_id: ModuleId, |
129 | ) { | 129 | ) { |
130 | let expander = CfgExpander::new(db, ast.file_id, module_id.krate); | 130 | let expander = CfgExpander::new(db, ast.file_id, module_id.krate); |
@@ -179,7 +179,7 @@ impl VariantData { | |||
179 | 179 | ||
180 | impl HasChildSource for VariantId { | 180 | impl HasChildSource for VariantId { |
181 | type ChildId = LocalFieldId; | 181 | type ChildId = LocalFieldId; |
182 | type Value = Either<ast::TupleFieldDef, ast::RecordFieldDef>; | 182 | type Value = Either<ast::TupleField, ast::RecordField>; |
183 | 183 | ||
184 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { | 184 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<ArenaMap<Self::ChildId, Self::Value>> { |
185 | let (src, module_id) = match self { | 185 | let (src, module_id) = match self { |
@@ -194,7 +194,7 @@ impl HasChildSource for VariantId { | |||
194 | } | 194 | } |
195 | VariantId::UnionId(it) => ( | 195 | VariantId::UnionId(it) => ( |
196 | it.lookup(db).source(db).map(|it| { | 196 | it.lookup(db).source(db).map(|it| { |
197 | it.record_field_def_list() | 197 | it.record_field_list() |
198 | .map(ast::StructKind::Record) | 198 | .map(ast::StructKind::Record) |
199 | .unwrap_or(ast::StructKind::Unit) | 199 | .unwrap_or(ast::StructKind::Unit) |
200 | }), | 200 | }), |
@@ -218,7 +218,7 @@ pub enum StructKind { | |||
218 | fn lower_struct( | 218 | fn lower_struct( |
219 | db: &dyn DefDatabase, | 219 | db: &dyn DefDatabase, |
220 | expander: &mut CfgExpander, | 220 | expander: &mut CfgExpander, |
221 | trace: &mut Trace<FieldData, Either<ast::TupleFieldDef, ast::RecordFieldDef>>, | 221 | trace: &mut Trace<FieldData, Either<ast::TupleField, ast::RecordField>>, |
222 | ast: &InFile<ast::StructKind>, | 222 | ast: &InFile<ast::StructKind>, |
223 | ) -> StructKind { | 223 | ) -> StructKind { |
224 | let ctx = LowerCtx::new(db, ast.file_id); | 224 | let ctx = LowerCtx::new(db, ast.file_id); |
@@ -234,7 +234,7 @@ fn lower_struct( | |||
234 | || Either::Left(fd.clone()), | 234 | || Either::Left(fd.clone()), |
235 | || FieldData { | 235 | || FieldData { |
236 | name: Name::new_tuple_field(i), | 236 | name: Name::new_tuple_field(i), |
237 | type_ref: TypeRef::from_ast_opt(&ctx, fd.type_ref()), | 237 | type_ref: TypeRef::from_ast_opt(&ctx, fd.ty()), |
238 | visibility: RawVisibility::from_ast(db, ast.with_value(fd.visibility())), | 238 | visibility: RawVisibility::from_ast(db, ast.with_value(fd.visibility())), |
239 | }, | 239 | }, |
240 | ); | 240 | ); |
@@ -251,7 +251,7 @@ fn lower_struct( | |||
251 | || Either::Right(fd.clone()), | 251 | || Either::Right(fd.clone()), |
252 | || FieldData { | 252 | || FieldData { |
253 | name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing), | 253 | name: fd.name().map(|n| n.as_name()).unwrap_or_else(Name::missing), |
254 | type_ref: TypeRef::from_ast_opt(&ctx, fd.ascribed_type()), | 254 | type_ref: TypeRef::from_ast_opt(&ctx, fd.ty()), |
255 | visibility: RawVisibility::from_ast(db, ast.with_value(fd.visibility())), | 255 | visibility: RawVisibility::from_ast(db, ast.with_value(fd.visibility())), |
256 | }, | 256 | }, |
257 | ); | 257 | ); |
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index 70ccd4305..050832ce0 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs | |||
@@ -151,18 +151,15 @@ pub enum AttrInput { | |||
151 | impl Attr { | 151 | impl Attr { |
152 | fn from_src(ast: ast::Attr, hygiene: &Hygiene) -> Option<Attr> { | 152 | fn from_src(ast: ast::Attr, hygiene: &Hygiene) -> Option<Attr> { |
153 | let path = ModPath::from_src(ast.path()?, hygiene)?; | 153 | let path = ModPath::from_src(ast.path()?, hygiene)?; |
154 | let input = match ast.input() { | 154 | let input = if let Some(lit) = ast.literal() { |
155 | None => None, | 155 | // FIXME: escape? raw string? |
156 | Some(ast::AttrInput::Literal(lit)) => { | 156 | let value = lit.syntax().first_token()?.text().trim_matches('"').into(); |
157 | // FIXME: escape? raw string? | 157 | Some(AttrInput::Literal(value)) |
158 | let value = lit.syntax().first_token()?.text().trim_matches('"').into(); | 158 | } else if let Some(tt) = ast.token_tree() { |
159 | Some(AttrInput::Literal(value)) | 159 | Some(AttrInput::TokenTree(ast_to_token_tree(&tt)?.0)) |
160 | } | 160 | } else { |
161 | Some(ast::AttrInput::TokenTree(tt)) => { | 161 | None |
162 | Some(AttrInput::TokenTree(ast_to_token_tree(&tt)?.0)) | ||
163 | } | ||
164 | }; | 162 | }; |
165 | |||
166 | Some(Attr { path, input }) | 163 | Some(Attr { path, input }) |
167 | } | 164 | } |
168 | } | 165 | } |
diff --git a/crates/ra_hir_def/src/body.rs b/crates/ra_hir_def/src/body.rs index 2fe04db2b..d5f18b920 100644 --- a/crates/ra_hir_def/src/body.rs +++ b/crates/ra_hir_def/src/body.rs | |||
@@ -216,7 +216,7 @@ pub struct BodySourceMap { | |||
216 | expr_map_back: ArenaMap<ExprId, Result<ExprSource, SyntheticSyntax>>, | 216 | expr_map_back: ArenaMap<ExprId, Result<ExprSource, SyntheticSyntax>>, |
217 | pat_map: FxHashMap<PatSource, PatId>, | 217 | pat_map: FxHashMap<PatSource, PatId>, |
218 | pat_map_back: ArenaMap<PatId, Result<PatSource, SyntheticSyntax>>, | 218 | pat_map_back: ArenaMap<PatId, Result<PatSource, SyntheticSyntax>>, |
219 | field_map: FxHashMap<(ExprId, usize), InFile<AstPtr<ast::RecordField>>>, | 219 | field_map: FxHashMap<(ExprId, usize), InFile<AstPtr<ast::RecordExprField>>>, |
220 | expansions: FxHashMap<InFile<AstPtr<ast::MacroCall>>, HirFileId>, | 220 | expansions: FxHashMap<InFile<AstPtr<ast::MacroCall>>, HirFileId>, |
221 | } | 221 | } |
222 | 222 | ||
@@ -314,7 +314,7 @@ impl BodySourceMap { | |||
314 | self.pat_map.get(&src).cloned() | 314 | self.pat_map.get(&src).cloned() |
315 | } | 315 | } |
316 | 316 | ||
317 | pub fn field_syntax(&self, expr: ExprId, field: usize) -> InFile<AstPtr<ast::RecordField>> { | 317 | pub fn field_syntax(&self, expr: ExprId, field: usize) -> InFile<AstPtr<ast::RecordExprField>> { |
318 | self.field_map[&(expr, field)].clone() | 318 | self.field_map[&(expr, field)].clone() |
319 | } | 319 | } |
320 | } | 320 | } |
diff --git a/crates/ra_hir_def/src/body/lower.rs b/crates/ra_hir_def/src/body/lower.rs index 5c57d8bde..827ced4ad 100644 --- a/crates/ra_hir_def/src/body/lower.rs +++ b/crates/ra_hir_def/src/body/lower.rs | |||
@@ -11,7 +11,7 @@ use ra_arena::Arena; | |||
11 | use ra_syntax::{ | 11 | use ra_syntax::{ |
12 | ast::{ | 12 | ast::{ |
13 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, ModuleItemOwner, NameOwner, | 13 | self, ArgListOwner, ArrayExprKind, LiteralKind, LoopBodyOwner, ModuleItemOwner, NameOwner, |
14 | SlicePatComponents, TypeAscriptionOwner, | 14 | SlicePatComponents, |
15 | }, | 15 | }, |
16 | AstNode, AstPtr, | 16 | AstNode, AstPtr, |
17 | }; | 17 | }; |
@@ -379,10 +379,10 @@ impl ExprCollector<'_> { | |||
379 | let expr = e.expr().map(|e| self.collect_expr(e)); | 379 | let expr = e.expr().map(|e| self.collect_expr(e)); |
380 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) | 380 | self.alloc_expr(Expr::Return { expr }, syntax_ptr) |
381 | } | 381 | } |
382 | ast::Expr::RecordLit(e) => { | 382 | ast::Expr::RecordExpr(e) => { |
383 | let path = e.path().and_then(|path| self.expander.parse_path(path)); | 383 | let path = e.path().and_then(|path| self.expander.parse_path(path)); |
384 | let mut field_ptrs = Vec::new(); | 384 | let mut field_ptrs = Vec::new(); |
385 | let record_lit = if let Some(nfl) = e.record_field_list() { | 385 | let record_lit = if let Some(nfl) = e.record_expr_field_list() { |
386 | let fields = nfl | 386 | let fields = nfl |
387 | .fields() | 387 | .fields() |
388 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) | 388 | .inspect(|field| field_ptrs.push(AstPtr::new(field))) |
@@ -432,7 +432,7 @@ impl ExprCollector<'_> { | |||
432 | } | 432 | } |
433 | ast::Expr::CastExpr(e) => { | 433 | ast::Expr::CastExpr(e) => { |
434 | let expr = self.collect_expr_opt(e.expr()); | 434 | let expr = self.collect_expr_opt(e.expr()); |
435 | let type_ref = TypeRef::from_ast_opt(&self.ctx(), e.type_ref()); | 435 | let type_ref = TypeRef::from_ast_opt(&self.ctx(), e.ty()); |
436 | self.alloc_expr(Expr::Cast { expr, type_ref }, syntax_ptr) | 436 | self.alloc_expr(Expr::Cast { expr, type_ref }, syntax_ptr) |
437 | } | 437 | } |
438 | ast::Expr::RefExpr(e) => { | 438 | ast::Expr::RefExpr(e) => { |
@@ -466,16 +466,13 @@ impl ExprCollector<'_> { | |||
466 | if let Some(pl) = e.param_list() { | 466 | if let Some(pl) = e.param_list() { |
467 | for param in pl.params() { | 467 | for param in pl.params() { |
468 | let pat = self.collect_pat_opt(param.pat()); | 468 | let pat = self.collect_pat_opt(param.pat()); |
469 | let type_ref = | 469 | let type_ref = param.ty().map(|it| TypeRef::from_ast(&self.ctx(), it)); |
470 | param.ascribed_type().map(|it| TypeRef::from_ast(&self.ctx(), it)); | ||
471 | args.push(pat); | 470 | args.push(pat); |
472 | arg_types.push(type_ref); | 471 | arg_types.push(type_ref); |
473 | } | 472 | } |
474 | } | 473 | } |
475 | let ret_type = e | 474 | let ret_type = |
476 | .ret_type() | 475 | e.ret_type().and_then(|r| r.ty()).map(|it| TypeRef::from_ast(&self.ctx(), it)); |
477 | .and_then(|r| r.type_ref()) | ||
478 | .map(|it| TypeRef::from_ast(&self.ctx(), it)); | ||
479 | let body = self.collect_expr_opt(e.body()); | 476 | let body = self.collect_expr_opt(e.body()); |
480 | self.alloc_expr(Expr::Lambda { args, arg_types, ret_type, body }, syntax_ptr) | 477 | self.alloc_expr(Expr::Lambda { args, arg_types, ret_type, body }, syntax_ptr) |
481 | } | 478 | } |
@@ -607,8 +604,7 @@ impl ExprCollector<'_> { | |||
607 | .map(|s| match s { | 604 | .map(|s| match s { |
608 | ast::Stmt::LetStmt(stmt) => { | 605 | ast::Stmt::LetStmt(stmt) => { |
609 | let pat = self.collect_pat_opt(stmt.pat()); | 606 | let pat = self.collect_pat_opt(stmt.pat()); |
610 | let type_ref = | 607 | let type_ref = stmt.ty().map(|it| TypeRef::from_ast(&self.ctx(), it)); |
611 | stmt.ascribed_type().map(|it| TypeRef::from_ast(&self.ctx(), it)); | ||
612 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); | 608 | let initializer = stmt.initializer().map(|e| self.collect_expr(e)); |
613 | Statement::Let { pat, type_ref, initializer } | 609 | Statement::Let { pat, type_ref, initializer } |
614 | } | 610 | } |
@@ -627,49 +623,49 @@ impl ExprCollector<'_> { | |||
627 | .items() | 623 | .items() |
628 | .filter_map(|item| { | 624 | .filter_map(|item| { |
629 | let (def, name): (ModuleDefId, Option<ast::Name>) = match item { | 625 | let (def, name): (ModuleDefId, Option<ast::Name>) = match item { |
630 | ast::Item::FnDef(def) => { | 626 | ast::Item::Fn(def) => { |
631 | let id = self.find_inner_item(&def)?; | 627 | let id = self.find_inner_item(&def)?; |
632 | ( | 628 | ( |
633 | FunctionLoc { container: container.into(), id }.intern(self.db).into(), | 629 | FunctionLoc { container: container.into(), id }.intern(self.db).into(), |
634 | def.name(), | 630 | def.name(), |
635 | ) | 631 | ) |
636 | } | 632 | } |
637 | ast::Item::TypeAliasDef(def) => { | 633 | ast::Item::TypeAlias(def) => { |
638 | let id = self.find_inner_item(&def)?; | 634 | let id = self.find_inner_item(&def)?; |
639 | ( | 635 | ( |
640 | TypeAliasLoc { container: container.into(), id }.intern(self.db).into(), | 636 | TypeAliasLoc { container: container.into(), id }.intern(self.db).into(), |
641 | def.name(), | 637 | def.name(), |
642 | ) | 638 | ) |
643 | } | 639 | } |
644 | ast::Item::ConstDef(def) => { | 640 | ast::Item::Const(def) => { |
645 | let id = self.find_inner_item(&def)?; | 641 | let id = self.find_inner_item(&def)?; |
646 | ( | 642 | ( |
647 | ConstLoc { container: container.into(), id }.intern(self.db).into(), | 643 | ConstLoc { container: container.into(), id }.intern(self.db).into(), |
648 | def.name(), | 644 | def.name(), |
649 | ) | 645 | ) |
650 | } | 646 | } |
651 | ast::Item::StaticDef(def) => { | 647 | ast::Item::Static(def) => { |
652 | let id = self.find_inner_item(&def)?; | 648 | let id = self.find_inner_item(&def)?; |
653 | (StaticLoc { container, id }.intern(self.db).into(), def.name()) | 649 | (StaticLoc { container, id }.intern(self.db).into(), def.name()) |
654 | } | 650 | } |
655 | ast::Item::StructDef(def) => { | 651 | ast::Item::Struct(def) => { |
656 | let id = self.find_inner_item(&def)?; | 652 | let id = self.find_inner_item(&def)?; |
657 | (StructLoc { container, id }.intern(self.db).into(), def.name()) | 653 | (StructLoc { container, id }.intern(self.db).into(), def.name()) |
658 | } | 654 | } |
659 | ast::Item::EnumDef(def) => { | 655 | ast::Item::Enum(def) => { |
660 | let id = self.find_inner_item(&def)?; | 656 | let id = self.find_inner_item(&def)?; |
661 | (EnumLoc { container, id }.intern(self.db).into(), def.name()) | 657 | (EnumLoc { container, id }.intern(self.db).into(), def.name()) |
662 | } | 658 | } |
663 | ast::Item::UnionDef(def) => { | 659 | ast::Item::Union(def) => { |
664 | let id = self.find_inner_item(&def)?; | 660 | let id = self.find_inner_item(&def)?; |
665 | (UnionLoc { container, id }.intern(self.db).into(), def.name()) | 661 | (UnionLoc { container, id }.intern(self.db).into(), def.name()) |
666 | } | 662 | } |
667 | ast::Item::TraitDef(def) => { | 663 | ast::Item::Trait(def) => { |
668 | let id = self.find_inner_item(&def)?; | 664 | let id = self.find_inner_item(&def)?; |
669 | (TraitLoc { container, id }.intern(self.db).into(), def.name()) | 665 | (TraitLoc { container, id }.intern(self.db).into(), def.name()) |
670 | } | 666 | } |
671 | ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks | 667 | ast::Item::ExternBlock(_) => return None, // FIXME: collect from extern blocks |
672 | ast::Item::ImplDef(_) | 668 | ast::Item::Impl(_) |
673 | | ast::Item::Use(_) | 669 | | ast::Item::Use(_) |
674 | | ast::Item::ExternCrate(_) | 670 | | ast::Item::ExternCrate(_) |
675 | | ast::Item::Module(_) | 671 | | ast::Item::Module(_) |
diff --git a/crates/ra_hir_def/src/child_by_source.rs b/crates/ra_hir_def/src/child_by_source.rs index a885ec96d..dcb00a1d9 100644 --- a/crates/ra_hir_def/src/child_by_source.rs +++ b/crates/ra_hir_def/src/child_by_source.rs | |||
@@ -162,7 +162,7 @@ impl ChildBySource for EnumId { | |||
162 | let arena_map = arena_map.as_ref(); | 162 | let arena_map = arena_map.as_ref(); |
163 | for (local_id, source) in arena_map.value.iter() { | 163 | for (local_id, source) in arena_map.value.iter() { |
164 | let id = EnumVariantId { parent: *self, local_id }; | 164 | let id = EnumVariantId { parent: *self, local_id }; |
165 | res[keys::ENUM_VARIANT].insert(arena_map.with_value(source.clone()), id) | 165 | res[keys::VARIANT].insert(arena_map.with_value(source.clone()), id) |
166 | } | 166 | } |
167 | 167 | ||
168 | res | 168 | res |
diff --git a/crates/ra_hir_def/src/generics.rs b/crates/ra_hir_def/src/generics.rs index 6a0f493a7..8ea61fcf2 100644 --- a/crates/ra_hir_def/src/generics.rs +++ b/crates/ra_hir_def/src/generics.rs | |||
@@ -12,7 +12,7 @@ use hir_expand::{ | |||
12 | use ra_arena::{map::ArenaMap, Arena}; | 12 | use ra_arena::{map::ArenaMap, Arena}; |
13 | use ra_db::FileId; | 13 | use ra_db::FileId; |
14 | use ra_prof::profile; | 14 | use ra_prof::profile; |
15 | use ra_syntax::ast::{self, NameOwner, TypeBoundsOwner, TypeParamsOwner}; | 15 | use ra_syntax::ast::{self, GenericParamsOwner, NameOwner, TypeBoundsOwner}; |
16 | 16 | ||
17 | use crate::{ | 17 | use crate::{ |
18 | body::LowerCtx, | 18 | body::LowerCtx, |
@@ -66,7 +66,7 @@ pub enum WherePredicateTarget { | |||
66 | TypeParam(LocalTypeParamId), | 66 | TypeParam(LocalTypeParamId), |
67 | } | 67 | } |
68 | 68 | ||
69 | type SourceMap = ArenaMap<LocalTypeParamId, Either<ast::TraitDef, ast::TypeParam>>; | 69 | type SourceMap = ArenaMap<LocalTypeParamId, Either<ast::Trait, ast::TypeParam>>; |
70 | 70 | ||
71 | impl GenericParams { | 71 | impl GenericParams { |
72 | pub(crate) fn generic_params_query( | 72 | pub(crate) fn generic_params_query( |
@@ -205,9 +205,9 @@ impl GenericParams { | |||
205 | &mut self, | 205 | &mut self, |
206 | lower_ctx: &LowerCtx, | 206 | lower_ctx: &LowerCtx, |
207 | sm: &mut SourceMap, | 207 | sm: &mut SourceMap, |
208 | node: &dyn TypeParamsOwner, | 208 | node: &dyn GenericParamsOwner, |
209 | ) { | 209 | ) { |
210 | if let Some(params) = node.type_param_list() { | 210 | if let Some(params) = node.generic_param_list() { |
211 | self.fill_params(lower_ctx, sm, params) | 211 | self.fill_params(lower_ctx, sm, params) |
212 | } | 212 | } |
213 | if let Some(where_clause) = node.where_clause() { | 213 | if let Some(where_clause) = node.where_clause() { |
@@ -232,7 +232,7 @@ impl GenericParams { | |||
232 | &mut self, | 232 | &mut self, |
233 | lower_ctx: &LowerCtx, | 233 | lower_ctx: &LowerCtx, |
234 | sm: &mut SourceMap, | 234 | sm: &mut SourceMap, |
235 | params: ast::TypeParamList, | 235 | params: ast::GenericParamList, |
236 | ) { | 236 | ) { |
237 | for type_param in params.type_params() { | 237 | for type_param in params.type_params() { |
238 | let name = type_param.name().map_or_else(Name::missing, |it| it.as_name()); | 238 | let name = type_param.name().map_or_else(Name::missing, |it| it.as_name()); |
@@ -317,7 +317,7 @@ impl GenericParams { | |||
317 | 317 | ||
318 | impl HasChildSource for GenericDefId { | 318 | impl HasChildSource for GenericDefId { |
319 | type ChildId = LocalTypeParamId; | 319 | type ChildId = LocalTypeParamId; |
320 | type Value = Either<ast::TraitDef, ast::TypeParam>; | 320 | type Value = Either<ast::Trait, ast::TypeParam>; |
321 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<SourceMap> { | 321 | fn child_source(&self, db: &dyn DefDatabase) -> InFile<SourceMap> { |
322 | let (_, sm) = GenericParams::new(db, *self); | 322 | let (_, sm) = GenericParams::new(db, *self); |
323 | sm | 323 | sm |
diff --git a/crates/ra_hir_def/src/item_tree.rs b/crates/ra_hir_def/src/item_tree.rs index 0bab9c6d8..a67e75dac 100644 --- a/crates/ra_hir_def/src/item_tree.rs +++ b/crates/ra_hir_def/src/item_tree.rs | |||
@@ -13,7 +13,7 @@ use std::{ | |||
13 | sync::Arc, | 13 | sync::Arc, |
14 | }; | 14 | }; |
15 | 15 | ||
16 | use ast::{AstNode, AttrsOwner, NameOwner, StructKind, TypeAscriptionOwner}; | 16 | use ast::{AstNode, AttrsOwner, NameOwner, StructKind}; |
17 | use either::Either; | 17 | use either::Either; |
18 | use hir_expand::{ | 18 | use hir_expand::{ |
19 | ast_id_map::FileAstId, | 19 | ast_id_map::FileAstId, |
@@ -413,15 +413,15 @@ macro_rules! mod_items { | |||
413 | mod_items! { | 413 | mod_items! { |
414 | Import in imports -> ast::Use, | 414 | Import in imports -> ast::Use, |
415 | ExternCrate in extern_crates -> ast::ExternCrate, | 415 | ExternCrate in extern_crates -> ast::ExternCrate, |
416 | Function in functions -> ast::FnDef, | 416 | Function in functions -> ast::Fn, |
417 | Struct in structs -> ast::StructDef, | 417 | Struct in structs -> ast::Struct, |
418 | Union in unions -> ast::UnionDef, | 418 | Union in unions -> ast::Union, |
419 | Enum in enums -> ast::EnumDef, | 419 | Enum in enums -> ast::Enum, |
420 | Const in consts -> ast::ConstDef, | 420 | Const in consts -> ast::Const, |
421 | Static in statics -> ast::StaticDef, | 421 | Static in statics -> ast::Static, |
422 | Trait in traits -> ast::TraitDef, | 422 | Trait in traits -> ast::Trait, |
423 | Impl in impls -> ast::ImplDef, | 423 | Impl in impls -> ast::Impl, |
424 | TypeAlias in type_aliases -> ast::TypeAliasDef, | 424 | TypeAlias in type_aliases -> ast::TypeAlias, |
425 | Mod in mods -> ast::Module, | 425 | Mod in mods -> ast::Module, |
426 | MacroCall in macro_calls -> ast::MacroCall, | 426 | MacroCall in macro_calls -> ast::MacroCall, |
427 | } | 427 | } |
@@ -505,7 +505,7 @@ pub struct Function { | |||
505 | pub params: Box<[TypeRef]>, | 505 | pub params: Box<[TypeRef]>, |
506 | pub is_varargs: bool, | 506 | pub is_varargs: bool, |
507 | pub ret_type: TypeRef, | 507 | pub ret_type: TypeRef, |
508 | pub ast_id: FileAstId<ast::FnDef>, | 508 | pub ast_id: FileAstId<ast::Fn>, |
509 | } | 509 | } |
510 | 510 | ||
511 | #[derive(Debug, Clone, Eq, PartialEq)] | 511 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -514,7 +514,7 @@ pub struct Struct { | |||
514 | pub visibility: RawVisibilityId, | 514 | pub visibility: RawVisibilityId, |
515 | pub generic_params: GenericParamsId, | 515 | pub generic_params: GenericParamsId, |
516 | pub fields: Fields, | 516 | pub fields: Fields, |
517 | pub ast_id: FileAstId<ast::StructDef>, | 517 | pub ast_id: FileAstId<ast::Struct>, |
518 | pub kind: StructDefKind, | 518 | pub kind: StructDefKind, |
519 | } | 519 | } |
520 | 520 | ||
@@ -534,7 +534,7 @@ pub struct Union { | |||
534 | pub visibility: RawVisibilityId, | 534 | pub visibility: RawVisibilityId, |
535 | pub generic_params: GenericParamsId, | 535 | pub generic_params: GenericParamsId, |
536 | pub fields: Fields, | 536 | pub fields: Fields, |
537 | pub ast_id: FileAstId<ast::UnionDef>, | 537 | pub ast_id: FileAstId<ast::Union>, |
538 | } | 538 | } |
539 | 539 | ||
540 | #[derive(Debug, Clone, Eq, PartialEq)] | 540 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -543,7 +543,7 @@ pub struct Enum { | |||
543 | pub visibility: RawVisibilityId, | 543 | pub visibility: RawVisibilityId, |
544 | pub generic_params: GenericParamsId, | 544 | pub generic_params: GenericParamsId, |
545 | pub variants: IdRange<Variant>, | 545 | pub variants: IdRange<Variant>, |
546 | pub ast_id: FileAstId<ast::EnumDef>, | 546 | pub ast_id: FileAstId<ast::Enum>, |
547 | } | 547 | } |
548 | 548 | ||
549 | #[derive(Debug, Clone, Eq, PartialEq)] | 549 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -552,7 +552,7 @@ pub struct Const { | |||
552 | pub name: Option<Name>, | 552 | pub name: Option<Name>, |
553 | pub visibility: RawVisibilityId, | 553 | pub visibility: RawVisibilityId, |
554 | pub type_ref: TypeRef, | 554 | pub type_ref: TypeRef, |
555 | pub ast_id: FileAstId<ast::ConstDef>, | 555 | pub ast_id: FileAstId<ast::Const>, |
556 | } | 556 | } |
557 | 557 | ||
558 | #[derive(Debug, Clone, Eq, PartialEq)] | 558 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -561,7 +561,7 @@ pub struct Static { | |||
561 | pub visibility: RawVisibilityId, | 561 | pub visibility: RawVisibilityId, |
562 | pub mutable: bool, | 562 | pub mutable: bool, |
563 | pub type_ref: TypeRef, | 563 | pub type_ref: TypeRef, |
564 | pub ast_id: FileAstId<ast::StaticDef>, | 564 | pub ast_id: FileAstId<ast::Static>, |
565 | } | 565 | } |
566 | 566 | ||
567 | #[derive(Debug, Clone, Eq, PartialEq)] | 567 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -571,7 +571,7 @@ pub struct Trait { | |||
571 | pub generic_params: GenericParamsId, | 571 | pub generic_params: GenericParamsId, |
572 | pub auto: bool, | 572 | pub auto: bool, |
573 | pub items: Box<[AssocItem]>, | 573 | pub items: Box<[AssocItem]>, |
574 | pub ast_id: FileAstId<ast::TraitDef>, | 574 | pub ast_id: FileAstId<ast::Trait>, |
575 | } | 575 | } |
576 | 576 | ||
577 | #[derive(Debug, Clone, Eq, PartialEq)] | 577 | #[derive(Debug, Clone, Eq, PartialEq)] |
@@ -581,7 +581,7 @@ pub struct Impl { | |||
581 | pub target_type: TypeRef, | 581 | pub target_type: TypeRef, |
582 | pub is_negative: bool, | 582 | pub is_negative: bool, |
583 | pub items: Box<[AssocItem]>, | 583 | pub items: Box<[AssocItem]>, |
584 | pub ast_id: FileAstId<ast::ImplDef>, | 584 | pub ast_id: FileAstId<ast::Impl>, |
585 | } | 585 | } |
586 | 586 | ||
587 | #[derive(Debug, Clone, PartialEq, Eq)] | 587 | #[derive(Debug, Clone, PartialEq, Eq)] |
@@ -592,7 +592,7 @@ pub struct TypeAlias { | |||
592 | pub bounds: Box<[TypeBound]>, | 592 | pub bounds: Box<[TypeBound]>, |
593 | pub generic_params: GenericParamsId, | 593 | pub generic_params: GenericParamsId, |
594 | pub type_ref: Option<TypeRef>, | 594 | pub type_ref: Option<TypeRef>, |
595 | pub ast_id: FileAstId<ast::TypeAliasDef>, | 595 | pub ast_id: FileAstId<ast::TypeAlias>, |
596 | } | 596 | } |
597 | 597 | ||
598 | #[derive(Debug, Clone, Eq, PartialEq)] | 598 | #[derive(Debug, Clone, Eq, PartialEq)] |
diff --git a/crates/ra_hir_def/src/item_tree/lower.rs b/crates/ra_hir_def/src/item_tree/lower.rs index 8bd0362dc..feb31579e 100644 --- a/crates/ra_hir_def/src/item_tree/lower.rs +++ b/crates/ra_hir_def/src/item_tree/lower.rs | |||
@@ -1,10 +1,7 @@ | |||
1 | //! AST -> `ItemTree` lowering code. | 1 | //! AST -> `ItemTree` lowering code. |
2 | 2 | ||
3 | use super::*; | 3 | use std::{collections::hash_map::Entry, mem, sync::Arc}; |
4 | use crate::{ | 4 | |
5 | attr::Attrs, | ||
6 | generics::{GenericParams, TypeParamData, TypeParamProvenance}, | ||
7 | }; | ||
8 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; | 5 | use hir_expand::{ast_id_map::AstIdMap, hygiene::Hygiene, HirFileId}; |
9 | use ra_arena::map::ArenaMap; | 6 | use ra_arena::map::ArenaMap; |
10 | use ra_syntax::{ | 7 | use ra_syntax::{ |
@@ -12,7 +9,13 @@ use ra_syntax::{ | |||
12 | SyntaxNode, | 9 | SyntaxNode, |
13 | }; | 10 | }; |
14 | use smallvec::SmallVec; | 11 | use smallvec::SmallVec; |
15 | use std::{collections::hash_map::Entry, mem, sync::Arc}; | 12 | |
13 | use crate::{ | ||
14 | attr::Attrs, | ||
15 | generics::{GenericParams, TypeParamData, TypeParamProvenance}, | ||
16 | }; | ||
17 | |||
18 | use super::*; | ||
16 | 19 | ||
17 | fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> { | 20 | fn id<N: ItemTreeNode>(index: Idx<N>) -> FileItemTreeId<N> { |
18 | FileItemTreeId { index, _p: PhantomData } | 21 | FileItemTreeId { index, _p: PhantomData } |
@@ -75,13 +78,13 @@ impl Ctx { | |||
75 | 78 | ||
76 | // Collect inner items for 1-to-1-lowered items. | 79 | // Collect inner items for 1-to-1-lowered items. |
77 | match item { | 80 | match item { |
78 | ast::Item::StructDef(_) | 81 | ast::Item::Struct(_) |
79 | | ast::Item::UnionDef(_) | 82 | | ast::Item::Union(_) |
80 | | ast::Item::EnumDef(_) | 83 | | ast::Item::Enum(_) |
81 | | ast::Item::FnDef(_) | 84 | | ast::Item::Fn(_) |
82 | | ast::Item::TypeAliasDef(_) | 85 | | ast::Item::TypeAlias(_) |
83 | | ast::Item::ConstDef(_) | 86 | | ast::Item::Const(_) |
84 | | ast::Item::StaticDef(_) | 87 | | ast::Item::Static(_) |
85 | | ast::Item::MacroCall(_) => { | 88 | | ast::Item::MacroCall(_) => { |
86 | // Skip this if we're already collecting inner items. We'll descend into all nodes | 89 | // Skip this if we're already collecting inner items. We'll descend into all nodes |
87 | // already. | 90 | // already. |
@@ -92,7 +95,7 @@ impl Ctx { | |||
92 | 95 | ||
93 | // These are handled in their respective `lower_X` method (since we can't just blindly | 96 | // These are handled in their respective `lower_X` method (since we can't just blindly |
94 | // walk them). | 97 | // walk them). |
95 | ast::Item::TraitDef(_) | ast::Item::ImplDef(_) | ast::Item::ExternBlock(_) => {} | 98 | ast::Item::Trait(_) | ast::Item::Impl(_) | ast::Item::ExternBlock(_) => {} |
96 | 99 | ||
97 | // These don't have inner items. | 100 | // These don't have inner items. |
98 | ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {} | 101 | ast::Item::Module(_) | ast::Item::ExternCrate(_) | ast::Item::Use(_) => {} |
@@ -100,16 +103,16 @@ impl Ctx { | |||
100 | 103 | ||
101 | let attrs = Attrs::new(item, &self.hygiene); | 104 | let attrs = Attrs::new(item, &self.hygiene); |
102 | let items = match item { | 105 | let items = match item { |
103 | ast::Item::StructDef(ast) => self.lower_struct(ast).map(Into::into), | 106 | ast::Item::Struct(ast) => self.lower_struct(ast).map(Into::into), |
104 | ast::Item::UnionDef(ast) => self.lower_union(ast).map(Into::into), | 107 | ast::Item::Union(ast) => self.lower_union(ast).map(Into::into), |
105 | ast::Item::EnumDef(ast) => self.lower_enum(ast).map(Into::into), | 108 | ast::Item::Enum(ast) => self.lower_enum(ast).map(Into::into), |
106 | ast::Item::FnDef(ast) => self.lower_function(ast).map(Into::into), | 109 | ast::Item::Fn(ast) => self.lower_function(ast).map(Into::into), |
107 | ast::Item::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), | 110 | ast::Item::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), |
108 | ast::Item::StaticDef(ast) => self.lower_static(ast).map(Into::into), | 111 | ast::Item::Static(ast) => self.lower_static(ast).map(Into::into), |
109 | ast::Item::ConstDef(ast) => Some(self.lower_const(ast).into()), | 112 | ast::Item::Const(ast) => Some(self.lower_const(ast).into()), |
110 | ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), | 113 | ast::Item::Module(ast) => self.lower_module(ast).map(Into::into), |
111 | ast::Item::TraitDef(ast) => self.lower_trait(ast).map(Into::into), | 114 | ast::Item::Trait(ast) => self.lower_trait(ast).map(Into::into), |
112 | ast::Item::ImplDef(ast) => self.lower_impl(ast).map(Into::into), | 115 | ast::Item::Impl(ast) => self.lower_impl(ast).map(Into::into), |
113 | ast::Item::Use(ast) => Some(ModItems( | 116 | ast::Item::Use(ast) => Some(ModItems( |
114 | self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(), | 117 | self.lower_use(ast).into_iter().map(Into::into).collect::<SmallVec<_>>(), |
115 | )), | 118 | )), |
@@ -155,14 +158,14 @@ impl Ctx { | |||
155 | 158 | ||
156 | fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> { | 159 | fn lower_assoc_item(&mut self, item: &ast::AssocItem) -> Option<AssocItem> { |
157 | match item { | 160 | match item { |
158 | ast::AssocItem::FnDef(ast) => self.lower_function(ast).map(Into::into), | 161 | ast::AssocItem::Fn(ast) => self.lower_function(ast).map(Into::into), |
159 | ast::AssocItem::TypeAliasDef(ast) => self.lower_type_alias(ast).map(Into::into), | 162 | ast::AssocItem::TypeAlias(ast) => self.lower_type_alias(ast).map(Into::into), |
160 | ast::AssocItem::ConstDef(ast) => Some(self.lower_const(ast).into()), | 163 | ast::AssocItem::Const(ast) => Some(self.lower_const(ast).into()), |
161 | ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), | 164 | ast::AssocItem::MacroCall(ast) => self.lower_macro_call(ast).map(Into::into), |
162 | } | 165 | } |
163 | } | 166 | } |
164 | 167 | ||
165 | fn lower_struct(&mut self, strukt: &ast::StructDef) -> Option<FileItemTreeId<Struct>> { | 168 | fn lower_struct(&mut self, strukt: &ast::Struct) -> Option<FileItemTreeId<Struct>> { |
166 | let visibility = self.lower_visibility(strukt); | 169 | let visibility = self.lower_visibility(strukt); |
167 | let name = strukt.name()?.as_name(); | 170 | let name = strukt.name()?.as_name(); |
168 | let generic_params = self.lower_generic_params(GenericsOwner::Struct, strukt); | 171 | let generic_params = self.lower_generic_params(GenericsOwner::Struct, strukt); |
@@ -191,7 +194,7 @@ impl Ctx { | |||
191 | } | 194 | } |
192 | } | 195 | } |
193 | 196 | ||
194 | fn lower_record_fields(&mut self, fields: &ast::RecordFieldDefList) -> IdRange<Field> { | 197 | fn lower_record_fields(&mut self, fields: &ast::RecordFieldList) -> IdRange<Field> { |
195 | let start = self.next_field_idx(); | 198 | let start = self.next_field_idx(); |
196 | for field in fields.fields() { | 199 | for field in fields.fields() { |
197 | if let Some(data) = self.lower_record_field(&field) { | 200 | if let Some(data) = self.lower_record_field(&field) { |
@@ -203,15 +206,15 @@ impl Ctx { | |||
203 | IdRange::new(start..end) | 206 | IdRange::new(start..end) |
204 | } | 207 | } |
205 | 208 | ||
206 | fn lower_record_field(&mut self, field: &ast::RecordFieldDef) -> Option<Field> { | 209 | fn lower_record_field(&mut self, field: &ast::RecordField) -> Option<Field> { |
207 | let name = field.name()?.as_name(); | 210 | let name = field.name()?.as_name(); |
208 | let visibility = self.lower_visibility(field); | 211 | let visibility = self.lower_visibility(field); |
209 | let type_ref = self.lower_type_ref_opt(field.ascribed_type()); | 212 | let type_ref = self.lower_type_ref_opt(field.ty()); |
210 | let res = Field { name, type_ref, visibility }; | 213 | let res = Field { name, type_ref, visibility }; |
211 | Some(res) | 214 | Some(res) |
212 | } | 215 | } |
213 | 216 | ||
214 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldDefList) -> IdRange<Field> { | 217 | fn lower_tuple_fields(&mut self, fields: &ast::TupleFieldList) -> IdRange<Field> { |
215 | let start = self.next_field_idx(); | 218 | let start = self.next_field_idx(); |
216 | for (i, field) in fields.fields().enumerate() { | 219 | for (i, field) in fields.fields().enumerate() { |
217 | let data = self.lower_tuple_field(i, &field); | 220 | let data = self.lower_tuple_field(i, &field); |
@@ -222,22 +225,20 @@ impl Ctx { | |||
222 | IdRange::new(start..end) | 225 | IdRange::new(start..end) |
223 | } | 226 | } |
224 | 227 | ||
225 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleFieldDef) -> Field { | 228 | fn lower_tuple_field(&mut self, idx: usize, field: &ast::TupleField) -> Field { |
226 | let name = Name::new_tuple_field(idx); | 229 | let name = Name::new_tuple_field(idx); |
227 | let visibility = self.lower_visibility(field); | 230 | let visibility = self.lower_visibility(field); |
228 | let type_ref = self.lower_type_ref_opt(field.type_ref()); | 231 | let type_ref = self.lower_type_ref_opt(field.ty()); |
229 | let res = Field { name, type_ref, visibility }; | 232 | let res = Field { name, type_ref, visibility }; |
230 | res | 233 | res |
231 | } | 234 | } |
232 | 235 | ||
233 | fn lower_union(&mut self, union: &ast::UnionDef) -> Option<FileItemTreeId<Union>> { | 236 | fn lower_union(&mut self, union: &ast::Union) -> Option<FileItemTreeId<Union>> { |
234 | let visibility = self.lower_visibility(union); | 237 | let visibility = self.lower_visibility(union); |
235 | let name = union.name()?.as_name(); | 238 | let name = union.name()?.as_name(); |
236 | let generic_params = self.lower_generic_params(GenericsOwner::Union, union); | 239 | let generic_params = self.lower_generic_params(GenericsOwner::Union, union); |
237 | let fields = match union.record_field_def_list() { | 240 | let fields = match union.record_field_list() { |
238 | Some(record_field_def_list) => { | 241 | Some(record_field_list) => self.lower_fields(&StructKind::Record(record_field_list)), |
239 | self.lower_fields(&StructKind::Record(record_field_def_list)) | ||
240 | } | ||
241 | None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), | 242 | None => Fields::Record(IdRange::new(self.next_field_idx()..self.next_field_idx())), |
242 | }; | 243 | }; |
243 | let ast_id = self.source_ast_id_map.ast_id(union); | 244 | let ast_id = self.source_ast_id_map.ast_id(union); |
@@ -245,7 +246,7 @@ impl Ctx { | |||
245 | Some(id(self.data().unions.alloc(res))) | 246 | Some(id(self.data().unions.alloc(res))) |
246 | } | 247 | } |
247 | 248 | ||
248 | fn lower_enum(&mut self, enum_: &ast::EnumDef) -> Option<FileItemTreeId<Enum>> { | 249 | fn lower_enum(&mut self, enum_: &ast::Enum) -> Option<FileItemTreeId<Enum>> { |
249 | let visibility = self.lower_visibility(enum_); | 250 | let visibility = self.lower_visibility(enum_); |
250 | let name = enum_.name()?.as_name(); | 251 | let name = enum_.name()?.as_name(); |
251 | let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_); | 252 | let generic_params = self.lower_generic_params(GenericsOwner::Enum, enum_); |
@@ -258,7 +259,7 @@ impl Ctx { | |||
258 | Some(id(self.data().enums.alloc(res))) | 259 | Some(id(self.data().enums.alloc(res))) |
259 | } | 260 | } |
260 | 261 | ||
261 | fn lower_variants(&mut self, variants: &ast::EnumVariantList) -> IdRange<Variant> { | 262 | fn lower_variants(&mut self, variants: &ast::VariantList) -> IdRange<Variant> { |
262 | let start = self.next_variant_idx(); | 263 | let start = self.next_variant_idx(); |
263 | for variant in variants.variants() { | 264 | for variant in variants.variants() { |
264 | if let Some(data) = self.lower_variant(&variant) { | 265 | if let Some(data) = self.lower_variant(&variant) { |
@@ -270,14 +271,14 @@ impl Ctx { | |||
270 | IdRange::new(start..end) | 271 | IdRange::new(start..end) |
271 | } | 272 | } |
272 | 273 | ||
273 | fn lower_variant(&mut self, variant: &ast::EnumVariant) -> Option<Variant> { | 274 | fn lower_variant(&mut self, variant: &ast::Variant) -> Option<Variant> { |
274 | let name = variant.name()?.as_name(); | 275 | let name = variant.name()?.as_name(); |
275 | let fields = self.lower_fields(&variant.kind()); | 276 | let fields = self.lower_fields(&variant.kind()); |
276 | let res = Variant { name, fields }; | 277 | let res = Variant { name, fields }; |
277 | Some(res) | 278 | Some(res) |
278 | } | 279 | } |
279 | 280 | ||
280 | fn lower_function(&mut self, func: &ast::FnDef) -> Option<FileItemTreeId<Function>> { | 281 | fn lower_function(&mut self, func: &ast::Fn) -> Option<FileItemTreeId<Function>> { |
281 | let visibility = self.lower_visibility(func); | 282 | let visibility = self.lower_visibility(func); |
282 | let name = func.name()?.as_name(); | 283 | let name = func.name()?.as_name(); |
283 | 284 | ||
@@ -285,7 +286,7 @@ impl Ctx { | |||
285 | let mut has_self_param = false; | 286 | let mut has_self_param = false; |
286 | if let Some(param_list) = func.param_list() { | 287 | if let Some(param_list) = func.param_list() { |
287 | if let Some(self_param) = param_list.self_param() { | 288 | if let Some(self_param) = param_list.self_param() { |
288 | let self_type = match self_param.ascribed_type() { | 289 | let self_type = match self_param.ty() { |
289 | Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), | 290 | Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), |
290 | None => { | 291 | None => { |
291 | let self_type = TypeRef::Path(name![Self].into()); | 292 | let self_type = TypeRef::Path(name![Self].into()); |
@@ -304,7 +305,7 @@ impl Ctx { | |||
304 | has_self_param = true; | 305 | has_self_param = true; |
305 | } | 306 | } |
306 | for param in param_list.params() { | 307 | for param in param_list.params() { |
307 | let type_ref = TypeRef::from_ast_opt(&self.body_ctx, param.ascribed_type()); | 308 | let type_ref = TypeRef::from_ast_opt(&self.body_ctx, param.ty()); |
308 | params.push(type_ref); | 309 | params.push(type_ref); |
309 | } | 310 | } |
310 | } | 311 | } |
@@ -316,7 +317,7 @@ impl Ctx { | |||
316 | } | 317 | } |
317 | } | 318 | } |
318 | 319 | ||
319 | let ret_type = match func.ret_type().and_then(|rt| rt.type_ref()) { | 320 | let ret_type = match func.ret_type().and_then(|rt| rt.ty()) { |
320 | Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), | 321 | Some(type_ref) => TypeRef::from_ast(&self.body_ctx, type_ref), |
321 | _ => TypeRef::unit(), | 322 | _ => TypeRef::unit(), |
322 | }; | 323 | }; |
@@ -348,10 +349,10 @@ impl Ctx { | |||
348 | 349 | ||
349 | fn lower_type_alias( | 350 | fn lower_type_alias( |
350 | &mut self, | 351 | &mut self, |
351 | type_alias: &ast::TypeAliasDef, | 352 | type_alias: &ast::TypeAlias, |
352 | ) -> Option<FileItemTreeId<TypeAlias>> { | 353 | ) -> Option<FileItemTreeId<TypeAlias>> { |
353 | let name = type_alias.name()?.as_name(); | 354 | let name = type_alias.name()?.as_name(); |
354 | let type_ref = type_alias.type_ref().map(|it| self.lower_type_ref(&it)); | 355 | let type_ref = type_alias.ty().map(|it| self.lower_type_ref(&it)); |
355 | let visibility = self.lower_visibility(type_alias); | 356 | let visibility = self.lower_visibility(type_alias); |
356 | let bounds = self.lower_type_bounds(type_alias); | 357 | let bounds = self.lower_type_bounds(type_alias); |
357 | let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias); | 358 | let generic_params = self.lower_generic_params(GenericsOwner::TypeAlias, type_alias); |
@@ -367,9 +368,9 @@ impl Ctx { | |||
367 | Some(id(self.data().type_aliases.alloc(res))) | 368 | Some(id(self.data().type_aliases.alloc(res))) |
368 | } | 369 | } |
369 | 370 | ||
370 | fn lower_static(&mut self, static_: &ast::StaticDef) -> Option<FileItemTreeId<Static>> { | 371 | fn lower_static(&mut self, static_: &ast::Static) -> Option<FileItemTreeId<Static>> { |
371 | let name = static_.name()?.as_name(); | 372 | let name = static_.name()?.as_name(); |
372 | let type_ref = self.lower_type_ref_opt(static_.ascribed_type()); | 373 | let type_ref = self.lower_type_ref_opt(static_.ty()); |
373 | let visibility = self.lower_visibility(static_); | 374 | let visibility = self.lower_visibility(static_); |
374 | let mutable = static_.mut_token().is_some(); | 375 | let mutable = static_.mut_token().is_some(); |
375 | let ast_id = self.source_ast_id_map.ast_id(static_); | 376 | let ast_id = self.source_ast_id_map.ast_id(static_); |
@@ -377,9 +378,9 @@ impl Ctx { | |||
377 | Some(id(self.data().statics.alloc(res))) | 378 | Some(id(self.data().statics.alloc(res))) |
378 | } | 379 | } |
379 | 380 | ||
380 | fn lower_const(&mut self, konst: &ast::ConstDef) -> FileItemTreeId<Const> { | 381 | fn lower_const(&mut self, konst: &ast::Const) -> FileItemTreeId<Const> { |
381 | let name = konst.name().map(|it| it.as_name()); | 382 | let name = konst.name().map(|it| it.as_name()); |
382 | let type_ref = self.lower_type_ref_opt(konst.ascribed_type()); | 383 | let type_ref = self.lower_type_ref_opt(konst.ty()); |
383 | let visibility = self.lower_visibility(konst); | 384 | let visibility = self.lower_visibility(konst); |
384 | let ast_id = self.source_ast_id_map.ast_id(konst); | 385 | let ast_id = self.source_ast_id_map.ast_id(konst); |
385 | let res = Const { name, visibility, type_ref, ast_id }; | 386 | let res = Const { name, visibility, type_ref, ast_id }; |
@@ -412,7 +413,7 @@ impl Ctx { | |||
412 | Some(id(self.data().mods.alloc(res))) | 413 | Some(id(self.data().mods.alloc(res))) |
413 | } | 414 | } |
414 | 415 | ||
415 | fn lower_trait(&mut self, trait_def: &ast::TraitDef) -> Option<FileItemTreeId<Trait>> { | 416 | fn lower_trait(&mut self, trait_def: &ast::Trait) -> Option<FileItemTreeId<Trait>> { |
416 | let name = trait_def.name()?.as_name(); | 417 | let name = trait_def.name()?.as_name(); |
417 | let visibility = self.lower_visibility(trait_def); | 418 | let visibility = self.lower_visibility(trait_def); |
418 | let generic_params = | 419 | let generic_params = |
@@ -444,7 +445,7 @@ impl Ctx { | |||
444 | Some(id(self.data().traits.alloc(res))) | 445 | Some(id(self.data().traits.alloc(res))) |
445 | } | 446 | } |
446 | 447 | ||
447 | fn lower_impl(&mut self, impl_def: &ast::ImplDef) -> Option<FileItemTreeId<Impl>> { | 448 | fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> { |
448 | let generic_params = | 449 | let generic_params = |
449 | self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); | 450 | self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def); |
450 | let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr)); | 451 | let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr)); |
@@ -547,15 +548,16 @@ impl Ctx { | |||
547 | self.collect_inner_items(item.syntax()); | 548 | self.collect_inner_items(item.syntax()); |
548 | let attrs = Attrs::new(&item, &self.hygiene); | 549 | let attrs = Attrs::new(&item, &self.hygiene); |
549 | let id: ModItem = match item { | 550 | let id: ModItem = match item { |
550 | ast::ExternItem::FnDef(ast) => { | 551 | ast::ExternItem::Fn(ast) => { |
551 | let func = self.lower_function(&ast)?; | 552 | let func = self.lower_function(&ast)?; |
552 | self.data().functions[func.index].is_unsafe = true; | 553 | self.data().functions[func.index].is_unsafe = true; |
553 | func.into() | 554 | func.into() |
554 | } | 555 | } |
555 | ast::ExternItem::StaticDef(ast) => { | 556 | ast::ExternItem::Static(ast) => { |
556 | let statik = self.lower_static(&ast)?; | 557 | let statik = self.lower_static(&ast)?; |
557 | statik.into() | 558 | statik.into() |
558 | } | 559 | } |
560 | ast::ExternItem::MacroCall(_) => return None, | ||
559 | }; | 561 | }; |
560 | self.add_attrs(id.into(), attrs); | 562 | self.add_attrs(id.into(), attrs); |
561 | Some(id) | 563 | Some(id) |
@@ -568,10 +570,10 @@ impl Ctx { | |||
568 | fn lower_generic_params_and_inner_items( | 570 | fn lower_generic_params_and_inner_items( |
569 | &mut self, | 571 | &mut self, |
570 | owner: GenericsOwner<'_>, | 572 | owner: GenericsOwner<'_>, |
571 | node: &impl ast::TypeParamsOwner, | 573 | node: &impl ast::GenericParamsOwner, |
572 | ) -> GenericParamsId { | 574 | ) -> GenericParamsId { |
573 | // Generics are part of item headers and may contain inner items we need to collect. | 575 | // Generics are part of item headers and may contain inner items we need to collect. |
574 | if let Some(params) = node.type_param_list() { | 576 | if let Some(params) = node.generic_param_list() { |
575 | self.collect_inner_items(params.syntax()); | 577 | self.collect_inner_items(params.syntax()); |
576 | } | 578 | } |
577 | if let Some(clause) = node.where_clause() { | 579 | if let Some(clause) = node.where_clause() { |
@@ -584,7 +586,7 @@ impl Ctx { | |||
584 | fn lower_generic_params( | 586 | fn lower_generic_params( |
585 | &mut self, | 587 | &mut self, |
586 | owner: GenericsOwner<'_>, | 588 | owner: GenericsOwner<'_>, |
587 | node: &impl ast::TypeParamsOwner, | 589 | node: &impl ast::GenericParamsOwner, |
588 | ) -> GenericParamsId { | 590 | ) -> GenericParamsId { |
589 | let mut sm = &mut ArenaMap::default(); | 591 | let mut sm = &mut ArenaMap::default(); |
590 | let mut generics = GenericParams::default(); | 592 | let mut generics = GenericParams::default(); |
@@ -697,7 +699,7 @@ enum GenericsOwner<'a> { | |||
697 | Enum, | 699 | Enum, |
698 | Union, | 700 | Union, |
699 | /// The `TraitDef` is needed to fill the source map for the implicit `Self` parameter. | 701 | /// The `TraitDef` is needed to fill the source map for the implicit `Self` parameter. |
700 | Trait(&'a ast::TraitDef), | 702 | Trait(&'a ast::Trait), |
701 | TypeAlias, | 703 | TypeAlias, |
702 | Impl, | 704 | Impl, |
703 | } | 705 | } |
diff --git a/crates/ra_hir_def/src/item_tree/tests.rs b/crates/ra_hir_def/src/item_tree/tests.rs index 3f2e29d9e..a81497fa8 100644 --- a/crates/ra_hir_def/src/item_tree/tests.rs +++ b/crates/ra_hir_def/src/item_tree/tests.rs | |||
@@ -234,25 +234,25 @@ fn smoke() { | |||
234 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }] | 234 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("ext_crate"))] }, input: None }]) }] |
235 | ExternCrate { path: ModPath { kind: Plain, segments: [Name(Text("krate"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_macro_use: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ExternCrate>(1) } | 235 | ExternCrate { path: ModPath { kind: Plain, segments: [Name(Text("krate"))] }, alias: None, visibility: RawVisibilityId("pub(self)"), is_macro_use: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ExternCrate>(1) } |
236 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }] | 236 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_trait"))] }, input: None }]) }] |
237 | Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(2) } | 237 | Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [TypeAlias(Idx::<TypeAlias>(0)), Const(Idx::<Const>(0)), Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Trait>(2) } |
238 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }] | 238 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_ty"))] }, input: None }]) }] |
239 | > TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAliasDef>(8) } | 239 | > TypeAlias { name: Name(Text("AssocTy")), visibility: RawVisibilityId("pub(self)"), bounds: [Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Tr"))] }, generic_args: [Some(GenericArgs { args: [Type(Tuple([]))], has_self_type: false, bindings: [] })] })], generic_params: GenericParamsId(4294967295), type_ref: None, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TypeAlias>(8) } |
240 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }] | 240 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_const"))] }, input: None }]) }] |
241 | > Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ConstDef>(9) } | 241 | > Const { name: Some(Name(Text("CONST"))), visibility: RawVisibilityId("pub(self)"), type_ref: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("u8"))] }, generic_args: [None] }), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Const>(9) } |
242 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }] | 242 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_method"))] }, input: None }]) }] |
243 | > Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(10) } | 243 | > Function { name: Name(Text("method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Shared)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(10) } |
244 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }] | 244 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("assoc_dfl_method"))] }, input: None }]) }] |
245 | > Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(11) } | 245 | > Function { name: Name(Text("dfl_method")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: true, is_unsafe: false, params: [Reference(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Self"))] }, generic_args: [None] }), Mut)], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(11) } |
246 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct0"))] }, input: None }]) }] | 246 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct0"))] }, input: None }]) }] |
247 | Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::StructDef>(3), kind: Unit } | 247 | Struct { name: Name(Text("Struct0")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), fields: Unit, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(3), kind: Unit } |
248 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct1"))] }, input: None }]) }] | 248 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct1"))] }, input: None }]) }] |
249 | Struct { name: Name(Text("Struct1")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(2), fields: Tuple(IdRange::<ra_hir_def::item_tree::Field>(0..1)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::StructDef>(4), kind: Tuple } | 249 | Struct { name: Name(Text("Struct1")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(2), fields: Tuple(IdRange::<ra_hir_def::item_tree::Field>(0..1)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(4), kind: Tuple } |
250 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }] | 250 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("struct2"))] }, input: None }]) }] |
251 | Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(1..2)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::StructDef>(5), kind: Record } | 251 | Struct { name: Name(Text("Struct2")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(3), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(1..2)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Struct>(5), kind: Record } |
252 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }] | 252 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("en"))] }, input: None }]) }] |
253 | Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::EnumDef>(6) } | 253 | Enum { name: Name(Text("En")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), variants: IdRange::<ra_hir_def::item_tree::Variant>(0..1), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Enum>(6) } |
254 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }] | 254 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("un"))] }, input: None }]) }] |
255 | Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::UnionDef>(7) } | 255 | Union { name: Name(Text("Un")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), fields: Record(IdRange::<ra_hir_def::item_tree::Field>(3..4)), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Union>(7) } |
256 | "##]], | 256 | "##]], |
257 | ); | 257 | ); |
258 | } | 258 | } |
@@ -274,13 +274,13 @@ fn simple_inner_items() { | |||
274 | inner attrs: Attrs { entries: None } | 274 | inner attrs: Attrs { entries: None } |
275 | 275 | ||
276 | top-level items: | 276 | top-level items: |
277 | Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) } | 277 | Impl { generic_params: GenericParamsId(0), target_trait: Some(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("D"))] }, generic_args: [None] })), target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Response"))] }, generic_args: [Some(GenericArgs { args: [Type(Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("T"))] }, generic_args: [None] }))], has_self_type: false, bindings: [] })] }), is_negative: false, items: [Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) } |
278 | > Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) } | 278 | > Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } |
279 | 279 | ||
280 | inner items: | 280 | inner items: |
281 | 281 | ||
282 | for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(2): | 282 | for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(2): |
283 | Function { name: Name(Text("end")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) } | 283 | Function { name: Name(Text("end")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(1), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) } |
284 | 284 | ||
285 | "#]], | 285 | "#]], |
286 | ); | 286 | ); |
@@ -303,9 +303,9 @@ fn extern_attrs() { | |||
303 | 303 | ||
304 | top-level items: | 304 | top-level items: |
305 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }] | 305 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }] |
306 | Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) } | 306 | Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } |
307 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }] | 307 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }, Attr { path: ModPath { kind: Plain, segments: [Name(Text("block_attr"))] }, input: None }]) }] |
308 | Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) } | 308 | Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: true, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) } |
309 | "##]], | 309 | "##]], |
310 | ); | 310 | ); |
311 | } | 311 | } |
@@ -327,11 +327,11 @@ fn trait_attrs() { | |||
327 | 327 | ||
328 | top-level items: | 328 | top-level items: |
329 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }] | 329 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("trait_attr"))] }, input: None }]) }] |
330 | Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::TraitDef>(0) } | 330 | Trait { name: Name(Text("Tr")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(0), auto: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Trait>(0) } |
331 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }] | 331 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }] |
332 | > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) } | 332 | > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } |
333 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }] | 333 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }] |
334 | > Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) } | 334 | > Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) } |
335 | "##]], | 335 | "##]], |
336 | ); | 336 | ); |
337 | } | 337 | } |
@@ -353,11 +353,11 @@ fn impl_attrs() { | |||
353 | 353 | ||
354 | top-level items: | 354 | top-level items: |
355 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }] | 355 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("impl_attr"))] }, input: None }]) }] |
356 | Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) } | 356 | Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("Ty"))] }, generic_args: [None] }), is_negative: false, items: [Function(Idx::<Function>(0)), Function(Idx::<Function>(1))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) } |
357 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }] | 357 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_a"))] }, input: None }]) }] |
358 | > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) } | 358 | > Function { name: Name(Text("a")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } |
359 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }] | 359 | > #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("attr_b"))] }, input: None }]) }] |
360 | > Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(2) } | 360 | > Function { name: Name(Text("b")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(2) } |
361 | "##]], | 361 | "##]], |
362 | ); | 362 | ); |
363 | } | 363 | } |
@@ -408,13 +408,13 @@ fn inner_item_attrs() { | |||
408 | inner attrs: Attrs { entries: None } | 408 | inner attrs: Attrs { entries: None } |
409 | 409 | ||
410 | top-level items: | 410 | top-level items: |
411 | Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(0) } | 411 | Function { name: Name(Text("foo")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(0) } |
412 | 412 | ||
413 | inner items: | 413 | inner items: |
414 | 414 | ||
415 | for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(1): | 415 | for AST FileAstId::<ra_syntax::ast::generated::nodes::Item>(1): |
416 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_inner"))] }, input: None }]) }] | 416 | #[Attrs { entries: Some([Attr { path: ModPath { kind: Plain, segments: [Name(Text("on_inner"))] }, input: None }]) }] |
417 | Function { name: Name(Text("inner")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::FnDef>(1) } | 417 | Function { name: Name(Text("inner")), visibility: RawVisibilityId("pub(self)"), generic_params: GenericParamsId(4294967295), has_self_param: false, is_unsafe: false, params: [], is_varargs: false, ret_type: Tuple([]), ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Fn>(1) } |
418 | 418 | ||
419 | "##]], | 419 | "##]], |
420 | ); | 420 | ); |
@@ -432,7 +432,7 @@ fn assoc_item_macros() { | |||
432 | inner attrs: Attrs { entries: None } | 432 | inner attrs: Attrs { entries: None } |
433 | 433 | ||
434 | top-level items: | 434 | top-level items: |
435 | Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("S"))] }, generic_args: [None] }), is_negative: false, items: [MacroCall(Idx::<MacroCall>(0))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::ImplDef>(0) } | 435 | Impl { generic_params: GenericParamsId(4294967295), target_trait: None, target_type: Path(Path { type_anchor: None, mod_path: ModPath { kind: Plain, segments: [Name(Text("S"))] }, generic_args: [None] }), is_negative: false, items: [MacroCall(Idx::<MacroCall>(0))], ast_id: FileAstId::<ra_syntax::ast::generated::nodes::Impl>(0) } |
436 | > MacroCall { name: None, path: ModPath { kind: Plain, segments: [Name(Text("items"))] }, is_export: false, is_local_inner: false, is_builtin: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::MacroCall>(1) } | 436 | > MacroCall { name: None, path: ModPath { kind: Plain, segments: [Name(Text("items"))] }, is_export: false, is_local_inner: false, is_builtin: false, ast_id: FileAstId::<ra_syntax::ast::generated::nodes::MacroCall>(1) } |
437 | "#]], | 437 | "#]], |
438 | ); | 438 | ); |
diff --git a/crates/ra_hir_def/src/keys.rs b/crates/ra_hir_def/src/keys.rs index a7349a21d..441bdbead 100644 --- a/crates/ra_hir_def/src/keys.rs +++ b/crates/ra_hir_def/src/keys.rs | |||
@@ -14,19 +14,19 @@ use crate::{ | |||
14 | 14 | ||
15 | pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>; | 15 | pub type Key<K, V> = crate::dyn_map::Key<InFile<K>, V, AstPtrPolicy<K, V>>; |
16 | 16 | ||
17 | pub const FUNCTION: Key<ast::FnDef, FunctionId> = Key::new(); | 17 | pub const FUNCTION: Key<ast::Fn, FunctionId> = Key::new(); |
18 | pub const CONST: Key<ast::ConstDef, ConstId> = Key::new(); | 18 | pub const CONST: Key<ast::Const, ConstId> = Key::new(); |
19 | pub const STATIC: Key<ast::StaticDef, StaticId> = Key::new(); | 19 | pub const STATIC: Key<ast::Static, StaticId> = Key::new(); |
20 | pub const TYPE_ALIAS: Key<ast::TypeAliasDef, TypeAliasId> = Key::new(); | 20 | pub const TYPE_ALIAS: Key<ast::TypeAlias, TypeAliasId> = Key::new(); |
21 | pub const IMPL: Key<ast::ImplDef, ImplId> = Key::new(); | 21 | pub const IMPL: Key<ast::Impl, ImplId> = Key::new(); |
22 | pub const TRAIT: Key<ast::TraitDef, TraitId> = Key::new(); | 22 | pub const TRAIT: Key<ast::Trait, TraitId> = Key::new(); |
23 | pub const STRUCT: Key<ast::StructDef, StructId> = Key::new(); | 23 | pub const STRUCT: Key<ast::Struct, StructId> = Key::new(); |
24 | pub const UNION: Key<ast::UnionDef, UnionId> = Key::new(); | 24 | pub const UNION: Key<ast::Union, UnionId> = Key::new(); |
25 | pub const ENUM: Key<ast::EnumDef, EnumId> = Key::new(); | 25 | pub const ENUM: Key<ast::Enum, EnumId> = Key::new(); |
26 | 26 | ||
27 | pub const ENUM_VARIANT: Key<ast::EnumVariant, EnumVariantId> = Key::new(); | 27 | pub const VARIANT: Key<ast::Variant, EnumVariantId> = Key::new(); |
28 | pub const TUPLE_FIELD: Key<ast::TupleFieldDef, FieldId> = Key::new(); | 28 | pub const TUPLE_FIELD: Key<ast::TupleField, FieldId> = Key::new(); |
29 | pub const RECORD_FIELD: Key<ast::RecordFieldDef, FieldId> = Key::new(); | 29 | pub const RECORD_FIELD: Key<ast::RecordField, FieldId> = Key::new(); |
30 | pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new(); | 30 | pub const TYPE_PARAM: Key<ast::TypeParam, TypeParamId> = Key::new(); |
31 | 31 | ||
32 | pub const MACRO: Key<ast::MacroCall, MacroDefId> = Key::new(); | 32 | pub const MACRO: Key<ast::MacroCall, MacroDefId> = Key::new(); |
diff --git a/crates/ra_hir_def/src/path/lower.rs b/crates/ra_hir_def/src/path/lower.rs index 6a0c019fd..07d17916a 100644 --- a/crates/ra_hir_def/src/path/lower.rs +++ b/crates/ra_hir_def/src/path/lower.rs | |||
@@ -9,7 +9,7 @@ use hir_expand::{ | |||
9 | hygiene::Hygiene, | 9 | hygiene::Hygiene, |
10 | name::{name, AsName}, | 10 | name::{name, AsName}, |
11 | }; | 11 | }; |
12 | use ra_syntax::ast::{self, AstNode, TypeAscriptionOwner, TypeBoundsOwner}; | 12 | use ra_syntax::ast::{self, AstNode, TypeBoundsOwner}; |
13 | 13 | ||
14 | use super::AssociatedTypeBinding; | 14 | use super::AssociatedTypeBinding; |
15 | use crate::{ | 15 | use crate::{ |
@@ -189,14 +189,14 @@ fn lower_generic_args_from_fn_path( | |||
189 | if let Some(params) = params { | 189 | if let Some(params) = params { |
190 | let mut param_types = Vec::new(); | 190 | let mut param_types = Vec::new(); |
191 | for param in params.params() { | 191 | for param in params.params() { |
192 | let type_ref = TypeRef::from_ast_opt(&ctx, param.ascribed_type()); | 192 | let type_ref = TypeRef::from_ast_opt(&ctx, param.ty()); |
193 | param_types.push(type_ref); | 193 | param_types.push(type_ref); |
194 | } | 194 | } |
195 | let arg = GenericArg::Type(TypeRef::Tuple(param_types)); | 195 | let arg = GenericArg::Type(TypeRef::Tuple(param_types)); |
196 | args.push(arg); | 196 | args.push(arg); |
197 | } | 197 | } |
198 | if let Some(ret_type) = ret_type { | 198 | if let Some(ret_type) = ret_type { |
199 | let type_ref = TypeRef::from_ast_opt(&ctx, ret_type.type_ref()); | 199 | let type_ref = TypeRef::from_ast_opt(&ctx, ret_type.ty()); |
200 | bindings.push(AssociatedTypeBinding { | 200 | bindings.push(AssociatedTypeBinding { |
201 | name: name![Output], | 201 | name: name![Output], |
202 | type_ref: Some(type_ref), | 202 | type_ref: Some(type_ref), |
diff --git a/crates/ra_hir_def/src/type_ref.rs b/crates/ra_hir_def/src/type_ref.rs index 970fc9af5..a5dc10eac 100644 --- a/crates/ra_hir_def/src/type_ref.rs +++ b/crates/ra_hir_def/src/type_ref.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! HIR for references to types. Paths in these are not yet resolved. They can | 1 | //! HIR for references to types. Paths in these are not yet resolved. They can |
2 | //! be directly created from an ast::TypeRef, without further queries. | 2 | //! be directly created from an ast::TypeRef, without further queries. |
3 | 3 | ||
4 | use ra_syntax::ast::{self, TypeAscriptionOwner}; | 4 | use ra_syntax::ast::{self}; |
5 | 5 | ||
6 | use crate::{body::LowerCtx, path::Path}; | 6 | use crate::{body::LowerCtx, path::Path}; |
7 | 7 | ||
@@ -82,7 +82,7 @@ impl TypeRef { | |||
82 | /// Converts an `ast::TypeRef` to a `hir::TypeRef`. | 82 | /// Converts an `ast::TypeRef` to a `hir::TypeRef`. |
83 | pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::TypeRef) -> Self { | 83 | pub(crate) fn from_ast(ctx: &LowerCtx, node: ast::TypeRef) -> Self { |
84 | match node { | 84 | match node { |
85 | ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.type_ref()), | 85 | ast::TypeRef::ParenType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), |
86 | ast::TypeRef::TupleType(inner) => { | 86 | ast::TypeRef::TupleType(inner) => { |
87 | TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect()) | 87 | TypeRef::Tuple(inner.fields().map(|it| TypeRef::from_ast(ctx, it)).collect()) |
88 | } | 88 | } |
@@ -96,18 +96,18 @@ impl TypeRef { | |||
96 | .unwrap_or(TypeRef::Error) | 96 | .unwrap_or(TypeRef::Error) |
97 | } | 97 | } |
98 | ast::TypeRef::PointerType(inner) => { | 98 | ast::TypeRef::PointerType(inner) => { |
99 | let inner_ty = TypeRef::from_ast_opt(&ctx, inner.type_ref()); | 99 | let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); |
100 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); | 100 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); |
101 | TypeRef::RawPtr(Box::new(inner_ty), mutability) | 101 | TypeRef::RawPtr(Box::new(inner_ty), mutability) |
102 | } | 102 | } |
103 | ast::TypeRef::ArrayType(inner) => { | 103 | ast::TypeRef::ArrayType(inner) => { |
104 | TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.type_ref()))) | 104 | TypeRef::Array(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) |
105 | } | 105 | } |
106 | ast::TypeRef::SliceType(inner) => { | 106 | ast::TypeRef::SliceType(inner) => { |
107 | TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.type_ref()))) | 107 | TypeRef::Slice(Box::new(TypeRef::from_ast_opt(&ctx, inner.ty()))) |
108 | } | 108 | } |
109 | ast::TypeRef::ReferenceType(inner) => { | 109 | ast::TypeRef::ReferenceType(inner) => { |
110 | let inner_ty = TypeRef::from_ast_opt(&ctx, inner.type_ref()); | 110 | let inner_ty = TypeRef::from_ast_opt(&ctx, inner.ty()); |
111 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); | 111 | let mutability = Mutability::from_mutable(inner.mut_token().is_some()); |
112 | TypeRef::Reference(Box::new(inner_ty), mutability) | 112 | TypeRef::Reference(Box::new(inner_ty), mutability) |
113 | } | 113 | } |
@@ -115,7 +115,7 @@ impl TypeRef { | |||
115 | ast::TypeRef::FnPointerType(inner) => { | 115 | ast::TypeRef::FnPointerType(inner) => { |
116 | let ret_ty = inner | 116 | let ret_ty = inner |
117 | .ret_type() | 117 | .ret_type() |
118 | .and_then(|rt| rt.type_ref()) | 118 | .and_then(|rt| rt.ty()) |
119 | .map(|it| TypeRef::from_ast(ctx, it)) | 119 | .map(|it| TypeRef::from_ast(ctx, it)) |
120 | .unwrap_or_else(|| TypeRef::Tuple(Vec::new())); | 120 | .unwrap_or_else(|| TypeRef::Tuple(Vec::new())); |
121 | let mut is_varargs = false; | 121 | let mut is_varargs = false; |
@@ -124,10 +124,7 @@ impl TypeRef { | |||
124 | is_varargs = param.dotdotdot_token().is_some(); | 124 | is_varargs = param.dotdotdot_token().is_some(); |
125 | } | 125 | } |
126 | 126 | ||
127 | pl.params() | 127 | pl.params().map(|p| p.ty()).map(|it| TypeRef::from_ast_opt(&ctx, it)).collect() |
128 | .map(|p| p.ascribed_type()) | ||
129 | .map(|it| TypeRef::from_ast_opt(&ctx, it)) | ||
130 | .collect() | ||
131 | } else { | 128 | } else { |
132 | Vec::new() | 129 | Vec::new() |
133 | }; | 130 | }; |
@@ -135,7 +132,7 @@ impl TypeRef { | |||
135 | TypeRef::Fn(params, is_varargs) | 132 | TypeRef::Fn(params, is_varargs) |
136 | } | 133 | } |
137 | // for types are close enough for our purposes to the inner type for now... | 134 | // for types are close enough for our purposes to the inner type for now... |
138 | ast::TypeRef::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.type_ref()), | 135 | ast::TypeRef::ForType(inner) => TypeRef::from_ast_opt(&ctx, inner.ty()), |
139 | ast::TypeRef::ImplTraitType(inner) => { | 136 | ast::TypeRef::ImplTraitType(inner) => { |
140 | TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) | 137 | TypeRef::ImplTrait(type_bounds_from_ast(ctx, inner.type_bound_list())) |
141 | } | 138 | } |
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs index 8f70a3567..69fa907cb 100644 --- a/crates/ra_hir_expand/src/builtin_derive.rs +++ b/crates/ra_hir_expand/src/builtin_derive.rs | |||
@@ -4,7 +4,7 @@ use log::debug; | |||
4 | 4 | ||
5 | use ra_parser::FragmentKind; | 5 | use ra_parser::FragmentKind; |
6 | use ra_syntax::{ | 6 | use ra_syntax::{ |
7 | ast::{self, AstNode, ModuleItemOwner, NameOwner, TypeParamsOwner}, | 7 | ast::{self, AstNode, GenericParamsOwner, ModuleItemOwner, NameOwner}, |
8 | match_ast, | 8 | match_ast, |
9 | }; | 9 | }; |
10 | 10 | ||
@@ -72,9 +72,9 @@ fn parse_adt(tt: &tt::Subtree) -> Result<BasicAdtInfo, mbe::ExpandError> { | |||
72 | let node = item.syntax(); | 72 | let node = item.syntax(); |
73 | let (name, params) = match_ast! { | 73 | let (name, params) = match_ast! { |
74 | match node { | 74 | match node { |
75 | ast::StructDef(it) => (it.name(), it.type_param_list()), | 75 | ast::Struct(it) => (it.name(), it.generic_param_list()), |
76 | ast::EnumDef(it) => (it.name(), it.type_param_list()), | 76 | ast::Enum(it) => (it.name(), it.generic_param_list()), |
77 | ast::UnionDef(it) => (it.name(), it.type_param_list()), | 77 | ast::Union(it) => (it.name(), it.generic_param_list()), |
78 | _ => { | 78 | _ => { |
79 | debug!("unexpected node is {:?}", node); | 79 | debug!("unexpected node is {:?}", node); |
80 | return Err(mbe::ExpandError::ConversionError) | 80 | return Err(mbe::ExpandError::ConversionError) |
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs index e0ad1567f..41df66696 100644 --- a/crates/ra_hir_expand/src/db.rs +++ b/crates/ra_hir_expand/src/db.rs | |||
@@ -386,7 +386,7 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind { | |||
386 | MATCH_EXPR => FragmentKind::Expr, | 386 | MATCH_EXPR => FragmentKind::Expr, |
387 | MATCH_ARM => FragmentKind::Expr, | 387 | MATCH_ARM => FragmentKind::Expr, |
388 | MATCH_GUARD => FragmentKind::Expr, | 388 | MATCH_GUARD => FragmentKind::Expr, |
389 | RECORD_FIELD => FragmentKind::Expr, | 389 | RECORD_EXPR_FIELD => FragmentKind::Expr, |
390 | CALL_EXPR => FragmentKind::Expr, | 390 | CALL_EXPR => FragmentKind::Expr, |
391 | INDEX_EXPR => FragmentKind::Expr, | 391 | INDEX_EXPR => FragmentKind::Expr, |
392 | METHOD_CALL_EXPR => FragmentKind::Expr, | 392 | METHOD_CALL_EXPR => FragmentKind::Expr, |
diff --git a/crates/ra_hir_ty/Cargo.toml b/crates/ra_hir_ty/Cargo.toml index 7242e2cb6..623ce261a 100644 --- a/crates/ra_hir_ty/Cargo.toml +++ b/crates/ra_hir_ty/Cargo.toml | |||
@@ -28,9 +28,9 @@ test_utils = { path = "../test_utils" } | |||
28 | 28 | ||
29 | scoped-tls = "1" | 29 | scoped-tls = "1" |
30 | 30 | ||
31 | chalk-solve = { version = "0.18.0" } | 31 | chalk-solve = { version = "0.19.0" } |
32 | chalk-ir = { version = "0.18.0" } | 32 | chalk-ir = { version = "0.19.0" } |
33 | chalk-recursive = { version = "0.18.0" } | 33 | chalk-recursive = { version = "0.19.0" } |
34 | 34 | ||
35 | [dev-dependencies] | 35 | [dev-dependencies] |
36 | expect = { path = "../expect" } | 36 | expect = { path = "../expect" } |
diff --git a/crates/ra_hir_ty/src/diagnostics.rs b/crates/ra_hir_ty/src/diagnostics.rs index 885abbaf2..f210c305a 100644 --- a/crates/ra_hir_ty/src/diagnostics.rs +++ b/crates/ra_hir_ty/src/diagnostics.rs | |||
@@ -29,7 +29,7 @@ pub fn validate_body(db: &dyn HirDatabase, owner: DefWithBodyId, sink: &mut Diag | |||
29 | #[derive(Debug)] | 29 | #[derive(Debug)] |
30 | pub struct NoSuchField { | 30 | pub struct NoSuchField { |
31 | pub file: HirFileId, | 31 | pub file: HirFileId, |
32 | pub field: AstPtr<ast::RecordField>, | 32 | pub field: AstPtr<ast::RecordExprField>, |
33 | } | 33 | } |
34 | 34 | ||
35 | impl Diagnostic for NoSuchField { | 35 | impl Diagnostic for NoSuchField { |
@@ -47,19 +47,19 @@ impl Diagnostic for NoSuchField { | |||
47 | } | 47 | } |
48 | 48 | ||
49 | impl AstDiagnostic for NoSuchField { | 49 | impl AstDiagnostic for NoSuchField { |
50 | type AST = ast::RecordField; | 50 | type AST = ast::RecordExprField; |
51 | 51 | ||
52 | fn ast(&self, db: &dyn AstDatabase) -> Self::AST { | 52 | fn ast(&self, db: &dyn AstDatabase) -> Self::AST { |
53 | let root = db.parse_or_expand(self.source().file_id).unwrap(); | 53 | let root = db.parse_or_expand(self.source().file_id).unwrap(); |
54 | let node = self.source().value.to_node(&root); | 54 | let node = self.source().value.to_node(&root); |
55 | ast::RecordField::cast(node).unwrap() | 55 | ast::RecordExprField::cast(node).unwrap() |
56 | } | 56 | } |
57 | } | 57 | } |
58 | 58 | ||
59 | #[derive(Debug)] | 59 | #[derive(Debug)] |
60 | pub struct MissingFields { | 60 | pub struct MissingFields { |
61 | pub file: HirFileId, | 61 | pub file: HirFileId, |
62 | pub field_list: AstPtr<ast::RecordFieldList>, | 62 | pub field_list: AstPtr<ast::RecordExprFieldList>, |
63 | pub missed_fields: Vec<Name>, | 63 | pub missed_fields: Vec<Name>, |
64 | } | 64 | } |
65 | 65 | ||
@@ -80,12 +80,12 @@ impl Diagnostic for MissingFields { | |||
80 | } | 80 | } |
81 | 81 | ||
82 | impl AstDiagnostic for MissingFields { | 82 | impl AstDiagnostic for MissingFields { |
83 | type AST = ast::RecordFieldList; | 83 | type AST = ast::RecordExprFieldList; |
84 | 84 | ||
85 | fn ast(&self, db: &dyn AstDatabase) -> Self::AST { | 85 | fn ast(&self, db: &dyn AstDatabase) -> Self::AST { |
86 | let root = db.parse_or_expand(self.source().file_id).unwrap(); | 86 | let root = db.parse_or_expand(self.source().file_id).unwrap(); |
87 | let node = self.source().value.to_node(&root); | 87 | let node = self.source().value.to_node(&root); |
88 | ast::RecordFieldList::cast(node).unwrap() | 88 | ast::RecordExprFieldList::cast(node).unwrap() |
89 | } | 89 | } |
90 | } | 90 | } |
91 | 91 | ||
diff --git a/crates/ra_hir_ty/src/diagnostics/expr.rs b/crates/ra_hir_ty/src/diagnostics/expr.rs index fd930eab1..f0e0f2988 100644 --- a/crates/ra_hir_ty/src/diagnostics/expr.rs +++ b/crates/ra_hir_ty/src/diagnostics/expr.rs | |||
@@ -100,8 +100,8 @@ impl<'a, 'b> ExprValidator<'a, 'b> { | |||
100 | 100 | ||
101 | if let Ok(source_ptr) = source_map.expr_syntax(id) { | 101 | if let Ok(source_ptr) = source_map.expr_syntax(id) { |
102 | let root = source_ptr.file_syntax(db.upcast()); | 102 | let root = source_ptr.file_syntax(db.upcast()); |
103 | if let ast::Expr::RecordLit(record_lit) = &source_ptr.value.to_node(&root) { | 103 | if let ast::Expr::RecordExpr(record_lit) = &source_ptr.value.to_node(&root) { |
104 | if let Some(field_list) = record_lit.record_field_list() { | 104 | if let Some(field_list) = record_lit.record_expr_field_list() { |
105 | let variant_data = variant_data(db.upcast(), variant_def); | 105 | let variant_data = variant_data(db.upcast(), variant_def); |
106 | let missed_fields = missed_fields | 106 | let missed_fields = missed_fields |
107 | .into_iter() | 107 | .into_iter() |
diff --git a/crates/ra_hir_ty/src/tests.rs b/crates/ra_hir_ty/src/tests.rs index 45bc14c37..016e689ff 100644 --- a/crates/ra_hir_ty/src/tests.rs +++ b/crates/ra_hir_ty/src/tests.rs | |||
@@ -81,7 +81,7 @@ fn check_types_impl(ra_fixture: &str, display_source: bool) { | |||
81 | fn type_at_range(db: &TestDB, pos: FileRange) -> Ty { | 81 | fn type_at_range(db: &TestDB, pos: FileRange) -> Ty { |
82 | let file = db.parse(pos.file_id).ok().unwrap(); | 82 | let file = db.parse(pos.file_id).ok().unwrap(); |
83 | let expr = algo::find_node_at_range::<ast::Expr>(file.syntax(), pos.range).unwrap(); | 83 | let expr = algo::find_node_at_range::<ast::Expr>(file.syntax(), pos.range).unwrap(); |
84 | let fn_def = expr.syntax().ancestors().find_map(ast::FnDef::cast).unwrap(); | 84 | let fn_def = expr.syntax().ancestors().find_map(ast::Fn::cast).unwrap(); |
85 | let module = db.module_for_file(pos.file_id); | 85 | let module = db.module_for_file(pos.file_id); |
86 | let func = *module.child_by_source(db)[keys::FUNCTION] | 86 | let func = *module.child_by_source(db)[keys::FUNCTION] |
87 | .get(&InFile::new(pos.file_id.into(), fn_def)) | 87 | .get(&InFile::new(pos.file_id.into(), fn_def)) |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 5298dbecf..1c7065364 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -183,6 +183,7 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
183 | .collect(), | 183 | .collect(), |
184 | 1, | 184 | 1, |
185 | ), | 185 | ), |
186 | where_clauses: make_binders(vec![], 0), | ||
186 | }; | 187 | }; |
187 | let num_vars = datas.num_binders; | 188 | let num_vars = datas.num_binders; |
188 | Arc::new(OpaqueTyDatum { opaque_ty_id: id, bound: make_binders(bound, num_vars) }) | 189 | Arc::new(OpaqueTyDatum { opaque_ty_id: id, bound: make_binders(bound, num_vars) }) |
@@ -193,15 +194,6 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> { | |||
193 | Ty::Unknown.to_chalk(self.db) | 194 | Ty::Unknown.to_chalk(self.db) |
194 | } | 195 | } |
195 | 196 | ||
196 | fn force_impl_for( | ||
197 | &self, | ||
198 | _well_known: rust_ir::WellKnownTrait, | ||
199 | _ty: &chalk_ir::TyData<Interner>, | ||
200 | ) -> Option<bool> { | ||
201 | // this method is mostly for rustc | ||
202 | None | ||
203 | } | ||
204 | |||
205 | fn is_object_safe(&self, _trait_id: chalk_ir::TraitId<Interner>) -> bool { | 197 | fn is_object_safe(&self, _trait_id: chalk_ir::TraitId<Interner>) -> bool { |
206 | // FIXME: implement actual object safety | 198 | // FIXME: implement actual object safety |
207 | true | 199 | true |
@@ -547,8 +539,13 @@ pub(crate) fn fn_def_datum_query( | |||
547 | ), | 539 | ), |
548 | where_clauses, | 540 | where_clauses, |
549 | }; | 541 | }; |
550 | let datum = | 542 | let datum = FnDefDatum { |
551 | FnDefDatum { id: fn_def_id, binders: make_binders(bound, sig.num_binders), abi: () }; | 543 | id: fn_def_id, |
544 | abi: (), | ||
545 | safety: chalk_ir::Safety::Safe, | ||
546 | variadic: sig.value.is_varargs, | ||
547 | binders: make_binders(bound, sig.num_binders), | ||
548 | }; | ||
552 | Arc::new(datum) | 549 | Arc::new(datum) |
553 | } | 550 | } |
554 | 551 | ||
diff --git a/crates/ra_hir_ty/src/traits/chalk/mapping.rs b/crates/ra_hir_ty/src/traits/chalk/mapping.rs index 09d8347ca..b3e92993d 100644 --- a/crates/ra_hir_ty/src/traits/chalk/mapping.rs +++ b/crates/ra_hir_ty/src/traits/chalk/mapping.rs | |||
@@ -30,11 +30,16 @@ impl ToChalk for Ty { | |||
30 | Ty::Apply(apply_ty) => match apply_ty.ctor { | 30 | Ty::Apply(apply_ty) => match apply_ty.ctor { |
31 | TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), | 31 | TypeCtor::Ref(m) => ref_to_chalk(db, m, apply_ty.parameters), |
32 | TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), | 32 | TypeCtor::Array => array_to_chalk(db, apply_ty.parameters), |
33 | TypeCtor::FnPtr { num_args: _, is_varargs: _ } => { | 33 | TypeCtor::FnPtr { num_args: _, is_varargs } => { |
34 | // FIXME: handle is_varargs | ||
35 | let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); | 34 | let substitution = apply_ty.parameters.to_chalk(db).shifted_in(&Interner); |
36 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders: 0, substitution }) | 35 | chalk_ir::TyData::Function(chalk_ir::FnPointer { |
37 | .intern(&Interner) | 36 | num_binders: 0, |
37 | abi: (), | ||
38 | safety: chalk_ir::Safety::Safe, | ||
39 | variadic: is_varargs, | ||
40 | substitution, | ||
41 | }) | ||
42 | .intern(&Interner) | ||
38 | } | 43 | } |
39 | _ => { | 44 | _ => { |
40 | let name = apply_ty.ctor.to_chalk(db); | 45 | let name = apply_ty.ctor.to_chalk(db); |
@@ -118,7 +123,12 @@ impl ToChalk for Ty { | |||
118 | let parameters = from_chalk(db, opaque_ty.substitution); | 123 | let parameters = from_chalk(db, opaque_ty.substitution); |
119 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) | 124 | Ty::Opaque(OpaqueTy { opaque_ty_id: impl_trait_id, parameters }) |
120 | } | 125 | } |
121 | chalk_ir::TyData::Function(chalk_ir::Fn { num_binders, substitution }) => { | 126 | chalk_ir::TyData::Function(chalk_ir::FnPointer { |
127 | num_binders, | ||
128 | variadic, | ||
129 | substitution, | ||
130 | .. | ||
131 | }) => { | ||
122 | assert_eq!(num_binders, 0); | 132 | assert_eq!(num_binders, 0); |
123 | let parameters: Substs = from_chalk( | 133 | let parameters: Substs = from_chalk( |
124 | db, | 134 | db, |
@@ -127,7 +137,7 @@ impl ToChalk for Ty { | |||
127 | Ty::Apply(ApplicationTy { | 137 | Ty::Apply(ApplicationTy { |
128 | ctor: TypeCtor::FnPtr { | 138 | ctor: TypeCtor::FnPtr { |
129 | num_args: (parameters.len() - 1) as u16, | 139 | num_args: (parameters.len() - 1) as u16, |
130 | is_varargs: false, | 140 | is_varargs: variadic, |
131 | }, | 141 | }, |
132 | parameters, | 142 | parameters, |
133 | }) | 143 | }) |
diff --git a/crates/ra_ide/src/call_hierarchy.rs b/crates/ra_ide/src/call_hierarchy.rs index c28af8ab3..1fcaf4a32 100644 --- a/crates/ra_ide/src/call_hierarchy.rs +++ b/crates/ra_ide/src/call_hierarchy.rs | |||
@@ -59,7 +59,7 @@ pub(crate) fn incoming_calls(db: &RootDatabase, position: FilePosition) -> Optio | |||
59 | if let Some(nav) = syntax.ancestors().find_map(|node| { | 59 | if let Some(nav) = syntax.ancestors().find_map(|node| { |
60 | match_ast! { | 60 | match_ast! { |
61 | match node { | 61 | match node { |
62 | ast::FnDef(it) => { | 62 | ast::Fn(it) => { |
63 | let def = sema.to_def(&it)?; | 63 | let def = sema.to_def(&it)?; |
64 | Some(def.to_nav(sema.db)) | 64 | Some(def.to_nav(sema.db)) |
65 | }, | 65 | }, |
@@ -181,8 +181,8 @@ fn caller() { | |||
181 | call<|>ee(); | 181 | call<|>ee(); |
182 | } | 182 | } |
183 | "#, | 183 | "#, |
184 | "callee FN_DEF FileId(1) 0..14 3..9", | 184 | "callee FN FileId(1) 0..14 3..9", |
185 | &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], | 185 | &["caller FN FileId(1) 15..44 18..24 : [33..39]"], |
186 | &[], | 186 | &[], |
187 | ); | 187 | ); |
188 | } | 188 | } |
@@ -197,8 +197,8 @@ fn caller() { | |||
197 | callee(); | 197 | callee(); |
198 | } | 198 | } |
199 | "#, | 199 | "#, |
200 | "callee FN_DEF FileId(1) 0..14 3..9", | 200 | "callee FN FileId(1) 0..14 3..9", |
201 | &["caller FN_DEF FileId(1) 15..44 18..24 : [33..39]"], | 201 | &["caller FN FileId(1) 15..44 18..24 : [33..39]"], |
202 | &[], | 202 | &[], |
203 | ); | 203 | ); |
204 | } | 204 | } |
@@ -214,8 +214,8 @@ fn caller() { | |||
214 | callee(); | 214 | callee(); |
215 | } | 215 | } |
216 | "#, | 216 | "#, |
217 | "callee FN_DEF FileId(1) 0..14 3..9", | 217 | "callee FN FileId(1) 0..14 3..9", |
218 | &["caller FN_DEF FileId(1) 15..58 18..24 : [33..39, 47..53]"], | 218 | &["caller FN FileId(1) 15..58 18..24 : [33..39, 47..53]"], |
219 | &[], | 219 | &[], |
220 | ); | 220 | ); |
221 | } | 221 | } |
@@ -234,10 +234,10 @@ fn caller2() { | |||
234 | callee(); | 234 | callee(); |
235 | } | 235 | } |
236 | "#, | 236 | "#, |
237 | "callee FN_DEF FileId(1) 0..14 3..9", | 237 | "callee FN FileId(1) 0..14 3..9", |
238 | &[ | 238 | &[ |
239 | "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", | 239 | "caller1 FN FileId(1) 15..45 18..25 : [34..40]", |
240 | "caller2 FN_DEF FileId(1) 47..77 50..57 : [66..72]", | 240 | "caller2 FN FileId(1) 47..77 50..57 : [66..72]", |
241 | ], | 241 | ], |
242 | &[], | 242 | &[], |
243 | ); | 243 | ); |
@@ -263,10 +263,10 @@ mod tests { | |||
263 | } | 263 | } |
264 | } | 264 | } |
265 | "#, | 265 | "#, |
266 | "callee FN_DEF FileId(1) 0..14 3..9", | 266 | "callee FN FileId(1) 0..14 3..9", |
267 | &[ | 267 | &[ |
268 | "caller1 FN_DEF FileId(1) 15..45 18..25 : [34..40]", | 268 | "caller1 FN FileId(1) 15..45 18..25 : [34..40]", |
269 | "test_caller FN_DEF FileId(1) 95..149 110..121 : [134..140]", | 269 | "test_caller FN FileId(1) 95..149 110..121 : [134..140]", |
270 | ], | 270 | ], |
271 | &[], | 271 | &[], |
272 | ); | 272 | ); |
@@ -287,8 +287,8 @@ fn caller() { | |||
287 | //- /foo/mod.rs | 287 | //- /foo/mod.rs |
288 | pub fn callee() {} | 288 | pub fn callee() {} |
289 | "#, | 289 | "#, |
290 | "callee FN_DEF FileId(2) 0..18 7..13", | 290 | "callee FN FileId(2) 0..18 7..13", |
291 | &["caller FN_DEF FileId(1) 27..56 30..36 : [45..51]"], | 291 | &["caller FN FileId(1) 27..56 30..36 : [45..51]"], |
292 | &[], | 292 | &[], |
293 | ); | 293 | ); |
294 | } | 294 | } |
@@ -304,9 +304,9 @@ fn call<|>er() { | |||
304 | callee(); | 304 | callee(); |
305 | } | 305 | } |
306 | "#, | 306 | "#, |
307 | "caller FN_DEF FileId(1) 15..58 18..24", | 307 | "caller FN FileId(1) 15..58 18..24", |
308 | &[], | 308 | &[], |
309 | &["callee FN_DEF FileId(1) 0..14 3..9 : [33..39, 47..53]"], | 309 | &["callee FN FileId(1) 0..14 3..9 : [33..39, 47..53]"], |
310 | ); | 310 | ); |
311 | } | 311 | } |
312 | 312 | ||
@@ -325,9 +325,9 @@ fn call<|>er() { | |||
325 | //- /foo/mod.rs | 325 | //- /foo/mod.rs |
326 | pub fn callee() {} | 326 | pub fn callee() {} |
327 | "#, | 327 | "#, |
328 | "caller FN_DEF FileId(1) 27..56 30..36", | 328 | "caller FN FileId(1) 27..56 30..36", |
329 | &[], | 329 | &[], |
330 | &["callee FN_DEF FileId(2) 0..18 7..13 : [45..51]"], | 330 | &["callee FN FileId(2) 0..18 7..13 : [45..51]"], |
331 | ); | 331 | ); |
332 | } | 332 | } |
333 | 333 | ||
@@ -348,9 +348,9 @@ fn caller3() { | |||
348 | 348 | ||
349 | } | 349 | } |
350 | "#, | 350 | "#, |
351 | "caller2 FN_DEF FileId(1) 33..64 36..43", | 351 | "caller2 FN FileId(1) 33..64 36..43", |
352 | &["caller1 FN_DEF FileId(1) 0..31 3..10 : [19..26]"], | 352 | &["caller1 FN FileId(1) 0..31 3..10 : [19..26]"], |
353 | &["caller3 FN_DEF FileId(1) 66..83 69..76 : [52..59]"], | 353 | &["caller3 FN FileId(1) 66..83 69..76 : [52..59]"], |
354 | ); | 354 | ); |
355 | } | 355 | } |
356 | 356 | ||
@@ -368,9 +368,9 @@ fn main() { | |||
368 | a<|>() | 368 | a<|>() |
369 | } | 369 | } |
370 | "#, | 370 | "#, |
371 | "a FN_DEF FileId(1) 0..18 3..4", | 371 | "a FN FileId(1) 0..18 3..4", |
372 | &["main FN_DEF FileId(1) 31..52 34..38 : [47..48]"], | 372 | &["main FN FileId(1) 31..52 34..38 : [47..48]"], |
373 | &["b FN_DEF FileId(1) 20..29 23..24 : [13..14]"], | 373 | &["b FN FileId(1) 20..29 23..24 : [13..14]"], |
374 | ); | 374 | ); |
375 | 375 | ||
376 | check_hierarchy( | 376 | check_hierarchy( |
@@ -385,8 +385,8 @@ fn main() { | |||
385 | a() | 385 | a() |
386 | } | 386 | } |
387 | "#, | 387 | "#, |
388 | "b FN_DEF FileId(1) 20..29 23..24", | 388 | "b FN FileId(1) 20..29 23..24", |
389 | &["a FN_DEF FileId(1) 0..18 3..4 : [13..14]"], | 389 | &["a FN FileId(1) 0..18 3..4 : [13..14]"], |
390 | &[], | 390 | &[], |
391 | ); | 391 | ); |
392 | } | 392 | } |
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index 109c5e9a8..2faaae974 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -13,20 +13,18 @@ use crate::completion::{ | |||
13 | 13 | ||
14 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 14 | pub(super) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
15 | let attribute = ctx.attribute_under_caret.as_ref()?; | 15 | let attribute = ctx.attribute_under_caret.as_ref()?; |
16 | match (attribute.path(), attribute.input()) { | 16 | match (attribute.path(), attribute.token_tree()) { |
17 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 17 | (Some(path), Some(token_tree)) if path.to_string() == "derive" => { |
18 | if path.to_string() == "derive" => | ||
19 | { | ||
20 | complete_derive(acc, ctx, token_tree) | 18 | complete_derive(acc, ctx, token_tree) |
21 | } | 19 | } |
22 | (Some(path), Some(ast::AttrInput::TokenTree(token_tree))) | 20 | (Some(path), Some(token_tree)) |
23 | if ["allow", "warn", "deny", "forbid"] | 21 | if ["allow", "warn", "deny", "forbid"] |
24 | .iter() | 22 | .iter() |
25 | .any(|lint_level| lint_level == &path.to_string()) => | 23 | .any(|lint_level| lint_level == &path.to_string()) => |
26 | { | 24 | { |
27 | complete_lint(acc, ctx, token_tree) | 25 | complete_lint(acc, ctx, token_tree) |
28 | } | 26 | } |
29 | (_, Some(ast::AttrInput::TokenTree(_token_tree))) => {} | 27 | (_, Some(_token_tree)) => {} |
30 | _ => complete_attribute_start(acc, ctx, attribute), | 28 | _ => complete_attribute_start(acc, ctx, attribute), |
31 | } | 29 | } |
32 | Some(()) | 30 | Some(()) |
diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs index d4b6112a5..406334257 100644 --- a/crates/ra_ide/src/completion/complete_fn_param.rs +++ b/crates/ra_ide/src/completion/complete_fn_param.rs | |||
@@ -19,8 +19,8 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
19 | 19 | ||
20 | let mut params = FxHashMap::default(); | 20 | let mut params = FxHashMap::default(); |
21 | 21 | ||
22 | let me = ctx.token.ancestors().find_map(ast::FnDef::cast); | 22 | let me = ctx.token.ancestors().find_map(ast::Fn::cast); |
23 | let mut process_fn = |func: ast::FnDef| { | 23 | let mut process_fn = |func: ast::Fn| { |
24 | if Some(&func) == me.as_ref() { | 24 | if Some(&func) == me.as_ref() { |
25 | return; | 25 | return; |
26 | } | 26 | } |
@@ -34,15 +34,15 @@ pub(super) fn complete_fn_param(acc: &mut Completions, ctx: &CompletionContext) | |||
34 | match_ast! { | 34 | match_ast! { |
35 | match node { | 35 | match node { |
36 | ast::SourceFile(it) => it.items().filter_map(|item| match item { | 36 | ast::SourceFile(it) => it.items().filter_map(|item| match item { |
37 | ast::Item::FnDef(it) => Some(it), | 37 | ast::Item::Fn(it) => Some(it), |
38 | _ => None, | 38 | _ => None, |
39 | }).for_each(&mut process_fn), | 39 | }).for_each(&mut process_fn), |
40 | ast::ItemList(it) => it.items().filter_map(|item| match item { | 40 | ast::ItemList(it) => it.items().filter_map(|item| match item { |
41 | ast::Item::FnDef(it) => Some(it), | 41 | ast::Item::Fn(it) => Some(it), |
42 | _ => None, | 42 | _ => None, |
43 | }).for_each(&mut process_fn), | 43 | }).for_each(&mut process_fn), |
44 | ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item { | 44 | ast::AssocItemList(it) => it.assoc_items().filter_map(|item| match item { |
45 | ast::AssocItem::FnDef(it) => Some(it), | 45 | ast::AssocItem::Fn(it) => Some(it), |
46 | _ => None, | 46 | _ => None, |
47 | }).for_each(&mut process_fn), | 47 | }).for_each(&mut process_fn), |
48 | _ => continue, | 48 | _ => continue, |
diff --git a/crates/ra_ide/src/completion/complete_keyword.rs b/crates/ra_ide/src/completion/complete_keyword.rs index 1581b2d5d..b62064797 100644 --- a/crates/ra_ide/src/completion/complete_keyword.rs +++ b/crates/ra_ide/src/completion/complete_keyword.rs | |||
@@ -169,7 +169,7 @@ fn add_keyword(ctx: &CompletionContext, acc: &mut Completions, kw: &str, snippet | |||
169 | 169 | ||
170 | fn complete_return( | 170 | fn complete_return( |
171 | ctx: &CompletionContext, | 171 | ctx: &CompletionContext, |
172 | fn_def: &ast::FnDef, | 172 | fn_def: &ast::Fn, |
173 | can_be_stmt: bool, | 173 | can_be_stmt: bool, |
174 | ) -> Option<CompletionItem> { | 174 | ) -> Option<CompletionItem> { |
175 | let snip = match (can_be_stmt, fn_def.ret_type().is_some()) { | 175 | let snip = match (can_be_stmt, fn_def.ret_type().is_some()) { |
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index cf716540f..d9a0ef167 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -2,8 +2,8 @@ | |||
2 | //! | 2 | //! |
3 | //! This module adds the completion items related to implementing associated | 3 | //! This module adds the completion items related to implementing associated |
4 | //! items within a `impl Trait for Struct` block. The current context node | 4 | //! items within a `impl Trait for Struct` block. The current context node |
5 | //! must be within either a `FN_DEF`, `TYPE_ALIAS_DEF`, or `CONST_DEF` node | 5 | //! must be within either a `FN`, `TYPE_ALIAS`, or `CONST` node |
6 | //! and an direct child of an `IMPL_DEF`. | 6 | //! and an direct child of an `IMPL`. |
7 | //! | 7 | //! |
8 | //! # Examples | 8 | //! # Examples |
9 | //! | 9 | //! |
@@ -34,7 +34,7 @@ | |||
34 | use hir::{self, Docs, HasSource}; | 34 | use hir::{self, Docs, HasSource}; |
35 | use ra_assists::utils::get_missing_assoc_items; | 35 | use ra_assists::utils::get_missing_assoc_items; |
36 | use ra_syntax::{ | 36 | use ra_syntax::{ |
37 | ast::{self, edit, ImplDef}, | 37 | ast::{self, edit, Impl}, |
38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, | 38 | AstNode, SyntaxKind, SyntaxNode, TextRange, T, |
39 | }; | 39 | }; |
40 | use ra_text_edit::TextEdit; | 40 | use ra_text_edit::TextEdit; |
@@ -63,7 +63,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
63 | } | 63 | } |
64 | }), | 64 | }), |
65 | 65 | ||
66 | SyntaxKind::FN_DEF => { | 66 | SyntaxKind::FN => { |
67 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) | 67 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) |
68 | .into_iter() | 68 | .into_iter() |
69 | .filter_map(|item| match item { | 69 | .filter_map(|item| match item { |
@@ -75,7 +75,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | SyntaxKind::TYPE_ALIAS_DEF => { | 78 | SyntaxKind::TYPE_ALIAS => { |
79 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) | 79 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) |
80 | .into_iter() | 80 | .into_iter() |
81 | .filter_map(|item| match item { | 81 | .filter_map(|item| match item { |
@@ -87,7 +87,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | SyntaxKind::CONST_DEF => { | 90 | SyntaxKind::CONST => { |
91 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) | 91 | for missing_fn in get_missing_assoc_items(&ctx.sema, &impl_def) |
92 | .into_iter() | 92 | .into_iter() |
93 | .filter_map(|item| match item { | 93 | .filter_map(|item| match item { |
@@ -104,18 +104,17 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, ImplDef)> { | 107 | fn completion_match(ctx: &CompletionContext) -> Option<(SyntaxNode, Impl)> { |
108 | let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { | 108 | let (trigger, impl_def_offset) = ctx.token.ancestors().find_map(|p| match p.kind() { |
109 | SyntaxKind::FN_DEF | 109 | SyntaxKind::FN | SyntaxKind::TYPE_ALIAS | SyntaxKind::CONST | SyntaxKind::BLOCK_EXPR => { |
110 | | SyntaxKind::TYPE_ALIAS_DEF | 110 | Some((p, 2)) |
111 | | SyntaxKind::CONST_DEF | 111 | } |
112 | | SyntaxKind::BLOCK_EXPR => Some((p, 2)), | ||
113 | SyntaxKind::NAME_REF => Some((p, 5)), | 112 | SyntaxKind::NAME_REF => Some((p, 5)), |
114 | _ => None, | 113 | _ => None, |
115 | })?; | 114 | })?; |
116 | let impl_def = (0..impl_def_offset - 1) | 115 | let impl_def = (0..impl_def_offset - 1) |
117 | .try_fold(trigger.parent()?, |t, _| t.parent()) | 116 | .try_fold(trigger.parent()?, |t, _| t.parent()) |
118 | .and_then(ast::ImplDef::cast)?; | 117 | .and_then(ast::Impl::cast)?; |
119 | Some((trigger, impl_def)) | 118 | Some((trigger, impl_def)) |
120 | } | 119 | } |
121 | 120 | ||
@@ -201,7 +200,7 @@ fn add_const_impl( | |||
201 | } | 200 | } |
202 | } | 201 | } |
203 | 202 | ||
204 | fn make_const_compl_syntax(const_: &ast::ConstDef) -> String { | 203 | fn make_const_compl_syntax(const_: &ast::Const) -> String { |
205 | let const_ = edit::remove_attrs_and_docs(const_); | 204 | let const_ = edit::remove_attrs_and_docs(const_); |
206 | 205 | ||
207 | let const_start = const_.syntax().text_range().start(); | 206 | let const_start = const_.syntax().text_range().start(); |
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index cc55f6dd6..2113abbb2 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -35,12 +35,12 @@ pub(crate) struct CompletionContext<'a> { | |||
35 | pub(super) krate: Option<hir::Crate>, | 35 | pub(super) krate: Option<hir::Crate>, |
36 | pub(super) expected_type: Option<Type>, | 36 | pub(super) expected_type: Option<Type>, |
37 | pub(super) name_ref_syntax: Option<ast::NameRef>, | 37 | pub(super) name_ref_syntax: Option<ast::NameRef>, |
38 | pub(super) function_syntax: Option<ast::FnDef>, | 38 | pub(super) function_syntax: Option<ast::Fn>, |
39 | pub(super) use_item_syntax: Option<ast::Use>, | 39 | pub(super) use_item_syntax: Option<ast::Use>, |
40 | pub(super) record_lit_syntax: Option<ast::RecordLit>, | 40 | pub(super) record_lit_syntax: Option<ast::RecordExpr>, |
41 | pub(super) record_pat_syntax: Option<ast::RecordPat>, | 41 | pub(super) record_pat_syntax: Option<ast::RecordPat>, |
42 | pub(super) record_field_syntax: Option<ast::RecordField>, | 42 | pub(super) record_field_syntax: Option<ast::RecordExprField>, |
43 | pub(super) impl_def: Option<ast::ImplDef>, | 43 | pub(super) impl_def: Option<ast::Impl>, |
44 | /// FIXME: `ActiveParameter` is string-based, which is very very wrong | 44 | /// FIXME: `ActiveParameter` is string-based, which is very very wrong |
45 | pub(super) active_parameter: Option<ActiveParameter>, | 45 | pub(super) active_parameter: Option<ActiveParameter>, |
46 | pub(super) is_param: bool, | 46 | pub(super) is_param: bool, |
@@ -316,7 +316,7 @@ impl<'a> CompletionContext<'a> { | |||
316 | self.name_ref_syntax = | 316 | self.name_ref_syntax = |
317 | find_node_at_offset(&original_file, name_ref.syntax().text_range().start()); | 317 | find_node_at_offset(&original_file, name_ref.syntax().text_range().start()); |
318 | let name_range = name_ref.syntax().text_range(); | 318 | let name_range = name_ref.syntax().text_range(); |
319 | if ast::RecordField::for_field_name(&name_ref).is_some() { | 319 | if ast::RecordExprField::for_field_name(&name_ref).is_some() { |
320 | self.record_lit_syntax = | 320 | self.record_lit_syntax = |
321 | self.sema.find_node_at_offset_with_macros(&original_file, offset); | 321 | self.sema.find_node_at_offset_with_macros(&original_file, offset); |
322 | } | 322 | } |
@@ -325,7 +325,7 @@ impl<'a> CompletionContext<'a> { | |||
325 | .sema | 325 | .sema |
326 | .ancestors_with_macros(self.token.parent()) | 326 | .ancestors_with_macros(self.token.parent()) |
327 | .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) | 327 | .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) |
328 | .find_map(ast::ImplDef::cast); | 328 | .find_map(ast::Impl::cast); |
329 | 329 | ||
330 | let top_node = name_ref | 330 | let top_node = name_ref |
331 | .syntax() | 331 | .syntax() |
@@ -349,7 +349,7 @@ impl<'a> CompletionContext<'a> { | |||
349 | .sema | 349 | .sema |
350 | .ancestors_with_macros(self.token.parent()) | 350 | .ancestors_with_macros(self.token.parent()) |
351 | .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) | 351 | .take_while(|it| it.kind() != SOURCE_FILE && it.kind() != MODULE) |
352 | .find_map(ast::FnDef::cast); | 352 | .find_map(ast::Fn::cast); |
353 | 353 | ||
354 | self.record_field_syntax = self | 354 | self.record_field_syntax = self |
355 | .sema | 355 | .sema |
@@ -357,7 +357,7 @@ impl<'a> CompletionContext<'a> { | |||
357 | .take_while(|it| { | 357 | .take_while(|it| { |
358 | it.kind() != SOURCE_FILE && it.kind() != MODULE && it.kind() != CALL_EXPR | 358 | it.kind() != SOURCE_FILE && it.kind() != MODULE && it.kind() != CALL_EXPR |
359 | }) | 359 | }) |
360 | .find_map(ast::RecordField::cast); | 360 | .find_map(ast::RecordExprField::cast); |
361 | 361 | ||
362 | let parent = match name_ref.syntax().parent() { | 362 | let parent = match name_ref.syntax().parent() { |
363 | Some(it) => it, | 363 | Some(it) => it, |
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index 175209d8a..a68861e1c 100644 --- a/crates/ra_ide/src/completion/patterns.rs +++ b/crates/ra_ide/src/completion/patterns.rs | |||
@@ -15,7 +15,7 @@ pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool { | |||
15 | not_same_range_ancestor(element) | 15 | not_same_range_ancestor(element) |
16 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) | 16 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) |
17 | .and_then(|it| it.parent()) | 17 | .and_then(|it| it.parent()) |
18 | .filter(|it| it.kind() == TRAIT_DEF) | 18 | .filter(|it| it.kind() == TRAIT) |
19 | .is_some() | 19 | .is_some() |
20 | } | 20 | } |
21 | #[test] | 21 | #[test] |
@@ -27,7 +27,7 @@ pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { | |||
27 | not_same_range_ancestor(element) | 27 | not_same_range_ancestor(element) |
28 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) | 28 | .filter(|it| it.kind() == ASSOC_ITEM_LIST) |
29 | .and_then(|it| it.parent()) | 29 | .and_then(|it| it.parent()) |
30 | .filter(|it| it.kind() == IMPL_DEF) | 30 | .filter(|it| it.kind() == IMPL) |
31 | .is_some() | 31 | .is_some() |
32 | } | 32 | } |
33 | #[test] | 33 | #[test] |
@@ -113,7 +113,7 @@ fn test_if_is_prev() { | |||
113 | } | 113 | } |
114 | 114 | ||
115 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { | 115 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { |
116 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == TRAIT_DEF).is_some() | 116 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == TRAIT).is_some() |
117 | } | 117 | } |
118 | #[test] | 118 | #[test] |
119 | fn test_has_trait_as_prev_sibling() { | 119 | fn test_has_trait_as_prev_sibling() { |
@@ -121,7 +121,7 @@ fn test_has_trait_as_prev_sibling() { | |||
121 | } | 121 | } |
122 | 122 | ||
123 | pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { | 123 | pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { |
124 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == IMPL_DEF).is_some() | 124 | previous_sibling_or_ancestor_sibling(element).filter(|it| it.kind() == IMPL).is_some() |
125 | } | 125 | } |
126 | #[test] | 126 | #[test] |
127 | fn test_has_impl_as_prev_sibling() { | 127 | fn test_has_impl_as_prev_sibling() { |
@@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { | |||
134 | NodeOrToken::Token(token) => token.parent(), | 134 | NodeOrToken::Token(token) => token.parent(), |
135 | }; | 135 | }; |
136 | for node in leaf.ancestors() { | 136 | for node in leaf.ancestors() { |
137 | if node.kind() == FN_DEF || node.kind() == LAMBDA_EXPR { | 137 | if node.kind() == FN || node.kind() == LAMBDA_EXPR { |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | let loop_body = match_ast! { | 140 | let loop_body = match_ast! { |
diff --git a/crates/ra_ide/src/diagnostics.rs b/crates/ra_ide/src/diagnostics.rs index 897177d05..dd8a7ffd9 100644 --- a/crates/ra_ide/src/diagnostics.rs +++ b/crates/ra_ide/src/diagnostics.rs | |||
@@ -146,7 +146,7 @@ fn missing_struct_field_fix( | |||
146 | ) -> Option<Fix> { | 146 | ) -> Option<Fix> { |
147 | let record_expr = sema.ast(d); | 147 | let record_expr = sema.ast(d); |
148 | 148 | ||
149 | let record_lit = ast::RecordLit::cast(record_expr.syntax().parent()?.parent()?)?; | 149 | let record_lit = ast::RecordExpr::cast(record_expr.syntax().parent()?.parent()?)?; |
150 | let def_id = sema.resolve_variant(record_lit)?; | 150 | let def_id = sema.resolve_variant(record_lit)?; |
151 | let module; | 151 | let module; |
152 | let def_file_id; | 152 | let def_file_id; |
@@ -155,21 +155,21 @@ fn missing_struct_field_fix( | |||
155 | module = s.module(sema.db); | 155 | module = s.module(sema.db); |
156 | let source = s.source(sema.db); | 156 | let source = s.source(sema.db); |
157 | def_file_id = source.file_id; | 157 | def_file_id = source.file_id; |
158 | let fields = source.value.field_def_list()?; | 158 | let fields = source.value.field_list()?; |
159 | record_field_def_list(fields)? | 159 | record_field_list(fields)? |
160 | } | 160 | } |
161 | VariantDef::Union(u) => { | 161 | VariantDef::Union(u) => { |
162 | module = u.module(sema.db); | 162 | module = u.module(sema.db); |
163 | let source = u.source(sema.db); | 163 | let source = u.source(sema.db); |
164 | def_file_id = source.file_id; | 164 | def_file_id = source.file_id; |
165 | source.value.record_field_def_list()? | 165 | source.value.record_field_list()? |
166 | } | 166 | } |
167 | VariantDef::EnumVariant(e) => { | 167 | VariantDef::EnumVariant(e) => { |
168 | module = e.module(sema.db); | 168 | module = e.module(sema.db); |
169 | let source = e.source(sema.db); | 169 | let source = e.source(sema.db); |
170 | def_file_id = source.file_id; | 170 | def_file_id = source.file_id; |
171 | let fields = source.value.field_def_list()?; | 171 | let fields = source.value.field_list()?; |
172 | record_field_def_list(fields)? | 172 | record_field_list(fields)? |
173 | } | 173 | } |
174 | }; | 174 | }; |
175 | let def_file_id = def_file_id.original_file(sema.db); | 175 | let def_file_id = def_file_id.original_file(sema.db); |
@@ -205,10 +205,10 @@ fn missing_struct_field_fix( | |||
205 | let fix = Fix::new("Create field", source_change.into()); | 205 | let fix = Fix::new("Create field", source_change.into()); |
206 | return Some(fix); | 206 | return Some(fix); |
207 | 207 | ||
208 | fn record_field_def_list(field_def_list: ast::FieldDefList) -> Option<ast::RecordFieldDefList> { | 208 | fn record_field_list(field_def_list: ast::FieldList) -> Option<ast::RecordFieldList> { |
209 | match field_def_list { | 209 | match field_def_list { |
210 | ast::FieldDefList::RecordFieldDefList(it) => Some(it), | 210 | ast::FieldList::RecordFieldList(it) => Some(it), |
211 | ast::FieldDefList::TupleFieldDefList(_) => None, | 211 | ast::FieldList::TupleFieldList(_) => None, |
212 | } | 212 | } |
213 | } | 213 | } |
214 | } | 214 | } |
@@ -263,8 +263,8 @@ fn check_struct_shorthand_initialization( | |||
263 | file_id: FileId, | 263 | file_id: FileId, |
264 | node: &SyntaxNode, | 264 | node: &SyntaxNode, |
265 | ) -> Option<()> { | 265 | ) -> Option<()> { |
266 | let record_lit = ast::RecordLit::cast(node.clone())?; | 266 | let record_lit = ast::RecordExpr::cast(node.clone())?; |
267 | let record_field_list = record_lit.record_field_list()?; | 267 | let record_field_list = record_lit.record_expr_field_list()?; |
268 | for record_field in record_field_list.fields() { | 268 | for record_field in record_field_list.fields() { |
269 | if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { | 269 | if let (Some(name_ref), Some(expr)) = (record_field.name_ref(), record_field.expr()) { |
270 | let field_name = name_ref.syntax().text().to_string(); | 270 | let field_name = name_ref.syntax().text().to_string(); |
diff --git a/crates/ra_ide/src/display.rs b/crates/ra_ide/src/display.rs index 6d4151dd8..fd42aa435 100644 --- a/crates/ra_ide/src/display.rs +++ b/crates/ra_ide/src/display.rs | |||
@@ -5,7 +5,7 @@ mod navigation_target; | |||
5 | mod short_label; | 5 | mod short_label; |
6 | 6 | ||
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{self, AstNode, AttrsOwner, NameOwner, TypeParamsOwner}, | 8 | ast::{self, AstNode, AttrsOwner, GenericParamsOwner, NameOwner}, |
9 | SyntaxKind::{ATTR, COMMENT}, | 9 | SyntaxKind::{ATTR, COMMENT}, |
10 | }; | 10 | }; |
11 | 11 | ||
@@ -16,7 +16,7 @@ pub use navigation_target::NavigationTarget; | |||
16 | pub(crate) use navigation_target::{ToNav, TryToNav}; | 16 | pub(crate) use navigation_target::{ToNav, TryToNav}; |
17 | pub(crate) use short_label::ShortLabel; | 17 | pub(crate) use short_label::ShortLabel; |
18 | 18 | ||
19 | pub(crate) fn function_declaration(node: &ast::FnDef) -> String { | 19 | pub(crate) fn function_declaration(node: &ast::Fn) -> String { |
20 | let mut buf = String::new(); | 20 | let mut buf = String::new(); |
21 | if let Some(vis) = node.visibility() { | 21 | if let Some(vis) = node.visibility() { |
22 | format_to!(buf, "{} ", vis); | 22 | format_to!(buf, "{} ", vis); |
@@ -37,14 +37,14 @@ pub(crate) fn function_declaration(node: &ast::FnDef) -> String { | |||
37 | if let Some(name) = node.name() { | 37 | if let Some(name) = node.name() { |
38 | format_to!(buf, "fn {}", name) | 38 | format_to!(buf, "fn {}", name) |
39 | } | 39 | } |
40 | if let Some(type_params) = node.type_param_list() { | 40 | if let Some(type_params) = node.generic_param_list() { |
41 | format_to!(buf, "{}", type_params); | 41 | format_to!(buf, "{}", type_params); |
42 | } | 42 | } |
43 | if let Some(param_list) = node.param_list() { | 43 | if let Some(param_list) = node.param_list() { |
44 | format_to!(buf, "{}", param_list); | 44 | format_to!(buf, "{}", param_list); |
45 | } | 45 | } |
46 | if let Some(ret_type) = node.ret_type() { | 46 | if let Some(ret_type) = node.ret_type() { |
47 | if ret_type.type_ref().is_some() { | 47 | if ret_type.ty().is_some() { |
48 | format_to!(buf, " {}", ret_type); | 48 | format_to!(buf, " {}", ret_type); |
49 | } | 49 | } |
50 | } | 50 | } |
@@ -54,7 +54,7 @@ pub(crate) fn function_declaration(node: &ast::FnDef) -> String { | |||
54 | buf | 54 | buf |
55 | } | 55 | } |
56 | 56 | ||
57 | pub(crate) fn const_label(node: &ast::ConstDef) -> String { | 57 | pub(crate) fn const_label(node: &ast::Const) -> String { |
58 | let label: String = node | 58 | let label: String = node |
59 | .syntax() | 59 | .syntax() |
60 | .children_with_tokens() | 60 | .children_with_tokens() |
@@ -65,7 +65,7 @@ pub(crate) fn const_label(node: &ast::ConstDef) -> String { | |||
65 | label.trim().to_owned() | 65 | label.trim().to_owned() |
66 | } | 66 | } |
67 | 67 | ||
68 | pub(crate) fn type_label(node: &ast::TypeAliasDef) -> String { | 68 | pub(crate) fn type_label(node: &ast::TypeAlias) -> String { |
69 | let label: String = node | 69 | let label: String = node |
70 | .syntax() | 70 | .syntax() |
71 | .children_with_tokens() | 71 | .children_with_tokens() |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index fd245705c..45fbc86ef 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -379,16 +379,16 @@ pub(crate) fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option | |||
379 | 379 | ||
380 | match_ast! { | 380 | match_ast! { |
381 | match node { | 381 | match node { |
382 | ast::FnDef(it) => it.doc_comment_text(), | 382 | ast::Fn(it) => it.doc_comment_text(), |
383 | ast::StructDef(it) => it.doc_comment_text(), | 383 | ast::Struct(it) => it.doc_comment_text(), |
384 | ast::EnumDef(it) => it.doc_comment_text(), | 384 | ast::Enum(it) => it.doc_comment_text(), |
385 | ast::TraitDef(it) => it.doc_comment_text(), | 385 | ast::Trait(it) => it.doc_comment_text(), |
386 | ast::Module(it) => it.doc_comment_text(), | 386 | ast::Module(it) => it.doc_comment_text(), |
387 | ast::TypeAliasDef(it) => it.doc_comment_text(), | 387 | ast::TypeAlias(it) => it.doc_comment_text(), |
388 | ast::ConstDef(it) => it.doc_comment_text(), | 388 | ast::Const(it) => it.doc_comment_text(), |
389 | ast::StaticDef(it) => it.doc_comment_text(), | 389 | ast::Static(it) => it.doc_comment_text(), |
390 | ast::RecordFieldDef(it) => it.doc_comment_text(), | 390 | ast::RecordField(it) => it.doc_comment_text(), |
391 | ast::EnumVariant(it) => it.doc_comment_text(), | 391 | ast::Variant(it) => it.doc_comment_text(), |
392 | ast::MacroCall(it) => it.doc_comment_text(), | 392 | ast::MacroCall(it) => it.doc_comment_text(), |
393 | _ => None, | 393 | _ => None, |
394 | } | 394 | } |
@@ -404,16 +404,16 @@ pub(crate) fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> | |||
404 | 404 | ||
405 | match_ast! { | 405 | match_ast! { |
406 | match node { | 406 | match node { |
407 | ast::FnDef(it) => it.short_label(), | 407 | ast::Fn(it) => it.short_label(), |
408 | ast::StructDef(it) => it.short_label(), | 408 | ast::Struct(it) => it.short_label(), |
409 | ast::EnumDef(it) => it.short_label(), | 409 | ast::Enum(it) => it.short_label(), |
410 | ast::TraitDef(it) => it.short_label(), | 410 | ast::Trait(it) => it.short_label(), |
411 | ast::Module(it) => it.short_label(), | 411 | ast::Module(it) => it.short_label(), |
412 | ast::TypeAliasDef(it) => it.short_label(), | 412 | ast::TypeAlias(it) => it.short_label(), |
413 | ast::ConstDef(it) => it.short_label(), | 413 | ast::Const(it) => it.short_label(), |
414 | ast::StaticDef(it) => it.short_label(), | 414 | ast::Static(it) => it.short_label(), |
415 | ast::RecordFieldDef(it) => it.short_label(), | 415 | ast::RecordField(it) => it.short_label(), |
416 | ast::EnumVariant(it) => it.short_label(), | 416 | ast::Variant(it) => it.short_label(), |
417 | _ => None, | 417 | _ => None, |
418 | } | 418 | } |
419 | } | 419 | } |
@@ -446,7 +446,7 @@ fn foo() { enum FooInner { } } | |||
446 | 5..13, | 446 | 5..13, |
447 | ), | 447 | ), |
448 | name: "FooInner", | 448 | name: "FooInner", |
449 | kind: ENUM_DEF, | 449 | kind: ENUM, |
450 | container_name: None, | 450 | container_name: None, |
451 | description: Some( | 451 | description: Some( |
452 | "enum FooInner", | 452 | "enum FooInner", |
@@ -462,7 +462,7 @@ fn foo() { enum FooInner { } } | |||
462 | 34..42, | 462 | 34..42, |
463 | ), | 463 | ), |
464 | name: "FooInner", | 464 | name: "FooInner", |
465 | kind: ENUM_DEF, | 465 | kind: ENUM, |
466 | container_name: Some( | 466 | container_name: Some( |
467 | "foo", | 467 | "foo", |
468 | ), | 468 | ), |
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index 5588130a1..bddf1bd47 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -1,37 +1,37 @@ | |||
1 | //! FIXME: write short doc here | 1 | //! FIXME: write short doc here |
2 | 2 | ||
3 | use ra_syntax::ast::{self, AstNode, NameOwner, TypeAscriptionOwner, VisibilityOwner}; | 3 | use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner}; |
4 | use stdx::format_to; | 4 | use stdx::format_to; |
5 | 5 | ||
6 | pub(crate) trait ShortLabel { | 6 | pub(crate) trait ShortLabel { |
7 | fn short_label(&self) -> Option<String>; | 7 | fn short_label(&self) -> Option<String>; |
8 | } | 8 | } |
9 | 9 | ||
10 | impl ShortLabel for ast::FnDef { | 10 | impl ShortLabel for ast::Fn { |
11 | fn short_label(&self) -> Option<String> { | 11 | fn short_label(&self) -> Option<String> { |
12 | Some(crate::display::function_declaration(self)) | 12 | Some(crate::display::function_declaration(self)) |
13 | } | 13 | } |
14 | } | 14 | } |
15 | 15 | ||
16 | impl ShortLabel for ast::StructDef { | 16 | impl ShortLabel for ast::Struct { |
17 | fn short_label(&self) -> Option<String> { | 17 | fn short_label(&self) -> Option<String> { |
18 | short_label_from_node(self, "struct ") | 18 | short_label_from_node(self, "struct ") |
19 | } | 19 | } |
20 | } | 20 | } |
21 | 21 | ||
22 | impl ShortLabel for ast::UnionDef { | 22 | impl ShortLabel for ast::Union { |
23 | fn short_label(&self) -> Option<String> { | 23 | fn short_label(&self) -> Option<String> { |
24 | short_label_from_node(self, "union ") | 24 | short_label_from_node(self, "union ") |
25 | } | 25 | } |
26 | } | 26 | } |
27 | 27 | ||
28 | impl ShortLabel for ast::EnumDef { | 28 | impl ShortLabel for ast::Enum { |
29 | fn short_label(&self) -> Option<String> { | 29 | fn short_label(&self) -> Option<String> { |
30 | short_label_from_node(self, "enum ") | 30 | short_label_from_node(self, "enum ") |
31 | } | 31 | } |
32 | } | 32 | } |
33 | 33 | ||
34 | impl ShortLabel for ast::TraitDef { | 34 | impl ShortLabel for ast::Trait { |
35 | fn short_label(&self) -> Option<String> { | 35 | fn short_label(&self) -> Option<String> { |
36 | if self.unsafe_token().is_some() { | 36 | if self.unsafe_token().is_some() { |
37 | short_label_from_node(self, "unsafe trait ") | 37 | short_label_from_node(self, "unsafe trait ") |
@@ -47,43 +47,43 @@ impl ShortLabel for ast::Module { | |||
47 | } | 47 | } |
48 | } | 48 | } |
49 | 49 | ||
50 | impl ShortLabel for ast::TypeAliasDef { | 50 | impl ShortLabel for ast::TypeAlias { |
51 | fn short_label(&self) -> Option<String> { | 51 | fn short_label(&self) -> Option<String> { |
52 | short_label_from_node(self, "type ") | 52 | short_label_from_node(self, "type ") |
53 | } | 53 | } |
54 | } | 54 | } |
55 | 55 | ||
56 | impl ShortLabel for ast::ConstDef { | 56 | impl ShortLabel for ast::Const { |
57 | fn short_label(&self) -> Option<String> { | 57 | fn short_label(&self) -> Option<String> { |
58 | short_label_from_ascribed_node(self, "const ") | 58 | short_label_from_ty(self, self.ty(), "const ") |
59 | } | 59 | } |
60 | } | 60 | } |
61 | 61 | ||
62 | impl ShortLabel for ast::StaticDef { | 62 | impl ShortLabel for ast::Static { |
63 | fn short_label(&self) -> Option<String> { | 63 | fn short_label(&self) -> Option<String> { |
64 | short_label_from_ascribed_node(self, "static ") | 64 | short_label_from_ty(self, self.ty(), "static ") |
65 | } | 65 | } |
66 | } | 66 | } |
67 | 67 | ||
68 | impl ShortLabel for ast::RecordFieldDef { | 68 | impl ShortLabel for ast::RecordField { |
69 | fn short_label(&self) -> Option<String> { | 69 | fn short_label(&self) -> Option<String> { |
70 | short_label_from_ascribed_node(self, "") | 70 | short_label_from_ty(self, self.ty(), "") |
71 | } | 71 | } |
72 | } | 72 | } |
73 | 73 | ||
74 | impl ShortLabel for ast::EnumVariant { | 74 | impl ShortLabel for ast::Variant { |
75 | fn short_label(&self) -> Option<String> { | 75 | fn short_label(&self) -> Option<String> { |
76 | Some(self.name()?.text().to_string()) | 76 | Some(self.name()?.text().to_string()) |
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | fn short_label_from_ascribed_node<T>(node: &T, prefix: &str) -> Option<String> | 80 | fn short_label_from_ty<T>(node: &T, ty: Option<ast::TypeRef>, prefix: &str) -> Option<String> |
81 | where | 81 | where |
82 | T: NameOwner + VisibilityOwner + TypeAscriptionOwner, | 82 | T: NameOwner + VisibilityOwner, |
83 | { | 83 | { |
84 | let mut buf = short_label_from_node(node, prefix)?; | 84 | let mut buf = short_label_from_node(node, prefix)?; |
85 | 85 | ||
86 | if let Some(type_ref) = node.ascribed_type() { | 86 | if let Some(type_ref) = ty { |
87 | format_to!(buf, ": {}", type_ref.syntax()); | 87 | format_to!(buf, ": {}", type_ref.syntax()); |
88 | } | 88 | } |
89 | 89 | ||
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index 8a6b3ea99..fc81b48cc 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -39,12 +39,12 @@ fn try_extend_selection( | |||
39 | let list_kinds = [ | 39 | let list_kinds = [ |
40 | RECORD_FIELD_PAT_LIST, | 40 | RECORD_FIELD_PAT_LIST, |
41 | MATCH_ARM_LIST, | 41 | MATCH_ARM_LIST, |
42 | RECORD_FIELD_DEF_LIST, | ||
43 | TUPLE_FIELD_DEF_LIST, | ||
44 | RECORD_FIELD_LIST, | 42 | RECORD_FIELD_LIST, |
45 | ENUM_VARIANT_LIST, | 43 | TUPLE_FIELD_LIST, |
44 | RECORD_EXPR_FIELD_LIST, | ||
45 | VARIANT_LIST, | ||
46 | USE_TREE_LIST, | 46 | USE_TREE_LIST, |
47 | TYPE_PARAM_LIST, | 47 | GENERIC_PARAM_LIST, |
48 | TYPE_ARG_LIST, | 48 | TYPE_ARG_LIST, |
49 | TYPE_BOUND_LIST, | 49 | TYPE_BOUND_LIST, |
50 | PARAM_LIST, | 50 | PARAM_LIST, |
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 1f6a3febf..91765140a 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, AttrsOwner, NameOwner, TypeAscriptionOwner, TypeParamsOwner}, | 2 | ast::{self, AttrsOwner, GenericParamsOwner, NameOwner}, |
3 | match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, WalkEvent, | 3 | match_ast, AstNode, SourceFile, SyntaxKind, SyntaxNode, TextRange, WalkEvent, |
4 | }; | 4 | }; |
5 | 5 | ||
@@ -52,18 +52,11 @@ pub fn file_structure(file: &SourceFile) -> Vec<StructureNode> { | |||
52 | 52 | ||
53 | fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | 53 | fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { |
54 | fn decl<N: NameOwner + AttrsOwner>(node: N) -> Option<StructureNode> { | 54 | fn decl<N: NameOwner + AttrsOwner>(node: N) -> Option<StructureNode> { |
55 | decl_with_detail(node, None) | 55 | decl_with_detail(&node, None) |
56 | } | ||
57 | |||
58 | fn decl_with_ascription<N: NameOwner + AttrsOwner + TypeAscriptionOwner>( | ||
59 | node: N, | ||
60 | ) -> Option<StructureNode> { | ||
61 | let ty = node.ascribed_type(); | ||
62 | decl_with_type_ref(node, ty) | ||
63 | } | 56 | } |
64 | 57 | ||
65 | fn decl_with_type_ref<N: NameOwner + AttrsOwner>( | 58 | fn decl_with_type_ref<N: NameOwner + AttrsOwner>( |
66 | node: N, | 59 | node: &N, |
67 | type_ref: Option<ast::TypeRef>, | 60 | type_ref: Option<ast::TypeRef>, |
68 | ) -> Option<StructureNode> { | 61 | ) -> Option<StructureNode> { |
69 | let detail = type_ref.map(|type_ref| { | 62 | let detail = type_ref.map(|type_ref| { |
@@ -75,7 +68,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
75 | } | 68 | } |
76 | 69 | ||
77 | fn decl_with_detail<N: NameOwner + AttrsOwner>( | 70 | fn decl_with_detail<N: NameOwner + AttrsOwner>( |
78 | node: N, | 71 | node: &N, |
79 | detail: Option<String>, | 72 | detail: Option<String>, |
80 | ) -> Option<StructureNode> { | 73 | ) -> Option<StructureNode> { |
81 | let name = node.name()?; | 74 | let name = node.name()?; |
@@ -111,9 +104,9 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
111 | 104 | ||
112 | match_ast! { | 105 | match_ast! { |
113 | match node { | 106 | match node { |
114 | ast::FnDef(it) => { | 107 | ast::Fn(it) => { |
115 | let mut detail = String::from("fn"); | 108 | let mut detail = String::from("fn"); |
116 | if let Some(type_param_list) = it.type_param_list() { | 109 | if let Some(type_param_list) = it.generic_param_list() { |
117 | collapse_ws(type_param_list.syntax(), &mut detail); | 110 | collapse_ws(type_param_list.syntax(), &mut detail); |
118 | } | 111 | } |
119 | if let Some(param_list) = it.param_list() { | 112 | if let Some(param_list) = it.param_list() { |
@@ -124,22 +117,19 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
124 | collapse_ws(ret_type.syntax(), &mut detail); | 117 | collapse_ws(ret_type.syntax(), &mut detail); |
125 | } | 118 | } |
126 | 119 | ||
127 | decl_with_detail(it, Some(detail)) | 120 | decl_with_detail(&it, Some(detail)) |
128 | }, | 121 | }, |
129 | ast::StructDef(it) => decl(it), | 122 | ast::Struct(it) => decl(it), |
130 | ast::UnionDef(it) => decl(it), | 123 | ast::Union(it) => decl(it), |
131 | ast::EnumDef(it) => decl(it), | 124 | ast::Enum(it) => decl(it), |
132 | ast::EnumVariant(it) => decl(it), | 125 | ast::Variant(it) => decl(it), |
133 | ast::TraitDef(it) => decl(it), | 126 | ast::Trait(it) => decl(it), |
134 | ast::Module(it) => decl(it), | 127 | ast::Module(it) => decl(it), |
135 | ast::TypeAliasDef(it) => { | 128 | ast::TypeAlias(it) => decl_with_type_ref(&it, it.ty()), |
136 | let ty = it.type_ref(); | 129 | ast::RecordField(it) => decl_with_type_ref(&it, it.ty()), |
137 | decl_with_type_ref(it, ty) | 130 | ast::Const(it) => decl_with_type_ref(&it, it.ty()), |
138 | }, | 131 | ast::Static(it) => decl_with_type_ref(&it, it.ty()), |
139 | ast::RecordFieldDef(it) => decl_with_ascription(it), | 132 | ast::Impl(it) => { |
140 | ast::ConstDef(it) => decl_with_ascription(it), | ||
141 | ast::StaticDef(it) => decl_with_ascription(it), | ||
142 | ast::ImplDef(it) => { | ||
143 | let target_type = it.target_type()?; | 133 | let target_type = it.target_type()?; |
144 | let target_trait = it.target_trait(); | 134 | let target_trait = it.target_trait(); |
145 | let label = match target_trait { | 135 | let label = match target_trait { |
@@ -238,7 +228,7 @@ fn very_obsolete() {} | |||
238 | label: "Foo", | 228 | label: "Foo", |
239 | navigation_range: 8..11, | 229 | navigation_range: 8..11, |
240 | node_range: 1..26, | 230 | node_range: 1..26, |
241 | kind: STRUCT_DEF, | 231 | kind: STRUCT, |
242 | detail: None, | 232 | detail: None, |
243 | deprecated: false, | 233 | deprecated: false, |
244 | }, | 234 | }, |
@@ -249,7 +239,7 @@ fn very_obsolete() {} | |||
249 | label: "x", | 239 | label: "x", |
250 | navigation_range: 18..19, | 240 | navigation_range: 18..19, |
251 | node_range: 18..24, | 241 | node_range: 18..24, |
252 | kind: RECORD_FIELD_DEF, | 242 | kind: RECORD_FIELD, |
253 | detail: Some( | 243 | detail: Some( |
254 | "i32", | 244 | "i32", |
255 | ), | 245 | ), |
@@ -271,7 +261,7 @@ fn very_obsolete() {} | |||
271 | label: "bar1", | 261 | label: "bar1", |
272 | navigation_range: 43..47, | 262 | navigation_range: 43..47, |
273 | node_range: 40..52, | 263 | node_range: 40..52, |
274 | kind: FN_DEF, | 264 | kind: FN, |
275 | detail: Some( | 265 | detail: Some( |
276 | "fn()", | 266 | "fn()", |
277 | ), | 267 | ), |
@@ -284,7 +274,7 @@ fn very_obsolete() {} | |||
284 | label: "bar2", | 274 | label: "bar2", |
285 | navigation_range: 60..64, | 275 | navigation_range: 60..64, |
286 | node_range: 57..81, | 276 | node_range: 57..81, |
287 | kind: FN_DEF, | 277 | kind: FN, |
288 | detail: Some( | 278 | detail: Some( |
289 | "fn<T>(t: T) -> T", | 279 | "fn<T>(t: T) -> T", |
290 | ), | 280 | ), |
@@ -297,7 +287,7 @@ fn very_obsolete() {} | |||
297 | label: "bar3", | 287 | label: "bar3", |
298 | navigation_range: 89..93, | 288 | navigation_range: 89..93, |
299 | node_range: 86..156, | 289 | node_range: 86..156, |
300 | kind: FN_DEF, | 290 | kind: FN, |
301 | detail: Some( | 291 | detail: Some( |
302 | "fn<A, B>(a: A, b: B) -> Vec< u32 >", | 292 | "fn<A, B>(a: A, b: B) -> Vec< u32 >", |
303 | ), | 293 | ), |
@@ -308,7 +298,7 @@ fn very_obsolete() {} | |||
308 | label: "E", | 298 | label: "E", |
309 | navigation_range: 165..166, | 299 | navigation_range: 165..166, |
310 | node_range: 160..180, | 300 | node_range: 160..180, |
311 | kind: ENUM_DEF, | 301 | kind: ENUM, |
312 | detail: None, | 302 | detail: None, |
313 | deprecated: false, | 303 | deprecated: false, |
314 | }, | 304 | }, |
@@ -319,7 +309,7 @@ fn very_obsolete() {} | |||
319 | label: "X", | 309 | label: "X", |
320 | navigation_range: 169..170, | 310 | navigation_range: 169..170, |
321 | node_range: 169..170, | 311 | node_range: 169..170, |
322 | kind: ENUM_VARIANT, | 312 | kind: VARIANT, |
323 | detail: None, | 313 | detail: None, |
324 | deprecated: false, | 314 | deprecated: false, |
325 | }, | 315 | }, |
@@ -330,7 +320,7 @@ fn very_obsolete() {} | |||
330 | label: "Y", | 320 | label: "Y", |
331 | navigation_range: 172..173, | 321 | navigation_range: 172..173, |
332 | node_range: 172..178, | 322 | node_range: 172..178, |
333 | kind: ENUM_VARIANT, | 323 | kind: VARIANT, |
334 | detail: None, | 324 | detail: None, |
335 | deprecated: false, | 325 | deprecated: false, |
336 | }, | 326 | }, |
@@ -339,7 +329,7 @@ fn very_obsolete() {} | |||
339 | label: "T", | 329 | label: "T", |
340 | navigation_range: 186..187, | 330 | navigation_range: 186..187, |
341 | node_range: 181..193, | 331 | node_range: 181..193, |
342 | kind: TYPE_ALIAS_DEF, | 332 | kind: TYPE_ALIAS, |
343 | detail: Some( | 333 | detail: Some( |
344 | "()", | 334 | "()", |
345 | ), | 335 | ), |
@@ -350,7 +340,7 @@ fn very_obsolete() {} | |||
350 | label: "S", | 340 | label: "S", |
351 | navigation_range: 201..202, | 341 | navigation_range: 201..202, |
352 | node_range: 194..213, | 342 | node_range: 194..213, |
353 | kind: STATIC_DEF, | 343 | kind: STATIC, |
354 | detail: Some( | 344 | detail: Some( |
355 | "i32", | 345 | "i32", |
356 | ), | 346 | ), |
@@ -361,7 +351,7 @@ fn very_obsolete() {} | |||
361 | label: "C", | 351 | label: "C", |
362 | navigation_range: 220..221, | 352 | navigation_range: 220..221, |
363 | node_range: 214..232, | 353 | node_range: 214..232, |
364 | kind: CONST_DEF, | 354 | kind: CONST, |
365 | detail: Some( | 355 | detail: Some( |
366 | "i32", | 356 | "i32", |
367 | ), | 357 | ), |
@@ -372,7 +362,7 @@ fn very_obsolete() {} | |||
372 | label: "impl E", | 362 | label: "impl E", |
373 | navigation_range: 239..240, | 363 | navigation_range: 239..240, |
374 | node_range: 234..243, | 364 | node_range: 234..243, |
375 | kind: IMPL_DEF, | 365 | kind: IMPL, |
376 | detail: None, | 366 | detail: None, |
377 | deprecated: false, | 367 | deprecated: false, |
378 | }, | 368 | }, |
@@ -381,7 +371,7 @@ fn very_obsolete() {} | |||
381 | label: "impl fmt::Debug for E", | 371 | label: "impl fmt::Debug for E", |
382 | navigation_range: 265..266, | 372 | navigation_range: 265..266, |
383 | node_range: 245..269, | 373 | node_range: 245..269, |
384 | kind: IMPL_DEF, | 374 | kind: IMPL, |
385 | detail: None, | 375 | detail: None, |
386 | deprecated: false, | 376 | deprecated: false, |
387 | }, | 377 | }, |
@@ -417,7 +407,7 @@ fn very_obsolete() {} | |||
417 | label: "obsolete", | 407 | label: "obsolete", |
418 | navigation_range: 428..436, | 408 | navigation_range: 428..436, |
419 | node_range: 411..441, | 409 | node_range: 411..441, |
420 | kind: FN_DEF, | 410 | kind: FN, |
421 | detail: Some( | 411 | detail: Some( |
422 | "fn()", | 412 | "fn()", |
423 | ), | 413 | ), |
@@ -428,7 +418,7 @@ fn very_obsolete() {} | |||
428 | label: "very_obsolete", | 418 | label: "very_obsolete", |
429 | navigation_range: 481..494, | 419 | navigation_range: 481..494, |
430 | node_range: 443..499, | 420 | node_range: 443..499, |
431 | kind: FN_DEF, | 421 | kind: FN, |
432 | detail: Some( | 422 | detail: Some( |
433 | "fn()", | 423 | "fn()", |
434 | ), | 424 | ), |
diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index bad079146..5a6e17936 100644 --- a/crates/ra_ide/src/folding_ranges.rs +++ b/crates/ra_ide/src/folding_ranges.rs | |||
@@ -85,15 +85,15 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { | |||
85 | COMMENT => Some(FoldKind::Comment), | 85 | COMMENT => Some(FoldKind::Comment), |
86 | USE => Some(FoldKind::Imports), | 86 | USE => Some(FoldKind::Imports), |
87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), | 87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), |
88 | RECORD_FIELD_DEF_LIST | 88 | RECORD_FIELD_LIST |
89 | | RECORD_FIELD_PAT_LIST | 89 | | RECORD_FIELD_PAT_LIST |
90 | | RECORD_FIELD_LIST | 90 | | RECORD_EXPR_FIELD_LIST |
91 | | ITEM_LIST | 91 | | ITEM_LIST |
92 | | EXTERN_ITEM_LIST | 92 | | EXTERN_ITEM_LIST |
93 | | USE_TREE_LIST | 93 | | USE_TREE_LIST |
94 | | BLOCK_EXPR | 94 | | BLOCK_EXPR |
95 | | MATCH_ARM_LIST | 95 | | MATCH_ARM_LIST |
96 | | ENUM_VARIANT_LIST | 96 | | VARIANT_LIST |
97 | | TOKEN_TREE => Some(FoldKind::Block), | 97 | | TOKEN_TREE => Some(FoldKind::Block), |
98 | _ => None, | 98 | _ => None, |
99 | } | 99 | } |
diff --git a/crates/ra_ide/src/goto_implementation.rs b/crates/ra_ide/src/goto_implementation.rs index 16a61d071..9912b7142 100644 --- a/crates/ra_ide/src/goto_implementation.rs +++ b/crates/ra_ide/src/goto_implementation.rs | |||
@@ -28,7 +28,7 @@ pub(crate) fn goto_implementation( | |||
28 | nominal_def.syntax().text_range(), | 28 | nominal_def.syntax().text_range(), |
29 | impls_for_def(&sema, &nominal_def, krate)?, | 29 | impls_for_def(&sema, &nominal_def, krate)?, |
30 | )); | 30 | )); |
31 | } else if let Some(trait_def) = find_node_at_offset::<ast::TraitDef>(&syntax, position.offset) { | 31 | } else if let Some(trait_def) = find_node_at_offset::<ast::Trait>(&syntax, position.offset) { |
32 | return Some(RangeInfo::new( | 32 | return Some(RangeInfo::new( |
33 | trait_def.syntax().text_range(), | 33 | trait_def.syntax().text_range(), |
34 | impls_for_trait(&sema, &trait_def, krate)?, | 34 | impls_for_trait(&sema, &trait_def, krate)?, |
@@ -44,9 +44,9 @@ fn impls_for_def( | |||
44 | krate: Crate, | 44 | krate: Crate, |
45 | ) -> Option<Vec<NavigationTarget>> { | 45 | ) -> Option<Vec<NavigationTarget>> { |
46 | let ty = match node { | 46 | let ty = match node { |
47 | ast::AdtDef::StructDef(def) => sema.to_def(def)?.ty(sema.db), | 47 | ast::AdtDef::Struct(def) => sema.to_def(def)?.ty(sema.db), |
48 | ast::AdtDef::EnumDef(def) => sema.to_def(def)?.ty(sema.db), | 48 | ast::AdtDef::Enum(def) => sema.to_def(def)?.ty(sema.db), |
49 | ast::AdtDef::UnionDef(def) => sema.to_def(def)?.ty(sema.db), | 49 | ast::AdtDef::Union(def) => sema.to_def(def)?.ty(sema.db), |
50 | }; | 50 | }; |
51 | 51 | ||
52 | let impls = ImplDef::all_in_crate(sema.db, krate); | 52 | let impls = ImplDef::all_in_crate(sema.db, krate); |
@@ -62,7 +62,7 @@ fn impls_for_def( | |||
62 | 62 | ||
63 | fn impls_for_trait( | 63 | fn impls_for_trait( |
64 | sema: &Semantics<RootDatabase>, | 64 | sema: &Semantics<RootDatabase>, |
65 | node: &ast::TraitDef, | 65 | node: &ast::Trait, |
66 | krate: Crate, | 66 | krate: Crate, |
67 | ) -> Option<Vec<NavigationTarget>> { | 67 | ) -> Option<Vec<NavigationTarget>> { |
68 | let tr = sema.to_def(node)?; | 68 | let tr = sema.to_def(node)?; |
diff --git a/crates/ra_ide/src/hover.rs b/crates/ra_ide/src/hover.rs index d067c339d..aa48cb412 100644 --- a/crates/ra_ide/src/hover.rs +++ b/crates/ra_ide/src/hover.rs | |||
@@ -1361,7 +1361,7 @@ fn foo_<|>test() {} | |||
1361 | 11..19, | 1361 | 11..19, |
1362 | ), | 1362 | ), |
1363 | name: "foo_test", | 1363 | name: "foo_test", |
1364 | kind: FN_DEF, | 1364 | kind: FN, |
1365 | container_name: None, | 1365 | container_name: None, |
1366 | description: None, | 1366 | description: None, |
1367 | docs: None, | 1367 | docs: None, |
@@ -1443,7 +1443,7 @@ fn main() { let s<|>t = S{ f1:0 }; } | |||
1443 | 7..8, | 1443 | 7..8, |
1444 | ), | 1444 | ), |
1445 | name: "S", | 1445 | name: "S", |
1446 | kind: STRUCT_DEF, | 1446 | kind: STRUCT, |
1447 | container_name: None, | 1447 | container_name: None, |
1448 | description: Some( | 1448 | description: Some( |
1449 | "struct S", | 1449 | "struct S", |
@@ -1482,7 +1482,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } | |||
1482 | 24..25, | 1482 | 24..25, |
1483 | ), | 1483 | ), |
1484 | name: "S", | 1484 | name: "S", |
1485 | kind: STRUCT_DEF, | 1485 | kind: STRUCT, |
1486 | container_name: None, | 1486 | container_name: None, |
1487 | description: Some( | 1487 | description: Some( |
1488 | "struct S", | 1488 | "struct S", |
@@ -1501,7 +1501,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } | |||
1501 | 7..10, | 1501 | 7..10, |
1502 | ), | 1502 | ), |
1503 | name: "Arg", | 1503 | name: "Arg", |
1504 | kind: STRUCT_DEF, | 1504 | kind: STRUCT, |
1505 | container_name: None, | 1505 | container_name: None, |
1506 | description: Some( | 1506 | description: Some( |
1507 | "struct Arg", | 1507 | "struct Arg", |
@@ -1540,7 +1540,7 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } | |||
1540 | 24..25, | 1540 | 24..25, |
1541 | ), | 1541 | ), |
1542 | name: "S", | 1542 | name: "S", |
1543 | kind: STRUCT_DEF, | 1543 | kind: STRUCT, |
1544 | container_name: None, | 1544 | container_name: None, |
1545 | description: Some( | 1545 | description: Some( |
1546 | "struct S", | 1546 | "struct S", |
@@ -1559,7 +1559,7 @@ fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } | |||
1559 | 7..10, | 1559 | 7..10, |
1560 | ), | 1560 | ), |
1561 | name: "Arg", | 1561 | name: "Arg", |
1562 | kind: STRUCT_DEF, | 1562 | kind: STRUCT, |
1563 | container_name: None, | 1563 | container_name: None, |
1564 | description: Some( | 1564 | description: Some( |
1565 | "struct Arg", | 1565 | "struct Arg", |
@@ -1601,7 +1601,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | |||
1601 | 7..8, | 1601 | 7..8, |
1602 | ), | 1602 | ), |
1603 | name: "A", | 1603 | name: "A", |
1604 | kind: STRUCT_DEF, | 1604 | kind: STRUCT, |
1605 | container_name: None, | 1605 | container_name: None, |
1606 | description: Some( | 1606 | description: Some( |
1607 | "struct A", | 1607 | "struct A", |
@@ -1620,7 +1620,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | |||
1620 | 22..23, | 1620 | 22..23, |
1621 | ), | 1621 | ), |
1622 | name: "B", | 1622 | name: "B", |
1623 | kind: STRUCT_DEF, | 1623 | kind: STRUCT, |
1624 | container_name: None, | 1624 | container_name: None, |
1625 | description: Some( | 1625 | description: Some( |
1626 | "struct B", | 1626 | "struct B", |
@@ -1639,7 +1639,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | |||
1639 | 53..54, | 1639 | 53..54, |
1640 | ), | 1640 | ), |
1641 | name: "C", | 1641 | name: "C", |
1642 | kind: STRUCT_DEF, | 1642 | kind: STRUCT, |
1643 | container_name: None, | 1643 | container_name: None, |
1644 | description: Some( | 1644 | description: Some( |
1645 | "pub struct C", | 1645 | "pub struct C", |
@@ -1678,7 +1678,7 @@ fn main() { let s<|>t = foo(); } | |||
1678 | 6..9, | 1678 | 6..9, |
1679 | ), | 1679 | ), |
1680 | name: "Foo", | 1680 | name: "Foo", |
1681 | kind: TRAIT_DEF, | 1681 | kind: TRAIT, |
1682 | container_name: None, | 1682 | container_name: None, |
1683 | description: Some( | 1683 | description: Some( |
1684 | "trait Foo", | 1684 | "trait Foo", |
@@ -1718,7 +1718,7 @@ fn main() { let s<|>t = foo(); } | |||
1718 | 6..9, | 1718 | 6..9, |
1719 | ), | 1719 | ), |
1720 | name: "Foo", | 1720 | name: "Foo", |
1721 | kind: TRAIT_DEF, | 1721 | kind: TRAIT, |
1722 | container_name: None, | 1722 | container_name: None, |
1723 | description: Some( | 1723 | description: Some( |
1724 | "trait Foo", | 1724 | "trait Foo", |
@@ -1737,7 +1737,7 @@ fn main() { let s<|>t = foo(); } | |||
1737 | 23..24, | 1737 | 23..24, |
1738 | ), | 1738 | ), |
1739 | name: "S", | 1739 | name: "S", |
1740 | kind: STRUCT_DEF, | 1740 | kind: STRUCT, |
1741 | container_name: None, | 1741 | container_name: None, |
1742 | description: Some( | 1742 | description: Some( |
1743 | "struct S", | 1743 | "struct S", |
@@ -1777,7 +1777,7 @@ fn main() { let s<|>t = foo(); } | |||
1777 | 6..9, | 1777 | 6..9, |
1778 | ), | 1778 | ), |
1779 | name: "Foo", | 1779 | name: "Foo", |
1780 | kind: TRAIT_DEF, | 1780 | kind: TRAIT, |
1781 | container_name: None, | 1781 | container_name: None, |
1782 | description: Some( | 1782 | description: Some( |
1783 | "trait Foo", | 1783 | "trait Foo", |
@@ -1796,7 +1796,7 @@ fn main() { let s<|>t = foo(); } | |||
1796 | 19..22, | 1796 | 19..22, |
1797 | ), | 1797 | ), |
1798 | name: "Bar", | 1798 | name: "Bar", |
1799 | kind: TRAIT_DEF, | 1799 | kind: TRAIT, |
1800 | container_name: None, | 1800 | container_name: None, |
1801 | description: Some( | 1801 | description: Some( |
1802 | "trait Bar", | 1802 | "trait Bar", |
@@ -1839,7 +1839,7 @@ fn main() { let s<|>t = foo(); } | |||
1839 | 6..9, | 1839 | 6..9, |
1840 | ), | 1840 | ), |
1841 | name: "Foo", | 1841 | name: "Foo", |
1842 | kind: TRAIT_DEF, | 1842 | kind: TRAIT, |
1843 | container_name: None, | 1843 | container_name: None, |
1844 | description: Some( | 1844 | description: Some( |
1845 | "trait Foo", | 1845 | "trait Foo", |
@@ -1858,7 +1858,7 @@ fn main() { let s<|>t = foo(); } | |||
1858 | 22..25, | 1858 | 22..25, |
1859 | ), | 1859 | ), |
1860 | name: "Bar", | 1860 | name: "Bar", |
1861 | kind: TRAIT_DEF, | 1861 | kind: TRAIT, |
1862 | container_name: None, | 1862 | container_name: None, |
1863 | description: Some( | 1863 | description: Some( |
1864 | "trait Bar", | 1864 | "trait Bar", |
@@ -1877,7 +1877,7 @@ fn main() { let s<|>t = foo(); } | |||
1877 | 39..41, | 1877 | 39..41, |
1878 | ), | 1878 | ), |
1879 | name: "S1", | 1879 | name: "S1", |
1880 | kind: STRUCT_DEF, | 1880 | kind: STRUCT, |
1881 | container_name: None, | 1881 | container_name: None, |
1882 | description: Some( | 1882 | description: Some( |
1883 | "struct S1", | 1883 | "struct S1", |
@@ -1896,7 +1896,7 @@ fn main() { let s<|>t = foo(); } | |||
1896 | 52..54, | 1896 | 52..54, |
1897 | ), | 1897 | ), |
1898 | name: "S2", | 1898 | name: "S2", |
1899 | kind: STRUCT_DEF, | 1899 | kind: STRUCT, |
1900 | container_name: None, | 1900 | container_name: None, |
1901 | description: Some( | 1901 | description: Some( |
1902 | "struct S2", | 1902 | "struct S2", |
@@ -1933,7 +1933,7 @@ fn foo(ar<|>g: &impl Foo) {} | |||
1933 | 6..9, | 1933 | 6..9, |
1934 | ), | 1934 | ), |
1935 | name: "Foo", | 1935 | name: "Foo", |
1936 | kind: TRAIT_DEF, | 1936 | kind: TRAIT, |
1937 | container_name: None, | 1937 | container_name: None, |
1938 | description: Some( | 1938 | description: Some( |
1939 | "trait Foo", | 1939 | "trait Foo", |
@@ -1973,7 +1973,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
1973 | 6..9, | 1973 | 6..9, |
1974 | ), | 1974 | ), |
1975 | name: "Foo", | 1975 | name: "Foo", |
1976 | kind: TRAIT_DEF, | 1976 | kind: TRAIT, |
1977 | container_name: None, | 1977 | container_name: None, |
1978 | description: Some( | 1978 | description: Some( |
1979 | "trait Foo", | 1979 | "trait Foo", |
@@ -1992,7 +1992,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
1992 | 19..22, | 1992 | 19..22, |
1993 | ), | 1993 | ), |
1994 | name: "Bar", | 1994 | name: "Bar", |
1995 | kind: TRAIT_DEF, | 1995 | kind: TRAIT, |
1996 | container_name: None, | 1996 | container_name: None, |
1997 | description: Some( | 1997 | description: Some( |
1998 | "trait Bar", | 1998 | "trait Bar", |
@@ -2011,7 +2011,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
2011 | 36..37, | 2011 | 36..37, |
2012 | ), | 2012 | ), |
2013 | name: "S", | 2013 | name: "S", |
2014 | kind: STRUCT_DEF, | 2014 | kind: STRUCT, |
2015 | container_name: None, | 2015 | container_name: None, |
2016 | description: Some( | 2016 | description: Some( |
2017 | "struct S", | 2017 | "struct S", |
@@ -2049,7 +2049,7 @@ fn foo(ar<|>g: &impl Foo<S>) {} | |||
2049 | 6..9, | 2049 | 6..9, |
2050 | ), | 2050 | ), |
2051 | name: "Foo", | 2051 | name: "Foo", |
2052 | kind: TRAIT_DEF, | 2052 | kind: TRAIT, |
2053 | container_name: None, | 2053 | container_name: None, |
2054 | description: Some( | 2054 | description: Some( |
2055 | "trait Foo", | 2055 | "trait Foo", |
@@ -2068,7 +2068,7 @@ fn foo(ar<|>g: &impl Foo<S>) {} | |||
2068 | 23..24, | 2068 | 23..24, |
2069 | ), | 2069 | ), |
2070 | name: "S", | 2070 | name: "S", |
2071 | kind: STRUCT_DEF, | 2071 | kind: STRUCT, |
2072 | container_name: None, | 2072 | container_name: None, |
2073 | description: Some( | 2073 | description: Some( |
2074 | "struct S", | 2074 | "struct S", |
@@ -2111,7 +2111,7 @@ fn main() { let s<|>t = foo(); } | |||
2111 | 49..50, | 2111 | 49..50, |
2112 | ), | 2112 | ), |
2113 | name: "B", | 2113 | name: "B", |
2114 | kind: STRUCT_DEF, | 2114 | kind: STRUCT, |
2115 | container_name: None, | 2115 | container_name: None, |
2116 | description: Some( | 2116 | description: Some( |
2117 | "struct B", | 2117 | "struct B", |
@@ -2130,7 +2130,7 @@ fn main() { let s<|>t = foo(); } | |||
2130 | 6..9, | 2130 | 6..9, |
2131 | ), | 2131 | ), |
2132 | name: "Foo", | 2132 | name: "Foo", |
2133 | kind: TRAIT_DEF, | 2133 | kind: TRAIT, |
2134 | container_name: None, | 2134 | container_name: None, |
2135 | description: Some( | 2135 | description: Some( |
2136 | "trait Foo", | 2136 | "trait Foo", |
@@ -2167,7 +2167,7 @@ fn foo(ar<|>g: &dyn Foo) {} | |||
2167 | 6..9, | 2167 | 6..9, |
2168 | ), | 2168 | ), |
2169 | name: "Foo", | 2169 | name: "Foo", |
2170 | kind: TRAIT_DEF, | 2170 | kind: TRAIT, |
2171 | container_name: None, | 2171 | container_name: None, |
2172 | description: Some( | 2172 | description: Some( |
2173 | "trait Foo", | 2173 | "trait Foo", |
@@ -2205,7 +2205,7 @@ fn foo(ar<|>g: &dyn Foo<S>) {} | |||
2205 | 6..9, | 2205 | 6..9, |
2206 | ), | 2206 | ), |
2207 | name: "Foo", | 2207 | name: "Foo", |
2208 | kind: TRAIT_DEF, | 2208 | kind: TRAIT, |
2209 | container_name: None, | 2209 | container_name: None, |
2210 | description: Some( | 2210 | description: Some( |
2211 | "trait Foo", | 2211 | "trait Foo", |
@@ -2224,7 +2224,7 @@ fn foo(ar<|>g: &dyn Foo<S>) {} | |||
2224 | 23..24, | 2224 | 23..24, |
2225 | ), | 2225 | ), |
2226 | name: "S", | 2226 | name: "S", |
2227 | kind: STRUCT_DEF, | 2227 | kind: STRUCT, |
2228 | container_name: None, | 2228 | container_name: None, |
2229 | description: Some( | 2229 | description: Some( |
2230 | "struct S", | 2230 | "struct S", |
@@ -2265,7 +2265,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | |||
2265 | 6..15, | 2265 | 6..15, |
2266 | ), | 2266 | ), |
2267 | name: "ImplTrait", | 2267 | name: "ImplTrait", |
2268 | kind: TRAIT_DEF, | 2268 | kind: TRAIT, |
2269 | container_name: None, | 2269 | container_name: None, |
2270 | description: Some( | 2270 | description: Some( |
2271 | "trait ImplTrait", | 2271 | "trait ImplTrait", |
@@ -2284,7 +2284,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | |||
2284 | 50..51, | 2284 | 50..51, |
2285 | ), | 2285 | ), |
2286 | name: "B", | 2286 | name: "B", |
2287 | kind: STRUCT_DEF, | 2287 | kind: STRUCT, |
2288 | container_name: None, | 2288 | container_name: None, |
2289 | description: Some( | 2289 | description: Some( |
2290 | "struct B", | 2290 | "struct B", |
@@ -2303,7 +2303,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | |||
2303 | 28..36, | 2303 | 28..36, |
2304 | ), | 2304 | ), |
2305 | name: "DynTrait", | 2305 | name: "DynTrait", |
2306 | kind: TRAIT_DEF, | 2306 | kind: TRAIT, |
2307 | container_name: None, | 2307 | container_name: None, |
2308 | description: Some( | 2308 | description: Some( |
2309 | "trait DynTrait", | 2309 | "trait DynTrait", |
@@ -2322,7 +2322,7 @@ fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | |||
2322 | 65..66, | 2322 | 65..66, |
2323 | ), | 2323 | ), |
2324 | name: "S", | 2324 | name: "S", |
2325 | kind: STRUCT_DEF, | 2325 | kind: STRUCT, |
2326 | container_name: None, | 2326 | container_name: None, |
2327 | description: Some( | 2327 | description: Some( |
2328 | "struct S", | 2328 | "struct S", |
@@ -2370,7 +2370,7 @@ fn main() { let s<|>t = test().get(); } | |||
2370 | 6..9, | 2370 | 6..9, |
2371 | ), | 2371 | ), |
2372 | name: "Foo", | 2372 | name: "Foo", |
2373 | kind: TRAIT_DEF, | 2373 | kind: TRAIT, |
2374 | container_name: None, | 2374 | container_name: None, |
2375 | description: Some( | 2375 | description: Some( |
2376 | "trait Foo", | 2376 | "trait Foo", |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index f2e4f7ee5..4bbbcd258 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -2,7 +2,7 @@ use hir::{Adt, Callable, HirDisplay, Semantics, Type}; | |||
2 | use ra_ide_db::RootDatabase; | 2 | use ra_ide_db::RootDatabase; |
3 | use ra_prof::profile; | 3 | use ra_prof::profile; |
4 | use ra_syntax::{ | 4 | use ra_syntax::{ |
5 | ast::{self, ArgListOwner, AstNode, TypeAscriptionOwner}, | 5 | ast::{self, ArgListOwner, AstNode}, |
6 | match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, | 6 | match_ast, Direction, NodeOrToken, SmolStr, SyntaxKind, TextRange, T, |
7 | }; | 7 | }; |
8 | use stdx::to_lower_snake_case; | 8 | use stdx::to_lower_snake_case; |
@@ -96,7 +96,7 @@ fn get_chaining_hints( | |||
96 | return None; | 96 | return None; |
97 | } | 97 | } |
98 | 98 | ||
99 | if matches!(expr, ast::Expr::RecordLit(_)) { | 99 | if matches!(expr, ast::Expr::RecordExpr(_)) { |
100 | return None; | 100 | return None; |
101 | } | 101 | } |
102 | 102 | ||
@@ -230,10 +230,10 @@ fn should_not_display_type_hint(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ | |||
230 | match_ast! { | 230 | match_ast! { |
231 | match node { | 231 | match node { |
232 | ast::LetStmt(it) => { | 232 | ast::LetStmt(it) => { |
233 | return it.ascribed_type().is_some() | 233 | return it.ty().is_some() |
234 | }, | 234 | }, |
235 | ast::Param(it) => { | 235 | ast::Param(it) => { |
236 | return it.ascribed_type().is_some() | 236 | return it.ty().is_some() |
237 | }, | 237 | }, |
238 | ast::MatchArm(_it) => { | 238 | ast::MatchArm(_it) => { |
239 | return pat_is_enum_variant(db, bind_pat, pat_ty); | 239 | return pat_is_enum_variant(db, bind_pat, pat_ty); |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index fe1c074d1..519e4bf1a 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -172,16 +172,16 @@ fn get_struct_def_name_for_struct_literal_search( | |||
172 | if let Some(name) = | 172 | if let Some(name) = |
173 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, left.text_range().start()) | 173 | sema.find_node_at_offset_with_descend::<ast::Name>(&syntax, left.text_range().start()) |
174 | { | 174 | { |
175 | return name.syntax().ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); | 175 | return name.syntax().ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); |
176 | } | 176 | } |
177 | if sema | 177 | if sema |
178 | .find_node_at_offset_with_descend::<ast::TypeParamList>( | 178 | .find_node_at_offset_with_descend::<ast::GenericParamList>( |
179 | &syntax, | 179 | &syntax, |
180 | left.text_range().start(), | 180 | left.text_range().start(), |
181 | ) | 181 | ) |
182 | .is_some() | 182 | .is_some() |
183 | { | 183 | { |
184 | return left.ancestors().find_map(ast::StructDef::cast).and_then(|l| l.name()); | 184 | return left.ancestors().find_map(ast::Struct::cast).and_then(|l| l.name()); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | None | 187 | None |
@@ -212,7 +212,7 @@ fn main() { | |||
212 | ); | 212 | ); |
213 | check_result( | 213 | check_result( |
214 | refs, | 214 | refs, |
215 | "Foo STRUCT_DEF FileId(1) 0..26 7..10 Other", | 215 | "Foo STRUCT FileId(1) 0..26 7..10 Other", |
216 | &["FileId(1) 101..104 StructLiteral"], | 216 | &["FileId(1) 101..104 StructLiteral"], |
217 | ); | 217 | ); |
218 | } | 218 | } |
@@ -230,7 +230,7 @@ struct Foo<|> {} | |||
230 | ); | 230 | ); |
231 | check_result( | 231 | check_result( |
232 | refs, | 232 | refs, |
233 | "Foo STRUCT_DEF FileId(1) 0..13 7..10 Other", | 233 | "Foo STRUCT FileId(1) 0..13 7..10 Other", |
234 | &["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"], | 234 | &["FileId(1) 41..44 Other", "FileId(1) 54..57 StructLiteral"], |
235 | ); | 235 | ); |
236 | } | 236 | } |
@@ -248,7 +248,7 @@ struct Foo<T> <|>{} | |||
248 | ); | 248 | ); |
249 | check_result( | 249 | check_result( |
250 | refs, | 250 | refs, |
251 | "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", | 251 | "Foo STRUCT FileId(1) 0..16 7..10 Other", |
252 | &["FileId(1) 64..67 StructLiteral"], | 252 | &["FileId(1) 64..67 StructLiteral"], |
253 | ); | 253 | ); |
254 | } | 254 | } |
@@ -267,7 +267,7 @@ fn main() { | |||
267 | ); | 267 | ); |
268 | check_result( | 268 | check_result( |
269 | refs, | 269 | refs, |
270 | "Foo STRUCT_DEF FileId(1) 0..16 7..10 Other", | 270 | "Foo STRUCT FileId(1) 0..16 7..10 Other", |
271 | &["FileId(1) 54..57 StructLiteral"], | 271 | &["FileId(1) 54..57 StructLiteral"], |
272 | ); | 272 | ); |
273 | } | 273 | } |
@@ -361,7 +361,7 @@ fn main(s: Foo) { | |||
361 | ); | 361 | ); |
362 | check_result( | 362 | check_result( |
363 | refs, | 363 | refs, |
364 | "spam RECORD_FIELD_DEF FileId(1) 17..30 21..25 Other", | 364 | "spam RECORD_FIELD FileId(1) 17..30 21..25 Other", |
365 | &["FileId(1) 67..71 Other Read"], | 365 | &["FileId(1) 67..71 Other Read"], |
366 | ); | 366 | ); |
367 | } | 367 | } |
@@ -376,7 +376,7 @@ impl Foo { | |||
376 | } | 376 | } |
377 | "#, | 377 | "#, |
378 | ); | 378 | ); |
379 | check_result(refs, "f FN_DEF FileId(1) 27..43 30..31 Other", &[]); | 379 | check_result(refs, "f FN FileId(1) 27..43 30..31 Other", &[]); |
380 | } | 380 | } |
381 | 381 | ||
382 | #[test] | 382 | #[test] |
@@ -390,7 +390,7 @@ enum Foo { | |||
390 | } | 390 | } |
391 | "#, | 391 | "#, |
392 | ); | 392 | ); |
393 | check_result(refs, "B ENUM_VARIANT FileId(1) 22..23 22..23 Other", &[]); | 393 | check_result(refs, "B VARIANT FileId(1) 22..23 22..23 Other", &[]); |
394 | } | 394 | } |
395 | 395 | ||
396 | #[test] | 396 | #[test] |
@@ -431,7 +431,7 @@ fn f() { | |||
431 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 431 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
432 | check_result( | 432 | check_result( |
433 | refs, | 433 | refs, |
434 | "Foo STRUCT_DEF FileId(2) 17..51 28..31 Other", | 434 | "Foo STRUCT FileId(2) 17..51 28..31 Other", |
435 | &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], | 435 | &["FileId(1) 53..56 StructLiteral", "FileId(3) 79..82 StructLiteral"], |
436 | ); | 436 | ); |
437 | } | 437 | } |
@@ -486,7 +486,7 @@ pub(super) struct Foo<|> { | |||
486 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 486 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
487 | check_result( | 487 | check_result( |
488 | refs, | 488 | refs, |
489 | "Foo STRUCT_DEF FileId(3) 0..41 18..21 Other", | 489 | "Foo STRUCT FileId(3) 0..41 18..21 Other", |
490 | &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], | 490 | &["FileId(2) 20..23 Other", "FileId(2) 47..50 StructLiteral"], |
491 | ); | 491 | ); |
492 | } | 492 | } |
@@ -514,7 +514,7 @@ pub(super) struct Foo<|> { | |||
514 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 514 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
515 | check_result( | 515 | check_result( |
516 | refs, | 516 | refs, |
517 | "quux FN_DEF FileId(1) 19..35 26..30 Other", | 517 | "quux FN FileId(1) 19..35 26..30 Other", |
518 | &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], | 518 | &["FileId(2) 16..20 StructLiteral", "FileId(3) 16..20 StructLiteral"], |
519 | ); | 519 | ); |
520 | 520 | ||
@@ -522,7 +522,7 @@ pub(super) struct Foo<|> { | |||
522 | analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); | 522 | analysis.find_all_refs(pos, Some(SearchScope::single_file(bar))).unwrap().unwrap(); |
523 | check_result( | 523 | check_result( |
524 | refs, | 524 | refs, |
525 | "quux FN_DEF FileId(1) 19..35 26..30 Other", | 525 | "quux FN FileId(1) 19..35 26..30 Other", |
526 | &["FileId(3) 16..20 StructLiteral"], | 526 | &["FileId(3) 16..20 StructLiteral"], |
527 | ); | 527 | ); |
528 | } | 528 | } |
@@ -580,7 +580,7 @@ fn foo() { | |||
580 | ); | 580 | ); |
581 | check_result( | 581 | check_result( |
582 | refs, | 582 | refs, |
583 | "f RECORD_FIELD_DEF FileId(1) 15..21 15..16 Other", | 583 | "f RECORD_FIELD FileId(1) 15..21 15..16 Other", |
584 | &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], | 584 | &["FileId(1) 55..56 Other Read", "FileId(1) 68..69 Other Write"], |
585 | ); | 585 | ); |
586 | } | 586 | } |
@@ -619,7 +619,7 @@ fn main() { | |||
619 | ); | 619 | ); |
620 | check_result( | 620 | check_result( |
621 | refs, | 621 | refs, |
622 | "new FN_DEF FileId(1) 54..101 61..64 Other", | 622 | "new FN FileId(1) 54..101 61..64 Other", |
623 | &["FileId(1) 146..149 StructLiteral"], | 623 | &["FileId(1) 146..149 StructLiteral"], |
624 | ); | 624 | ); |
625 | } | 625 | } |
@@ -646,7 +646,7 @@ fn main() { | |||
646 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); | 646 | let refs = analysis.find_all_refs(pos, None).unwrap().unwrap(); |
647 | check_result( | 647 | check_result( |
648 | refs, | 648 | refs, |
649 | "f FN_DEF FileId(1) 26..35 29..30 Other", | 649 | "f FN FileId(1) 26..35 29..30 Other", |
650 | &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], | 650 | &["FileId(2) 11..12 Other", "FileId(2) 28..29 StructLiteral"], |
651 | ); | 651 | ); |
652 | } | 652 | } |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 8735ec53c..31654bf79 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -7,7 +7,8 @@ use ra_ide_db::{ | |||
7 | RootDatabase, | 7 | RootDatabase, |
8 | }; | 8 | }; |
9 | use ra_syntax::{ | 9 | use ra_syntax::{ |
10 | algo::find_node_at_offset, ast, ast::NameOwner, ast::TypeAscriptionOwner, | 10 | algo::find_node_at_offset, |
11 | ast::{self, NameOwner}, | ||
11 | lex_single_valid_syntax_kind, match_ast, AstNode, SyntaxKind, SyntaxNode, SyntaxToken, | 12 | lex_single_valid_syntax_kind, match_ast, AstNode, SyntaxKind, SyntaxNode, SyntaxToken, |
12 | }; | 13 | }; |
13 | use ra_text_edit::TextEdit; | 14 | use ra_text_edit::TextEdit; |
@@ -149,13 +150,13 @@ fn rename_to_self( | |||
149 | let source_file = sema.parse(position.file_id); | 150 | let source_file = sema.parse(position.file_id); |
150 | let syn = source_file.syntax(); | 151 | let syn = source_file.syntax(); |
151 | 152 | ||
152 | let fn_def = find_node_at_offset::<ast::FnDef>(syn, position.offset)?; | 153 | let fn_def = find_node_at_offset::<ast::Fn>(syn, position.offset)?; |
153 | let params = fn_def.param_list()?; | 154 | let params = fn_def.param_list()?; |
154 | if params.self_param().is_some() { | 155 | if params.self_param().is_some() { |
155 | return None; // method already has self param | 156 | return None; // method already has self param |
156 | } | 157 | } |
157 | let first_param = params.params().next()?; | 158 | let first_param = params.params().next()?; |
158 | let mutable = match first_param.ascribed_type() { | 159 | let mutable = match first_param.ty() { |
159 | Some(ast::TypeRef::ReferenceType(rt)) => rt.mut_token().is_some(), | 160 | Some(ast::TypeRef::ReferenceType(rt)) => rt.mut_token().is_some(), |
160 | _ => return None, // not renaming other types | 161 | _ => return None, // not renaming other types |
161 | }; | 162 | }; |
@@ -192,15 +193,14 @@ fn text_edit_from_self_param( | |||
192 | self_param: &ast::SelfParam, | 193 | self_param: &ast::SelfParam, |
193 | new_name: &str, | 194 | new_name: &str, |
194 | ) -> Option<TextEdit> { | 195 | ) -> Option<TextEdit> { |
195 | fn target_type_name(impl_def: &ast::ImplDef) -> Option<String> { | 196 | fn target_type_name(impl_def: &ast::Impl) -> Option<String> { |
196 | if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { | 197 | if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { |
197 | return Some(p.path()?.segment()?.name_ref()?.text().to_string()); | 198 | return Some(p.path()?.segment()?.name_ref()?.text().to_string()); |
198 | } | 199 | } |
199 | None | 200 | None |
200 | } | 201 | } |
201 | 202 | ||
202 | let impl_def = | 203 | let impl_def = find_node_at_offset::<ast::Impl>(syn, self_param.syntax().text_range().start())?; |
203 | find_node_at_offset::<ast::ImplDef>(syn, self_param.syntax().text_range().start())?; | ||
204 | let type_name = target_type_name(&impl_def)?; | 204 | let type_name = target_type_name(&impl_def)?; |
205 | 205 | ||
206 | let mut replacement_text = String::from(new_name); | 206 | let mut replacement_text = String::from(new_name); |
@@ -221,7 +221,7 @@ fn rename_self_to_param( | |||
221 | let syn = source_file.syntax(); | 221 | let syn = source_file.syntax(); |
222 | 222 | ||
223 | let text = sema.db.file_text(position.file_id); | 223 | let text = sema.db.file_text(position.file_id); |
224 | let fn_def = find_node_at_offset::<ast::FnDef>(syn, position.offset)?; | 224 | let fn_def = find_node_at_offset::<ast::Fn>(syn, position.offset)?; |
225 | let search_range = fn_def.syntax().text_range(); | 225 | let search_range = fn_def.syntax().text_range(); |
226 | 226 | ||
227 | let mut edits: Vec<SourceFileEdit> = vec![]; | 227 | let mut edits: Vec<SourceFileEdit> = vec![]; |
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index f612835c2..3b7162b84 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs | |||
@@ -102,7 +102,7 @@ pub(crate) fn runnable( | |||
102 | ) -> Option<Runnable> { | 102 | ) -> Option<Runnable> { |
103 | match_ast! { | 103 | match_ast! { |
104 | match item { | 104 | match item { |
105 | ast::FnDef(it) => runnable_fn(sema, it, file_id), | 105 | ast::Fn(it) => runnable_fn(sema, it, file_id), |
106 | ast::Module(it) => runnable_mod(sema, it, file_id), | 106 | ast::Module(it) => runnable_mod(sema, it, file_id), |
107 | _ => None, | 107 | _ => None, |
108 | } | 108 | } |
@@ -111,7 +111,7 @@ pub(crate) fn runnable( | |||
111 | 111 | ||
112 | fn runnable_fn( | 112 | fn runnable_fn( |
113 | sema: &Semantics<RootDatabase>, | 113 | sema: &Semantics<RootDatabase>, |
114 | fn_def: ast::FnDef, | 114 | fn_def: ast::Fn, |
115 | file_id: FileId, | 115 | file_id: FileId, |
116 | ) -> Option<Runnable> { | 116 | ) -> Option<Runnable> { |
117 | let name_string = fn_def.name()?.text().to_string(); | 117 | let name_string = fn_def.name()?.text().to_string(); |
@@ -188,7 +188,7 @@ pub struct TestAttr { | |||
188 | } | 188 | } |
189 | 189 | ||
190 | impl TestAttr { | 190 | impl TestAttr { |
191 | fn from_fn(fn_def: &ast::FnDef) -> TestAttr { | 191 | fn from_fn(fn_def: &ast::Fn) -> TestAttr { |
192 | let ignore = fn_def | 192 | let ignore = fn_def |
193 | .attrs() | 193 | .attrs() |
194 | .filter_map(|attr| attr.simple_name()) | 194 | .filter_map(|attr| attr.simple_name()) |
@@ -203,7 +203,7 @@ impl TestAttr { | |||
203 | /// | 203 | /// |
204 | /// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test, | 204 | /// It may produce false positives, for example, `#[wasm_bindgen_test]` requires a different command to run the test, |
205 | /// but it's better than not to have the runnables for the tests at all. | 205 | /// but it's better than not to have the runnables for the tests at all. |
206 | fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool { | 206 | fn has_test_related_attribute(fn_def: &ast::Fn) -> bool { |
207 | fn_def | 207 | fn_def |
208 | .attrs() | 208 | .attrs() |
209 | .filter_map(|attr| attr.path()) | 209 | .filter_map(|attr| attr.path()) |
@@ -211,7 +211,7 @@ fn has_test_related_attribute(fn_def: &ast::FnDef) -> bool { | |||
211 | .any(|attribute_text| attribute_text.contains("test")) | 211 | .any(|attribute_text| attribute_text.contains("test")) |
212 | } | 212 | } |
213 | 213 | ||
214 | fn has_doc_test(fn_def: &ast::FnDef) -> bool { | 214 | fn has_doc_test(fn_def: &ast::Fn) -> bool { |
215 | fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```")) | 215 | fn_def.doc_comment_text().map_or(false, |comment| comment.contains("```")) |
216 | } | 216 | } |
217 | 217 | ||
@@ -246,7 +246,7 @@ fn has_test_function_or_multiple_test_submodules(module: &ast::Module) -> bool { | |||
246 | 246 | ||
247 | for item in item_list.items() { | 247 | for item in item_list.items() { |
248 | match item { | 248 | match item { |
249 | ast::Item::FnDef(f) => { | 249 | ast::Item::Fn(f) => { |
250 | if has_test_related_attribute(&f) { | 250 | if has_test_related_attribute(&f) { |
251 | return true; | 251 | return true; |
252 | } | 252 | } |
@@ -320,7 +320,7 @@ fn bench() {} | |||
320 | 4..8, | 320 | 4..8, |
321 | ), | 321 | ), |
322 | name: "main", | 322 | name: "main", |
323 | kind: FN_DEF, | 323 | kind: FN, |
324 | container_name: None, | 324 | container_name: None, |
325 | description: None, | 325 | description: None, |
326 | docs: None, | 326 | docs: None, |
@@ -338,7 +338,7 @@ fn bench() {} | |||
338 | 26..34, | 338 | 26..34, |
339 | ), | 339 | ), |
340 | name: "test_foo", | 340 | name: "test_foo", |
341 | kind: FN_DEF, | 341 | kind: FN, |
342 | container_name: None, | 342 | container_name: None, |
343 | description: None, | 343 | description: None, |
344 | docs: None, | 344 | docs: None, |
@@ -363,7 +363,7 @@ fn bench() {} | |||
363 | 62..70, | 363 | 62..70, |
364 | ), | 364 | ), |
365 | name: "test_foo", | 365 | name: "test_foo", |
366 | kind: FN_DEF, | 366 | kind: FN, |
367 | container_name: None, | 367 | container_name: None, |
368 | description: None, | 368 | description: None, |
369 | docs: None, | 369 | docs: None, |
@@ -388,7 +388,7 @@ fn bench() {} | |||
388 | 89..94, | 388 | 89..94, |
389 | ), | 389 | ), |
390 | name: "bench", | 390 | name: "bench", |
391 | kind: FN_DEF, | 391 | kind: FN, |
392 | container_name: None, | 392 | container_name: None, |
393 | description: None, | 393 | description: None, |
394 | docs: None, | 394 | docs: None, |
@@ -431,7 +431,7 @@ fn foo() {} | |||
431 | 4..8, | 431 | 4..8, |
432 | ), | 432 | ), |
433 | name: "main", | 433 | name: "main", |
434 | kind: FN_DEF, | 434 | kind: FN, |
435 | container_name: None, | 435 | container_name: None, |
436 | description: None, | 436 | description: None, |
437 | docs: None, | 437 | docs: None, |
@@ -447,7 +447,7 @@ fn foo() {} | |||
447 | full_range: 15..57, | 447 | full_range: 15..57, |
448 | focus_range: None, | 448 | focus_range: None, |
449 | name: "foo", | 449 | name: "foo", |
450 | kind: FN_DEF, | 450 | kind: FN, |
451 | container_name: None, | 451 | container_name: None, |
452 | description: None, | 452 | description: None, |
453 | docs: None, | 453 | docs: None, |
@@ -493,7 +493,7 @@ impl Data { | |||
493 | 4..8, | 493 | 4..8, |
494 | ), | 494 | ), |
495 | name: "main", | 495 | name: "main", |
496 | kind: FN_DEF, | 496 | kind: FN, |
497 | container_name: None, | 497 | container_name: None, |
498 | description: None, | 498 | description: None, |
499 | docs: None, | 499 | docs: None, |
@@ -509,7 +509,7 @@ impl Data { | |||
509 | full_range: 44..98, | 509 | full_range: 44..98, |
510 | focus_range: None, | 510 | focus_range: None, |
511 | name: "foo", | 511 | name: "foo", |
512 | kind: FN_DEF, | 512 | kind: FN, |
513 | container_name: None, | 513 | container_name: None, |
514 | description: None, | 514 | description: None, |
515 | docs: None, | 515 | docs: None, |
@@ -570,7 +570,7 @@ mod test_mod { | |||
570 | 35..44, | 570 | 35..44, |
571 | ), | 571 | ), |
572 | name: "test_foo1", | 572 | name: "test_foo1", |
573 | kind: FN_DEF, | 573 | kind: FN, |
574 | container_name: None, | 574 | container_name: None, |
575 | description: None, | 575 | description: None, |
576 | docs: None, | 576 | docs: None, |
@@ -670,7 +670,7 @@ mod root_tests { | |||
670 | 107..121, | 670 | 107..121, |
671 | ), | 671 | ), |
672 | name: "nested_test_11", | 672 | name: "nested_test_11", |
673 | kind: FN_DEF, | 673 | kind: FN, |
674 | container_name: None, | 674 | container_name: None, |
675 | description: None, | 675 | description: None, |
676 | docs: None, | 676 | docs: None, |
@@ -695,7 +695,7 @@ mod root_tests { | |||
695 | 163..177, | 695 | 163..177, |
696 | ), | 696 | ), |
697 | name: "nested_test_12", | 697 | name: "nested_test_12", |
698 | kind: FN_DEF, | 698 | kind: FN, |
699 | container_name: None, | 699 | container_name: None, |
700 | description: None, | 700 | description: None, |
701 | docs: None, | 701 | docs: None, |
@@ -740,7 +740,7 @@ mod root_tests { | |||
740 | 258..271, | 740 | 258..271, |
741 | ), | 741 | ), |
742 | name: "nested_test_2", | 742 | name: "nested_test_2", |
743 | kind: FN_DEF, | 743 | kind: FN, |
744 | container_name: None, | 744 | container_name: None, |
745 | description: None, | 745 | description: None, |
746 | docs: None, | 746 | docs: None, |
@@ -783,7 +783,7 @@ fn test_foo1() {} | |||
783 | 36..45, | 783 | 36..45, |
784 | ), | 784 | ), |
785 | name: "test_foo1", | 785 | name: "test_foo1", |
786 | kind: FN_DEF, | 786 | kind: FN, |
787 | container_name: None, | 787 | container_name: None, |
788 | description: None, | 788 | description: None, |
789 | docs: None, | 789 | docs: None, |
@@ -831,7 +831,7 @@ fn test_foo1() {} | |||
831 | 58..67, | 831 | 58..67, |
832 | ), | 832 | ), |
833 | name: "test_foo1", | 833 | name: "test_foo1", |
834 | kind: FN_DEF, | 834 | kind: FN, |
835 | container_name: None, | 835 | container_name: None, |
836 | description: None, | 836 | description: None, |
837 | docs: None, | 837 | docs: None, |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index d456d5d36..e3a96f9d5 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -464,7 +464,7 @@ fn highlight_element( | |||
464 | let db = sema.db; | 464 | let db = sema.db; |
465 | let mut binding_hash = None; | 465 | let mut binding_hash = None; |
466 | let highlight: Highlight = match element.kind() { | 466 | let highlight: Highlight = match element.kind() { |
467 | FN_DEF => { | 467 | FN => { |
468 | bindings_shadow_count.clear(); | 468 | bindings_shadow_count.clear(); |
469 | return None; | 469 | return None; |
470 | } | 470 | } |
@@ -647,7 +647,7 @@ fn highlight_element( | |||
647 | 647 | ||
648 | fn is_child_of_impl(element: &SyntaxElement) -> bool { | 648 | fn is_child_of_impl(element: &SyntaxElement) -> bool { |
649 | match element.parent() { | 649 | match element.parent() { |
650 | Some(e) => e.kind() == IMPL_DEF, | 650 | Some(e) => e.kind() == IMPL, |
651 | _ => false, | 651 | _ => false, |
652 | } | 652 | } |
653 | } | 653 | } |
@@ -705,18 +705,18 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | |||
705 | }; | 705 | }; |
706 | 706 | ||
707 | let tag = match parent.kind() { | 707 | let tag = match parent.kind() { |
708 | STRUCT_DEF => HighlightTag::Struct, | 708 | STRUCT => HighlightTag::Struct, |
709 | ENUM_DEF => HighlightTag::Enum, | 709 | ENUM => HighlightTag::Enum, |
710 | UNION_DEF => HighlightTag::Union, | 710 | UNION => HighlightTag::Union, |
711 | TRAIT_DEF => HighlightTag::Trait, | 711 | TRAIT => HighlightTag::Trait, |
712 | TYPE_ALIAS_DEF => HighlightTag::TypeAlias, | 712 | TYPE_ALIAS => HighlightTag::TypeAlias, |
713 | TYPE_PARAM => HighlightTag::TypeParam, | 713 | TYPE_PARAM => HighlightTag::TypeParam, |
714 | RECORD_FIELD_DEF => HighlightTag::Field, | 714 | RECORD_FIELD => HighlightTag::Field, |
715 | MODULE => HighlightTag::Module, | 715 | MODULE => HighlightTag::Module, |
716 | FN_DEF => HighlightTag::Function, | 716 | FN => HighlightTag::Function, |
717 | CONST_DEF => HighlightTag::Constant, | 717 | CONST => HighlightTag::Constant, |
718 | STATIC_DEF => HighlightTag::Static, | 718 | STATIC => HighlightTag::Static, |
719 | ENUM_VARIANT => HighlightTag::EnumVariant, | 719 | VARIANT => HighlightTag::EnumVariant, |
720 | BIND_PAT => HighlightTag::Local, | 720 | BIND_PAT => HighlightTag::Local, |
721 | _ => default, | 721 | _ => default, |
722 | }; | 722 | }; |
diff --git a/crates/ra_ide/src/syntax_tree.rs b/crates/ra_ide/src/syntax_tree.rs index f716a3861..07217e808 100644 --- a/crates/ra_ide/src/syntax_tree.rs +++ b/crates/ra_ide/src/syntax_tree.rs | |||
@@ -116,7 +116,7 @@ mod tests { | |||
116 | syn.trim(), | 116 | syn.trim(), |
117 | r#" | 117 | r#" |
118 | [email protected] | 118 | [email protected] |
119 | FN_DEF@0..11 | 119 | [email protected] |
120 | [email protected] "fn" | 120 | [email protected] "fn" |
121 | [email protected] " " | 121 | [email protected] " " |
122 | [email protected] | 122 | [email protected] |
@@ -148,7 +148,7 @@ fn test() { | |||
148 | syn.trim(), | 148 | syn.trim(), |
149 | r#" | 149 | r#" |
150 | [email protected] | 150 | [email protected] |
151 | FN_DEF@0..60 | 151 | [email protected] |
152 | [email protected] "fn" | 152 | [email protected] "fn" |
153 | [email protected] " " | 153 | [email protected] " " |
154 | [email protected] | 154 | [email protected] |
@@ -190,7 +190,7 @@ [email protected] | |||
190 | assert_eq_text!( | 190 | assert_eq_text!( |
191 | syn.trim(), | 191 | syn.trim(), |
192 | r#" | 192 | r#" |
193 | FN_DEF@0..11 | 193 | [email protected] |
194 | [email protected] "fn" | 194 | [email protected] "fn" |
195 | [email protected] " " | 195 | [email protected] " " |
196 | [email protected] | 196 | [email protected] |
@@ -258,7 +258,7 @@ fn bar() { | |||
258 | syn.trim(), | 258 | syn.trim(), |
259 | r#" | 259 | r#" |
260 | [email protected] | 260 | [email protected] |
261 | FN_DEF@0..12 | 261 | [email protected] |
262 | [email protected] "fn" | 262 | [email protected] "fn" |
263 | [email protected] " " | 263 | [email protected] " " |
264 | [email protected] | 264 | [email protected] |
@@ -292,7 +292,7 @@ fn bar() { | |||
292 | syn.trim(), | 292 | syn.trim(), |
293 | r#" | 293 | r#" |
294 | [email protected] | 294 | [email protected] |
295 | FN_DEF@0..12 | 295 | [email protected] |
296 | [email protected] "fn" | 296 | [email protected] "fn" |
297 | [email protected] " " | 297 | [email protected] " " |
298 | [email protected] | 298 | [email protected] |
@@ -325,7 +325,7 @@ fn bar() { | |||
325 | syn.trim(), | 325 | syn.trim(), |
326 | r#" | 326 | r#" |
327 | [email protected] | 327 | [email protected] |
328 | FN_DEF@0..12 | 328 | [email protected] |
329 | [email protected] "fn" | 329 | [email protected] "fn" |
330 | [email protected] " " | 330 | [email protected] " " |
331 | [email protected] | 331 | [email protected] |
@@ -339,7 +339,7 @@ [email protected] | |||
339 | [email protected] "\n" | 339 | [email protected] "\n" |
340 | [email protected] "}" | 340 | [email protected] "}" |
341 | [email protected] "\n" | 341 | [email protected] "\n" |
342 | FN_DEF@13..25 | 342 | [email protected] |
343 | [email protected] "fn" | 343 | [email protected] "fn" |
344 | [email protected] " " | 344 | [email protected] " " |
345 | [email protected] | 345 | [email protected] |
diff --git a/crates/ra_ide_db/src/defs.rs b/crates/ra_ide_db/src/defs.rs index 1464c5f2a..df56f2d9e 100644 --- a/crates/ra_ide_db/src/defs.rs +++ b/crates/ra_ide_db/src/defs.rs | |||
@@ -142,7 +142,7 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
142 | 142 | ||
143 | Some(NameClass::Definition(Definition::Local(local))) | 143 | Some(NameClass::Definition(Definition::Local(local))) |
144 | }, | 144 | }, |
145 | ast::RecordFieldDef(it) => { | 145 | ast::RecordField(it) => { |
146 | let field: hir::Field = sema.to_def(&it)?; | 146 | let field: hir::Field = sema.to_def(&it)?; |
147 | Some(NameClass::Definition(Definition::Field(field))) | 147 | Some(NameClass::Definition(Definition::Field(field))) |
148 | }, | 148 | }, |
@@ -150,39 +150,39 @@ pub fn classify_name(sema: &Semantics<RootDatabase>, name: &ast::Name) -> Option | |||
150 | let def = sema.to_def(&it)?; | 150 | let def = sema.to_def(&it)?; |
151 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 151 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
152 | }, | 152 | }, |
153 | ast::StructDef(it) => { | 153 | ast::Struct(it) => { |
154 | let def: hir::Struct = sema.to_def(&it)?; | 154 | let def: hir::Struct = sema.to_def(&it)?; |
155 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 155 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
156 | }, | 156 | }, |
157 | ast::UnionDef(it) => { | 157 | ast::Union(it) => { |
158 | let def: hir::Union = sema.to_def(&it)?; | 158 | let def: hir::Union = sema.to_def(&it)?; |
159 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 159 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
160 | }, | 160 | }, |
161 | ast::EnumDef(it) => { | 161 | ast::Enum(it) => { |
162 | let def: hir::Enum = sema.to_def(&it)?; | 162 | let def: hir::Enum = sema.to_def(&it)?; |
163 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 163 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
164 | }, | 164 | }, |
165 | ast::TraitDef(it) => { | 165 | ast::Trait(it) => { |
166 | let def: hir::Trait = sema.to_def(&it)?; | 166 | let def: hir::Trait = sema.to_def(&it)?; |
167 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 167 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
168 | }, | 168 | }, |
169 | ast::StaticDef(it) => { | 169 | ast::Static(it) => { |
170 | let def: hir::Static = sema.to_def(&it)?; | 170 | let def: hir::Static = sema.to_def(&it)?; |
171 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 171 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
172 | }, | 172 | }, |
173 | ast::EnumVariant(it) => { | 173 | ast::Variant(it) => { |
174 | let def: hir::EnumVariant = sema.to_def(&it)?; | 174 | let def: hir::EnumVariant = sema.to_def(&it)?; |
175 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 175 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
176 | }, | 176 | }, |
177 | ast::FnDef(it) => { | 177 | ast::Fn(it) => { |
178 | let def: hir::Function = sema.to_def(&it)?; | 178 | let def: hir::Function = sema.to_def(&it)?; |
179 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 179 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
180 | }, | 180 | }, |
181 | ast::ConstDef(it) => { | 181 | ast::Const(it) => { |
182 | let def: hir::Const = sema.to_def(&it)?; | 182 | let def: hir::Const = sema.to_def(&it)?; |
183 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 183 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
184 | }, | 184 | }, |
185 | ast::TypeAliasDef(it) => { | 185 | ast::TypeAlias(it) => { |
186 | let def: hir::TypeAlias = sema.to_def(&it)?; | 186 | let def: hir::TypeAlias = sema.to_def(&it)?; |
187 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) | 187 | Some(NameClass::Definition(Definition::ModuleDef(def.into()))) |
188 | }, | 188 | }, |
@@ -236,7 +236,7 @@ pub fn classify_name_ref( | |||
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | if let Some(record_field) = ast::RecordField::for_field_name(name_ref) { | 239 | if let Some(record_field) = ast::RecordExprField::for_field_name(name_ref) { |
240 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { | 240 | if let Some((field, local)) = sema.resolve_record_field(&record_field) { |
241 | let field = Definition::Field(field); | 241 | let field = Definition::Field(field); |
242 | let res = match local { | 242 | let res = match local { |
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs index a7cae37b0..0b862b449 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ra_ide_db/src/search.rs | |||
@@ -315,7 +315,7 @@ fn is_record_lit_name_ref(name_ref: &ast::NameRef) -> bool { | |||
315 | name_ref | 315 | name_ref |
316 | .syntax() | 316 | .syntax() |
317 | .ancestors() | 317 | .ancestors() |
318 | .find_map(ast::RecordLit::cast) | 318 | .find_map(ast::RecordExpr::cast) |
319 | .and_then(|l| l.path()) | 319 | .and_then(|l| l.path()) |
320 | .and_then(|p| p.segment()) | 320 | .and_then(|p| p.segment()) |
321 | .map(|p| p.name_ref().as_ref() == Some(name_ref)) | 321 | .map(|p| p.name_ref().as_ref() == Some(name_ref)) |
diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 131e2a128..35a2c5be3 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs | |||
@@ -344,7 +344,7 @@ impl Query { | |||
344 | } | 344 | } |
345 | 345 | ||
346 | fn is_type(kind: SyntaxKind) -> bool { | 346 | fn is_type(kind: SyntaxKind) -> bool { |
347 | matches!(kind, STRUCT_DEF | ENUM_DEF | TRAIT_DEF | TYPE_ALIAS_DEF) | 347 | matches!(kind, STRUCT | ENUM | TRAIT | TYPE_ALIAS) |
348 | } | 348 | } |
349 | 349 | ||
350 | /// The actual data that is stored in the index. It should be as compact as | 350 | /// The actual data that is stored in the index. It should be as compact as |
@@ -397,14 +397,14 @@ fn to_symbol(node: &SyntaxNode) -> Option<(SmolStr, SyntaxNodePtr, TextRange)> { | |||
397 | } | 397 | } |
398 | match_ast! { | 398 | match_ast! { |
399 | match node { | 399 | match node { |
400 | ast::FnDef(it) => decl(it), | 400 | ast::Fn(it) => decl(it), |
401 | ast::StructDef(it) => decl(it), | 401 | ast::Struct(it) => decl(it), |
402 | ast::EnumDef(it) => decl(it), | 402 | ast::Enum(it) => decl(it), |
403 | ast::TraitDef(it) => decl(it), | 403 | ast::Trait(it) => decl(it), |
404 | ast::Module(it) => decl(it), | 404 | ast::Module(it) => decl(it), |
405 | ast::TypeAliasDef(it) => decl(it), | 405 | ast::TypeAlias(it) => decl(it), |
406 | ast::ConstDef(it) => decl(it), | 406 | ast::Const(it) => decl(it), |
407 | ast::StaticDef(it) => decl(it), | 407 | ast::Static(it) => decl(it), |
408 | ast::MacroCall(it) => { | 408 | ast::MacroCall(it) => { |
409 | if it.is_macro_rules().is_some() { | 409 | if it.is_macro_rules().is_some() { |
410 | decl(it) | 410 | decl(it) |
diff --git a/crates/ra_mbe/src/syntax_bridge.rs b/crates/ra_mbe/src/syntax_bridge.rs index fc4133a67..5fc48507f 100644 --- a/crates/ra_mbe/src/syntax_bridge.rs +++ b/crates/ra_mbe/src/syntax_bridge.rs | |||
@@ -825,7 +825,7 @@ mod tests { | |||
825 | #[test] | 825 | #[test] |
826 | fn test_token_tree_multi_char_punct() { | 826 | fn test_token_tree_multi_char_punct() { |
827 | let source_file = ast::SourceFile::parse("struct Foo { a: x::Y }").ok().unwrap(); | 827 | let source_file = ast::SourceFile::parse("struct Foo { a: x::Y }").ok().unwrap(); |
828 | let struct_def = source_file.syntax().descendants().find_map(ast::StructDef::cast).unwrap(); | 828 | let struct_def = source_file.syntax().descendants().find_map(ast::Struct::cast).unwrap(); |
829 | let tt = ast_to_token_tree(&struct_def).unwrap().0; | 829 | let tt = ast_to_token_tree(&struct_def).unwrap().0; |
830 | token_tree_to_syntax_node(&tt, FragmentKind::Item).unwrap(); | 830 | token_tree_to_syntax_node(&tt, FragmentKind::Item).unwrap(); |
831 | } | 831 | } |
diff --git a/crates/ra_mbe/src/tests.rs b/crates/ra_mbe/src/tests.rs index c43003fd6..707e84f42 100644 --- a/crates/ra_mbe/src/tests.rs +++ b/crates/ra_mbe/src/tests.rs | |||
@@ -258,7 +258,7 @@ fn test_expr_order() { | |||
258 | assert_eq_text!( | 258 | assert_eq_text!( |
259 | dump.trim(), | 259 | dump.trim(), |
260 | r#"[email protected] | 260 | r#"[email protected] |
261 | FN_DEF@0..15 | 261 | [email protected] |
262 | [email protected] "fn" | 262 | [email protected] "fn" |
263 | [email protected] | 263 | [email protected] |
264 | [email protected] "bar" | 264 | [email protected] "bar" |
@@ -490,13 +490,13 @@ fn test_expand_to_item_list() { | |||
490 | format!("{:#?}", tree).trim(), | 490 | format!("{:#?}", tree).trim(), |
491 | r#" | 491 | r#" |
492 | [email protected] | 492 | [email protected] |
493 | STRUCT_DEF@0..20 | 493 | [email protected] |
494 | [email protected] "struct" | 494 | [email protected] "struct" |
495 | [email protected] | 495 | [email protected] |
496 | [email protected] "Foo" | 496 | [email protected] "Foo" |
497 | RECORD_FIELD_DEF_[email protected] | 497 | [email protected] |
498 | [email protected] "{" | 498 | [email protected] "{" |
499 | RECORD_FIELD_DEF@10..19 | 499 | [email protected] |
500 | [email protected] | 500 | [email protected] |
501 | [email protected] "field" | 501 | [email protected] "field" |
502 | [email protected] ":" | 502 | [email protected] ":" |
@@ -506,13 +506,13 @@ [email protected] | |||
506 | [email protected] | 506 | [email protected] |
507 | [email protected] "u32" | 507 | [email protected] "u32" |
508 | [email protected] "}" | 508 | [email protected] "}" |
509 | STRUCT_DEF@20..40 | 509 | [email protected] |
510 | [email protected] "struct" | 510 | [email protected] "struct" |
511 | [email protected] | 511 | [email protected] |
512 | [email protected] "Bar" | 512 | [email protected] "Bar" |
513 | RECORD_FIELD_DEF_[email protected] | 513 | [email protected] |
514 | [email protected] "{" | 514 | [email protected] "{" |
515 | RECORD_FIELD_DEF@30..39 | 515 | [email protected] |
516 | [email protected] | 516 | [email protected] |
517 | [email protected] "field" | 517 | [email protected] "field" |
518 | [email protected] ":" | 518 | [email protected] ":" |
@@ -1467,7 +1467,7 @@ macro_rules! quick_error { | |||
1467 | buf [ ] | 1467 | buf [ ] |
1468 | queue [ ] | 1468 | queue [ ] |
1469 | ) => { | 1469 | ) => { |
1470 | quick_error!(ENUM_DEFINITION [enum $name $( #[$meta] )*] | 1470 | quick_error!(ENUMINITION [enum $name $( #[$meta] )*] |
1471 | body [] | 1471 | body [] |
1472 | queue [$( | 1472 | queue [$( |
1473 | $( #[$imeta] )* | 1473 | $( #[$imeta] )* |
@@ -1489,7 +1489,7 @@ quick_error ! (SORT [enum Wrapped # [derive (Debug)]] items [ | |||
1489 | "#, | 1489 | "#, |
1490 | ); | 1490 | ); |
1491 | 1491 | ||
1492 | assert_eq!(expanded.to_string(), "quick_error ! (ENUM_DEFINITION [enum Wrapped # [derive (Debug)]] body [] queue [=> One : UNIT [] => Two : TUPLE [s : String]]) ;"); | 1492 | assert_eq!(expanded.to_string(), "quick_error ! (ENUMINITION [enum Wrapped # [derive (Debug)]] body [] queue [=> One : UNIT [] => Two : TUPLE [s : String]]) ;"); |
1493 | } | 1493 | } |
1494 | 1494 | ||
1495 | #[test] | 1495 | #[test] |
diff --git a/crates/ra_parser/src/grammar.rs b/crates/ra_parser/src/grammar.rs index 7dfac2813..c2e1d701e 100644 --- a/crates/ra_parser/src/grammar.rs +++ b/crates/ra_parser/src/grammar.rs | |||
@@ -142,16 +142,16 @@ pub(crate) fn reparser( | |||
142 | ) -> Option<fn(&mut Parser)> { | 142 | ) -> Option<fn(&mut Parser)> { |
143 | let res = match node { | 143 | let res = match node { |
144 | BLOCK_EXPR => expressions::block_expr, | 144 | BLOCK_EXPR => expressions::block_expr, |
145 | RECORD_FIELD_DEF_LIST => items::record_field_def_list, | 145 | RECORD_FIELD_LIST => items::record_field_def_list, |
146 | RECORD_FIELD_LIST => items::record_field_list, | 146 | RECORD_EXPR_FIELD_LIST => items::record_field_list, |
147 | ENUM_VARIANT_LIST => items::enum_variant_list, | 147 | VARIANT_LIST => items::enum_variant_list, |
148 | MATCH_ARM_LIST => items::match_arm_list, | 148 | MATCH_ARM_LIST => items::match_arm_list, |
149 | USE_TREE_LIST => items::use_tree_list, | 149 | USE_TREE_LIST => items::use_tree_list, |
150 | EXTERN_ITEM_LIST => items::extern_item_list, | 150 | EXTERN_ITEM_LIST => items::extern_item_list, |
151 | TOKEN_TREE if first_child? == T!['{'] => items::token_tree, | 151 | TOKEN_TREE if first_child? == T!['{'] => items::token_tree, |
152 | ASSOC_ITEM_LIST => match parent? { | 152 | ASSOC_ITEM_LIST => match parent? { |
153 | IMPL_DEF => items::impl_item_list, | 153 | IMPL => items::impl_item_list, |
154 | TRAIT_DEF => items::trait_item_list, | 154 | TRAIT => items::trait_item_list, |
155 | _ => return None, | 155 | _ => return None, |
156 | }, | 156 | }, |
157 | ITEM_LIST => items::mod_item_list, | 157 | ITEM_LIST => items::mod_item_list, |
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs index 6e72eea66..e1c25a838 100644 --- a/crates/ra_parser/src/grammar/expressions.rs +++ b/crates/ra_parser/src/grammar/expressions.rs | |||
@@ -587,7 +587,7 @@ fn path_expr(p: &mut Parser, r: Restrictions) -> (CompletedMarker, BlockLike) { | |||
587 | match p.current() { | 587 | match p.current() { |
588 | T!['{'] if !r.forbid_structs => { | 588 | T!['{'] if !r.forbid_structs => { |
589 | record_field_list(p); | 589 | record_field_list(p); |
590 | (m.complete(p, RECORD_LIT), BlockLike::NotBlock) | 590 | (m.complete(p, RECORD_EXPR), BlockLike::NotBlock) |
591 | } | 591 | } |
592 | T![!] if !p.at(T![!=]) => { | 592 | T![!] if !p.at(T![!=]) => { |
593 | let block_like = items::macro_call_after_excl(p); | 593 | let block_like = items::macro_call_after_excl(p); |
@@ -627,7 +627,7 @@ pub(crate) fn record_field_list(p: &mut Parser) { | |||
627 | p.expect(T![:]); | 627 | p.expect(T![:]); |
628 | } | 628 | } |
629 | expr(p); | 629 | expr(p); |
630 | m.complete(p, RECORD_FIELD); | 630 | m.complete(p, RECORD_EXPR_FIELD); |
631 | } | 631 | } |
632 | T![.] if p.at(T![..]) => { | 632 | T![.] if p.at(T![..]) => { |
633 | m.abandon(p); | 633 | m.abandon(p); |
@@ -648,5 +648,5 @@ pub(crate) fn record_field_list(p: &mut Parser) { | |||
648 | } | 648 | } |
649 | } | 649 | } |
650 | p.expect(T!['}']); | 650 | p.expect(T!['}']); |
651 | m.complete(p, RECORD_FIELD_LIST); | 651 | m.complete(p, RECORD_EXPR_FIELD_LIST); |
652 | } | 652 | } |
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 3b73e5346..cca524cea 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -180,7 +180,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
180 | // unsafe const fn bar() {} | 180 | // unsafe const fn bar() {} |
181 | T![fn] => { | 181 | T![fn] => { |
182 | fn_def(p); | 182 | fn_def(p); |
183 | m.complete(p, FN_DEF); | 183 | m.complete(p, FN); |
184 | } | 184 | } |
185 | 185 | ||
186 | // test unsafe_trait | 186 | // test unsafe_trait |
@@ -193,7 +193,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
193 | // unsafe auto trait T {} | 193 | // unsafe auto trait T {} |
194 | T![trait] => { | 194 | T![trait] => { |
195 | traits::trait_def(p); | 195 | traits::trait_def(p); |
196 | m.complete(p, TRAIT_DEF); | 196 | m.complete(p, TRAIT); |
197 | } | 197 | } |
198 | 198 | ||
199 | // test unsafe_impl | 199 | // test unsafe_impl |
@@ -221,7 +221,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
221 | // unsafe default impl Foo {} | 221 | // unsafe default impl Foo {} |
222 | T![impl] => { | 222 | T![impl] => { |
223 | traits::impl_def(p); | 223 | traits::impl_def(p); |
224 | m.complete(p, IMPL_DEF); | 224 | m.complete(p, IMPL); |
225 | } | 225 | } |
226 | 226 | ||
227 | // test existential_type | 227 | // test existential_type |
@@ -380,7 +380,7 @@ fn type_def(p: &mut Parser, m: Marker) { | |||
380 | types::type_(p); | 380 | types::type_(p); |
381 | } | 381 | } |
382 | p.expect(T![;]); | 382 | p.expect(T![;]); |
383 | m.complete(p, TYPE_ALIAS_DEF); | 383 | m.complete(p, TYPE_ALIAS); |
384 | } | 384 | } |
385 | 385 | ||
386 | pub(crate) fn mod_item(p: &mut Parser, m: Marker) { | 386 | pub(crate) fn mod_item(p: &mut Parser, m: Marker) { |
diff --git a/crates/ra_parser/src/grammar/items/adt.rs b/crates/ra_parser/src/grammar/items/adt.rs index 74b9f514b..addfb59d4 100644 --- a/crates/ra_parser/src/grammar/items/adt.rs +++ b/crates/ra_parser/src/grammar/items/adt.rs | |||
@@ -5,13 +5,13 @@ use super::*; | |||
5 | pub(super) fn struct_def(p: &mut Parser, m: Marker) { | 5 | pub(super) fn struct_def(p: &mut Parser, m: Marker) { |
6 | assert!(p.at(T![struct])); | 6 | assert!(p.at(T![struct])); |
7 | p.bump(T![struct]); | 7 | p.bump(T![struct]); |
8 | struct_or_union(p, m, T![struct], STRUCT_DEF); | 8 | struct_or_union(p, m, T![struct], STRUCT); |
9 | } | 9 | } |
10 | 10 | ||
11 | pub(super) fn union_def(p: &mut Parser, m: Marker) { | 11 | pub(super) fn union_def(p: &mut Parser, m: Marker) { |
12 | assert!(p.at_contextual_kw("union")); | 12 | assert!(p.at_contextual_kw("union")); |
13 | p.bump_remap(T![union]); | 13 | p.bump_remap(T![union]); |
14 | struct_or_union(p, m, T![union], UNION_DEF); | 14 | struct_or_union(p, m, T![union], UNION); |
15 | } | 15 | } |
16 | 16 | ||
17 | fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | 17 | fn struct_or_union(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { |
@@ -64,7 +64,7 @@ pub(super) fn enum_def(p: &mut Parser, m: Marker) { | |||
64 | } else { | 64 | } else { |
65 | p.error("expected `{`") | 65 | p.error("expected `{`") |
66 | } | 66 | } |
67 | m.complete(p, ENUM_DEF); | 67 | m.complete(p, ENUM); |
68 | } | 68 | } |
69 | 69 | ||
70 | pub(crate) fn enum_variant_list(p: &mut Parser) { | 70 | pub(crate) fn enum_variant_list(p: &mut Parser) { |
@@ -91,7 +91,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
91 | if p.eat(T![=]) { | 91 | if p.eat(T![=]) { |
92 | expressions::expr(p); | 92 | expressions::expr(p); |
93 | } | 93 | } |
94 | var.complete(p, ENUM_VARIANT); | 94 | var.complete(p, VARIANT); |
95 | } else { | 95 | } else { |
96 | var.abandon(p); | 96 | var.abandon(p); |
97 | p.err_and_bump("expected enum variant"); | 97 | p.err_and_bump("expected enum variant"); |
@@ -101,7 +101,7 @@ pub(crate) fn enum_variant_list(p: &mut Parser) { | |||
101 | } | 101 | } |
102 | } | 102 | } |
103 | p.expect(T!['}']); | 103 | p.expect(T!['}']); |
104 | m.complete(p, ENUM_VARIANT_LIST); | 104 | m.complete(p, VARIANT_LIST); |
105 | } | 105 | } |
106 | 106 | ||
107 | pub(crate) fn record_field_def_list(p: &mut Parser) { | 107 | pub(crate) fn record_field_def_list(p: &mut Parser) { |
@@ -119,7 +119,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
119 | } | 119 | } |
120 | } | 120 | } |
121 | p.expect(T!['}']); | 121 | p.expect(T!['}']); |
122 | m.complete(p, RECORD_FIELD_DEF_LIST); | 122 | m.complete(p, RECORD_FIELD_LIST); |
123 | 123 | ||
124 | fn record_field_def(p: &mut Parser) { | 124 | fn record_field_def(p: &mut Parser) { |
125 | let m = p.start(); | 125 | let m = p.start(); |
@@ -134,7 +134,7 @@ pub(crate) fn record_field_def_list(p: &mut Parser) { | |||
134 | name(p); | 134 | name(p); |
135 | p.expect(T![:]); | 135 | p.expect(T![:]); |
136 | types::type_(p); | 136 | types::type_(p); |
137 | m.complete(p, RECORD_FIELD_DEF); | 137 | m.complete(p, RECORD_FIELD); |
138 | } else { | 138 | } else { |
139 | m.abandon(p); | 139 | m.abandon(p); |
140 | p.err_and_bump("expected field declaration"); | 140 | p.err_and_bump("expected field declaration"); |
@@ -167,12 +167,12 @@ fn tuple_field_def_list(p: &mut Parser) { | |||
167 | break; | 167 | break; |
168 | } | 168 | } |
169 | types::type_(p); | 169 | types::type_(p); |
170 | m.complete(p, TUPLE_FIELD_DEF); | 170 | m.complete(p, TUPLE_FIELD); |
171 | 171 | ||
172 | if !p.at(T![')']) { | 172 | if !p.at(T![')']) { |
173 | p.expect(T![,]); | 173 | p.expect(T![,]); |
174 | } | 174 | } |
175 | } | 175 | } |
176 | p.expect(T![')']); | 176 | p.expect(T![')']); |
177 | m.complete(p, TUPLE_FIELD_DEF_LIST); | 177 | m.complete(p, TUPLE_FIELD_LIST); |
178 | } | 178 | } |
diff --git a/crates/ra_parser/src/grammar/items/consts.rs b/crates/ra_parser/src/grammar/items/consts.rs index 742a7e056..35ad766dc 100644 --- a/crates/ra_parser/src/grammar/items/consts.rs +++ b/crates/ra_parser/src/grammar/items/consts.rs | |||
@@ -3,11 +3,11 @@ | |||
3 | use super::*; | 3 | use super::*; |
4 | 4 | ||
5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { | 5 | pub(super) fn static_def(p: &mut Parser, m: Marker) { |
6 | const_or_static(p, m, T![static], STATIC_DEF) | 6 | const_or_static(p, m, T![static], STATIC) |
7 | } | 7 | } |
8 | 8 | ||
9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { | 9 | pub(super) fn const_def(p: &mut Parser, m: Marker) { |
10 | const_or_static(p, m, T![const], CONST_DEF) | 10 | const_or_static(p, m, T![const], CONST) |
11 | } | 11 | } |
12 | 12 | ||
13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { | 13 | fn const_or_static(p: &mut Parser, m: Marker, kw: SyntaxKind, def: SyntaxKind) { |
diff --git a/crates/ra_parser/src/grammar/type_params.rs b/crates/ra_parser/src/grammar/type_params.rs index d1330d4b9..90dabb4c0 100644 --- a/crates/ra_parser/src/grammar/type_params.rs +++ b/crates/ra_parser/src/grammar/type_params.rs | |||
@@ -36,7 +36,7 @@ fn type_param_list(p: &mut Parser) { | |||
36 | } | 36 | } |
37 | } | 37 | } |
38 | p.expect(T![>]); | 38 | p.expect(T![>]); |
39 | m.complete(p, TYPE_PARAM_LIST); | 39 | m.complete(p, GENERIC_PARAM_LIST); |
40 | } | 40 | } |
41 | 41 | ||
42 | fn lifetime_param(p: &mut Parser, m: Marker) { | 42 | fn lifetime_param(p: &mut Parser, m: Marker) { |
diff --git a/crates/ra_parser/src/syntax_kind/generated.rs b/crates/ra_parser/src/syntax_kind/generated.rs index 4f35e0baa..be4da67bc 100644 --- a/crates/ra_parser/src/syntax_kind/generated.rs +++ b/crates/ra_parser/src/syntax_kind/generated.rs | |||
@@ -1,7 +1,7 @@ | |||
1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` | 1 | //! Generated file, do not edit by hand, see `xtask/src/codegen` |
2 | 2 | ||
3 | #![allow(bad_style, missing_docs, unreachable_pub)] | 3 | #![allow(bad_style, missing_docs, unreachable_pub)] |
4 | #[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`."] | 4 | #[doc = r" The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`."] |
5 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] | 5 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
6 | #[repr(u16)] | 6 | #[repr(u16)] |
7 | pub enum SyntaxKind { | 7 | pub enum SyntaxKind { |
@@ -123,19 +123,19 @@ pub enum SyntaxKind { | |||
123 | L_DOLLAR, | 123 | L_DOLLAR, |
124 | R_DOLLAR, | 124 | R_DOLLAR, |
125 | SOURCE_FILE, | 125 | SOURCE_FILE, |
126 | STRUCT_DEF, | 126 | STRUCT, |
127 | UNION_DEF, | 127 | UNION, |
128 | ENUM_DEF, | 128 | ENUM, |
129 | FN_DEF, | 129 | FN, |
130 | RET_TYPE, | 130 | RET_TYPE, |
131 | EXTERN_CRATE, | 131 | EXTERN_CRATE, |
132 | MODULE, | 132 | MODULE, |
133 | USE, | 133 | USE, |
134 | STATIC_DEF, | 134 | STATIC, |
135 | CONST_DEF, | 135 | CONST, |
136 | TRAIT_DEF, | 136 | TRAIT, |
137 | IMPL_DEF, | 137 | IMPL, |
138 | TYPE_ALIAS_DEF, | 138 | TYPE_ALIAS, |
139 | MACRO_CALL, | 139 | MACRO_CALL, |
140 | TOKEN_TREE, | 140 | TOKEN_TREE, |
141 | MACRO_DEF, | 141 | MACRO_DEF, |
@@ -188,9 +188,9 @@ pub enum SyntaxKind { | |||
188 | MATCH_ARM_LIST, | 188 | MATCH_ARM_LIST, |
189 | MATCH_ARM, | 189 | MATCH_ARM, |
190 | MATCH_GUARD, | 190 | MATCH_GUARD, |
191 | RECORD_LIT, | 191 | RECORD_EXPR, |
192 | RECORD_FIELD_LIST, | 192 | RECORD_EXPR_FIELD_LIST, |
193 | RECORD_FIELD, | 193 | RECORD_EXPR_FIELD, |
194 | EFFECT_EXPR, | 194 | EFFECT_EXPR, |
195 | BOX_EXPR, | 195 | BOX_EXPR, |
196 | CALL_EXPR, | 196 | CALL_EXPR, |
@@ -206,12 +206,12 @@ pub enum SyntaxKind { | |||
206 | BIN_EXPR, | 206 | BIN_EXPR, |
207 | EXTERN_BLOCK, | 207 | EXTERN_BLOCK, |
208 | EXTERN_ITEM_LIST, | 208 | EXTERN_ITEM_LIST, |
209 | ENUM_VARIANT, | 209 | VARIANT, |
210 | RECORD_FIELD_DEF_LIST, | 210 | RECORD_FIELD_LIST, |
211 | RECORD_FIELD_DEF, | 211 | RECORD_FIELD, |
212 | TUPLE_FIELD_DEF_LIST, | 212 | TUPLE_FIELD_LIST, |
213 | TUPLE_FIELD_DEF, | 213 | TUPLE_FIELD, |
214 | ENUM_VARIANT_LIST, | 214 | VARIANT_LIST, |
215 | ITEM_LIST, | 215 | ITEM_LIST, |
216 | ASSOC_ITEM_LIST, | 216 | ASSOC_ITEM_LIST, |
217 | ATTR, | 217 | ATTR, |
@@ -230,7 +230,8 @@ pub enum SyntaxKind { | |||
230 | NAME_REF, | 230 | NAME_REF, |
231 | LET_STMT, | 231 | LET_STMT, |
232 | EXPR_STMT, | 232 | EXPR_STMT, |
233 | TYPE_PARAM_LIST, | 233 | GENERIC_PARAM_LIST, |
234 | GENERIC_PARAM, | ||
234 | LIFETIME_PARAM, | 235 | LIFETIME_PARAM, |
235 | TYPE_PARAM, | 236 | TYPE_PARAM, |
236 | CONST_PARAM, | 237 | CONST_PARAM, |
diff --git a/crates/ra_project_model/src/cfg_flag.rs b/crates/ra_project_model/src/cfg_flag.rs index 1bc5d4832..bd50056c6 100644 --- a/crates/ra_project_model/src/cfg_flag.rs +++ b/crates/ra_project_model/src/cfg_flag.rs | |||
@@ -4,7 +4,7 @@ | |||
4 | use std::str::FromStr; | 4 | use std::str::FromStr; |
5 | 5 | ||
6 | use ra_cfg::CfgOptions; | 6 | use ra_cfg::CfgOptions; |
7 | use stdx::split_delim; | 7 | use stdx::split_once; |
8 | 8 | ||
9 | #[derive(Clone, Eq, PartialEq, Debug)] | 9 | #[derive(Clone, Eq, PartialEq, Debug)] |
10 | pub enum CfgFlag { | 10 | pub enum CfgFlag { |
@@ -15,7 +15,7 @@ pub enum CfgFlag { | |||
15 | impl FromStr for CfgFlag { | 15 | impl FromStr for CfgFlag { |
16 | type Err = String; | 16 | type Err = String; |
17 | fn from_str(s: &str) -> Result<Self, Self::Err> { | 17 | fn from_str(s: &str) -> Result<Self, Self::Err> { |
18 | let res = match split_delim(s, '=') { | 18 | let res = match split_once(s, '=') { |
19 | Some((key, value)) => { | 19 | Some((key, value)) => { |
20 | if !(value.starts_with('"') && value.ends_with('"')) { | 20 | if !(value.starts_with('"') && value.ends_with('"')) { |
21 | return Err(format!("Invalid cfg ({:?}), value should be in quotes", s)); | 21 | return Err(format!("Invalid cfg ({:?}), value should be in quotes", s)); |
diff --git a/crates/ra_project_model/src/sysroot.rs b/crates/ra_project_model/src/sysroot.rs index 9e23b5805..a10ade375 100644 --- a/crates/ra_project_model/src/sysroot.rs +++ b/crates/ra_project_model/src/sysroot.rs | |||
@@ -146,42 +146,28 @@ impl SysrootCrateData { | |||
146 | } | 146 | } |
147 | 147 | ||
148 | const SYSROOT_CRATES: &str = " | 148 | const SYSROOT_CRATES: &str = " |
149 | std | ||
150 | core | ||
151 | alloc | 149 | alloc |
152 | collections | 150 | core |
153 | libc | ||
154 | proc_macro | ||
155 | rustc_unicode | ||
156 | std_unicode | ||
157 | test | ||
158 | alloc_jemalloc | ||
159 | alloc_system | ||
160 | compiler_builtins | ||
161 | getopts | ||
162 | panic_unwind | ||
163 | panic_abort | 151 | panic_abort |
164 | rand | 152 | panic_unwind |
153 | proc_macro | ||
154 | profiler_builtins | ||
155 | rtstartup | ||
156 | std | ||
157 | stdarch | ||
165 | term | 158 | term |
166 | unwind | 159 | test |
167 | build_helper | 160 | unwind"; |
168 | rustc_asan | ||
169 | rustc_lsan | ||
170 | rustc_msan | ||
171 | rustc_tsan | ||
172 | syntax"; | ||
173 | 161 | ||
174 | const STD_DEPS: &str = " | 162 | const STD_DEPS: &str = " |
175 | alloc | 163 | alloc |
176 | alloc_jemalloc | ||
177 | alloc_system | ||
178 | core | 164 | core |
179 | panic_abort | 165 | panic_abort |
180 | rand | 166 | panic_unwind |
181 | compiler_builtins | 167 | profiler_builtins |
182 | unwind | 168 | rtstartup |
183 | rustc_asan | 169 | proc_macro |
184 | rustc_lsan | 170 | stdarch |
185 | rustc_msan | 171 | term |
186 | rustc_tsan | 172 | test |
187 | build_helper"; | 173 | unwind"; |
diff --git a/crates/ra_ssr/src/matching.rs b/crates/ra_ssr/src/matching.rs index c1b66748e..74e15c631 100644 --- a/crates/ra_ssr/src/matching.rs +++ b/crates/ra_ssr/src/matching.rs | |||
@@ -209,7 +209,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
209 | // Some kinds of nodes have special handling. For everything else, we fall back to default | 209 | // Some kinds of nodes have special handling. For everything else, we fall back to default |
210 | // matching. | 210 | // matching. |
211 | match code.kind() { | 211 | match code.kind() { |
212 | SyntaxKind::RECORD_FIELD_LIST => { | 212 | SyntaxKind::RECORD_EXPR_FIELD_LIST => { |
213 | self.attempt_match_record_field_list(phase, pattern, code) | 213 | self.attempt_match_record_field_list(phase, pattern, code) |
214 | } | 214 | } |
215 | SyntaxKind::TOKEN_TREE => self.attempt_match_token_tree(phase, pattern, code), | 215 | SyntaxKind::TOKEN_TREE => self.attempt_match_token_tree(phase, pattern, code), |
@@ -399,7 +399,7 @@ impl<'db, 'sema> Matcher<'db, 'sema> { | |||
399 | // Build a map keyed by field name. | 399 | // Build a map keyed by field name. |
400 | let mut fields_by_name = FxHashMap::default(); | 400 | let mut fields_by_name = FxHashMap::default(); |
401 | for child in code.children() { | 401 | for child in code.children() { |
402 | if let Some(record) = ast::RecordField::cast(child.clone()) { | 402 | if let Some(record) = ast::RecordExprField::cast(child.clone()) { |
403 | if let Some(name) = record.field_name() { | 403 | if let Some(name) = record.field_name() { |
404 | fields_by_name.insert(name.text().clone(), child.clone()); | 404 | fields_by_name.insert(name.text().clone(), child.clone()); |
405 | } | 405 | } |
diff --git a/crates/ra_syntax/Cargo.toml b/crates/ra_syntax/Cargo.toml index 670f04578..fc4d7aa04 100644 --- a/crates/ra_syntax/Cargo.toml +++ b/crates/ra_syntax/Cargo.toml | |||
@@ -13,7 +13,7 @@ doctest = false | |||
13 | [dependencies] | 13 | [dependencies] |
14 | itertools = "0.9.0" | 14 | itertools = "0.9.0" |
15 | rowan = "0.10.0" | 15 | rowan = "0.10.0" |
16 | rustc_lexer = { version = "669.0.0", package = "rustc-ap-rustc_lexer" } | 16 | rustc_lexer = { version = "671.0.0", package = "rustc-ap-rustc_lexer" } |
17 | rustc-hash = "1.1.0" | 17 | rustc-hash = "1.1.0" |
18 | arrayvec = "0.5.1" | 18 | arrayvec = "0.5.1" |
19 | once_cell = "1.3.1" | 19 | once_cell = "1.3.1" |
diff --git a/crates/ra_syntax/src/ast.rs b/crates/ra_syntax/src/ast.rs index c65c485cb..fd426ece9 100644 --- a/crates/ra_syntax/src/ast.rs +++ b/crates/ra_syntax/src/ast.rs | |||
@@ -139,7 +139,7 @@ fn test_doc_comment_of_statics() { | |||
139 | ) | 139 | ) |
140 | .ok() | 140 | .ok() |
141 | .unwrap(); | 141 | .unwrap(); |
142 | let st = file.syntax().descendants().find_map(StaticDef::cast).unwrap(); | 142 | let st = file.syntax().descendants().find_map(Static::cast).unwrap(); |
143 | assert_eq!("Number of levels", st.doc_comment_text().unwrap()); | 143 | assert_eq!("Number of levels", st.doc_comment_text().unwrap()); |
144 | } | 144 | } |
145 | 145 | ||
@@ -235,7 +235,7 @@ fn test_comments_preserve_trailing_whitespace() { | |||
235 | ) | 235 | ) |
236 | .ok() | 236 | .ok() |
237 | .unwrap(); | 237 | .unwrap(); |
238 | let def = file.syntax().descendants().find_map(StructDef::cast).unwrap(); | 238 | let def = file.syntax().descendants().find_map(Struct::cast).unwrap(); |
239 | assert_eq!( | 239 | assert_eq!( |
240 | "Representation of a Realm. \nIn the specification these are called Realm Records.", | 240 | "Representation of a Realm. \nIn the specification these are called Realm Records.", |
241 | def.doc_comment_text().unwrap() | 241 | def.doc_comment_text().unwrap() |
@@ -286,7 +286,7 @@ where | |||
286 | let mut bounds = pred.type_bound_list().unwrap().bounds(); | 286 | let mut bounds = pred.type_bound_list().unwrap().bounds(); |
287 | 287 | ||
288 | assert!(pred.for_token().is_none()); | 288 | assert!(pred.for_token().is_none()); |
289 | assert!(pred.type_param_list().is_none()); | 289 | assert!(pred.generic_param_list().is_none()); |
290 | assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string()); | 290 | assert_eq!("T", pred.type_ref().unwrap().syntax().text().to_string()); |
291 | assert_bound("Clone", bounds.next()); | 291 | assert_bound("Clone", bounds.next()); |
292 | assert_bound("Copy", bounds.next()); | 292 | assert_bound("Copy", bounds.next()); |
@@ -325,7 +325,7 @@ where | |||
325 | let mut bounds = pred.type_bound_list().unwrap().bounds(); | 325 | let mut bounds = pred.type_bound_list().unwrap().bounds(); |
326 | 326 | ||
327 | assert!(pred.for_token().is_some()); | 327 | assert!(pred.for_token().is_some()); |
328 | assert_eq!("<'a>", pred.type_param_list().unwrap().syntax().text().to_string()); | 328 | assert_eq!("<'a>", pred.generic_param_list().unwrap().syntax().text().to_string()); |
329 | assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string()); | 329 | assert_eq!("F", pred.type_ref().unwrap().syntax().text().to_string()); |
330 | assert_bound("Fn(&'a str)", bounds.next()); | 330 | assert_bound("Fn(&'a str)", bounds.next()); |
331 | } | 331 | } |
diff --git a/crates/ra_syntax/src/ast/edit.rs b/crates/ra_syntax/src/ast/edit.rs index 6ebe10ff6..8d3e42f25 100644 --- a/crates/ra_syntax/src/ast/edit.rs +++ b/crates/ra_syntax/src/ast/edit.rs | |||
@@ -29,9 +29,9 @@ impl ast::BinExpr { | |||
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
32 | impl ast::FnDef { | 32 | impl ast::Fn { |
33 | #[must_use] | 33 | #[must_use] |
34 | pub fn with_body(&self, body: ast::BlockExpr) -> ast::FnDef { | 34 | pub fn with_body(&self, body: ast::BlockExpr) -> ast::Fn { |
35 | let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); | 35 | let mut to_insert: ArrayVec<[SyntaxElement; 2]> = ArrayVec::new(); |
36 | let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { | 36 | let old_body_or_semi: SyntaxElement = if let Some(old_body) = self.body() { |
37 | old_body.syntax().clone().into() | 37 | old_body.syntax().clone().into() |
@@ -116,18 +116,18 @@ impl ast::AssocItemList { | |||
116 | } | 116 | } |
117 | } | 117 | } |
118 | 118 | ||
119 | impl ast::RecordFieldList { | 119 | impl ast::RecordExprFieldList { |
120 | #[must_use] | 120 | #[must_use] |
121 | pub fn append_field(&self, field: &ast::RecordField) -> ast::RecordFieldList { | 121 | pub fn append_field(&self, field: &ast::RecordExprField) -> ast::RecordExprFieldList { |
122 | self.insert_field(InsertPosition::Last, field) | 122 | self.insert_field(InsertPosition::Last, field) |
123 | } | 123 | } |
124 | 124 | ||
125 | #[must_use] | 125 | #[must_use] |
126 | pub fn insert_field( | 126 | pub fn insert_field( |
127 | &self, | 127 | &self, |
128 | position: InsertPosition<&'_ ast::RecordField>, | 128 | position: InsertPosition<&'_ ast::RecordExprField>, |
129 | field: &ast::RecordField, | 129 | field: &ast::RecordExprField, |
130 | ) -> ast::RecordFieldList { | 130 | ) -> ast::RecordExprFieldList { |
131 | let is_multiline = self.syntax().text().contains_char('\n'); | 131 | let is_multiline = self.syntax().text().contains_char('\n'); |
132 | let ws; | 132 | let ws; |
133 | let space = if is_multiline { | 133 | let space = if is_multiline { |
@@ -192,9 +192,9 @@ impl ast::RecordFieldList { | |||
192 | } | 192 | } |
193 | } | 193 | } |
194 | 194 | ||
195 | impl ast::TypeAliasDef { | 195 | impl ast::TypeAlias { |
196 | #[must_use] | 196 | #[must_use] |
197 | pub fn remove_bounds(&self) -> ast::TypeAliasDef { | 197 | pub fn remove_bounds(&self) -> ast::TypeAlias { |
198 | let colon = match self.colon_token() { | 198 | let colon = match self.colon_token() { |
199 | Some(it) => it, | 199 | Some(it) => it, |
200 | None => return self.clone(), | 200 | None => return self.clone(), |
diff --git a/crates/ra_syntax/src/ast/expr_ext.rs b/crates/ra_syntax/src/ast/expr_ext.rs index 69c85c809..f5ba87223 100644 --- a/crates/ra_syntax/src/ast/expr_ext.rs +++ b/crates/ra_syntax/src/ast/expr_ext.rs | |||
@@ -333,13 +333,12 @@ impl ast::Literal { | |||
333 | 333 | ||
334 | match token.kind() { | 334 | match token.kind() { |
335 | INT_NUMBER => { | 335 | INT_NUMBER => { |
336 | // FYI: there was a bug here previously, thus an if statement bellow is necessary. | 336 | // FYI: there was a bug here previously, thus the if statement below is necessary. |
337 | // The lexer treats e.g. `1f64` as an integer literal. See | 337 | // The lexer treats e.g. `1f64` as an integer literal. See |
338 | // https://github.com/rust-analyzer/rust-analyzer/issues/1592 | 338 | // https://github.com/rust-analyzer/rust-analyzer/issues/1592 |
339 | // and the comments on the linked PR. | 339 | // and the comments on the linked PR. |
340 | 340 | ||
341 | let text = token.text(); | 341 | let text = token.text(); |
342 | |||
343 | if let suffix @ Some(_) = Self::find_suffix(&text, &FLOAT_SUFFIXES) { | 342 | if let suffix @ Some(_) = Self::find_suffix(&text, &FLOAT_SUFFIXES) { |
344 | LiteralKind::FloatNumber { suffix } | 343 | LiteralKind::FloatNumber { suffix } |
345 | } else { | 344 | } else { |
@@ -401,7 +400,7 @@ impl ast::BlockExpr { | |||
401 | Some(it) => it, | 400 | Some(it) => it, |
402 | None => return true, | 401 | None => return true, |
403 | }; | 402 | }; |
404 | !matches!(parent.kind(), FN_DEF | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR) | 403 | !matches!(parent.kind(), FN | IF_EXPR | WHILE_EXPR | LOOP_EXPR | EFFECT_EXPR) |
405 | } | 404 | } |
406 | } | 405 | } |
407 | 406 | ||
@@ -412,8 +411,8 @@ fn test_literal_with_attr() { | |||
412 | assert_eq!(lit.token().text(), r#""Hello""#); | 411 | assert_eq!(lit.token().text(), r#""Hello""#); |
413 | } | 412 | } |
414 | 413 | ||
415 | impl ast::RecordField { | 414 | impl ast::RecordExprField { |
416 | pub fn parent_record_lit(&self) -> ast::RecordLit { | 415 | pub fn parent_record_lit(&self) -> ast::RecordExpr { |
417 | self.syntax().ancestors().find_map(ast::RecordLit::cast).unwrap() | 416 | self.syntax().ancestors().find_map(ast::RecordExpr::cast).unwrap() |
418 | } | 417 | } |
419 | } | 418 | } |
diff --git a/crates/ra_syntax/src/ast/generated/nodes.rs b/crates/ra_syntax/src/ast/generated/nodes.rs index be657699f..4306efe13 100644 --- a/crates/ra_syntax/src/ast/generated/nodes.rs +++ b/crates/ra_syntax/src/ast/generated/nodes.rs | |||
@@ -24,36 +24,38 @@ impl Attr { | |||
24 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 24 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
25 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 25 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
26 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 26 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
27 | pub fn input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | 27 | pub fn literal(&self) -> Option<Literal> { support::child(&self.syntax) } |
28 | pub fn token_tree(&self) -> Option<TokenTree> { support::child(&self.syntax) } | ||
28 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 29 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
29 | } | 30 | } |
30 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 31 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
31 | pub struct ConstDef { | 32 | pub struct Const { |
32 | pub(crate) syntax: SyntaxNode, | 33 | pub(crate) syntax: SyntaxNode, |
33 | } | 34 | } |
34 | impl ast::AttrsOwner for ConstDef {} | 35 | impl ast::AttrsOwner for Const {} |
35 | impl ast::NameOwner for ConstDef {} | 36 | impl ast::NameOwner for Const {} |
36 | impl ast::VisibilityOwner for ConstDef {} | 37 | impl ast::VisibilityOwner for Const {} |
37 | impl ast::TypeAscriptionOwner for ConstDef {} | 38 | impl Const { |
38 | impl ConstDef { | ||
39 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 39 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
40 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 40 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
41 | pub fn underscore_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![_]) } | ||
41 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 42 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
43 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
42 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 44 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
43 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 45 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
44 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 46 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
45 | } | 47 | } |
46 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 48 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
47 | pub struct EnumDef { | 49 | pub struct Enum { |
48 | pub(crate) syntax: SyntaxNode, | 50 | pub(crate) syntax: SyntaxNode, |
49 | } | 51 | } |
50 | impl ast::AttrsOwner for EnumDef {} | 52 | impl ast::AttrsOwner for Enum {} |
51 | impl ast::NameOwner for EnumDef {} | 53 | impl ast::NameOwner for Enum {} |
52 | impl ast::VisibilityOwner for EnumDef {} | 54 | impl ast::VisibilityOwner for Enum {} |
53 | impl ast::TypeParamsOwner for EnumDef {} | 55 | impl ast::GenericParamsOwner for Enum {} |
54 | impl EnumDef { | 56 | impl Enum { |
55 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } | 57 | pub fn enum_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![enum]) } |
56 | pub fn variant_list(&self) -> Option<EnumVariantList> { support::child(&self.syntax) } | 58 | pub fn variant_list(&self) -> Option<VariantList> { support::child(&self.syntax) } |
57 | } | 59 | } |
58 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 60 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
59 | pub struct ExternBlock { | 61 | pub struct ExternBlock { |
@@ -79,19 +81,19 @@ impl ExternCrate { | |||
79 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 81 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
80 | } | 82 | } |
81 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 83 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
82 | pub struct FnDef { | 84 | pub struct Fn { |
83 | pub(crate) syntax: SyntaxNode, | 85 | pub(crate) syntax: SyntaxNode, |
84 | } | 86 | } |
85 | impl ast::AttrsOwner for FnDef {} | 87 | impl ast::AttrsOwner for Fn {} |
86 | impl ast::NameOwner for FnDef {} | 88 | impl ast::NameOwner for Fn {} |
87 | impl ast::VisibilityOwner for FnDef {} | 89 | impl ast::VisibilityOwner for Fn {} |
88 | impl ast::TypeParamsOwner for FnDef {} | 90 | impl ast::GenericParamsOwner for Fn {} |
89 | impl FnDef { | 91 | impl Fn { |
90 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
91 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
92 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 92 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
93 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } | 93 | pub fn async_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![async]) } |
94 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
94 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 95 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
96 | pub fn abi(&self) -> Option<Abi> { support::child(&self.syntax) } | ||
95 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } | 97 | pub fn fn_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![fn]) } |
96 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } | 98 | pub fn param_list(&self) -> Option<ParamList> { support::child(&self.syntax) } |
97 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } | 99 | pub fn ret_type(&self) -> Option<RetType> { support::child(&self.syntax) } |
@@ -99,17 +101,18 @@ impl FnDef { | |||
99 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 101 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
100 | } | 102 | } |
101 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 103 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
102 | pub struct ImplDef { | 104 | pub struct Impl { |
103 | pub(crate) syntax: SyntaxNode, | 105 | pub(crate) syntax: SyntaxNode, |
104 | } | 106 | } |
105 | impl ast::AttrsOwner for ImplDef {} | 107 | impl ast::AttrsOwner for Impl {} |
106 | impl ast::VisibilityOwner for ImplDef {} | 108 | impl ast::VisibilityOwner for Impl {} |
107 | impl ast::TypeParamsOwner for ImplDef {} | 109 | impl ast::GenericParamsOwner for Impl {} |
108 | impl ImplDef { | 110 | impl Impl { |
109 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
110 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 111 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
111 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 112 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
112 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } | 113 | pub fn impl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![impl]) } |
114 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
115 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
113 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } | 116 | pub fn excl_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![!]) } |
114 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 117 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
115 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } | 118 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
@@ -139,78 +142,76 @@ impl Module { | |||
139 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 142 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
140 | } | 143 | } |
141 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 144 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
142 | pub struct StaticDef { | 145 | pub struct Static { |
143 | pub(crate) syntax: SyntaxNode, | 146 | pub(crate) syntax: SyntaxNode, |
144 | } | 147 | } |
145 | impl ast::AttrsOwner for StaticDef {} | 148 | impl ast::AttrsOwner for Static {} |
146 | impl ast::NameOwner for StaticDef {} | 149 | impl ast::NameOwner for Static {} |
147 | impl ast::VisibilityOwner for StaticDef {} | 150 | impl ast::VisibilityOwner for Static {} |
148 | impl ast::TypeAscriptionOwner for StaticDef {} | 151 | impl Static { |
149 | impl StaticDef { | ||
150 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } | 152 | pub fn static_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![static]) } |
151 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 153 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
152 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 154 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
155 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
153 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 156 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
154 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } | 157 | pub fn body(&self) -> Option<Expr> { support::child(&self.syntax) } |
155 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 158 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
156 | } | 159 | } |
157 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 160 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
158 | pub struct StructDef { | 161 | pub struct Struct { |
159 | pub(crate) syntax: SyntaxNode, | 162 | pub(crate) syntax: SyntaxNode, |
160 | } | 163 | } |
161 | impl ast::AttrsOwner for StructDef {} | 164 | impl ast::AttrsOwner for Struct {} |
162 | impl ast::NameOwner for StructDef {} | 165 | impl ast::NameOwner for Struct {} |
163 | impl ast::VisibilityOwner for StructDef {} | 166 | impl ast::VisibilityOwner for Struct {} |
164 | impl ast::TypeParamsOwner for StructDef {} | 167 | impl ast::GenericParamsOwner for Struct {} |
165 | impl StructDef { | 168 | impl Struct { |
166 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } | 169 | pub fn struct_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![struct]) } |
167 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 170 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
168 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 171 | pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } |
169 | } | 172 | } |
170 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 173 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
171 | pub struct TraitDef { | 174 | pub struct Trait { |
172 | pub(crate) syntax: SyntaxNode, | 175 | pub(crate) syntax: SyntaxNode, |
173 | } | 176 | } |
174 | impl ast::AttrsOwner for TraitDef {} | 177 | impl ast::AttrsOwner for Trait {} |
175 | impl ast::NameOwner for TraitDef {} | 178 | impl ast::NameOwner for Trait {} |
176 | impl ast::VisibilityOwner for TraitDef {} | 179 | impl ast::VisibilityOwner for Trait {} |
177 | impl ast::TypeParamsOwner for TraitDef {} | 180 | impl ast::GenericParamsOwner for Trait {} |
178 | impl ast::TypeBoundsOwner for TraitDef {} | 181 | impl ast::TypeBoundsOwner for Trait {} |
179 | impl TraitDef { | 182 | impl Trait { |
180 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } | 183 | pub fn unsafe_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![unsafe]) } |
181 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } | 184 | pub fn auto_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![auto]) } |
182 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } | 185 | pub fn trait_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![trait]) } |
183 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } | 186 | pub fn assoc_item_list(&self) -> Option<AssocItemList> { support::child(&self.syntax) } |
184 | } | 187 | } |
185 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 188 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
186 | pub struct TypeAliasDef { | 189 | pub struct TypeAlias { |
187 | pub(crate) syntax: SyntaxNode, | 190 | pub(crate) syntax: SyntaxNode, |
188 | } | 191 | } |
189 | impl ast::AttrsOwner for TypeAliasDef {} | 192 | impl ast::AttrsOwner for TypeAlias {} |
190 | impl ast::NameOwner for TypeAliasDef {} | 193 | impl ast::NameOwner for TypeAlias {} |
191 | impl ast::VisibilityOwner for TypeAliasDef {} | 194 | impl ast::VisibilityOwner for TypeAlias {} |
192 | impl ast::TypeParamsOwner for TypeAliasDef {} | 195 | impl ast::GenericParamsOwner for TypeAlias {} |
193 | impl ast::TypeBoundsOwner for TypeAliasDef {} | 196 | impl ast::TypeBoundsOwner for TypeAlias {} |
194 | impl TypeAliasDef { | 197 | impl TypeAlias { |
195 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } | 198 | pub fn default_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![default]) } |
196 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } | 199 | pub fn type_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![type]) } |
197 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 200 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
198 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 201 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
199 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 202 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
200 | } | 203 | } |
201 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 204 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
202 | pub struct UnionDef { | 205 | pub struct Union { |
203 | pub(crate) syntax: SyntaxNode, | 206 | pub(crate) syntax: SyntaxNode, |
204 | } | 207 | } |
205 | impl ast::AttrsOwner for UnionDef {} | 208 | impl ast::AttrsOwner for Union {} |
206 | impl ast::NameOwner for UnionDef {} | 209 | impl ast::NameOwner for Union {} |
207 | impl ast::VisibilityOwner for UnionDef {} | 210 | impl ast::VisibilityOwner for Union {} |
208 | impl ast::TypeParamsOwner for UnionDef {} | 211 | impl ast::GenericParamsOwner for Union {} |
209 | impl UnionDef { | 212 | impl Union { |
210 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } | 213 | pub fn union_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![union]) } |
211 | pub fn record_field_def_list(&self) -> Option<RecordFieldDefList> { | 214 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } |
212 | support::child(&self.syntax) | ||
213 | } | ||
214 | } | 215 | } |
215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 216 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
216 | pub struct Use { | 217 | pub struct Use { |
@@ -303,16 +304,16 @@ impl UseTreeList { | |||
303 | pub struct Abi { | 304 | pub struct Abi { |
304 | pub(crate) syntax: SyntaxNode, | 305 | pub(crate) syntax: SyntaxNode, |
305 | } | 306 | } |
306 | impl Abi {} | 307 | impl Abi { |
308 | pub fn extern_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![extern]) } | ||
309 | } | ||
307 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 310 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
308 | pub struct TypeParamList { | 311 | pub struct GenericParamList { |
309 | pub(crate) syntax: SyntaxNode, | 312 | pub(crate) syntax: SyntaxNode, |
310 | } | 313 | } |
311 | impl TypeParamList { | 314 | impl GenericParamList { |
312 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } | 315 | pub fn l_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![<]) } |
313 | pub fn type_params(&self) -> AstChildren<TypeParam> { support::children(&self.syntax) } | 316 | pub fn generic_params(&self) -> AstChildren<GenericParam> { support::children(&self.syntax) } |
314 | pub fn lifetime_params(&self) -> AstChildren<LifetimeParam> { support::children(&self.syntax) } | ||
315 | pub fn const_params(&self) -> AstChildren<ConstParam> { support::children(&self.syntax) } | ||
316 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } | 317 | pub fn r_angle_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![>]) } |
317 | } | 318 | } |
318 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 319 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -322,6 +323,7 @@ pub struct ParamList { | |||
322 | impl ParamList { | 323 | impl ParamList { |
323 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 324 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
324 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } | 325 | pub fn self_param(&self) -> Option<SelfParam> { support::child(&self.syntax) } |
326 | pub fn comma_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![,]) } | ||
325 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } | 327 | pub fn params(&self) -> AstChildren<Param> { support::children(&self.syntax) } |
326 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 328 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
327 | } | 329 | } |
@@ -331,7 +333,7 @@ pub struct RetType { | |||
331 | } | 333 | } |
332 | impl RetType { | 334 | impl RetType { |
333 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } | 335 | pub fn thin_arrow_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![->]) } |
334 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 336 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
335 | } | 337 | } |
336 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 338 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
337 | pub struct WhereClause { | 339 | pub struct WhereClause { |
@@ -355,80 +357,167 @@ impl BlockExpr { | |||
355 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 357 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
356 | } | 358 | } |
357 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 359 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
358 | pub struct RecordFieldDefList { | 360 | pub struct SelfParam { |
361 | pub(crate) syntax: SyntaxNode, | ||
362 | } | ||
363 | impl ast::AttrsOwner for SelfParam {} | ||
364 | impl SelfParam { | ||
365 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
366 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
367 | support::token(&self.syntax, T![lifetime]) | ||
368 | } | ||
369 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
370 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
371 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
372 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
373 | } | ||
374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
375 | pub struct Param { | ||
376 | pub(crate) syntax: SyntaxNode, | ||
377 | } | ||
378 | impl ast::AttrsOwner for Param {} | ||
379 | impl Param { | ||
380 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
381 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
382 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
383 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | ||
384 | } | ||
385 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
386 | pub struct TypeBoundList { | ||
387 | pub(crate) syntax: SyntaxNode, | ||
388 | } | ||
389 | impl TypeBoundList { | ||
390 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | ||
391 | } | ||
392 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
393 | pub struct RecordFieldList { | ||
359 | pub(crate) syntax: SyntaxNode, | 394 | pub(crate) syntax: SyntaxNode, |
360 | } | 395 | } |
361 | impl RecordFieldDefList { | 396 | impl RecordFieldList { |
362 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 397 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
363 | pub fn fields(&self) -> AstChildren<RecordFieldDef> { support::children(&self.syntax) } | 398 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } |
364 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 399 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
365 | } | 400 | } |
366 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 401 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
367 | pub struct TupleFieldDefList { | 402 | pub struct TupleFieldList { |
368 | pub(crate) syntax: SyntaxNode, | 403 | pub(crate) syntax: SyntaxNode, |
369 | } | 404 | } |
370 | impl TupleFieldDefList { | 405 | impl TupleFieldList { |
371 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 406 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
372 | pub fn fields(&self) -> AstChildren<TupleFieldDef> { support::children(&self.syntax) } | 407 | pub fn fields(&self) -> AstChildren<TupleField> { support::children(&self.syntax) } |
373 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 408 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
374 | } | 409 | } |
375 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 410 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
376 | pub struct RecordFieldDef { | 411 | pub struct RecordField { |
377 | pub(crate) syntax: SyntaxNode, | 412 | pub(crate) syntax: SyntaxNode, |
378 | } | 413 | } |
379 | impl ast::AttrsOwner for RecordFieldDef {} | 414 | impl ast::AttrsOwner for RecordField {} |
380 | impl ast::NameOwner for RecordFieldDef {} | 415 | impl ast::NameOwner for RecordField {} |
381 | impl ast::VisibilityOwner for RecordFieldDef {} | 416 | impl ast::VisibilityOwner for RecordField {} |
382 | impl ast::TypeAscriptionOwner for RecordFieldDef {} | 417 | impl RecordField { |
383 | impl RecordFieldDef { | ||
384 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 418 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
419 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
385 | } | 420 | } |
386 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 421 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
387 | pub struct TupleFieldDef { | 422 | pub struct TupleField { |
388 | pub(crate) syntax: SyntaxNode, | 423 | pub(crate) syntax: SyntaxNode, |
389 | } | 424 | } |
390 | impl ast::AttrsOwner for TupleFieldDef {} | 425 | impl ast::AttrsOwner for TupleField {} |
391 | impl ast::NameOwner for TupleFieldDef {} | 426 | impl ast::VisibilityOwner for TupleField {} |
392 | impl ast::VisibilityOwner for TupleFieldDef {} | 427 | impl TupleField { |
393 | impl TupleFieldDef { | 428 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
394 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
395 | } | 429 | } |
396 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 430 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
397 | pub struct EnumVariantList { | 431 | pub struct VariantList { |
398 | pub(crate) syntax: SyntaxNode, | 432 | pub(crate) syntax: SyntaxNode, |
399 | } | 433 | } |
400 | impl EnumVariantList { | 434 | impl VariantList { |
401 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 435 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
402 | pub fn variants(&self) -> AstChildren<EnumVariant> { support::children(&self.syntax) } | 436 | pub fn variants(&self) -> AstChildren<Variant> { support::children(&self.syntax) } |
403 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 437 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
404 | } | 438 | } |
405 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 439 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
406 | pub struct EnumVariant { | 440 | pub struct Variant { |
407 | pub(crate) syntax: SyntaxNode, | 441 | pub(crate) syntax: SyntaxNode, |
408 | } | 442 | } |
409 | impl ast::AttrsOwner for EnumVariant {} | 443 | impl ast::AttrsOwner for Variant {} |
410 | impl ast::NameOwner for EnumVariant {} | 444 | impl ast::NameOwner for Variant {} |
411 | impl ast::VisibilityOwner for EnumVariant {} | 445 | impl ast::VisibilityOwner for Variant {} |
412 | impl EnumVariant { | 446 | impl Variant { |
413 | pub fn field_def_list(&self) -> Option<FieldDefList> { support::child(&self.syntax) } | 447 | pub fn field_list(&self) -> Option<FieldList> { support::child(&self.syntax) } |
414 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 448 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
415 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 449 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
416 | } | 450 | } |
417 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 451 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
418 | pub struct TypeBoundList { | 452 | pub struct AssocItemList { |
419 | pub(crate) syntax: SyntaxNode, | 453 | pub(crate) syntax: SyntaxNode, |
420 | } | 454 | } |
421 | impl TypeBoundList { | 455 | impl ast::AttrsOwner for AssocItemList {} |
422 | pub fn bounds(&self) -> AstChildren<TypeBound> { support::children(&self.syntax) } | 456 | impl AssocItemList { |
457 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
458 | pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } | ||
459 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
423 | } | 460 | } |
424 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 461 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
425 | pub struct AssocItemList { | 462 | pub struct ExternItemList { |
426 | pub(crate) syntax: SyntaxNode, | 463 | pub(crate) syntax: SyntaxNode, |
427 | } | 464 | } |
428 | impl AssocItemList { | 465 | impl ast::AttrsOwner for ExternItemList {} |
466 | impl ExternItemList { | ||
467 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
468 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } | ||
469 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
470 | } | ||
471 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
472 | pub struct LifetimeParam { | ||
473 | pub(crate) syntax: SyntaxNode, | ||
474 | } | ||
475 | impl ast::AttrsOwner for LifetimeParam {} | ||
476 | impl LifetimeParam { | ||
477 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
478 | support::token(&self.syntax, T![lifetime]) | ||
479 | } | ||
480 | } | ||
481 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
482 | pub struct TypeParam { | ||
483 | pub(crate) syntax: SyntaxNode, | ||
484 | } | ||
485 | impl ast::AttrsOwner for TypeParam {} | ||
486 | impl ast::NameOwner for TypeParam {} | ||
487 | impl ast::TypeBoundsOwner for TypeParam {} | ||
488 | impl TypeParam { | ||
489 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
490 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
491 | } | ||
492 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
493 | pub struct ConstParam { | ||
494 | pub(crate) syntax: SyntaxNode, | ||
495 | } | ||
496 | impl ast::AttrsOwner for ConstParam {} | ||
497 | impl ast::NameOwner for ConstParam {} | ||
498 | impl ConstParam { | ||
499 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
500 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
501 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
502 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
503 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
504 | } | ||
505 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
506 | pub struct Literal { | ||
507 | pub(crate) syntax: SyntaxNode, | ||
508 | } | ||
509 | impl Literal {} | ||
510 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
511 | pub struct TokenTree { | ||
512 | pub(crate) syntax: SyntaxNode, | ||
513 | } | ||
514 | impl TokenTree { | ||
515 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
516 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
429 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 517 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
430 | pub fn assoc_items(&self) -> AstChildren<AssocItem> { support::children(&self.syntax) } | ||
431 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 518 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
519 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
520 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
432 | } | 521 | } |
433 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 522 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
434 | pub struct ParenType { | 523 | pub struct ParenType { |
@@ -436,7 +525,7 @@ pub struct ParenType { | |||
436 | } | 525 | } |
437 | impl ParenType { | 526 | impl ParenType { |
438 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | 527 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } |
439 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 528 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
440 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 529 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
441 | } | 530 | } |
442 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 531 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -470,7 +559,7 @@ impl PointerType { | |||
470 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } | 559 | pub fn star_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![*]) } |
471 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | 560 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } |
472 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 561 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
473 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 562 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
474 | } | 563 | } |
475 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 564 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
476 | pub struct ArrayType { | 565 | pub struct ArrayType { |
@@ -478,7 +567,7 @@ pub struct ArrayType { | |||
478 | } | 567 | } |
479 | impl ArrayType { | 568 | impl ArrayType { |
480 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 569 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
481 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 570 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
482 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 571 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
483 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 572 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
484 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 573 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
@@ -489,7 +578,7 @@ pub struct SliceType { | |||
489 | } | 578 | } |
490 | impl SliceType { | 579 | impl SliceType { |
491 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | 580 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } |
492 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 581 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
493 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | 582 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } |
494 | } | 583 | } |
495 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 584 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
@@ -502,7 +591,7 @@ impl ReferenceType { | |||
502 | support::token(&self.syntax, T![lifetime]) | 591 | support::token(&self.syntax, T![lifetime]) |
503 | } | 592 | } |
504 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | 593 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } |
505 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 594 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
506 | } | 595 | } |
507 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 596 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
508 | pub struct PlaceholderType { | 597 | pub struct PlaceholderType { |
@@ -528,8 +617,8 @@ pub struct ForType { | |||
528 | } | 617 | } |
529 | impl ForType { | 618 | impl ForType { |
530 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 619 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
531 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | 620 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } |
532 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 621 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
533 | } | 622 | } |
534 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 623 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
535 | pub struct ImplTraitType { | 624 | pub struct ImplTraitType { |
@@ -793,7 +882,7 @@ impl ast::AttrsOwner for CastExpr {} | |||
793 | impl CastExpr { | 882 | impl CastExpr { |
794 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 883 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
795 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } | 884 | pub fn as_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![as]) } |
796 | pub fn type_ref(&self) -> Option<TypeRef> { support::child(&self.syntax) } | 885 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } |
797 | } | 886 | } |
798 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 887 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
799 | pub struct RefExpr { | 888 | pub struct RefExpr { |
@@ -837,11 +926,6 @@ pub struct BinExpr { | |||
837 | impl ast::AttrsOwner for BinExpr {} | 926 | impl ast::AttrsOwner for BinExpr {} |
838 | impl BinExpr {} | 927 | impl BinExpr {} |
839 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 928 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
840 | pub struct Literal { | ||
841 | pub(crate) syntax: SyntaxNode, | ||
842 | } | ||
843 | impl Literal {} | ||
844 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
845 | pub struct MatchExpr { | 929 | pub struct MatchExpr { |
846 | pub(crate) syntax: SyntaxNode, | 930 | pub(crate) syntax: SyntaxNode, |
847 | } | 931 | } |
@@ -880,30 +964,32 @@ impl MatchGuard { | |||
880 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 964 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
881 | } | 965 | } |
882 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 966 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
883 | pub struct RecordLit { | 967 | pub struct RecordExpr { |
884 | pub(crate) syntax: SyntaxNode, | 968 | pub(crate) syntax: SyntaxNode, |
885 | } | 969 | } |
886 | impl RecordLit { | 970 | impl RecordExpr { |
887 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | 971 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } |
888 | pub fn record_field_list(&self) -> Option<RecordFieldList> { support::child(&self.syntax) } | 972 | pub fn record_expr_field_list(&self) -> Option<RecordExprFieldList> { |
973 | support::child(&self.syntax) | ||
974 | } | ||
889 | } | 975 | } |
890 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 976 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
891 | pub struct RecordFieldList { | 977 | pub struct RecordExprFieldList { |
892 | pub(crate) syntax: SyntaxNode, | 978 | pub(crate) syntax: SyntaxNode, |
893 | } | 979 | } |
894 | impl RecordFieldList { | 980 | impl RecordExprFieldList { |
895 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | 981 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } |
896 | pub fn fields(&self) -> AstChildren<RecordField> { support::children(&self.syntax) } | 982 | pub fn fields(&self) -> AstChildren<RecordExprField> { support::children(&self.syntax) } |
897 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } | 983 | pub fn dotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![..]) } |
898 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } | 984 | pub fn spread(&self) -> Option<Expr> { support::child(&self.syntax) } |
899 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | 985 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } |
900 | } | 986 | } |
901 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 987 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
902 | pub struct RecordField { | 988 | pub struct RecordExprField { |
903 | pub(crate) syntax: SyntaxNode, | 989 | pub(crate) syntax: SyntaxNode, |
904 | } | 990 | } |
905 | impl ast::AttrsOwner for RecordField {} | 991 | impl ast::AttrsOwner for RecordExprField {} |
906 | impl RecordField { | 992 | impl RecordExprField { |
907 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } | 993 | pub fn name_ref(&self) -> Option<NameRef> { support::child(&self.syntax) } |
908 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 994 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
909 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 995 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
@@ -1058,18 +1144,6 @@ impl TuplePat { | |||
1058 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | 1144 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } |
1059 | } | 1145 | } |
1060 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1146 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1061 | pub struct TokenTree { | ||
1062 | pub(crate) syntax: SyntaxNode, | ||
1063 | } | ||
1064 | impl TokenTree { | ||
1065 | pub fn l_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['(']) } | ||
1066 | pub fn r_paren_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![')']) } | ||
1067 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1068 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1069 | pub fn l_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['[']) } | ||
1070 | pub fn r_brack_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![']']) } | ||
1071 | } | ||
1072 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1073 | pub struct MacroDef { | 1147 | pub struct MacroDef { |
1074 | pub(crate) syntax: SyntaxNode, | 1148 | pub(crate) syntax: SyntaxNode, |
1075 | } | 1149 | } |
@@ -1092,40 +1166,6 @@ impl MacroStmts { | |||
1092 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } | 1166 | pub fn expr(&self) -> Option<Expr> { support::child(&self.syntax) } |
1093 | } | 1167 | } |
1094 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1168 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1095 | pub struct TypeParam { | ||
1096 | pub(crate) syntax: SyntaxNode, | ||
1097 | } | ||
1098 | impl ast::AttrsOwner for TypeParam {} | ||
1099 | impl ast::NameOwner for TypeParam {} | ||
1100 | impl ast::TypeBoundsOwner for TypeParam {} | ||
1101 | impl TypeParam { | ||
1102 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1103 | pub fn default_type(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1104 | } | ||
1105 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1106 | pub struct LifetimeParam { | ||
1107 | pub(crate) syntax: SyntaxNode, | ||
1108 | } | ||
1109 | impl ast::AttrsOwner for LifetimeParam {} | ||
1110 | impl LifetimeParam { | ||
1111 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1112 | support::token(&self.syntax, T![lifetime]) | ||
1113 | } | ||
1114 | } | ||
1115 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1116 | pub struct ConstParam { | ||
1117 | pub(crate) syntax: SyntaxNode, | ||
1118 | } | ||
1119 | impl ast::AttrsOwner for ConstParam {} | ||
1120 | impl ast::NameOwner for ConstParam {} | ||
1121 | impl ast::TypeAscriptionOwner for ConstParam {} | ||
1122 | impl ConstParam { | ||
1123 | pub fn const_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![const]) } | ||
1124 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1125 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1126 | pub fn default_val(&self) -> Option<Expr> { support::child(&self.syntax) } | ||
1127 | } | ||
1128 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1129 | pub struct TypeBound { | 1169 | pub struct TypeBound { |
1130 | pub(crate) syntax: SyntaxNode, | 1170 | pub(crate) syntax: SyntaxNode, |
1131 | } | 1171 | } |
@@ -1143,7 +1183,7 @@ pub struct WherePred { | |||
1143 | impl ast::TypeBoundsOwner for WherePred {} | 1183 | impl ast::TypeBoundsOwner for WherePred {} |
1144 | impl WherePred { | 1184 | impl WherePred { |
1145 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } | 1185 | pub fn for_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![for]) } |
1146 | pub fn type_param_list(&self) -> Option<TypeParamList> { support::child(&self.syntax) } | 1186 | pub fn generic_param_list(&self) -> Option<GenericParamList> { support::child(&self.syntax) } |
1147 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | 1187 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { |
1148 | support::token(&self.syntax, T![lifetime]) | 1188 | support::token(&self.syntax, T![lifetime]) |
1149 | } | 1189 | } |
@@ -1163,42 +1203,16 @@ pub struct LetStmt { | |||
1163 | pub(crate) syntax: SyntaxNode, | 1203 | pub(crate) syntax: SyntaxNode, |
1164 | } | 1204 | } |
1165 | impl ast::AttrsOwner for LetStmt {} | 1205 | impl ast::AttrsOwner for LetStmt {} |
1166 | impl ast::TypeAscriptionOwner for LetStmt {} | ||
1167 | impl LetStmt { | 1206 | impl LetStmt { |
1168 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } | 1207 | pub fn let_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![let]) } |
1169 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | 1208 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } |
1170 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | 1209 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } |
1210 | pub fn ty(&self) -> Option<TypeRef> { support::child(&self.syntax) } | ||
1171 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | 1211 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } |
1172 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } | 1212 | pub fn initializer(&self) -> Option<Expr> { support::child(&self.syntax) } |
1173 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } | 1213 | pub fn semicolon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![;]) } |
1174 | } | 1214 | } |
1175 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1215 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1176 | pub struct SelfParam { | ||
1177 | pub(crate) syntax: SyntaxNode, | ||
1178 | } | ||
1179 | impl ast::AttrsOwner for SelfParam {} | ||
1180 | impl ast::TypeAscriptionOwner for SelfParam {} | ||
1181 | impl SelfParam { | ||
1182 | pub fn amp_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![&]) } | ||
1183 | pub fn lifetime_token(&self) -> Option<SyntaxToken> { | ||
1184 | support::token(&self.syntax, T![lifetime]) | ||
1185 | } | ||
1186 | pub fn mut_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![mut]) } | ||
1187 | pub fn self_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![self]) } | ||
1188 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1189 | } | ||
1190 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1191 | pub struct Param { | ||
1192 | pub(crate) syntax: SyntaxNode, | ||
1193 | } | ||
1194 | impl ast::AttrsOwner for Param {} | ||
1195 | impl ast::TypeAscriptionOwner for Param {} | ||
1196 | impl Param { | ||
1197 | pub fn pat(&self) -> Option<Pat> { support::child(&self.syntax) } | ||
1198 | pub fn colon_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![:]) } | ||
1199 | pub fn dotdotdot_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![...]) } | ||
1200 | } | ||
1201 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1202 | pub struct PathSegment { | 1216 | pub struct PathSegment { |
1203 | pub(crate) syntax: SyntaxNode, | 1217 | pub(crate) syntax: SyntaxNode, |
1204 | } | 1218 | } |
@@ -1250,39 +1264,20 @@ impl ConstArg { | |||
1250 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } | 1264 | pub fn block_expr(&self) -> Option<BlockExpr> { support::child(&self.syntax) } |
1251 | } | 1265 | } |
1252 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1266 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1253 | pub struct ExternItemList { | ||
1254 | pub(crate) syntax: SyntaxNode, | ||
1255 | } | ||
1256 | impl ExternItemList { | ||
1257 | pub fn l_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['{']) } | ||
1258 | pub fn extern_items(&self) -> AstChildren<ExternItem> { support::children(&self.syntax) } | ||
1259 | pub fn r_curly_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T!['}']) } | ||
1260 | } | ||
1261 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1262 | pub struct MetaItem { | ||
1263 | pub(crate) syntax: SyntaxNode, | ||
1264 | } | ||
1265 | impl MetaItem { | ||
1266 | pub fn path(&self) -> Option<Path> { support::child(&self.syntax) } | ||
1267 | pub fn eq_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![=]) } | ||
1268 | pub fn attr_input(&self) -> Option<AttrInput> { support::child(&self.syntax) } | ||
1269 | pub fn nested_meta_items(&self) -> AstChildren<MetaItem> { support::children(&self.syntax) } | ||
1270 | } | ||
1271 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1272 | pub enum Item { | 1267 | pub enum Item { |
1273 | ConstDef(ConstDef), | 1268 | Const(Const), |
1274 | EnumDef(EnumDef), | 1269 | Enum(Enum), |
1275 | ExternBlock(ExternBlock), | 1270 | ExternBlock(ExternBlock), |
1276 | ExternCrate(ExternCrate), | 1271 | ExternCrate(ExternCrate), |
1277 | FnDef(FnDef), | 1272 | Fn(Fn), |
1278 | ImplDef(ImplDef), | 1273 | Impl(Impl), |
1279 | MacroCall(MacroCall), | 1274 | MacroCall(MacroCall), |
1280 | Module(Module), | 1275 | Module(Module), |
1281 | StaticDef(StaticDef), | 1276 | Static(Static), |
1282 | StructDef(StructDef), | 1277 | Struct(Struct), |
1283 | TraitDef(TraitDef), | 1278 | Trait(Trait), |
1284 | TypeAliasDef(TypeAliasDef), | 1279 | TypeAlias(TypeAlias), |
1285 | UnionDef(UnionDef), | 1280 | Union(Union), |
1286 | Use(Use), | 1281 | Use(Use), |
1287 | } | 1282 | } |
1288 | impl ast::AttrsOwner for Item {} | 1283 | impl ast::AttrsOwner for Item {} |
@@ -1303,9 +1298,27 @@ pub enum TypeRef { | |||
1303 | DynTraitType(DynTraitType), | 1298 | DynTraitType(DynTraitType), |
1304 | } | 1299 | } |
1305 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1300 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1306 | pub enum FieldDefList { | 1301 | pub enum Pat { |
1307 | RecordFieldDefList(RecordFieldDefList), | 1302 | OrPat(OrPat), |
1308 | TupleFieldDefList(TupleFieldDefList), | 1303 | ParenPat(ParenPat), |
1304 | RefPat(RefPat), | ||
1305 | BoxPat(BoxPat), | ||
1306 | BindPat(BindPat), | ||
1307 | PlaceholderPat(PlaceholderPat), | ||
1308 | DotDotPat(DotDotPat), | ||
1309 | PathPat(PathPat), | ||
1310 | RecordPat(RecordPat), | ||
1311 | TupleStructPat(TupleStructPat), | ||
1312 | TuplePat(TuplePat), | ||
1313 | SlicePat(SlicePat), | ||
1314 | RangePat(RangePat), | ||
1315 | LiteralPat(LiteralPat), | ||
1316 | MacroPat(MacroPat), | ||
1317 | } | ||
1318 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1319 | pub enum FieldList { | ||
1320 | RecordFieldList(RecordFieldList), | ||
1321 | TupleFieldList(TupleFieldList), | ||
1309 | } | 1322 | } |
1310 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1323 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1311 | pub enum Expr { | 1324 | pub enum Expr { |
@@ -1324,7 +1337,7 @@ pub enum Expr { | |||
1324 | BlockExpr(BlockExpr), | 1337 | BlockExpr(BlockExpr), |
1325 | ReturnExpr(ReturnExpr), | 1338 | ReturnExpr(ReturnExpr), |
1326 | MatchExpr(MatchExpr), | 1339 | MatchExpr(MatchExpr), |
1327 | RecordLit(RecordLit), | 1340 | RecordExpr(RecordExpr), |
1328 | CallExpr(CallExpr), | 1341 | CallExpr(CallExpr), |
1329 | IndexExpr(IndexExpr), | 1342 | IndexExpr(IndexExpr), |
1330 | MethodCallExpr(MethodCallExpr), | 1343 | MethodCallExpr(MethodCallExpr), |
@@ -1343,31 +1356,28 @@ pub enum Expr { | |||
1343 | } | 1356 | } |
1344 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1357 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1345 | pub enum AssocItem { | 1358 | pub enum AssocItem { |
1346 | FnDef(FnDef), | 1359 | Fn(Fn), |
1347 | TypeAliasDef(TypeAliasDef), | 1360 | TypeAlias(TypeAlias), |
1348 | ConstDef(ConstDef), | 1361 | Const(Const), |
1349 | MacroCall(MacroCall), | 1362 | MacroCall(MacroCall), |
1350 | } | 1363 | } |
1351 | impl ast::AttrsOwner for AssocItem {} | 1364 | impl ast::AttrsOwner for AssocItem {} |
1352 | impl ast::NameOwner for AssocItem {} | 1365 | impl ast::NameOwner for AssocItem {} |
1353 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1366 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1354 | pub enum Pat { | 1367 | pub enum ExternItem { |
1355 | OrPat(OrPat), | 1368 | Fn(Fn), |
1356 | ParenPat(ParenPat), | 1369 | Static(Static), |
1357 | RefPat(RefPat), | 1370 | MacroCall(MacroCall), |
1358 | BoxPat(BoxPat), | 1371 | } |
1359 | BindPat(BindPat), | 1372 | impl ast::AttrsOwner for ExternItem {} |
1360 | PlaceholderPat(PlaceholderPat), | 1373 | impl ast::NameOwner for ExternItem {} |
1361 | DotDotPat(DotDotPat), | 1374 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1362 | PathPat(PathPat), | 1375 | pub enum GenericParam { |
1363 | RecordPat(RecordPat), | 1376 | LifetimeParam(LifetimeParam), |
1364 | TupleStructPat(TupleStructPat), | 1377 | TypeParam(TypeParam), |
1365 | TuplePat(TuplePat), | 1378 | ConstParam(ConstParam), |
1366 | SlicePat(SlicePat), | ||
1367 | RangePat(RangePat), | ||
1368 | LiteralPat(LiteralPat), | ||
1369 | MacroPat(MacroPat), | ||
1370 | } | 1379 | } |
1380 | impl ast::AttrsOwner for GenericParam {} | ||
1371 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1381 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1372 | pub enum Stmt { | 1382 | pub enum Stmt { |
1373 | LetStmt(LetStmt), | 1383 | LetStmt(LetStmt), |
@@ -1375,27 +1385,14 @@ pub enum Stmt { | |||
1375 | } | 1385 | } |
1376 | impl ast::AttrsOwner for Stmt {} | 1386 | impl ast::AttrsOwner for Stmt {} |
1377 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | 1387 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] |
1378 | pub enum AttrInput { | ||
1379 | Literal(Literal), | ||
1380 | TokenTree(TokenTree), | ||
1381 | } | ||
1382 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1383 | pub enum ExternItem { | ||
1384 | FnDef(FnDef), | ||
1385 | StaticDef(StaticDef), | ||
1386 | } | ||
1387 | impl ast::AttrsOwner for ExternItem {} | ||
1388 | impl ast::NameOwner for ExternItem {} | ||
1389 | impl ast::VisibilityOwner for ExternItem {} | ||
1390 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
1391 | pub enum AdtDef { | 1388 | pub enum AdtDef { |
1392 | StructDef(StructDef), | 1389 | Struct(Struct), |
1393 | EnumDef(EnumDef), | 1390 | Enum(Enum), |
1394 | UnionDef(UnionDef), | 1391 | Union(Union), |
1395 | } | 1392 | } |
1396 | impl ast::AttrsOwner for AdtDef {} | 1393 | impl ast::AttrsOwner for AdtDef {} |
1394 | impl ast::GenericParamsOwner for AdtDef {} | ||
1397 | impl ast::NameOwner for AdtDef {} | 1395 | impl ast::NameOwner for AdtDef {} |
1398 | impl ast::TypeParamsOwner for AdtDef {} | ||
1399 | impl ast::VisibilityOwner for AdtDef {} | 1396 | impl ast::VisibilityOwner for AdtDef {} |
1400 | impl AstNode for SourceFile { | 1397 | impl AstNode for SourceFile { |
1401 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } | 1398 | fn can_cast(kind: SyntaxKind) -> bool { kind == SOURCE_FILE } |
@@ -1419,8 +1416,8 @@ impl AstNode for Attr { | |||
1419 | } | 1416 | } |
1420 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1417 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1421 | } | 1418 | } |
1422 | impl AstNode for ConstDef { | 1419 | impl AstNode for Const { |
1423 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_DEF } | 1420 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST } |
1424 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1421 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1425 | if Self::can_cast(syntax.kind()) { | 1422 | if Self::can_cast(syntax.kind()) { |
1426 | Some(Self { syntax }) | 1423 | Some(Self { syntax }) |
@@ -1430,8 +1427,8 @@ impl AstNode for ConstDef { | |||
1430 | } | 1427 | } |
1431 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1428 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1432 | } | 1429 | } |
1433 | impl AstNode for EnumDef { | 1430 | impl AstNode for Enum { |
1434 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_DEF } | 1431 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM } |
1435 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1432 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1436 | if Self::can_cast(syntax.kind()) { | 1433 | if Self::can_cast(syntax.kind()) { |
1437 | Some(Self { syntax }) | 1434 | Some(Self { syntax }) |
@@ -1463,8 +1460,8 @@ impl AstNode for ExternCrate { | |||
1463 | } | 1460 | } |
1464 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1461 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1465 | } | 1462 | } |
1466 | impl AstNode for FnDef { | 1463 | impl AstNode for Fn { |
1467 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN_DEF } | 1464 | fn can_cast(kind: SyntaxKind) -> bool { kind == FN } |
1468 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1465 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1469 | if Self::can_cast(syntax.kind()) { | 1466 | if Self::can_cast(syntax.kind()) { |
1470 | Some(Self { syntax }) | 1467 | Some(Self { syntax }) |
@@ -1474,8 +1471,8 @@ impl AstNode for FnDef { | |||
1474 | } | 1471 | } |
1475 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1472 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1476 | } | 1473 | } |
1477 | impl AstNode for ImplDef { | 1474 | impl AstNode for Impl { |
1478 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL_DEF } | 1475 | fn can_cast(kind: SyntaxKind) -> bool { kind == IMPL } |
1479 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1476 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1480 | if Self::can_cast(syntax.kind()) { | 1477 | if Self::can_cast(syntax.kind()) { |
1481 | Some(Self { syntax }) | 1478 | Some(Self { syntax }) |
@@ -1507,8 +1504,8 @@ impl AstNode for Module { | |||
1507 | } | 1504 | } |
1508 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1505 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1509 | } | 1506 | } |
1510 | impl AstNode for StaticDef { | 1507 | impl AstNode for Static { |
1511 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC_DEF } | 1508 | fn can_cast(kind: SyntaxKind) -> bool { kind == STATIC } |
1512 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1509 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1513 | if Self::can_cast(syntax.kind()) { | 1510 | if Self::can_cast(syntax.kind()) { |
1514 | Some(Self { syntax }) | 1511 | Some(Self { syntax }) |
@@ -1518,8 +1515,8 @@ impl AstNode for StaticDef { | |||
1518 | } | 1515 | } |
1519 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1516 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1520 | } | 1517 | } |
1521 | impl AstNode for StructDef { | 1518 | impl AstNode for Struct { |
1522 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT_DEF } | 1519 | fn can_cast(kind: SyntaxKind) -> bool { kind == STRUCT } |
1523 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1520 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1524 | if Self::can_cast(syntax.kind()) { | 1521 | if Self::can_cast(syntax.kind()) { |
1525 | Some(Self { syntax }) | 1522 | Some(Self { syntax }) |
@@ -1529,8 +1526,8 @@ impl AstNode for StructDef { | |||
1529 | } | 1526 | } |
1530 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1527 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1531 | } | 1528 | } |
1532 | impl AstNode for TraitDef { | 1529 | impl AstNode for Trait { |
1533 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT_DEF } | 1530 | fn can_cast(kind: SyntaxKind) -> bool { kind == TRAIT } |
1534 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1531 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1535 | if Self::can_cast(syntax.kind()) { | 1532 | if Self::can_cast(syntax.kind()) { |
1536 | Some(Self { syntax }) | 1533 | Some(Self { syntax }) |
@@ -1540,8 +1537,8 @@ impl AstNode for TraitDef { | |||
1540 | } | 1537 | } |
1541 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1538 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1542 | } | 1539 | } |
1543 | impl AstNode for TypeAliasDef { | 1540 | impl AstNode for TypeAlias { |
1544 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS_DEF } | 1541 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_ALIAS } |
1545 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1542 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1546 | if Self::can_cast(syntax.kind()) { | 1543 | if Self::can_cast(syntax.kind()) { |
1547 | Some(Self { syntax }) | 1544 | Some(Self { syntax }) |
@@ -1551,8 +1548,8 @@ impl AstNode for TypeAliasDef { | |||
1551 | } | 1548 | } |
1552 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1549 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1553 | } | 1550 | } |
1554 | impl AstNode for UnionDef { | 1551 | impl AstNode for Union { |
1555 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION_DEF } | 1552 | fn can_cast(kind: SyntaxKind) -> bool { kind == UNION } |
1556 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1553 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1557 | if Self::can_cast(syntax.kind()) { | 1554 | if Self::can_cast(syntax.kind()) { |
1558 | Some(Self { syntax }) | 1555 | Some(Self { syntax }) |
@@ -1672,8 +1669,8 @@ impl AstNode for Abi { | |||
1672 | } | 1669 | } |
1673 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1670 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1674 | } | 1671 | } |
1675 | impl AstNode for TypeParamList { | 1672 | impl AstNode for GenericParamList { |
1676 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM_LIST } | 1673 | fn can_cast(kind: SyntaxKind) -> bool { kind == GENERIC_PARAM_LIST } |
1677 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1674 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1678 | if Self::can_cast(syntax.kind()) { | 1675 | if Self::can_cast(syntax.kind()) { |
1679 | Some(Self { syntax }) | 1676 | Some(Self { syntax }) |
@@ -1727,8 +1724,19 @@ impl AstNode for BlockExpr { | |||
1727 | } | 1724 | } |
1728 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1725 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1729 | } | 1726 | } |
1730 | impl AstNode for RecordFieldDefList { | 1727 | impl AstNode for SelfParam { |
1731 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF_LIST } | 1728 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } |
1729 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1730 | if Self::can_cast(syntax.kind()) { | ||
1731 | Some(Self { syntax }) | ||
1732 | } else { | ||
1733 | None | ||
1734 | } | ||
1735 | } | ||
1736 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1737 | } | ||
1738 | impl AstNode for Param { | ||
1739 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } | ||
1732 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1740 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1733 | if Self::can_cast(syntax.kind()) { | 1741 | if Self::can_cast(syntax.kind()) { |
1734 | Some(Self { syntax }) | 1742 | Some(Self { syntax }) |
@@ -1738,8 +1746,8 @@ impl AstNode for RecordFieldDefList { | |||
1738 | } | 1746 | } |
1739 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1747 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1740 | } | 1748 | } |
1741 | impl AstNode for TupleFieldDefList { | 1749 | impl AstNode for TypeBoundList { |
1742 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF_LIST } | 1750 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } |
1743 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1751 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1744 | if Self::can_cast(syntax.kind()) { | 1752 | if Self::can_cast(syntax.kind()) { |
1745 | Some(Self { syntax }) | 1753 | Some(Self { syntax }) |
@@ -1749,8 +1757,8 @@ impl AstNode for TupleFieldDefList { | |||
1749 | } | 1757 | } |
1750 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1758 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1751 | } | 1759 | } |
1752 | impl AstNode for RecordFieldDef { | 1760 | impl AstNode for RecordFieldList { |
1753 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_DEF } | 1761 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } |
1754 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1762 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1755 | if Self::can_cast(syntax.kind()) { | 1763 | if Self::can_cast(syntax.kind()) { |
1756 | Some(Self { syntax }) | 1764 | Some(Self { syntax }) |
@@ -1760,8 +1768,8 @@ impl AstNode for RecordFieldDef { | |||
1760 | } | 1768 | } |
1761 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1769 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1762 | } | 1770 | } |
1763 | impl AstNode for TupleFieldDef { | 1771 | impl AstNode for TupleFieldList { |
1764 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_DEF } | 1772 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD_LIST } |
1765 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1773 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1766 | if Self::can_cast(syntax.kind()) { | 1774 | if Self::can_cast(syntax.kind()) { |
1767 | Some(Self { syntax }) | 1775 | Some(Self { syntax }) |
@@ -1771,8 +1779,8 @@ impl AstNode for TupleFieldDef { | |||
1771 | } | 1779 | } |
1772 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1780 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1773 | } | 1781 | } |
1774 | impl AstNode for EnumVariantList { | 1782 | impl AstNode for RecordField { |
1775 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT_LIST } | 1783 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } |
1776 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1784 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1777 | if Self::can_cast(syntax.kind()) { | 1785 | if Self::can_cast(syntax.kind()) { |
1778 | Some(Self { syntax }) | 1786 | Some(Self { syntax }) |
@@ -1782,8 +1790,8 @@ impl AstNode for EnumVariantList { | |||
1782 | } | 1790 | } |
1783 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1791 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1784 | } | 1792 | } |
1785 | impl AstNode for EnumVariant { | 1793 | impl AstNode for TupleField { |
1786 | fn can_cast(kind: SyntaxKind) -> bool { kind == ENUM_VARIANT } | 1794 | fn can_cast(kind: SyntaxKind) -> bool { kind == TUPLE_FIELD } |
1787 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1795 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1788 | if Self::can_cast(syntax.kind()) { | 1796 | if Self::can_cast(syntax.kind()) { |
1789 | Some(Self { syntax }) | 1797 | Some(Self { syntax }) |
@@ -1793,8 +1801,19 @@ impl AstNode for EnumVariant { | |||
1793 | } | 1801 | } |
1794 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1802 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1795 | } | 1803 | } |
1796 | impl AstNode for TypeBoundList { | 1804 | impl AstNode for VariantList { |
1797 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND_LIST } | 1805 | fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT_LIST } |
1806 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1807 | if Self::can_cast(syntax.kind()) { | ||
1808 | Some(Self { syntax }) | ||
1809 | } else { | ||
1810 | None | ||
1811 | } | ||
1812 | } | ||
1813 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1814 | } | ||
1815 | impl AstNode for Variant { | ||
1816 | fn can_cast(kind: SyntaxKind) -> bool { kind == VARIANT } | ||
1798 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1817 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
1799 | if Self::can_cast(syntax.kind()) { | 1818 | if Self::can_cast(syntax.kind()) { |
1800 | Some(Self { syntax }) | 1819 | Some(Self { syntax }) |
@@ -1815,6 +1834,72 @@ impl AstNode for AssocItemList { | |||
1815 | } | 1834 | } |
1816 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 1835 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
1817 | } | 1836 | } |
1837 | impl AstNode for ExternItemList { | ||
1838 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } | ||
1839 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1840 | if Self::can_cast(syntax.kind()) { | ||
1841 | Some(Self { syntax }) | ||
1842 | } else { | ||
1843 | None | ||
1844 | } | ||
1845 | } | ||
1846 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1847 | } | ||
1848 | impl AstNode for LifetimeParam { | ||
1849 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } | ||
1850 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1851 | if Self::can_cast(syntax.kind()) { | ||
1852 | Some(Self { syntax }) | ||
1853 | } else { | ||
1854 | None | ||
1855 | } | ||
1856 | } | ||
1857 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1858 | } | ||
1859 | impl AstNode for TypeParam { | ||
1860 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } | ||
1861 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1862 | if Self::can_cast(syntax.kind()) { | ||
1863 | Some(Self { syntax }) | ||
1864 | } else { | ||
1865 | None | ||
1866 | } | ||
1867 | } | ||
1868 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1869 | } | ||
1870 | impl AstNode for ConstParam { | ||
1871 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } | ||
1872 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1873 | if Self::can_cast(syntax.kind()) { | ||
1874 | Some(Self { syntax }) | ||
1875 | } else { | ||
1876 | None | ||
1877 | } | ||
1878 | } | ||
1879 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1880 | } | ||
1881 | impl AstNode for Literal { | ||
1882 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } | ||
1883 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1884 | if Self::can_cast(syntax.kind()) { | ||
1885 | Some(Self { syntax }) | ||
1886 | } else { | ||
1887 | None | ||
1888 | } | ||
1889 | } | ||
1890 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1891 | } | ||
1892 | impl AstNode for TokenTree { | ||
1893 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } | ||
1894 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
1895 | if Self::can_cast(syntax.kind()) { | ||
1896 | Some(Self { syntax }) | ||
1897 | } else { | ||
1898 | None | ||
1899 | } | ||
1900 | } | ||
1901 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
1902 | } | ||
1818 | impl AstNode for ParenType { | 1903 | impl AstNode for ParenType { |
1819 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } | 1904 | fn can_cast(kind: SyntaxKind) -> bool { kind == PAREN_TYPE } |
1820 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 1905 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2277,17 +2362,6 @@ impl AstNode for BinExpr { | |||
2277 | } | 2362 | } |
2278 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2363 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2279 | } | 2364 | } |
2280 | impl AstNode for Literal { | ||
2281 | fn can_cast(kind: SyntaxKind) -> bool { kind == LITERAL } | ||
2282 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2283 | if Self::can_cast(syntax.kind()) { | ||
2284 | Some(Self { syntax }) | ||
2285 | } else { | ||
2286 | None | ||
2287 | } | ||
2288 | } | ||
2289 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2290 | } | ||
2291 | impl AstNode for MatchExpr { | 2365 | impl AstNode for MatchExpr { |
2292 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } | 2366 | fn can_cast(kind: SyntaxKind) -> bool { kind == MATCH_EXPR } |
2293 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2367 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2332,8 +2406,8 @@ impl AstNode for MatchGuard { | |||
2332 | } | 2406 | } |
2333 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2407 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2334 | } | 2408 | } |
2335 | impl AstNode for RecordLit { | 2409 | impl AstNode for RecordExpr { |
2336 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_LIT } | 2410 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR } |
2337 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2411 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2338 | if Self::can_cast(syntax.kind()) { | 2412 | if Self::can_cast(syntax.kind()) { |
2339 | Some(Self { syntax }) | 2413 | Some(Self { syntax }) |
@@ -2343,8 +2417,8 @@ impl AstNode for RecordLit { | |||
2343 | } | 2417 | } |
2344 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2418 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2345 | } | 2419 | } |
2346 | impl AstNode for RecordFieldList { | 2420 | impl AstNode for RecordExprFieldList { |
2347 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD_LIST } | 2421 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD_LIST } |
2348 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2422 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2349 | if Self::can_cast(syntax.kind()) { | 2423 | if Self::can_cast(syntax.kind()) { |
2350 | Some(Self { syntax }) | 2424 | Some(Self { syntax }) |
@@ -2354,8 +2428,8 @@ impl AstNode for RecordFieldList { | |||
2354 | } | 2428 | } |
2355 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2429 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2356 | } | 2430 | } |
2357 | impl AstNode for RecordField { | 2431 | impl AstNode for RecordExprField { |
2358 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_FIELD } | 2432 | fn can_cast(kind: SyntaxKind) -> bool { kind == RECORD_EXPR_FIELD } |
2359 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2433 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2360 | if Self::can_cast(syntax.kind()) { | 2434 | if Self::can_cast(syntax.kind()) { |
2361 | Some(Self { syntax }) | 2435 | Some(Self { syntax }) |
@@ -2552,17 +2626,6 @@ impl AstNode for TuplePat { | |||
2552 | } | 2626 | } |
2553 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2627 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2554 | } | 2628 | } |
2555 | impl AstNode for TokenTree { | ||
2556 | fn can_cast(kind: SyntaxKind) -> bool { kind == TOKEN_TREE } | ||
2557 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2558 | if Self::can_cast(syntax.kind()) { | ||
2559 | Some(Self { syntax }) | ||
2560 | } else { | ||
2561 | None | ||
2562 | } | ||
2563 | } | ||
2564 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2565 | } | ||
2566 | impl AstNode for MacroDef { | 2629 | impl AstNode for MacroDef { |
2567 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } | 2630 | fn can_cast(kind: SyntaxKind) -> bool { kind == MACRO_DEF } |
2568 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2631 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2596,39 +2659,6 @@ impl AstNode for MacroStmts { | |||
2596 | } | 2659 | } |
2597 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2660 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2598 | } | 2661 | } |
2599 | impl AstNode for TypeParam { | ||
2600 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_PARAM } | ||
2601 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2602 | if Self::can_cast(syntax.kind()) { | ||
2603 | Some(Self { syntax }) | ||
2604 | } else { | ||
2605 | None | ||
2606 | } | ||
2607 | } | ||
2608 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2609 | } | ||
2610 | impl AstNode for LifetimeParam { | ||
2611 | fn can_cast(kind: SyntaxKind) -> bool { kind == LIFETIME_PARAM } | ||
2612 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2613 | if Self::can_cast(syntax.kind()) { | ||
2614 | Some(Self { syntax }) | ||
2615 | } else { | ||
2616 | None | ||
2617 | } | ||
2618 | } | ||
2619 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2620 | } | ||
2621 | impl AstNode for ConstParam { | ||
2622 | fn can_cast(kind: SyntaxKind) -> bool { kind == CONST_PARAM } | ||
2623 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2624 | if Self::can_cast(syntax.kind()) { | ||
2625 | Some(Self { syntax }) | ||
2626 | } else { | ||
2627 | None | ||
2628 | } | ||
2629 | } | ||
2630 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2631 | } | ||
2632 | impl AstNode for TypeBound { | 2662 | impl AstNode for TypeBound { |
2633 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } | 2663 | fn can_cast(kind: SyntaxKind) -> bool { kind == TYPE_BOUND } |
2634 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2664 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2673,28 +2703,6 @@ impl AstNode for LetStmt { | |||
2673 | } | 2703 | } |
2674 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2704 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2675 | } | 2705 | } |
2676 | impl AstNode for SelfParam { | ||
2677 | fn can_cast(kind: SyntaxKind) -> bool { kind == SELF_PARAM } | ||
2678 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2679 | if Self::can_cast(syntax.kind()) { | ||
2680 | Some(Self { syntax }) | ||
2681 | } else { | ||
2682 | None | ||
2683 | } | ||
2684 | } | ||
2685 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2686 | } | ||
2687 | impl AstNode for Param { | ||
2688 | fn can_cast(kind: SyntaxKind) -> bool { kind == PARAM } | ||
2689 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2690 | if Self::can_cast(syntax.kind()) { | ||
2691 | Some(Self { syntax }) | ||
2692 | } else { | ||
2693 | None | ||
2694 | } | ||
2695 | } | ||
2696 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2697 | } | ||
2698 | impl AstNode for PathSegment { | 2706 | impl AstNode for PathSegment { |
2699 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } | 2707 | fn can_cast(kind: SyntaxKind) -> bool { kind == PATH_SEGMENT } |
2700 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2708 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
@@ -2750,33 +2758,11 @@ impl AstNode for ConstArg { | |||
2750 | } | 2758 | } |
2751 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | 2759 | fn syntax(&self) -> &SyntaxNode { &self.syntax } |
2752 | } | 2760 | } |
2753 | impl AstNode for ExternItemList { | 2761 | impl From<Const> for Item { |
2754 | fn can_cast(kind: SyntaxKind) -> bool { kind == EXTERN_ITEM_LIST } | 2762 | fn from(node: Const) -> Item { Item::Const(node) } |
2755 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2756 | if Self::can_cast(syntax.kind()) { | ||
2757 | Some(Self { syntax }) | ||
2758 | } else { | ||
2759 | None | ||
2760 | } | ||
2761 | } | ||
2762 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2763 | } | 2763 | } |
2764 | impl AstNode for MetaItem { | 2764 | impl From<Enum> for Item { |
2765 | fn can_cast(kind: SyntaxKind) -> bool { kind == META_ITEM } | 2765 | fn from(node: Enum) -> Item { Item::Enum(node) } |
2766 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2767 | if Self::can_cast(syntax.kind()) { | ||
2768 | Some(Self { syntax }) | ||
2769 | } else { | ||
2770 | None | ||
2771 | } | ||
2772 | } | ||
2773 | fn syntax(&self) -> &SyntaxNode { &self.syntax } | ||
2774 | } | ||
2775 | impl From<ConstDef> for Item { | ||
2776 | fn from(node: ConstDef) -> Item { Item::ConstDef(node) } | ||
2777 | } | ||
2778 | impl From<EnumDef> for Item { | ||
2779 | fn from(node: EnumDef) -> Item { Item::EnumDef(node) } | ||
2780 | } | 2766 | } |
2781 | impl From<ExternBlock> for Item { | 2767 | impl From<ExternBlock> for Item { |
2782 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } | 2768 | fn from(node: ExternBlock) -> Item { Item::ExternBlock(node) } |
@@ -2784,11 +2770,11 @@ impl From<ExternBlock> for Item { | |||
2784 | impl From<ExternCrate> for Item { | 2770 | impl From<ExternCrate> for Item { |
2785 | fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) } | 2771 | fn from(node: ExternCrate) -> Item { Item::ExternCrate(node) } |
2786 | } | 2772 | } |
2787 | impl From<FnDef> for Item { | 2773 | impl From<Fn> for Item { |
2788 | fn from(node: FnDef) -> Item { Item::FnDef(node) } | 2774 | fn from(node: Fn) -> Item { Item::Fn(node) } |
2789 | } | 2775 | } |
2790 | impl From<ImplDef> for Item { | 2776 | impl From<Impl> for Item { |
2791 | fn from(node: ImplDef) -> Item { Item::ImplDef(node) } | 2777 | fn from(node: Impl) -> Item { Item::Impl(node) } |
2792 | } | 2778 | } |
2793 | impl From<MacroCall> for Item { | 2779 | impl From<MacroCall> for Item { |
2794 | fn from(node: MacroCall) -> Item { Item::MacroCall(node) } | 2780 | fn from(node: MacroCall) -> Item { Item::MacroCall(node) } |
@@ -2796,20 +2782,20 @@ impl From<MacroCall> for Item { | |||
2796 | impl From<Module> for Item { | 2782 | impl From<Module> for Item { |
2797 | fn from(node: Module) -> Item { Item::Module(node) } | 2783 | fn from(node: Module) -> Item { Item::Module(node) } |
2798 | } | 2784 | } |
2799 | impl From<StaticDef> for Item { | 2785 | impl From<Static> for Item { |
2800 | fn from(node: StaticDef) -> Item { Item::StaticDef(node) } | 2786 | fn from(node: Static) -> Item { Item::Static(node) } |
2801 | } | 2787 | } |
2802 | impl From<StructDef> for Item { | 2788 | impl From<Struct> for Item { |
2803 | fn from(node: StructDef) -> Item { Item::StructDef(node) } | 2789 | fn from(node: Struct) -> Item { Item::Struct(node) } |
2804 | } | 2790 | } |
2805 | impl From<TraitDef> for Item { | 2791 | impl From<Trait> for Item { |
2806 | fn from(node: TraitDef) -> Item { Item::TraitDef(node) } | 2792 | fn from(node: Trait) -> Item { Item::Trait(node) } |
2807 | } | 2793 | } |
2808 | impl From<TypeAliasDef> for Item { | 2794 | impl From<TypeAlias> for Item { |
2809 | fn from(node: TypeAliasDef) -> Item { Item::TypeAliasDef(node) } | 2795 | fn from(node: TypeAlias) -> Item { Item::TypeAlias(node) } |
2810 | } | 2796 | } |
2811 | impl From<UnionDef> for Item { | 2797 | impl From<Union> for Item { |
2812 | fn from(node: UnionDef) -> Item { Item::UnionDef(node) } | 2798 | fn from(node: Union) -> Item { Item::Union(node) } |
2813 | } | 2799 | } |
2814 | impl From<Use> for Item { | 2800 | impl From<Use> for Item { |
2815 | fn from(node: Use) -> Item { Item::Use(node) } | 2801 | fn from(node: Use) -> Item { Item::Use(node) } |
@@ -2817,28 +2803,26 @@ impl From<Use> for Item { | |||
2817 | impl AstNode for Item { | 2803 | impl AstNode for Item { |
2818 | fn can_cast(kind: SyntaxKind) -> bool { | 2804 | fn can_cast(kind: SyntaxKind) -> bool { |
2819 | match kind { | 2805 | match kind { |
2820 | CONST_DEF | ENUM_DEF | EXTERN_BLOCK | EXTERN_CRATE | FN_DEF | IMPL_DEF | MACRO_CALL | 2806 | CONST | ENUM | EXTERN_BLOCK | EXTERN_CRATE | FN | IMPL | MACRO_CALL | MODULE |
2821 | | MODULE | STATIC_DEF | STRUCT_DEF | TRAIT_DEF | TYPE_ALIAS_DEF | UNION_DEF | USE => { | 2807 | | STATIC | STRUCT | TRAIT | TYPE_ALIAS | UNION | USE => true, |
2822 | true | ||
2823 | } | ||
2824 | _ => false, | 2808 | _ => false, |
2825 | } | 2809 | } |
2826 | } | 2810 | } |
2827 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 2811 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2828 | let res = match syntax.kind() { | 2812 | let res = match syntax.kind() { |
2829 | CONST_DEF => Item::ConstDef(ConstDef { syntax }), | 2813 | CONST => Item::Const(Const { syntax }), |
2830 | ENUM_DEF => Item::EnumDef(EnumDef { syntax }), | 2814 | ENUM => Item::Enum(Enum { syntax }), |
2831 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), | 2815 | EXTERN_BLOCK => Item::ExternBlock(ExternBlock { syntax }), |
2832 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), | 2816 | EXTERN_CRATE => Item::ExternCrate(ExternCrate { syntax }), |
2833 | FN_DEF => Item::FnDef(FnDef { syntax }), | 2817 | FN => Item::Fn(Fn { syntax }), |
2834 | IMPL_DEF => Item::ImplDef(ImplDef { syntax }), | 2818 | IMPL => Item::Impl(Impl { syntax }), |
2835 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), | 2819 | MACRO_CALL => Item::MacroCall(MacroCall { syntax }), |
2836 | MODULE => Item::Module(Module { syntax }), | 2820 | MODULE => Item::Module(Module { syntax }), |
2837 | STATIC_DEF => Item::StaticDef(StaticDef { syntax }), | 2821 | STATIC => Item::Static(Static { syntax }), |
2838 | STRUCT_DEF => Item::StructDef(StructDef { syntax }), | 2822 | STRUCT => Item::Struct(Struct { syntax }), |
2839 | TRAIT_DEF => Item::TraitDef(TraitDef { syntax }), | 2823 | TRAIT => Item::Trait(Trait { syntax }), |
2840 | TYPE_ALIAS_DEF => Item::TypeAliasDef(TypeAliasDef { syntax }), | 2824 | TYPE_ALIAS => Item::TypeAlias(TypeAlias { syntax }), |
2841 | UNION_DEF => Item::UnionDef(UnionDef { syntax }), | 2825 | UNION => Item::Union(Union { syntax }), |
2842 | USE => Item::Use(Use { syntax }), | 2826 | USE => Item::Use(Use { syntax }), |
2843 | _ => return None, | 2827 | _ => return None, |
2844 | }; | 2828 | }; |
@@ -2846,19 +2830,19 @@ impl AstNode for Item { | |||
2846 | } | 2830 | } |
2847 | fn syntax(&self) -> &SyntaxNode { | 2831 | fn syntax(&self) -> &SyntaxNode { |
2848 | match self { | 2832 | match self { |
2849 | Item::ConstDef(it) => &it.syntax, | 2833 | Item::Const(it) => &it.syntax, |
2850 | Item::EnumDef(it) => &it.syntax, | 2834 | Item::Enum(it) => &it.syntax, |
2851 | Item::ExternBlock(it) => &it.syntax, | 2835 | Item::ExternBlock(it) => &it.syntax, |
2852 | Item::ExternCrate(it) => &it.syntax, | 2836 | Item::ExternCrate(it) => &it.syntax, |
2853 | Item::FnDef(it) => &it.syntax, | 2837 | Item::Fn(it) => &it.syntax, |
2854 | Item::ImplDef(it) => &it.syntax, | 2838 | Item::Impl(it) => &it.syntax, |
2855 | Item::MacroCall(it) => &it.syntax, | 2839 | Item::MacroCall(it) => &it.syntax, |
2856 | Item::Module(it) => &it.syntax, | 2840 | Item::Module(it) => &it.syntax, |
2857 | Item::StaticDef(it) => &it.syntax, | 2841 | Item::Static(it) => &it.syntax, |
2858 | Item::StructDef(it) => &it.syntax, | 2842 | Item::Struct(it) => &it.syntax, |
2859 | Item::TraitDef(it) => &it.syntax, | 2843 | Item::Trait(it) => &it.syntax, |
2860 | Item::TypeAliasDef(it) => &it.syntax, | 2844 | Item::TypeAlias(it) => &it.syntax, |
2861 | Item::UnionDef(it) => &it.syntax, | 2845 | Item::Union(it) => &it.syntax, |
2862 | Item::Use(it) => &it.syntax, | 2846 | Item::Use(it) => &it.syntax, |
2863 | } | 2847 | } |
2864 | } | 2848 | } |
@@ -2948,33 +2932,126 @@ impl AstNode for TypeRef { | |||
2948 | } | 2932 | } |
2949 | } | 2933 | } |
2950 | } | 2934 | } |
2951 | impl From<RecordFieldDefList> for FieldDefList { | 2935 | impl From<OrPat> for Pat { |
2952 | fn from(node: RecordFieldDefList) -> FieldDefList { FieldDefList::RecordFieldDefList(node) } | 2936 | fn from(node: OrPat) -> Pat { Pat::OrPat(node) } |
2937 | } | ||
2938 | impl From<ParenPat> for Pat { | ||
2939 | fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } | ||
2940 | } | ||
2941 | impl From<RefPat> for Pat { | ||
2942 | fn from(node: RefPat) -> Pat { Pat::RefPat(node) } | ||
2943 | } | ||
2944 | impl From<BoxPat> for Pat { | ||
2945 | fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } | ||
2946 | } | ||
2947 | impl From<BindPat> for Pat { | ||
2948 | fn from(node: BindPat) -> Pat { Pat::BindPat(node) } | ||
2949 | } | ||
2950 | impl From<PlaceholderPat> for Pat { | ||
2951 | fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } | ||
2952 | } | ||
2953 | impl From<DotDotPat> for Pat { | ||
2954 | fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) } | ||
2955 | } | ||
2956 | impl From<PathPat> for Pat { | ||
2957 | fn from(node: PathPat) -> Pat { Pat::PathPat(node) } | ||
2958 | } | ||
2959 | impl From<RecordPat> for Pat { | ||
2960 | fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) } | ||
2961 | } | ||
2962 | impl From<TupleStructPat> for Pat { | ||
2963 | fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } | ||
2964 | } | ||
2965 | impl From<TuplePat> for Pat { | ||
2966 | fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) } | ||
2967 | } | ||
2968 | impl From<SlicePat> for Pat { | ||
2969 | fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } | ||
2970 | } | ||
2971 | impl From<RangePat> for Pat { | ||
2972 | fn from(node: RangePat) -> Pat { Pat::RangePat(node) } | ||
2973 | } | ||
2974 | impl From<LiteralPat> for Pat { | ||
2975 | fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } | ||
2976 | } | ||
2977 | impl From<MacroPat> for Pat { | ||
2978 | fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } | ||
2979 | } | ||
2980 | impl AstNode for Pat { | ||
2981 | fn can_cast(kind: SyntaxKind) -> bool { | ||
2982 | match kind { | ||
2983 | OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | ||
2984 | | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | ||
2985 | | LITERAL_PAT | MACRO_PAT => true, | ||
2986 | _ => false, | ||
2987 | } | ||
2988 | } | ||
2989 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
2990 | let res = match syntax.kind() { | ||
2991 | OR_PAT => Pat::OrPat(OrPat { syntax }), | ||
2992 | PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), | ||
2993 | REF_PAT => Pat::RefPat(RefPat { syntax }), | ||
2994 | BOX_PAT => Pat::BoxPat(BoxPat { syntax }), | ||
2995 | BIND_PAT => Pat::BindPat(BindPat { syntax }), | ||
2996 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), | ||
2997 | DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }), | ||
2998 | PATH_PAT => Pat::PathPat(PathPat { syntax }), | ||
2999 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), | ||
3000 | TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), | ||
3001 | TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), | ||
3002 | SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), | ||
3003 | RANGE_PAT => Pat::RangePat(RangePat { syntax }), | ||
3004 | LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), | ||
3005 | MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), | ||
3006 | _ => return None, | ||
3007 | }; | ||
3008 | Some(res) | ||
3009 | } | ||
3010 | fn syntax(&self) -> &SyntaxNode { | ||
3011 | match self { | ||
3012 | Pat::OrPat(it) => &it.syntax, | ||
3013 | Pat::ParenPat(it) => &it.syntax, | ||
3014 | Pat::RefPat(it) => &it.syntax, | ||
3015 | Pat::BoxPat(it) => &it.syntax, | ||
3016 | Pat::BindPat(it) => &it.syntax, | ||
3017 | Pat::PlaceholderPat(it) => &it.syntax, | ||
3018 | Pat::DotDotPat(it) => &it.syntax, | ||
3019 | Pat::PathPat(it) => &it.syntax, | ||
3020 | Pat::RecordPat(it) => &it.syntax, | ||
3021 | Pat::TupleStructPat(it) => &it.syntax, | ||
3022 | Pat::TuplePat(it) => &it.syntax, | ||
3023 | Pat::SlicePat(it) => &it.syntax, | ||
3024 | Pat::RangePat(it) => &it.syntax, | ||
3025 | Pat::LiteralPat(it) => &it.syntax, | ||
3026 | Pat::MacroPat(it) => &it.syntax, | ||
3027 | } | ||
3028 | } | ||
3029 | } | ||
3030 | impl From<RecordFieldList> for FieldList { | ||
3031 | fn from(node: RecordFieldList) -> FieldList { FieldList::RecordFieldList(node) } | ||
2953 | } | 3032 | } |
2954 | impl From<TupleFieldDefList> for FieldDefList { | 3033 | impl From<TupleFieldList> for FieldList { |
2955 | fn from(node: TupleFieldDefList) -> FieldDefList { FieldDefList::TupleFieldDefList(node) } | 3034 | fn from(node: TupleFieldList) -> FieldList { FieldList::TupleFieldList(node) } |
2956 | } | 3035 | } |
2957 | impl AstNode for FieldDefList { | 3036 | impl AstNode for FieldList { |
2958 | fn can_cast(kind: SyntaxKind) -> bool { | 3037 | fn can_cast(kind: SyntaxKind) -> bool { |
2959 | match kind { | 3038 | match kind { |
2960 | RECORD_FIELD_DEF_LIST | TUPLE_FIELD_DEF_LIST => true, | 3039 | RECORD_FIELD_LIST | TUPLE_FIELD_LIST => true, |
2961 | _ => false, | 3040 | _ => false, |
2962 | } | 3041 | } |
2963 | } | 3042 | } |
2964 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3043 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
2965 | let res = match syntax.kind() { | 3044 | let res = match syntax.kind() { |
2966 | RECORD_FIELD_DEF_LIST => { | 3045 | RECORD_FIELD_LIST => FieldList::RecordFieldList(RecordFieldList { syntax }), |
2967 | FieldDefList::RecordFieldDefList(RecordFieldDefList { syntax }) | 3046 | TUPLE_FIELD_LIST => FieldList::TupleFieldList(TupleFieldList { syntax }), |
2968 | } | ||
2969 | TUPLE_FIELD_DEF_LIST => FieldDefList::TupleFieldDefList(TupleFieldDefList { syntax }), | ||
2970 | _ => return None, | 3047 | _ => return None, |
2971 | }; | 3048 | }; |
2972 | Some(res) | 3049 | Some(res) |
2973 | } | 3050 | } |
2974 | fn syntax(&self) -> &SyntaxNode { | 3051 | fn syntax(&self) -> &SyntaxNode { |
2975 | match self { | 3052 | match self { |
2976 | FieldDefList::RecordFieldDefList(it) => &it.syntax, | 3053 | FieldList::RecordFieldList(it) => &it.syntax, |
2977 | FieldDefList::TupleFieldDefList(it) => &it.syntax, | 3054 | FieldList::TupleFieldList(it) => &it.syntax, |
2978 | } | 3055 | } |
2979 | } | 3056 | } |
2980 | } | 3057 | } |
@@ -3023,8 +3100,8 @@ impl From<ReturnExpr> for Expr { | |||
3023 | impl From<MatchExpr> for Expr { | 3100 | impl From<MatchExpr> for Expr { |
3024 | fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } | 3101 | fn from(node: MatchExpr) -> Expr { Expr::MatchExpr(node) } |
3025 | } | 3102 | } |
3026 | impl From<RecordLit> for Expr { | 3103 | impl From<RecordExpr> for Expr { |
3027 | fn from(node: RecordLit) -> Expr { Expr::RecordLit(node) } | 3104 | fn from(node: RecordExpr) -> Expr { Expr::RecordExpr(node) } |
3028 | } | 3105 | } |
3029 | impl From<CallExpr> for Expr { | 3106 | impl From<CallExpr> for Expr { |
3030 | fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } | 3107 | fn from(node: CallExpr) -> Expr { Expr::CallExpr(node) } |
@@ -3076,7 +3153,7 @@ impl AstNode for Expr { | |||
3076 | match kind { | 3153 | match kind { |
3077 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR | 3154 | TUPLE_EXPR | ARRAY_EXPR | PAREN_EXPR | PATH_EXPR | LAMBDA_EXPR | IF_EXPR |
3078 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL | 3155 | | LOOP_EXPR | FOR_EXPR | WHILE_EXPR | CONTINUE_EXPR | BREAK_EXPR | LABEL |
3079 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_LIT | CALL_EXPR | INDEX_EXPR | 3156 | | BLOCK_EXPR | RETURN_EXPR | MATCH_EXPR | RECORD_EXPR | CALL_EXPR | INDEX_EXPR |
3080 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR | 3157 | | METHOD_CALL_EXPR | FIELD_EXPR | AWAIT_EXPR | TRY_EXPR | EFFECT_EXPR | CAST_EXPR |
3081 | | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { | 3158 | | REF_EXPR | PREFIX_EXPR | RANGE_EXPR | BIN_EXPR | LITERAL | MACRO_CALL | BOX_EXPR => { |
3082 | true | 3159 | true |
@@ -3101,7 +3178,7 @@ impl AstNode for Expr { | |||
3101 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), | 3178 | BLOCK_EXPR => Expr::BlockExpr(BlockExpr { syntax }), |
3102 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), | 3179 | RETURN_EXPR => Expr::ReturnExpr(ReturnExpr { syntax }), |
3103 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), | 3180 | MATCH_EXPR => Expr::MatchExpr(MatchExpr { syntax }), |
3104 | RECORD_LIT => Expr::RecordLit(RecordLit { syntax }), | 3181 | RECORD_EXPR => Expr::RecordExpr(RecordExpr { syntax }), |
3105 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), | 3182 | CALL_EXPR => Expr::CallExpr(CallExpr { syntax }), |
3106 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), | 3183 | INDEX_EXPR => Expr::IndexExpr(IndexExpr { syntax }), |
3107 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), | 3184 | METHOD_CALL_EXPR => Expr::MethodCallExpr(MethodCallExpr { syntax }), |
@@ -3138,7 +3215,7 @@ impl AstNode for Expr { | |||
3138 | Expr::BlockExpr(it) => &it.syntax, | 3215 | Expr::BlockExpr(it) => &it.syntax, |
3139 | Expr::ReturnExpr(it) => &it.syntax, | 3216 | Expr::ReturnExpr(it) => &it.syntax, |
3140 | Expr::MatchExpr(it) => &it.syntax, | 3217 | Expr::MatchExpr(it) => &it.syntax, |
3141 | Expr::RecordLit(it) => &it.syntax, | 3218 | Expr::RecordExpr(it) => &it.syntax, |
3142 | Expr::CallExpr(it) => &it.syntax, | 3219 | Expr::CallExpr(it) => &it.syntax, |
3143 | Expr::IndexExpr(it) => &it.syntax, | 3220 | Expr::IndexExpr(it) => &it.syntax, |
3144 | Expr::MethodCallExpr(it) => &it.syntax, | 3221 | Expr::MethodCallExpr(it) => &it.syntax, |
@@ -3157,14 +3234,14 @@ impl AstNode for Expr { | |||
3157 | } | 3234 | } |
3158 | } | 3235 | } |
3159 | } | 3236 | } |
3160 | impl From<FnDef> for AssocItem { | 3237 | impl From<Fn> for AssocItem { |
3161 | fn from(node: FnDef) -> AssocItem { AssocItem::FnDef(node) } | 3238 | fn from(node: Fn) -> AssocItem { AssocItem::Fn(node) } |
3162 | } | 3239 | } |
3163 | impl From<TypeAliasDef> for AssocItem { | 3240 | impl From<TypeAlias> for AssocItem { |
3164 | fn from(node: TypeAliasDef) -> AssocItem { AssocItem::TypeAliasDef(node) } | 3241 | fn from(node: TypeAlias) -> AssocItem { AssocItem::TypeAlias(node) } |
3165 | } | 3242 | } |
3166 | impl From<ConstDef> for AssocItem { | 3243 | impl From<Const> for AssocItem { |
3167 | fn from(node: ConstDef) -> AssocItem { AssocItem::ConstDef(node) } | 3244 | fn from(node: Const) -> AssocItem { AssocItem::Const(node) } |
3168 | } | 3245 | } |
3169 | impl From<MacroCall> for AssocItem { | 3246 | impl From<MacroCall> for AssocItem { |
3170 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } | 3247 | fn from(node: MacroCall) -> AssocItem { AssocItem::MacroCall(node) } |
@@ -3172,15 +3249,15 @@ impl From<MacroCall> for AssocItem { | |||
3172 | impl AstNode for AssocItem { | 3249 | impl AstNode for AssocItem { |
3173 | fn can_cast(kind: SyntaxKind) -> bool { | 3250 | fn can_cast(kind: SyntaxKind) -> bool { |
3174 | match kind { | 3251 | match kind { |
3175 | FN_DEF | TYPE_ALIAS_DEF | CONST_DEF | MACRO_CALL => true, | 3252 | FN | TYPE_ALIAS | CONST | MACRO_CALL => true, |
3176 | _ => false, | 3253 | _ => false, |
3177 | } | 3254 | } |
3178 | } | 3255 | } |
3179 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3256 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3180 | let res = match syntax.kind() { | 3257 | let res = match syntax.kind() { |
3181 | FN_DEF => AssocItem::FnDef(FnDef { syntax }), | 3258 | FN => AssocItem::Fn(Fn { syntax }), |
3182 | TYPE_ALIAS_DEF => AssocItem::TypeAliasDef(TypeAliasDef { syntax }), | 3259 | TYPE_ALIAS => AssocItem::TypeAlias(TypeAlias { syntax }), |
3183 | CONST_DEF => AssocItem::ConstDef(ConstDef { syntax }), | 3260 | CONST => AssocItem::Const(Const { syntax }), |
3184 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), | 3261 | MACRO_CALL => AssocItem::MacroCall(MacroCall { syntax }), |
3185 | _ => return None, | 3262 | _ => return None, |
3186 | }; | 3263 | }; |
@@ -3188,222 +3265,137 @@ impl AstNode for AssocItem { | |||
3188 | } | 3265 | } |
3189 | fn syntax(&self) -> &SyntaxNode { | 3266 | fn syntax(&self) -> &SyntaxNode { |
3190 | match self { | 3267 | match self { |
3191 | AssocItem::FnDef(it) => &it.syntax, | 3268 | AssocItem::Fn(it) => &it.syntax, |
3192 | AssocItem::TypeAliasDef(it) => &it.syntax, | 3269 | AssocItem::TypeAlias(it) => &it.syntax, |
3193 | AssocItem::ConstDef(it) => &it.syntax, | 3270 | AssocItem::Const(it) => &it.syntax, |
3194 | AssocItem::MacroCall(it) => &it.syntax, | 3271 | AssocItem::MacroCall(it) => &it.syntax, |
3195 | } | 3272 | } |
3196 | } | 3273 | } |
3197 | } | 3274 | } |
3198 | impl From<OrPat> for Pat { | 3275 | impl From<Fn> for ExternItem { |
3199 | fn from(node: OrPat) -> Pat { Pat::OrPat(node) } | 3276 | fn from(node: Fn) -> ExternItem { ExternItem::Fn(node) } |
3200 | } | ||
3201 | impl From<ParenPat> for Pat { | ||
3202 | fn from(node: ParenPat) -> Pat { Pat::ParenPat(node) } | ||
3203 | } | ||
3204 | impl From<RefPat> for Pat { | ||
3205 | fn from(node: RefPat) -> Pat { Pat::RefPat(node) } | ||
3206 | } | ||
3207 | impl From<BoxPat> for Pat { | ||
3208 | fn from(node: BoxPat) -> Pat { Pat::BoxPat(node) } | ||
3209 | } | ||
3210 | impl From<BindPat> for Pat { | ||
3211 | fn from(node: BindPat) -> Pat { Pat::BindPat(node) } | ||
3212 | } | 3277 | } |
3213 | impl From<PlaceholderPat> for Pat { | 3278 | impl From<Static> for ExternItem { |
3214 | fn from(node: PlaceholderPat) -> Pat { Pat::PlaceholderPat(node) } | 3279 | fn from(node: Static) -> ExternItem { ExternItem::Static(node) } |
3215 | } | 3280 | } |
3216 | impl From<DotDotPat> for Pat { | 3281 | impl From<MacroCall> for ExternItem { |
3217 | fn from(node: DotDotPat) -> Pat { Pat::DotDotPat(node) } | 3282 | fn from(node: MacroCall) -> ExternItem { ExternItem::MacroCall(node) } |
3218 | } | 3283 | } |
3219 | impl From<PathPat> for Pat { | 3284 | impl AstNode for ExternItem { |
3220 | fn from(node: PathPat) -> Pat { Pat::PathPat(node) } | ||
3221 | } | ||
3222 | impl From<RecordPat> for Pat { | ||
3223 | fn from(node: RecordPat) -> Pat { Pat::RecordPat(node) } | ||
3224 | } | ||
3225 | impl From<TupleStructPat> for Pat { | ||
3226 | fn from(node: TupleStructPat) -> Pat { Pat::TupleStructPat(node) } | ||
3227 | } | ||
3228 | impl From<TuplePat> for Pat { | ||
3229 | fn from(node: TuplePat) -> Pat { Pat::TuplePat(node) } | ||
3230 | } | ||
3231 | impl From<SlicePat> for Pat { | ||
3232 | fn from(node: SlicePat) -> Pat { Pat::SlicePat(node) } | ||
3233 | } | ||
3234 | impl From<RangePat> for Pat { | ||
3235 | fn from(node: RangePat) -> Pat { Pat::RangePat(node) } | ||
3236 | } | ||
3237 | impl From<LiteralPat> for Pat { | ||
3238 | fn from(node: LiteralPat) -> Pat { Pat::LiteralPat(node) } | ||
3239 | } | ||
3240 | impl From<MacroPat> for Pat { | ||
3241 | fn from(node: MacroPat) -> Pat { Pat::MacroPat(node) } | ||
3242 | } | ||
3243 | impl AstNode for Pat { | ||
3244 | fn can_cast(kind: SyntaxKind) -> bool { | 3285 | fn can_cast(kind: SyntaxKind) -> bool { |
3245 | match kind { | 3286 | match kind { |
3246 | OR_PAT | PAREN_PAT | REF_PAT | BOX_PAT | BIND_PAT | PLACEHOLDER_PAT | DOT_DOT_PAT | 3287 | FN | STATIC | MACRO_CALL => true, |
3247 | | PATH_PAT | RECORD_PAT | TUPLE_STRUCT_PAT | TUPLE_PAT | SLICE_PAT | RANGE_PAT | ||
3248 | | LITERAL_PAT | MACRO_PAT => true, | ||
3249 | _ => false, | 3288 | _ => false, |
3250 | } | 3289 | } |
3251 | } | 3290 | } |
3252 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3291 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3253 | let res = match syntax.kind() { | 3292 | let res = match syntax.kind() { |
3254 | OR_PAT => Pat::OrPat(OrPat { syntax }), | 3293 | FN => ExternItem::Fn(Fn { syntax }), |
3255 | PAREN_PAT => Pat::ParenPat(ParenPat { syntax }), | 3294 | STATIC => ExternItem::Static(Static { syntax }), |
3256 | REF_PAT => Pat::RefPat(RefPat { syntax }), | 3295 | MACRO_CALL => ExternItem::MacroCall(MacroCall { syntax }), |
3257 | BOX_PAT => Pat::BoxPat(BoxPat { syntax }), | ||
3258 | BIND_PAT => Pat::BindPat(BindPat { syntax }), | ||
3259 | PLACEHOLDER_PAT => Pat::PlaceholderPat(PlaceholderPat { syntax }), | ||
3260 | DOT_DOT_PAT => Pat::DotDotPat(DotDotPat { syntax }), | ||
3261 | PATH_PAT => Pat::PathPat(PathPat { syntax }), | ||
3262 | RECORD_PAT => Pat::RecordPat(RecordPat { syntax }), | ||
3263 | TUPLE_STRUCT_PAT => Pat::TupleStructPat(TupleStructPat { syntax }), | ||
3264 | TUPLE_PAT => Pat::TuplePat(TuplePat { syntax }), | ||
3265 | SLICE_PAT => Pat::SlicePat(SlicePat { syntax }), | ||
3266 | RANGE_PAT => Pat::RangePat(RangePat { syntax }), | ||
3267 | LITERAL_PAT => Pat::LiteralPat(LiteralPat { syntax }), | ||
3268 | MACRO_PAT => Pat::MacroPat(MacroPat { syntax }), | ||
3269 | _ => return None, | 3296 | _ => return None, |
3270 | }; | 3297 | }; |
3271 | Some(res) | 3298 | Some(res) |
3272 | } | 3299 | } |
3273 | fn syntax(&self) -> &SyntaxNode { | 3300 | fn syntax(&self) -> &SyntaxNode { |
3274 | match self { | 3301 | match self { |
3275 | Pat::OrPat(it) => &it.syntax, | 3302 | ExternItem::Fn(it) => &it.syntax, |
3276 | Pat::ParenPat(it) => &it.syntax, | 3303 | ExternItem::Static(it) => &it.syntax, |
3277 | Pat::RefPat(it) => &it.syntax, | 3304 | ExternItem::MacroCall(it) => &it.syntax, |
3278 | Pat::BoxPat(it) => &it.syntax, | ||
3279 | Pat::BindPat(it) => &it.syntax, | ||
3280 | Pat::PlaceholderPat(it) => &it.syntax, | ||
3281 | Pat::DotDotPat(it) => &it.syntax, | ||
3282 | Pat::PathPat(it) => &it.syntax, | ||
3283 | Pat::RecordPat(it) => &it.syntax, | ||
3284 | Pat::TupleStructPat(it) => &it.syntax, | ||
3285 | Pat::TuplePat(it) => &it.syntax, | ||
3286 | Pat::SlicePat(it) => &it.syntax, | ||
3287 | Pat::RangePat(it) => &it.syntax, | ||
3288 | Pat::LiteralPat(it) => &it.syntax, | ||
3289 | Pat::MacroPat(it) => &it.syntax, | ||
3290 | } | 3305 | } |
3291 | } | 3306 | } |
3292 | } | 3307 | } |
3293 | impl From<LetStmt> for Stmt { | 3308 | impl From<LifetimeParam> for GenericParam { |
3294 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } | 3309 | fn from(node: LifetimeParam) -> GenericParam { GenericParam::LifetimeParam(node) } |
3295 | } | 3310 | } |
3296 | impl From<ExprStmt> for Stmt { | 3311 | impl From<TypeParam> for GenericParam { |
3297 | fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } | 3312 | fn from(node: TypeParam) -> GenericParam { GenericParam::TypeParam(node) } |
3298 | } | 3313 | } |
3299 | impl AstNode for Stmt { | 3314 | impl From<ConstParam> for GenericParam { |
3300 | fn can_cast(kind: SyntaxKind) -> bool { | 3315 | fn from(node: ConstParam) -> GenericParam { GenericParam::ConstParam(node) } |
3301 | match kind { | ||
3302 | LET_STMT | EXPR_STMT => true, | ||
3303 | _ => false, | ||
3304 | } | ||
3305 | } | ||
3306 | fn cast(syntax: SyntaxNode) -> Option<Self> { | ||
3307 | let res = match syntax.kind() { | ||
3308 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), | ||
3309 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), | ||
3310 | _ => return None, | ||
3311 | }; | ||
3312 | Some(res) | ||
3313 | } | ||
3314 | fn syntax(&self) -> &SyntaxNode { | ||
3315 | match self { | ||
3316 | Stmt::LetStmt(it) => &it.syntax, | ||
3317 | Stmt::ExprStmt(it) => &it.syntax, | ||
3318 | } | ||
3319 | } | ||
3320 | } | ||
3321 | impl From<Literal> for AttrInput { | ||
3322 | fn from(node: Literal) -> AttrInput { AttrInput::Literal(node) } | ||
3323 | } | 3316 | } |
3324 | impl From<TokenTree> for AttrInput { | 3317 | impl AstNode for GenericParam { |
3325 | fn from(node: TokenTree) -> AttrInput { AttrInput::TokenTree(node) } | ||
3326 | } | ||
3327 | impl AstNode for AttrInput { | ||
3328 | fn can_cast(kind: SyntaxKind) -> bool { | 3318 | fn can_cast(kind: SyntaxKind) -> bool { |
3329 | match kind { | 3319 | match kind { |
3330 | LITERAL | TOKEN_TREE => true, | 3320 | LIFETIME_PARAM | TYPE_PARAM | CONST_PARAM => true, |
3331 | _ => false, | 3321 | _ => false, |
3332 | } | 3322 | } |
3333 | } | 3323 | } |
3334 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3324 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3335 | let res = match syntax.kind() { | 3325 | let res = match syntax.kind() { |
3336 | LITERAL => AttrInput::Literal(Literal { syntax }), | 3326 | LIFETIME_PARAM => GenericParam::LifetimeParam(LifetimeParam { syntax }), |
3337 | TOKEN_TREE => AttrInput::TokenTree(TokenTree { syntax }), | 3327 | TYPE_PARAM => GenericParam::TypeParam(TypeParam { syntax }), |
3328 | CONST_PARAM => GenericParam::ConstParam(ConstParam { syntax }), | ||
3338 | _ => return None, | 3329 | _ => return None, |
3339 | }; | 3330 | }; |
3340 | Some(res) | 3331 | Some(res) |
3341 | } | 3332 | } |
3342 | fn syntax(&self) -> &SyntaxNode { | 3333 | fn syntax(&self) -> &SyntaxNode { |
3343 | match self { | 3334 | match self { |
3344 | AttrInput::Literal(it) => &it.syntax, | 3335 | GenericParam::LifetimeParam(it) => &it.syntax, |
3345 | AttrInput::TokenTree(it) => &it.syntax, | 3336 | GenericParam::TypeParam(it) => &it.syntax, |
3337 | GenericParam::ConstParam(it) => &it.syntax, | ||
3346 | } | 3338 | } |
3347 | } | 3339 | } |
3348 | } | 3340 | } |
3349 | impl From<FnDef> for ExternItem { | 3341 | impl From<LetStmt> for Stmt { |
3350 | fn from(node: FnDef) -> ExternItem { ExternItem::FnDef(node) } | 3342 | fn from(node: LetStmt) -> Stmt { Stmt::LetStmt(node) } |
3351 | } | 3343 | } |
3352 | impl From<StaticDef> for ExternItem { | 3344 | impl From<ExprStmt> for Stmt { |
3353 | fn from(node: StaticDef) -> ExternItem { ExternItem::StaticDef(node) } | 3345 | fn from(node: ExprStmt) -> Stmt { Stmt::ExprStmt(node) } |
3354 | } | 3346 | } |
3355 | impl AstNode for ExternItem { | 3347 | impl AstNode for Stmt { |
3356 | fn can_cast(kind: SyntaxKind) -> bool { | 3348 | fn can_cast(kind: SyntaxKind) -> bool { |
3357 | match kind { | 3349 | match kind { |
3358 | FN_DEF | STATIC_DEF => true, | 3350 | LET_STMT | EXPR_STMT => true, |
3359 | _ => false, | 3351 | _ => false, |
3360 | } | 3352 | } |
3361 | } | 3353 | } |
3362 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3354 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3363 | let res = match syntax.kind() { | 3355 | let res = match syntax.kind() { |
3364 | FN_DEF => ExternItem::FnDef(FnDef { syntax }), | 3356 | LET_STMT => Stmt::LetStmt(LetStmt { syntax }), |
3365 | STATIC_DEF => ExternItem::StaticDef(StaticDef { syntax }), | 3357 | EXPR_STMT => Stmt::ExprStmt(ExprStmt { syntax }), |
3366 | _ => return None, | 3358 | _ => return None, |
3367 | }; | 3359 | }; |
3368 | Some(res) | 3360 | Some(res) |
3369 | } | 3361 | } |
3370 | fn syntax(&self) -> &SyntaxNode { | 3362 | fn syntax(&self) -> &SyntaxNode { |
3371 | match self { | 3363 | match self { |
3372 | ExternItem::FnDef(it) => &it.syntax, | 3364 | Stmt::LetStmt(it) => &it.syntax, |
3373 | ExternItem::StaticDef(it) => &it.syntax, | 3365 | Stmt::ExprStmt(it) => &it.syntax, |
3374 | } | 3366 | } |
3375 | } | 3367 | } |
3376 | } | 3368 | } |
3377 | impl From<StructDef> for AdtDef { | 3369 | impl From<Struct> for AdtDef { |
3378 | fn from(node: StructDef) -> AdtDef { AdtDef::StructDef(node) } | 3370 | fn from(node: Struct) -> AdtDef { AdtDef::Struct(node) } |
3379 | } | 3371 | } |
3380 | impl From<EnumDef> for AdtDef { | 3372 | impl From<Enum> for AdtDef { |
3381 | fn from(node: EnumDef) -> AdtDef { AdtDef::EnumDef(node) } | 3373 | fn from(node: Enum) -> AdtDef { AdtDef::Enum(node) } |
3382 | } | 3374 | } |
3383 | impl From<UnionDef> for AdtDef { | 3375 | impl From<Union> for AdtDef { |
3384 | fn from(node: UnionDef) -> AdtDef { AdtDef::UnionDef(node) } | 3376 | fn from(node: Union) -> AdtDef { AdtDef::Union(node) } |
3385 | } | 3377 | } |
3386 | impl AstNode for AdtDef { | 3378 | impl AstNode for AdtDef { |
3387 | fn can_cast(kind: SyntaxKind) -> bool { | 3379 | fn can_cast(kind: SyntaxKind) -> bool { |
3388 | match kind { | 3380 | match kind { |
3389 | STRUCT_DEF | ENUM_DEF | UNION_DEF => true, | 3381 | STRUCT | ENUM | UNION => true, |
3390 | _ => false, | 3382 | _ => false, |
3391 | } | 3383 | } |
3392 | } | 3384 | } |
3393 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 3385 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
3394 | let res = match syntax.kind() { | 3386 | let res = match syntax.kind() { |
3395 | STRUCT_DEF => AdtDef::StructDef(StructDef { syntax }), | 3387 | STRUCT => AdtDef::Struct(Struct { syntax }), |
3396 | ENUM_DEF => AdtDef::EnumDef(EnumDef { syntax }), | 3388 | ENUM => AdtDef::Enum(Enum { syntax }), |
3397 | UNION_DEF => AdtDef::UnionDef(UnionDef { syntax }), | 3389 | UNION => AdtDef::Union(Union { syntax }), |
3398 | _ => return None, | 3390 | _ => return None, |
3399 | }; | 3391 | }; |
3400 | Some(res) | 3392 | Some(res) |
3401 | } | 3393 | } |
3402 | fn syntax(&self) -> &SyntaxNode { | 3394 | fn syntax(&self) -> &SyntaxNode { |
3403 | match self { | 3395 | match self { |
3404 | AdtDef::StructDef(it) => &it.syntax, | 3396 | AdtDef::Struct(it) => &it.syntax, |
3405 | AdtDef::EnumDef(it) => &it.syntax, | 3397 | AdtDef::Enum(it) => &it.syntax, |
3406 | AdtDef::UnionDef(it) => &it.syntax, | 3398 | AdtDef::Union(it) => &it.syntax, |
3407 | } | 3399 | } |
3408 | } | 3400 | } |
3409 | } | 3401 | } |
@@ -3417,37 +3409,37 @@ impl std::fmt::Display for TypeRef { | |||
3417 | std::fmt::Display::fmt(self.syntax(), f) | 3409 | std::fmt::Display::fmt(self.syntax(), f) |
3418 | } | 3410 | } |
3419 | } | 3411 | } |
3420 | impl std::fmt::Display for FieldDefList { | 3412 | impl std::fmt::Display for Pat { |
3421 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3413 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3422 | std::fmt::Display::fmt(self.syntax(), f) | 3414 | std::fmt::Display::fmt(self.syntax(), f) |
3423 | } | 3415 | } |
3424 | } | 3416 | } |
3425 | impl std::fmt::Display for Expr { | 3417 | impl std::fmt::Display for FieldList { |
3426 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3418 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3427 | std::fmt::Display::fmt(self.syntax(), f) | 3419 | std::fmt::Display::fmt(self.syntax(), f) |
3428 | } | 3420 | } |
3429 | } | 3421 | } |
3430 | impl std::fmt::Display for AssocItem { | 3422 | impl std::fmt::Display for Expr { |
3431 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3423 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3432 | std::fmt::Display::fmt(self.syntax(), f) | 3424 | std::fmt::Display::fmt(self.syntax(), f) |
3433 | } | 3425 | } |
3434 | } | 3426 | } |
3435 | impl std::fmt::Display for Pat { | 3427 | impl std::fmt::Display for AssocItem { |
3436 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3428 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3437 | std::fmt::Display::fmt(self.syntax(), f) | 3429 | std::fmt::Display::fmt(self.syntax(), f) |
3438 | } | 3430 | } |
3439 | } | 3431 | } |
3440 | impl std::fmt::Display for Stmt { | 3432 | impl std::fmt::Display for ExternItem { |
3441 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3433 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3442 | std::fmt::Display::fmt(self.syntax(), f) | 3434 | std::fmt::Display::fmt(self.syntax(), f) |
3443 | } | 3435 | } |
3444 | } | 3436 | } |
3445 | impl std::fmt::Display for AttrInput { | 3437 | impl std::fmt::Display for GenericParam { |
3446 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3438 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3447 | std::fmt::Display::fmt(self.syntax(), f) | 3439 | std::fmt::Display::fmt(self.syntax(), f) |
3448 | } | 3440 | } |
3449 | } | 3441 | } |
3450 | impl std::fmt::Display for ExternItem { | 3442 | impl std::fmt::Display for Stmt { |
3451 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3443 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3452 | std::fmt::Display::fmt(self.syntax(), f) | 3444 | std::fmt::Display::fmt(self.syntax(), f) |
3453 | } | 3445 | } |
@@ -3467,12 +3459,12 @@ impl std::fmt::Display for Attr { | |||
3467 | std::fmt::Display::fmt(self.syntax(), f) | 3459 | std::fmt::Display::fmt(self.syntax(), f) |
3468 | } | 3460 | } |
3469 | } | 3461 | } |
3470 | impl std::fmt::Display for ConstDef { | 3462 | impl std::fmt::Display for Const { |
3471 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3463 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3472 | std::fmt::Display::fmt(self.syntax(), f) | 3464 | std::fmt::Display::fmt(self.syntax(), f) |
3473 | } | 3465 | } |
3474 | } | 3466 | } |
3475 | impl std::fmt::Display for EnumDef { | 3467 | impl std::fmt::Display for Enum { |
3476 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3468 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3477 | std::fmt::Display::fmt(self.syntax(), f) | 3469 | std::fmt::Display::fmt(self.syntax(), f) |
3478 | } | 3470 | } |
@@ -3487,12 +3479,12 @@ impl std::fmt::Display for ExternCrate { | |||
3487 | std::fmt::Display::fmt(self.syntax(), f) | 3479 | std::fmt::Display::fmt(self.syntax(), f) |
3488 | } | 3480 | } |
3489 | } | 3481 | } |
3490 | impl std::fmt::Display for FnDef { | 3482 | impl std::fmt::Display for Fn { |
3491 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3483 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3492 | std::fmt::Display::fmt(self.syntax(), f) | 3484 | std::fmt::Display::fmt(self.syntax(), f) |
3493 | } | 3485 | } |
3494 | } | 3486 | } |
3495 | impl std::fmt::Display for ImplDef { | 3487 | impl std::fmt::Display for Impl { |
3496 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3488 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3497 | std::fmt::Display::fmt(self.syntax(), f) | 3489 | std::fmt::Display::fmt(self.syntax(), f) |
3498 | } | 3490 | } |
@@ -3507,27 +3499,27 @@ impl std::fmt::Display for Module { | |||
3507 | std::fmt::Display::fmt(self.syntax(), f) | 3499 | std::fmt::Display::fmt(self.syntax(), f) |
3508 | } | 3500 | } |
3509 | } | 3501 | } |
3510 | impl std::fmt::Display for StaticDef { | 3502 | impl std::fmt::Display for Static { |
3511 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3503 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3512 | std::fmt::Display::fmt(self.syntax(), f) | 3504 | std::fmt::Display::fmt(self.syntax(), f) |
3513 | } | 3505 | } |
3514 | } | 3506 | } |
3515 | impl std::fmt::Display for StructDef { | 3507 | impl std::fmt::Display for Struct { |
3516 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3508 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3517 | std::fmt::Display::fmt(self.syntax(), f) | 3509 | std::fmt::Display::fmt(self.syntax(), f) |
3518 | } | 3510 | } |
3519 | } | 3511 | } |
3520 | impl std::fmt::Display for TraitDef { | 3512 | impl std::fmt::Display for Trait { |
3521 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3513 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3522 | std::fmt::Display::fmt(self.syntax(), f) | 3514 | std::fmt::Display::fmt(self.syntax(), f) |
3523 | } | 3515 | } |
3524 | } | 3516 | } |
3525 | impl std::fmt::Display for TypeAliasDef { | 3517 | impl std::fmt::Display for TypeAlias { |
3526 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3518 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3527 | std::fmt::Display::fmt(self.syntax(), f) | 3519 | std::fmt::Display::fmt(self.syntax(), f) |
3528 | } | 3520 | } |
3529 | } | 3521 | } |
3530 | impl std::fmt::Display for UnionDef { | 3522 | impl std::fmt::Display for Union { |
3531 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3523 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3532 | std::fmt::Display::fmt(self.syntax(), f) | 3524 | std::fmt::Display::fmt(self.syntax(), f) |
3533 | } | 3525 | } |
@@ -3582,7 +3574,7 @@ impl std::fmt::Display for Abi { | |||
3582 | std::fmt::Display::fmt(self.syntax(), f) | 3574 | std::fmt::Display::fmt(self.syntax(), f) |
3583 | } | 3575 | } |
3584 | } | 3576 | } |
3585 | impl std::fmt::Display for TypeParamList { | 3577 | impl std::fmt::Display for GenericParamList { |
3586 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3578 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3587 | std::fmt::Display::fmt(self.syntax(), f) | 3579 | std::fmt::Display::fmt(self.syntax(), f) |
3588 | } | 3580 | } |
@@ -3607,37 +3599,47 @@ impl std::fmt::Display for BlockExpr { | |||
3607 | std::fmt::Display::fmt(self.syntax(), f) | 3599 | std::fmt::Display::fmt(self.syntax(), f) |
3608 | } | 3600 | } |
3609 | } | 3601 | } |
3610 | impl std::fmt::Display for RecordFieldDefList { | 3602 | impl std::fmt::Display for SelfParam { |
3611 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3603 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3612 | std::fmt::Display::fmt(self.syntax(), f) | 3604 | std::fmt::Display::fmt(self.syntax(), f) |
3613 | } | 3605 | } |
3614 | } | 3606 | } |
3615 | impl std::fmt::Display for TupleFieldDefList { | 3607 | impl std::fmt::Display for Param { |
3616 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3608 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3617 | std::fmt::Display::fmt(self.syntax(), f) | 3609 | std::fmt::Display::fmt(self.syntax(), f) |
3618 | } | 3610 | } |
3619 | } | 3611 | } |
3620 | impl std::fmt::Display for RecordFieldDef { | 3612 | impl std::fmt::Display for TypeBoundList { |
3621 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3613 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3622 | std::fmt::Display::fmt(self.syntax(), f) | 3614 | std::fmt::Display::fmt(self.syntax(), f) |
3623 | } | 3615 | } |
3624 | } | 3616 | } |
3625 | impl std::fmt::Display for TupleFieldDef { | 3617 | impl std::fmt::Display for RecordFieldList { |
3626 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3618 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3627 | std::fmt::Display::fmt(self.syntax(), f) | 3619 | std::fmt::Display::fmt(self.syntax(), f) |
3628 | } | 3620 | } |
3629 | } | 3621 | } |
3630 | impl std::fmt::Display for EnumVariantList { | 3622 | impl std::fmt::Display for TupleFieldList { |
3631 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3623 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3632 | std::fmt::Display::fmt(self.syntax(), f) | 3624 | std::fmt::Display::fmt(self.syntax(), f) |
3633 | } | 3625 | } |
3634 | } | 3626 | } |
3635 | impl std::fmt::Display for EnumVariant { | 3627 | impl std::fmt::Display for RecordField { |
3636 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3628 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3637 | std::fmt::Display::fmt(self.syntax(), f) | 3629 | std::fmt::Display::fmt(self.syntax(), f) |
3638 | } | 3630 | } |
3639 | } | 3631 | } |
3640 | impl std::fmt::Display for TypeBoundList { | 3632 | impl std::fmt::Display for TupleField { |
3633 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3634 | std::fmt::Display::fmt(self.syntax(), f) | ||
3635 | } | ||
3636 | } | ||
3637 | impl std::fmt::Display for VariantList { | ||
3638 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3639 | std::fmt::Display::fmt(self.syntax(), f) | ||
3640 | } | ||
3641 | } | ||
3642 | impl std::fmt::Display for Variant { | ||
3641 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3643 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3642 | std::fmt::Display::fmt(self.syntax(), f) | 3644 | std::fmt::Display::fmt(self.syntax(), f) |
3643 | } | 3645 | } |
@@ -3647,6 +3649,36 @@ impl std::fmt::Display for AssocItemList { | |||
3647 | std::fmt::Display::fmt(self.syntax(), f) | 3649 | std::fmt::Display::fmt(self.syntax(), f) |
3648 | } | 3650 | } |
3649 | } | 3651 | } |
3652 | impl std::fmt::Display for ExternItemList { | ||
3653 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3654 | std::fmt::Display::fmt(self.syntax(), f) | ||
3655 | } | ||
3656 | } | ||
3657 | impl std::fmt::Display for LifetimeParam { | ||
3658 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3659 | std::fmt::Display::fmt(self.syntax(), f) | ||
3660 | } | ||
3661 | } | ||
3662 | impl std::fmt::Display for TypeParam { | ||
3663 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3664 | std::fmt::Display::fmt(self.syntax(), f) | ||
3665 | } | ||
3666 | } | ||
3667 | impl std::fmt::Display for ConstParam { | ||
3668 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3669 | std::fmt::Display::fmt(self.syntax(), f) | ||
3670 | } | ||
3671 | } | ||
3672 | impl std::fmt::Display for Literal { | ||
3673 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3674 | std::fmt::Display::fmt(self.syntax(), f) | ||
3675 | } | ||
3676 | } | ||
3677 | impl std::fmt::Display for TokenTree { | ||
3678 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3679 | std::fmt::Display::fmt(self.syntax(), f) | ||
3680 | } | ||
3681 | } | ||
3650 | impl std::fmt::Display for ParenType { | 3682 | impl std::fmt::Display for ParenType { |
3651 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3683 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3652 | std::fmt::Display::fmt(self.syntax(), f) | 3684 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3857,11 +3889,6 @@ impl std::fmt::Display for BinExpr { | |||
3857 | std::fmt::Display::fmt(self.syntax(), f) | 3889 | std::fmt::Display::fmt(self.syntax(), f) |
3858 | } | 3890 | } |
3859 | } | 3891 | } |
3860 | impl std::fmt::Display for Literal { | ||
3861 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3862 | std::fmt::Display::fmt(self.syntax(), f) | ||
3863 | } | ||
3864 | } | ||
3865 | impl std::fmt::Display for MatchExpr { | 3892 | impl std::fmt::Display for MatchExpr { |
3866 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3893 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3867 | std::fmt::Display::fmt(self.syntax(), f) | 3894 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -3882,17 +3909,17 @@ impl std::fmt::Display for MatchGuard { | |||
3882 | std::fmt::Display::fmt(self.syntax(), f) | 3909 | std::fmt::Display::fmt(self.syntax(), f) |
3883 | } | 3910 | } |
3884 | } | 3911 | } |
3885 | impl std::fmt::Display for RecordLit { | 3912 | impl std::fmt::Display for RecordExpr { |
3886 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3913 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3887 | std::fmt::Display::fmt(self.syntax(), f) | 3914 | std::fmt::Display::fmt(self.syntax(), f) |
3888 | } | 3915 | } |
3889 | } | 3916 | } |
3890 | impl std::fmt::Display for RecordFieldList { | 3917 | impl std::fmt::Display for RecordExprFieldList { |
3891 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3918 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3892 | std::fmt::Display::fmt(self.syntax(), f) | 3919 | std::fmt::Display::fmt(self.syntax(), f) |
3893 | } | 3920 | } |
3894 | } | 3921 | } |
3895 | impl std::fmt::Display for RecordField { | 3922 | impl std::fmt::Display for RecordExprField { |
3896 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 3923 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3897 | std::fmt::Display::fmt(self.syntax(), f) | 3924 | std::fmt::Display::fmt(self.syntax(), f) |
3898 | } | 3925 | } |
@@ -3982,11 +4009,6 @@ impl std::fmt::Display for TuplePat { | |||
3982 | std::fmt::Display::fmt(self.syntax(), f) | 4009 | std::fmt::Display::fmt(self.syntax(), f) |
3983 | } | 4010 | } |
3984 | } | 4011 | } |
3985 | impl std::fmt::Display for TokenTree { | ||
3986 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
3987 | std::fmt::Display::fmt(self.syntax(), f) | ||
3988 | } | ||
3989 | } | ||
3990 | impl std::fmt::Display for MacroDef { | 4012 | impl std::fmt::Display for MacroDef { |
3991 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4013 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
3992 | std::fmt::Display::fmt(self.syntax(), f) | 4014 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4002,21 +4024,6 @@ impl std::fmt::Display for MacroStmts { | |||
4002 | std::fmt::Display::fmt(self.syntax(), f) | 4024 | std::fmt::Display::fmt(self.syntax(), f) |
4003 | } | 4025 | } |
4004 | } | 4026 | } |
4005 | impl std::fmt::Display for TypeParam { | ||
4006 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4007 | std::fmt::Display::fmt(self.syntax(), f) | ||
4008 | } | ||
4009 | } | ||
4010 | impl std::fmt::Display for LifetimeParam { | ||
4011 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4012 | std::fmt::Display::fmt(self.syntax(), f) | ||
4013 | } | ||
4014 | } | ||
4015 | impl std::fmt::Display for ConstParam { | ||
4016 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4017 | std::fmt::Display::fmt(self.syntax(), f) | ||
4018 | } | ||
4019 | } | ||
4020 | impl std::fmt::Display for TypeBound { | 4027 | impl std::fmt::Display for TypeBound { |
4021 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4028 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4022 | std::fmt::Display::fmt(self.syntax(), f) | 4029 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4037,16 +4044,6 @@ impl std::fmt::Display for LetStmt { | |||
4037 | std::fmt::Display::fmt(self.syntax(), f) | 4044 | std::fmt::Display::fmt(self.syntax(), f) |
4038 | } | 4045 | } |
4039 | } | 4046 | } |
4040 | impl std::fmt::Display for SelfParam { | ||
4041 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4042 | std::fmt::Display::fmt(self.syntax(), f) | ||
4043 | } | ||
4044 | } | ||
4045 | impl std::fmt::Display for Param { | ||
4046 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4047 | std::fmt::Display::fmt(self.syntax(), f) | ||
4048 | } | ||
4049 | } | ||
4050 | impl std::fmt::Display for PathSegment { | 4047 | impl std::fmt::Display for PathSegment { |
4051 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | 4048 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |
4052 | std::fmt::Display::fmt(self.syntax(), f) | 4049 | std::fmt::Display::fmt(self.syntax(), f) |
@@ -4072,13 +4069,3 @@ impl std::fmt::Display for ConstArg { | |||
4072 | std::fmt::Display::fmt(self.syntax(), f) | 4069 | std::fmt::Display::fmt(self.syntax(), f) |
4073 | } | 4070 | } |
4074 | } | 4071 | } |
4075 | impl std::fmt::Display for ExternItemList { | ||
4076 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4077 | std::fmt::Display::fmt(self.syntax(), f) | ||
4078 | } | ||
4079 | } | ||
4080 | impl std::fmt::Display for MetaItem { | ||
4081 | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
4082 | std::fmt::Display::fmt(self.syntax(), f) | ||
4083 | } | ||
4084 | } | ||
diff --git a/crates/ra_syntax/src/ast/make.rs b/crates/ra_syntax/src/ast/make.rs index 0ff69bc2d..509e8ae7a 100644 --- a/crates/ra_syntax/src/ast/make.rs +++ b/crates/ra_syntax/src/ast/make.rs | |||
@@ -64,18 +64,18 @@ pub fn use_item(use_tree: ast::UseTree) -> ast::Use { | |||
64 | ast_from_text(&format!("use {};", use_tree)) | 64 | ast_from_text(&format!("use {};", use_tree)) |
65 | } | 65 | } |
66 | 66 | ||
67 | pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordField { | 67 | pub fn record_field(name: ast::NameRef, expr: Option<ast::Expr>) -> ast::RecordExprField { |
68 | return match expr { | 68 | return match expr { |
69 | Some(expr) => from_text(&format!("{}: {}", name, expr)), | 69 | Some(expr) => from_text(&format!("{}: {}", name, expr)), |
70 | None => from_text(&name.to_string()), | 70 | None => from_text(&name.to_string()), |
71 | }; | 71 | }; |
72 | 72 | ||
73 | fn from_text(text: &str) -> ast::RecordField { | 73 | fn from_text(text: &str) -> ast::RecordExprField { |
74 | ast_from_text(&format!("fn f() {{ S {{ {}, }} }}", text)) | 74 | ast_from_text(&format!("fn f() {{ S {{ {}, }} }}", text)) |
75 | } | 75 | } |
76 | } | 76 | } |
77 | 77 | ||
78 | pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordFieldDef { | 78 | pub fn record_field_def(name: ast::NameRef, ty: ast::TypeRef) -> ast::RecordField { |
79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) | 79 | ast_from_text(&format!("struct S {{ {}: {}, }}", name, ty)) |
80 | } | 80 | } |
81 | 81 | ||
@@ -291,10 +291,10 @@ pub fn visibility_pub_crate() -> ast::Visibility { | |||
291 | pub fn fn_def( | 291 | pub fn fn_def( |
292 | visibility: Option<ast::Visibility>, | 292 | visibility: Option<ast::Visibility>, |
293 | fn_name: ast::Name, | 293 | fn_name: ast::Name, |
294 | type_params: Option<ast::TypeParamList>, | 294 | type_params: Option<ast::GenericParamList>, |
295 | params: ast::ParamList, | 295 | params: ast::ParamList, |
296 | body: ast::BlockExpr, | 296 | body: ast::BlockExpr, |
297 | ) -> ast::FnDef { | 297 | ) -> ast::Fn { |
298 | let type_params = | 298 | let type_params = |
299 | if let Some(type_params) = type_params { format!("<{}>", type_params) } else { "".into() }; | 299 | if let Some(type_params) = type_params { format!("<{}>", type_params) } else { "".into() }; |
300 | let visibility = match visibility { | 300 | let visibility = match visibility { |
diff --git a/crates/ra_syntax/src/ast/node_ext.rs b/crates/ra_syntax/src/ast/node_ext.rs index 242900643..bba7310ad 100644 --- a/crates/ra_syntax/src/ast/node_ext.rs +++ b/crates/ra_syntax/src/ast/node_ext.rs | |||
@@ -7,7 +7,7 @@ use itertools::Itertools; | |||
7 | use ra_parser::SyntaxKind; | 7 | use ra_parser::SyntaxKind; |
8 | 8 | ||
9 | use crate::{ | 9 | use crate::{ |
10 | ast::{self, support, AstNode, AttrInput, NameOwner, SyntaxNode}, | 10 | ast::{self, support, AstNode, NameOwner, SyntaxNode}, |
11 | SmolStr, SyntaxElement, SyntaxToken, T, | 11 | SmolStr, SyntaxElement, SyntaxToken, T, |
12 | }; | 12 | }; |
13 | 13 | ||
@@ -39,29 +39,23 @@ pub enum AttrKind { | |||
39 | 39 | ||
40 | impl ast::Attr { | 40 | impl ast::Attr { |
41 | pub fn as_simple_atom(&self) -> Option<SmolStr> { | 41 | pub fn as_simple_atom(&self) -> Option<SmolStr> { |
42 | match self.input() { | 42 | if self.eq_token().is_some() || self.token_tree().is_some() { |
43 | None => self.simple_name(), | 43 | return None; |
44 | Some(_) => None, | ||
45 | } | 44 | } |
45 | self.simple_name() | ||
46 | } | 46 | } |
47 | 47 | ||
48 | pub fn as_simple_call(&self) -> Option<(SmolStr, ast::TokenTree)> { | 48 | pub fn as_simple_call(&self) -> Option<(SmolStr, ast::TokenTree)> { |
49 | match self.input() { | 49 | let tt = self.token_tree()?; |
50 | Some(AttrInput::TokenTree(tt)) => Some((self.simple_name()?, tt)), | 50 | Some((self.simple_name()?, tt)) |
51 | _ => None, | ||
52 | } | ||
53 | } | 51 | } |
54 | 52 | ||
55 | pub fn as_simple_key_value(&self) -> Option<(SmolStr, SmolStr)> { | 53 | pub fn as_simple_key_value(&self) -> Option<(SmolStr, SmolStr)> { |
56 | match self.input() { | 54 | let lit = self.literal()?; |
57 | Some(AttrInput::Literal(lit)) => { | 55 | let key = self.simple_name()?; |
58 | let key = self.simple_name()?; | 56 | // FIXME: escape? raw string? |
59 | // FIXME: escape? raw string? | 57 | let value = lit.syntax().first_token()?.text().trim_matches('"').into(); |
60 | let value = lit.syntax().first_token()?.text().trim_matches('"').into(); | 58 | Some((key, value)) |
61 | Some((key, value)) | ||
62 | } | ||
63 | _ => None, | ||
64 | } | ||
65 | } | 59 | } |
66 | 60 | ||
67 | pub fn simple_name(&self) -> Option<SmolStr> { | 61 | pub fn simple_name(&self) -> Option<SmolStr> { |
@@ -141,7 +135,7 @@ impl ast::UseTreeList { | |||
141 | } | 135 | } |
142 | } | 136 | } |
143 | 137 | ||
144 | impl ast::ImplDef { | 138 | impl ast::Impl { |
145 | pub fn target_type(&self) -> Option<ast::TypeRef> { | 139 | pub fn target_type(&self) -> Option<ast::TypeRef> { |
146 | match self.target() { | 140 | match self.target() { |
147 | (Some(t), None) | (_, Some(t)) => Some(t), | 141 | (Some(t), None) | (_, Some(t)) => Some(t), |
@@ -166,16 +160,16 @@ impl ast::ImplDef { | |||
166 | 160 | ||
167 | #[derive(Debug, Clone, PartialEq, Eq)] | 161 | #[derive(Debug, Clone, PartialEq, Eq)] |
168 | pub enum StructKind { | 162 | pub enum StructKind { |
169 | Record(ast::RecordFieldDefList), | 163 | Record(ast::RecordFieldList), |
170 | Tuple(ast::TupleFieldDefList), | 164 | Tuple(ast::TupleFieldList), |
171 | Unit, | 165 | Unit, |
172 | } | 166 | } |
173 | 167 | ||
174 | impl StructKind { | 168 | impl StructKind { |
175 | fn from_node<N: AstNode>(node: &N) -> StructKind { | 169 | fn from_node<N: AstNode>(node: &N) -> StructKind { |
176 | if let Some(nfdl) = support::child::<ast::RecordFieldDefList>(node.syntax()) { | 170 | if let Some(nfdl) = support::child::<ast::RecordFieldList>(node.syntax()) { |
177 | StructKind::Record(nfdl) | 171 | StructKind::Record(nfdl) |
178 | } else if let Some(pfl) = support::child::<ast::TupleFieldDefList>(node.syntax()) { | 172 | } else if let Some(pfl) = support::child::<ast::TupleFieldList>(node.syntax()) { |
179 | StructKind::Tuple(pfl) | 173 | StructKind::Tuple(pfl) |
180 | } else { | 174 | } else { |
181 | StructKind::Unit | 175 | StructKind::Unit |
@@ -183,17 +177,17 @@ impl StructKind { | |||
183 | } | 177 | } |
184 | } | 178 | } |
185 | 179 | ||
186 | impl ast::StructDef { | 180 | impl ast::Struct { |
187 | pub fn kind(&self) -> StructKind { | 181 | pub fn kind(&self) -> StructKind { |
188 | StructKind::from_node(self) | 182 | StructKind::from_node(self) |
189 | } | 183 | } |
190 | } | 184 | } |
191 | 185 | ||
192 | impl ast::RecordField { | 186 | impl ast::RecordExprField { |
193 | pub fn for_field_name(field_name: &ast::NameRef) -> Option<ast::RecordField> { | 187 | pub fn for_field_name(field_name: &ast::NameRef) -> Option<ast::RecordExprField> { |
194 | let candidate = | 188 | let candidate = |
195 | field_name.syntax().parent().and_then(ast::RecordField::cast).or_else(|| { | 189 | field_name.syntax().parent().and_then(ast::RecordExprField::cast).or_else(|| { |
196 | field_name.syntax().ancestors().nth(4).and_then(ast::RecordField::cast) | 190 | field_name.syntax().ancestors().nth(4).and_then(ast::RecordExprField::cast) |
197 | })?; | 191 | })?; |
198 | if candidate.field_name().as_ref() == Some(field_name) { | 192 | if candidate.field_name().as_ref() == Some(field_name) { |
199 | Some(candidate) | 193 | Some(candidate) |
@@ -247,12 +241,12 @@ impl ast::RecordFieldPat { | |||
247 | } | 241 | } |
248 | } | 242 | } |
249 | 243 | ||
250 | impl ast::EnumVariant { | 244 | impl ast::Variant { |
251 | pub fn parent_enum(&self) -> ast::EnumDef { | 245 | pub fn parent_enum(&self) -> ast::Enum { |
252 | self.syntax() | 246 | self.syntax() |
253 | .parent() | 247 | .parent() |
254 | .and_then(|it| it.parent()) | 248 | .and_then(|it| it.parent()) |
255 | .and_then(ast::EnumDef::cast) | 249 | .and_then(ast::Enum::cast) |
256 | .expect("EnumVariants are always nested in Enums") | 250 | .expect("EnumVariants are always nested in Enums") |
257 | } | 251 | } |
258 | pub fn kind(&self) -> StructKind { | 252 | pub fn kind(&self) -> StructKind { |
@@ -473,18 +467,39 @@ impl ast::TokenTree { | |||
473 | } | 467 | } |
474 | } | 468 | } |
475 | 469 | ||
470 | impl ast::GenericParamList { | ||
471 | pub fn lifetime_params(&self) -> impl Iterator<Item = ast::LifetimeParam> { | ||
472 | self.generic_params().filter_map(|param| match param { | ||
473 | ast::GenericParam::LifetimeParam(it) => Some(it), | ||
474 | ast::GenericParam::TypeParam(_) | ast::GenericParam::ConstParam(_) => None, | ||
475 | }) | ||
476 | } | ||
477 | pub fn type_params(&self) -> impl Iterator<Item = ast::TypeParam> { | ||
478 | self.generic_params().filter_map(|param| match param { | ||
479 | ast::GenericParam::TypeParam(it) => Some(it), | ||
480 | ast::GenericParam::LifetimeParam(_) | ast::GenericParam::ConstParam(_) => None, | ||
481 | }) | ||
482 | } | ||
483 | pub fn const_params(&self) -> impl Iterator<Item = ast::ConstParam> { | ||
484 | self.generic_params().filter_map(|param| match param { | ||
485 | ast::GenericParam::ConstParam(it) => Some(it), | ||
486 | ast::GenericParam::TypeParam(_) | ast::GenericParam::LifetimeParam(_) => None, | ||
487 | }) | ||
488 | } | ||
489 | } | ||
490 | |||
476 | impl ast::DocCommentsOwner for ast::SourceFile {} | 491 | impl ast::DocCommentsOwner for ast::SourceFile {} |
477 | impl ast::DocCommentsOwner for ast::FnDef {} | 492 | impl ast::DocCommentsOwner for ast::Fn {} |
478 | impl ast::DocCommentsOwner for ast::StructDef {} | 493 | impl ast::DocCommentsOwner for ast::Struct {} |
479 | impl ast::DocCommentsOwner for ast::UnionDef {} | 494 | impl ast::DocCommentsOwner for ast::Union {} |
480 | impl ast::DocCommentsOwner for ast::RecordFieldDef {} | 495 | impl ast::DocCommentsOwner for ast::RecordField {} |
481 | impl ast::DocCommentsOwner for ast::TupleFieldDef {} | 496 | impl ast::DocCommentsOwner for ast::TupleField {} |
482 | impl ast::DocCommentsOwner for ast::EnumDef {} | 497 | impl ast::DocCommentsOwner for ast::Enum {} |
483 | impl ast::DocCommentsOwner for ast::EnumVariant {} | 498 | impl ast::DocCommentsOwner for ast::Variant {} |
484 | impl ast::DocCommentsOwner for ast::TraitDef {} | 499 | impl ast::DocCommentsOwner for ast::Trait {} |
485 | impl ast::DocCommentsOwner for ast::Module {} | 500 | impl ast::DocCommentsOwner for ast::Module {} |
486 | impl ast::DocCommentsOwner for ast::StaticDef {} | 501 | impl ast::DocCommentsOwner for ast::Static {} |
487 | impl ast::DocCommentsOwner for ast::ConstDef {} | 502 | impl ast::DocCommentsOwner for ast::Const {} |
488 | impl ast::DocCommentsOwner for ast::TypeAliasDef {} | 503 | impl ast::DocCommentsOwner for ast::TypeAlias {} |
489 | impl ast::DocCommentsOwner for ast::ImplDef {} | 504 | impl ast::DocCommentsOwner for ast::Impl {} |
490 | impl ast::DocCommentsOwner for ast::MacroCall {} | 505 | impl ast::DocCommentsOwner for ast::MacroCall {} |
diff --git a/crates/ra_syntax/src/ast/traits.rs b/crates/ra_syntax/src/ast/traits.rs index 9fe0b93c1..3a56b1674 100644 --- a/crates/ra_syntax/src/ast/traits.rs +++ b/crates/ra_syntax/src/ast/traits.rs | |||
@@ -9,12 +9,6 @@ use crate::{ | |||
9 | SyntaxToken, T, | 9 | SyntaxToken, T, |
10 | }; | 10 | }; |
11 | 11 | ||
12 | pub trait TypeAscriptionOwner: AstNode { | ||
13 | fn ascribed_type(&self) -> Option<ast::TypeRef> { | ||
14 | support::child(self.syntax()) | ||
15 | } | ||
16 | } | ||
17 | |||
18 | pub trait NameOwner: AstNode { | 12 | pub trait NameOwner: AstNode { |
19 | fn name(&self) -> Option<ast::Name> { | 13 | fn name(&self) -> Option<ast::Name> { |
20 | support::child(self.syntax()) | 14 | support::child(self.syntax()) |
@@ -49,8 +43,8 @@ pub trait ModuleItemOwner: AstNode { | |||
49 | } | 43 | } |
50 | } | 44 | } |
51 | 45 | ||
52 | pub trait TypeParamsOwner: AstNode { | 46 | pub trait GenericParamsOwner: AstNode { |
53 | fn type_param_list(&self) -> Option<ast::TypeParamList> { | 47 | fn generic_param_list(&self) -> Option<ast::GenericParamList> { |
54 | support::child(self.syntax()) | 48 | support::child(self.syntax()) |
55 | } | 49 | } |
56 | 50 | ||
diff --git a/crates/ra_syntax/src/lib.rs b/crates/ra_syntax/src/lib.rs index 219dd0b07..6203b6206 100644 --- a/crates/ra_syntax/src/lib.rs +++ b/crates/ra_syntax/src/lib.rs | |||
@@ -255,11 +255,11 @@ fn api_walkthrough() { | |||
255 | let mut func = None; | 255 | let mut func = None; |
256 | for item in file.items() { | 256 | for item in file.items() { |
257 | match item { | 257 | match item { |
258 | ast::Item::FnDef(f) => func = Some(f), | 258 | ast::Item::Fn(f) => func = Some(f), |
259 | _ => unreachable!(), | 259 | _ => unreachable!(), |
260 | } | 260 | } |
261 | } | 261 | } |
262 | let func: ast::FnDef = func.unwrap(); | 262 | let func: ast::Fn = func.unwrap(); |
263 | 263 | ||
264 | // Each AST node has a bunch of getters for children. All getters return | 264 | // Each AST node has a bunch of getters for children. All getters return |
265 | // `Option`s though, to account for incomplete code. Some getters are common | 265 | // `Option`s though, to account for incomplete code. Some getters are common |
@@ -316,7 +316,7 @@ fn api_walkthrough() { | |||
316 | ); | 316 | ); |
317 | 317 | ||
318 | // As well as some iterator helpers: | 318 | // As well as some iterator helpers: |
319 | let f = expr_syntax.ancestors().find_map(ast::FnDef::cast); | 319 | let f = expr_syntax.ancestors().find_map(ast::Fn::cast); |
320 | assert_eq!(f, Some(func)); | 320 | assert_eq!(f, Some(func)); |
321 | assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}'])); | 321 | assert!(expr_syntax.siblings_with_tokens(Direction::Next).any(|it| it.kind() == T!['}'])); |
322 | assert_eq!( | 322 | assert_eq!( |
diff --git a/crates/ra_syntax/src/parsing/text_tree_sink.rs b/crates/ra_syntax/src/parsing/text_tree_sink.rs index c6b30a02a..6d1828d20 100644 --- a/crates/ra_syntax/src/parsing/text_tree_sink.rs +++ b/crates/ra_syntax/src/parsing/text_tree_sink.rs | |||
@@ -146,8 +146,8 @@ fn n_attached_trivias<'a>( | |||
146 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, | 146 | trivias: impl Iterator<Item = (SyntaxKind, &'a str)>, |
147 | ) -> usize { | 147 | ) -> usize { |
148 | match kind { | 148 | match kind { |
149 | MACRO_CALL | CONST_DEF | TYPE_ALIAS_DEF | STRUCT_DEF | ENUM_DEF | ENUM_VARIANT | FN_DEF | 149 | MACRO_CALL | CONST | TYPE_ALIAS | STRUCT | ENUM | VARIANT | FN | TRAIT | MODULE |
150 | | TRAIT_DEF | MODULE | RECORD_FIELD_DEF | STATIC_DEF => { | 150 | | RECORD_FIELD | STATIC => { |
151 | let mut res = 0; | 151 | let mut res = 0; |
152 | let mut trivias = trivias.enumerate().peekable(); | 152 | let mut trivias = trivias.enumerate().peekable(); |
153 | 153 | ||
diff --git a/crates/ra_syntax/src/ptr.rs b/crates/ra_syntax/src/ptr.rs index 62f03e93d..ca7957747 100644 --- a/crates/ra_syntax/src/ptr.rs +++ b/crates/ra_syntax/src/ptr.rs | |||
@@ -98,7 +98,7 @@ fn test_local_syntax_ptr() { | |||
98 | use crate::{ast, AstNode, SourceFile}; | 98 | use crate::{ast, AstNode, SourceFile}; |
99 | 99 | ||
100 | let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); | 100 | let file = SourceFile::parse("struct Foo { f: u32, }").ok().unwrap(); |
101 | let field = file.syntax().descendants().find_map(ast::RecordFieldDef::cast).unwrap(); | 101 | let field = file.syntax().descendants().find_map(ast::RecordField::cast).unwrap(); |
102 | let ptr = SyntaxNodePtr::new(field.syntax()); | 102 | let ptr = SyntaxNodePtr::new(field.syntax()); |
103 | let field_syntax = ptr.to_node(file.syntax()); | 103 | let field_syntax = ptr.to_node(file.syntax()); |
104 | assert_eq!(field.syntax(), &field_syntax); | 104 | assert_eq!(field.syntax(), &field_syntax); |
diff --git a/crates/ra_syntax/src/validation.rs b/crates/ra_syntax/src/validation.rs index fdec48fb0..0325ab0b4 100644 --- a/crates/ra_syntax/src/validation.rs +++ b/crates/ra_syntax/src/validation.rs | |||
@@ -4,7 +4,7 @@ mod block; | |||
4 | 4 | ||
5 | use crate::{ | 5 | use crate::{ |
6 | ast, match_ast, AstNode, SyntaxError, | 6 | ast, match_ast, AstNode, SyntaxError, |
7 | SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST_DEF, FN_DEF, INT_NUMBER, STRING, TYPE_ALIAS_DEF}, | 7 | SyntaxKind::{BYTE, BYTE_STRING, CHAR, CONST, FN, INT_NUMBER, STRING, TYPE_ALIAS}, |
8 | SyntaxNode, SyntaxToken, TextSize, T, | 8 | SyntaxNode, SyntaxToken, TextSize, T, |
9 | }; | 9 | }; |
10 | use rustc_lexer::unescape::{ | 10 | use rustc_lexer::unescape::{ |
@@ -91,7 +91,7 @@ pub(crate) fn validate(root: &SyntaxNode) -> Vec<SyntaxError> { | |||
91 | ast::Literal(it) => validate_literal(it, &mut errors), | 91 | ast::Literal(it) => validate_literal(it, &mut errors), |
92 | ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors), | 92 | ast::BlockExpr(it) => block::validate_block_expr(it, &mut errors), |
93 | ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors), | 93 | ast::FieldExpr(it) => validate_numeric_name(it.name_ref(), &mut errors), |
94 | ast::RecordField(it) => validate_numeric_name(it.name_ref(), &mut errors), | 94 | ast::RecordExprField(it) => validate_numeric_name(it.name_ref(), &mut errors), |
95 | ast::Visibility(it) => validate_visibility(it, &mut errors), | 95 | ast::Visibility(it) => validate_visibility(it, &mut errors), |
96 | ast::RangeExpr(it) => validate_range_expr(it, &mut errors), | 96 | ast::RangeExpr(it) => validate_range_expr(it, &mut errors), |
97 | ast::PathSegment(it) => validate_path_keywords(it, &mut errors), | 97 | ast::PathSegment(it) => validate_path_keywords(it, &mut errors), |
@@ -200,11 +200,11 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) { | |||
200 | None => return, | 200 | None => return, |
201 | }; | 201 | }; |
202 | match parent.kind() { | 202 | match parent.kind() { |
203 | FN_DEF | CONST_DEF | TYPE_ALIAS_DEF => (), | 203 | FN | CONST | TYPE_ALIAS => (), |
204 | _ => return, | 204 | _ => return, |
205 | } | 205 | } |
206 | 206 | ||
207 | let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::ImplDef::cast) { | 207 | let impl_def = match parent.parent().and_then(|it| it.parent()).and_then(ast::Impl::cast) { |
208 | Some(it) => it, | 208 | Some(it) => it, |
209 | None => return, | 209 | None => return, |
210 | }; | 210 | }; |
diff --git a/crates/ra_syntax/src/validation/block.rs b/crates/ra_syntax/src/validation/block.rs index 2c08f7e6e..ad9901468 100644 --- a/crates/ra_syntax/src/validation/block.rs +++ b/crates/ra_syntax/src/validation/block.rs | |||
@@ -9,7 +9,7 @@ use crate::{ | |||
9 | pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) { | 9 | pub(crate) fn validate_block_expr(block: ast::BlockExpr, errors: &mut Vec<SyntaxError>) { |
10 | if let Some(parent) = block.syntax().parent() { | 10 | if let Some(parent) = block.syntax().parent() { |
11 | match parent.kind() { | 11 | match parent.kind() { |
12 | FN_DEF | EXPR_STMT | BLOCK_EXPR => return, | 12 | FN | EXPR_STMT | BLOCK_EXPR => return, |
13 | _ => {} | 13 | _ => {} |
14 | } | 14 | } |
15 | } | 15 | } |
diff --git a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast index 81f0f575c..bbbf496c8 100644 --- a/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast +++ b/crates/ra_syntax/test_data/parser/err/0000_struct_field_missing_comma.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..34 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..21 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "a" | 13 | [email protected] "a" |
14 | [email protected] ":" | 14 | [email protected] ":" |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "u32" | 20 | [email protected] "u32" |
21 | [email protected] "\n " | 21 | [email protected] "\n " |
22 | RECORD_FIELD_DEF@26..32 | 22 | [email protected] |
23 | [email protected] | 23 | [email protected] |
24 | [email protected] "b" | 24 | [email protected] "b" |
25 | [email protected] ":" | 25 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast index 97d0fe910..6dc73bfdb 100644 --- a/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast +++ b/crates/ra_syntax/test_data/parser/err/0001_item_recovery_in_file.rast | |||
@@ -5,13 +5,13 @@ [email protected] | |||
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "match" | 6 | [email protected] "match" |
7 | [email protected] "\n\n" | 7 | [email protected] "\n\n" |
8 | STRUCT_DEF@10..21 | 8 | [email protected] |
9 | [email protected] "struct" | 9 | [email protected] "struct" |
10 | [email protected] " " | 10 | [email protected] " " |
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "S" | 12 | [email protected] "S" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | RECORD_FIELD_DEF_[email protected] | 14 | [email protected] |
15 | [email protected] "{" | 15 | [email protected] "{" |
16 | [email protected] "}" | 16 | [email protected] "}" |
17 | error 0..0: expected an item | 17 | error 0..0: expected an item |
diff --git a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast index 21c255698..7763fad84 100644 --- a/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast +++ b/crates/ra_syntax/test_data/parser/err/0003_C++_semicolon.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..39 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..21 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "a" | 13 | [email protected] "a" |
14 | [email protected] ":" | 14 | [email protected] ":" |
@@ -20,7 +20,7 @@ [email protected] | |||
20 | [email protected] "i32" | 20 | [email protected] "i32" |
21 | [email protected] "," | 21 | [email protected] "," |
22 | [email protected] "\n " | 22 | [email protected] "\n " |
23 | RECORD_FIELD_DEF@27..36 | 23 | [email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "b" | 25 | [email protected] "b" |
26 | [email protected] ":" | 26 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast index 375ed45e0..4845a6563 100644 --- a/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0005_attribute_recover.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..31 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "#" | 4 | [email protected] "#" |
5 | [email protected] "[" | 5 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast index 2d6364998..5f85c3943 100644 --- a/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0006_named_field_recovery.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..73 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..21 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "f" | 13 | [email protected] "f" |
14 | [email protected] ":" | 14 | [email protected] ":" |
@@ -35,7 +35,7 @@ [email protected] | |||
35 | [email protected] | 35 | [email protected] |
36 | [email protected] "*" | 36 | [email protected] "*" |
37 | [email protected] "\n " | 37 | [email protected] "\n " |
38 | RECORD_FIELD_DEF@48..58 | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] "pub" | 40 | [email protected] "pub" |
41 | [email protected] " " | 41 | [email protected] " " |
@@ -50,7 +50,7 @@ [email protected] | |||
50 | [email protected] "u32" | 50 | [email protected] "u32" |
51 | [email protected] "," | 51 | [email protected] "," |
52 | [email protected] "\n " | 52 | [email protected] "\n " |
53 | RECORD_FIELD_DEF@64..70 | 53 | [email protected] |
54 | [email protected] | 54 | [email protected] |
55 | [email protected] "z" | 55 | [email protected] "z" |
56 | [email protected] ":" | 56 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast index b72c92c33..560bfd751 100644 --- a/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast +++ b/crates/ra_syntax/test_data/parser/err/0007_stray_curly_in_file.rast | |||
@@ -2,7 +2,7 @@ [email protected] | |||
2 | [email protected] | 2 | [email protected] |
3 | [email protected] "}" | 3 | [email protected] "}" |
4 | [email protected] "\n\n" | 4 | [email protected] "\n\n" |
5 | STRUCT_DEF@3..12 | 5 | [email protected] |
6 | [email protected] "struct" | 6 | [email protected] "struct" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | [email protected] | 8 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "}" | 13 | [email protected] "}" |
14 | [email protected] "\n\n" | 14 | [email protected] "\n\n" |
15 | FN_DEF@17..27 | 15 | [email protected] |
16 | [email protected] "fn" | 16 | [email protected] "fn" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast index 33953d8d7..1e9637c26 100644 --- a/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0008_item_block_recovery.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -58,7 +58,7 @@ [email protected] | |||
58 | [email protected] "\n" | 58 | [email protected] "\n" |
59 | [email protected] "}" | 59 | [email protected] "}" |
60 | [email protected] "\n\n" | 60 | [email protected] "\n\n" |
61 | FN_DEF@82..94 | 61 | [email protected] |
62 | [email protected] "fn" | 62 | [email protected] "fn" |
63 | [email protected] " " | 63 | [email protected] " " |
64 | [email protected] | 64 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast index aca02ece4..dacf71aa1 100644 --- a/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast +++ b/crates/ra_syntax/test_data/parser/err/0009_broken_struct_type_parameter.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] "90" | 10 | [email protected] "90" |
@@ -38,7 +38,7 @@ [email protected] | |||
38 | [email protected] "\n" | 38 | [email protected] "\n" |
39 | [email protected] "}" | 39 | [email protected] "}" |
40 | [email protected] "\n\n" | 40 | [email protected] "\n\n" |
41 | STRUCT_DEF@33..42 | 41 | [email protected] |
42 | [email protected] "struct" | 42 | [email protected] "struct" |
43 | [email protected] " " | 43 | [email protected] " " |
44 | [email protected] | 44 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast index 3bf57eacc..1c3e0f65b 100644 --- a/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast +++ b/crates/ra_syntax/test_data/parser/err/0010_unsafe_lambda_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..41 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast index 87c54c32c..b02d390af 100644 --- a/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast +++ b/crates/ra_syntax/test_data/parser/err/0011_extern_struct.rast | |||
@@ -3,7 +3,7 @@ [email protected] | |||
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "extern" | 4 | [email protected] "extern" |
5 | [email protected] " " | 5 | [email protected] " " |
6 | STRUCT_DEF@7..18 | 6 | [email protected] |
7 | [email protected] "struct" | 7 | [email protected] "struct" |
8 | [email protected] " " | 8 | [email protected] " " |
9 | [email protected] | 9 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast index e1e782f5f..d62906b99 100644 --- a/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast +++ b/crates/ra_syntax/test_data/parser/err/0012_broken_lambda.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..389 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] | 4 | [email protected] |
5 | [email protected] | 5 | [email protected] |
@@ -10,7 +10,7 @@ [email protected] | |||
10 | [email protected] | 10 | [email protected] |
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "process" | 12 | [email protected] "process" |
13 | TYP[email protected] | 13 | GENERIC[email protected] |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] "'a" | 16 | [email protected] "'a" |
diff --git a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast index 211e5fd46..3eef848fc 100644 --- a/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast +++ b/crates/ra_syntax/test_data/parser/err/0013_invalid_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..72 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "pub" | 4 | [email protected] "pub" |
5 | [email protected] " " | 5 | [email protected] " " |
@@ -7,10 +7,10 @@ [email protected] | |||
7 | [email protected] " " | 7 | [email protected] " " |
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "Cache" | 9 | [email protected] "Cache" |
10 | TUPLE_FIELD_DEF_[email protected] | 10 | [email protected] |
11 | [email protected] "(" | 11 | [email protected] "(" |
12 | [email protected] "\n " | 12 | [email protected] "\n " |
13 | TUPLE_FIELD_DEF@22..68 | 13 | [email protected] |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
@@ -47,7 +47,7 @@ [email protected] | |||
47 | [email protected] | 47 | [email protected] |
48 | [email protected] "@" | 48 | [email protected] "@" |
49 | [email protected] " " | 49 | [email protected] " " |
50 | TUPLE_FIELD_DEF@69..72 | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] | 53 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast index 9323b7890..a1f39b22a 100644 --- a/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast +++ b/crates/ra_syntax/test_data/parser/err/0014_where_no_bounds.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..22 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "foo" | 6 | [email protected] "foo" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rast b/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rast index b18378cff..a3c25b450 100644 --- a/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rast +++ b/crates/ra_syntax/test_data/parser/err/0015_curly_in_params.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..7 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast index 93434f34f..66157c3dc 100644 --- a/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast +++ b/crates/ra_syntax/test_data/parser/err/0016_missing_semi.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..55 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast index 628315c78..bb4a28f4e 100644 --- a/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast +++ b/crates/ra_syntax/test_data/parser/err/0017_incomplete_binexpr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..46 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast index a87e5061a..bc95b8512 100644 --- a/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast +++ b/crates/ra_syntax/test_data/parser/err/0018_incomplete_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..182 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@20..161 | 14 | [email protected] |
15 | [email protected] "fn" | 15 | [email protected] "fn" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -75,16 +75,16 @@ [email protected] | |||
75 | [email protected] "push" | 75 | [email protected] "push" |
76 | [email protected] | 76 | [email protected] |
77 | [email protected] "(" | 77 | [email protected] "(" |
78 | RECORD_LIT@111..154 | 78 | RECORD_EXPR@111..154 |
79 | [email protected] | 79 | [email protected] |
80 | [email protected] | 80 | [email protected] |
81 | [email protected] | 81 | [email protected] |
82 | [email protected] "ScopeData" | 82 | [email protected] "ScopeData" |
83 | [email protected] " " | 83 | [email protected] " " |
84 | [email protected] | 84 | RECORD_EXPR_[email protected] |
85 | [email protected] "{" | 85 | [email protected] "{" |
86 | [email protected] " " | 86 | [email protected] " " |
87 | [email protected] | 87 | RECORD_EXPR_[email protected] |
88 | [email protected] | 88 | [email protected] |
89 | [email protected] "parent" | 89 | [email protected] "parent" |
90 | [email protected] ":" | 90 | [email protected] ":" |
@@ -96,7 +96,7 @@ [email protected] | |||
96 | [email protected] "None" | 96 | [email protected] "None" |
97 | [email protected] "," | 97 | [email protected] "," |
98 | [email protected] " " | 98 | [email protected] " " |
99 | [email protected] | 99 | RECORD_EXPR_[email protected] |
100 | [email protected] | 100 | [email protected] |
101 | [email protected] "entries" | 101 | [email protected] "entries" |
102 | [email protected] ":" | 102 | [email protected] ":" |
@@ -116,7 +116,7 @@ [email protected] | |||
116 | [email protected] "\n " | 116 | [email protected] "\n " |
117 | [email protected] "}" | 117 | [email protected] "}" |
118 | [email protected] "\n\n " | 118 | [email protected] "\n\n " |
119 | FN_DEF@167..180 | 119 | [email protected] |
120 | [email protected] "fn" | 120 | [email protected] "fn" |
121 | [email protected] " " | 121 | [email protected] " " |
122 | [email protected] | 122 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast index 4ff27f5c8..f6fa964b7 100644 --- a/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0019_let_recover.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..138 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast index 5f3a31473..6f6feba5a 100644 --- a/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0020_fn_recover.rast | |||
@@ -1,8 +1,8 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..2 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] "\n\n" | 4 | [email protected] "\n\n" |
5 | FN_DEF@4..15 | 5 | [email protected] |
6 | [email protected] "fn" | 6 | [email protected] "fn" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | [email protected] | 8 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast index 1746bd3c1..ba4ce4795 100644 --- a/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast +++ b/crates/ra_syntax/test_data/parser/err/0021_incomplete_param.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..21 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast index 28146f44e..71fb19783 100644 --- a/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast +++ b/crates/ra_syntax/test_data/parser/err/0022_bad_exprs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..33 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -28,7 +28,7 @@ [email protected] | |||
28 | [email protected] | 28 | [email protected] |
29 | [email protected] "," | 29 | [email protected] "," |
30 | [email protected] " " | 30 | [email protected] " " |
31 | STRUCT_DEF@19..26 | 31 | [email protected] |
32 | [email protected] "struct" | 32 | [email protected] "struct" |
33 | [email protected] | 33 | [email protected] |
34 | [email protected] "," | 34 | [email protected] "," |
@@ -40,7 +40,7 @@ [email protected] | |||
40 | [email protected] " " | 40 | [email protected] " " |
41 | [email protected] "}" | 41 | [email protected] "}" |
42 | [email protected] "\n" | 42 | [email protected] "\n" |
43 | FN_DEF@34..68 | 43 | [email protected] |
44 | [email protected] "fn" | 44 | [email protected] "fn" |
45 | [email protected] " " | 45 | [email protected] " " |
46 | [email protected] | 46 | [email protected] |
@@ -75,7 +75,7 @@ [email protected] | |||
75 | [email protected] | 75 | [email protected] |
76 | [email protected] "," | 76 | [email protected] "," |
77 | [email protected] " " | 77 | [email protected] " " |
78 | IMPL_DEF@56..60 | 78 | [email protected] |
79 | [email protected] "impl" | 79 | [email protected] "impl" |
80 | [email protected] | 80 | [email protected] |
81 | [email protected] | 81 | [email protected] |
@@ -88,7 +88,7 @@ [email protected] | |||
88 | [email protected] " " | 88 | [email protected] " " |
89 | [email protected] "}" | 89 | [email protected] "}" |
90 | [email protected] "\n" | 90 | [email protected] "\n" |
91 | FN_DEF@69..111 | 91 | [email protected] |
92 | [email protected] "fn" | 92 | [email protected] "fn" |
93 | [email protected] " " | 93 | [email protected] " " |
94 | [email protected] | 94 | [email protected] |
@@ -133,7 +133,7 @@ [email protected] | |||
133 | [email protected] | 133 | [email protected] |
134 | [email protected] "," | 134 | [email protected] "," |
135 | [email protected] " " | 135 | [email protected] " " |
136 | TRAIT_DEF@98..104 | 136 | [email protected] |
137 | [email protected] "trait" | 137 | [email protected] "trait" |
138 | [email protected] | 138 | [email protected] |
139 | [email protected] "," | 139 | [email protected] "," |
diff --git a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast index 9ea9d715e..5ffefd742 100644 --- a/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast +++ b/crates/ra_syntax/test_data/parser/err/0023_mismatched_paren.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..55 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast index 48610a5eb..4c2d1ad68 100644 --- a/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast +++ b/crates/ra_syntax/test_data/parser/err/0024_many_type_parens.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..53 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "f" | 6 | [email protected] "f" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -39,7 +39,7 @@ [email protected] | |||
39 | [email protected] "(" | 39 | [email protected] "(" |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] "for" | 41 | [email protected] "for" |
42 | TYP[email protected] | 42 | GENERIC[email protected] |
43 | [email protected] "<" | 43 | [email protected] "<" |
44 | [email protected] | 44 | [email protected] |
45 | [email protected] "\'a" | 45 | [email protected] "\'a" |
@@ -65,7 +65,7 @@ [email protected] | |||
65 | [email protected] "{" | 65 | [email protected] "{" |
66 | [email protected] "}" | 66 | [email protected] "}" |
67 | [email protected] "\n\n" | 67 | [email protected] "\n\n" |
68 | FN_DEF@55..239 | 68 | [email protected] |
69 | [email protected] "fn" | 69 | [email protected] "fn" |
70 | [email protected] " " | 70 | [email protected] " " |
71 | [email protected] | 71 | [email protected] |
@@ -122,7 +122,7 @@ [email protected] | |||
122 | [email protected] "(" | 122 | [email protected] "(" |
123 | [email protected] | 123 | [email protected] |
124 | [email protected] "for" | 124 | [email protected] "for" |
125 | TYP[email protected] | 125 | GENERIC[email protected] |
126 | [email protected] "<" | 126 | [email protected] "<" |
127 | [email protected] | 127 | [email protected] |
128 | [email protected] "\'a" | 128 | [email protected] "\'a" |
@@ -242,7 +242,7 @@ [email protected] | |||
242 | [email protected] "(" | 242 | [email protected] "(" |
243 | [email protected] | 243 | [email protected] |
244 | [email protected] "for" | 244 | [email protected] "for" |
245 | TYP[email protected] | 245 | GENERIC[email protected] |
246 | [email protected] "<" | 246 | [email protected] "<" |
247 | [email protected] | 247 | [email protected] |
248 | [email protected] "\'a" | 248 | [email protected] "\'a" |
diff --git a/crates/ra_syntax/test_data/parser/err/0025_nope.rast b/crates/ra_syntax/test_data/parser/err/0025_nope.rast index 88b086daf..fca646557 100644 --- a/crates/ra_syntax/test_data/parser/err/0025_nope.rast +++ b/crates/ra_syntax/test_data/parser/err/0025_nope.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..574 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,26 +11,26 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | ENUM_DEF@16..152 | 14 | [email protected] |
15 | [email protected] "enum" | 15 | [email protected] "enum" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "Test" | 18 | [email protected] "Test" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | ENUM_[email protected] | 20 | [email protected] |
21 | [email protected] "{" | 21 | [email protected] "{" |
22 | [email protected] "\n " | 22 | [email protected] "\n " |
23 | ENUM_[email protected] | 23 | [email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "Var1" | 25 | [email protected] "Var1" |
26 | [email protected] "," | 26 | [email protected] "," |
27 | [email protected] "\n " | 27 | [email protected] "\n " |
28 | ENUM_[email protected] | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "Var2" | 30 | [email protected] "Var2" |
31 | TUPLE_FIELD_DEF_[email protected] | 31 | [email protected] |
32 | [email protected] "(" | 32 | [email protected] "(" |
33 | TUPLE_FIELD_DEF@55..61 | 33 | [email protected] |
34 | [email protected] | 34 | [email protected] |
35 | [email protected] | 35 | [email protected] |
36 | [email protected] | 36 | [email protected] |
@@ -39,14 +39,14 @@ [email protected] | |||
39 | [email protected] ")" | 39 | [email protected] ")" |
40 | [email protected] "," | 40 | [email protected] "," |
41 | [email protected] "\n " | 41 | [email protected] "\n " |
42 | ENUM_[email protected] | 42 | [email protected] |
43 | [email protected] | 43 | [email protected] |
44 | [email protected] "Var3" | 44 | [email protected] "Var3" |
45 | [email protected] " " | 45 | [email protected] " " |
46 | RECORD_FIELD_DEF_[email protected] | 46 | [email protected] |
47 | [email protected] "{" | 47 | [email protected] "{" |
48 | [email protected] "\n " | 48 | [email protected] "\n " |
49 | RECORD_FIELD_DEF@91..95 | 49 | [email protected] |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] "abc" | 51 | [email protected] "abc" |
52 | [email protected] ":" | 52 | [email protected] ":" |
@@ -79,39 +79,39 @@ [email protected] | |||
79 | [email protected] "1" | 79 | [email protected] "1" |
80 | [email protected] ";" | 80 | [email protected] ";" |
81 | [email protected] "\n " | 81 | [email protected] "\n " |
82 | ENUM_DEF@191..223 | 82 | [email protected] |
83 | [email protected] "enum" | 83 | [email protected] "enum" |
84 | [email protected] " " | 84 | [email protected] " " |
85 | [email protected] | 85 | [email protected] |
86 | [email protected] "Test2" | 86 | [email protected] "Test2" |
87 | [email protected] " " | 87 | [email protected] " " |
88 | ENUM_[email protected] | 88 | [email protected] |
89 | [email protected] "{" | 89 | [email protected] "{" |
90 | [email protected] "\n " | 90 | [email protected] "\n " |
91 | ENUM_[email protected] | 91 | [email protected] |
92 | [email protected] | 92 | [email protected] |
93 | [email protected] "Fine" | 93 | [email protected] "Fine" |
94 | [email protected] "," | 94 | [email protected] "," |
95 | [email protected] "\n " | 95 | [email protected] "\n " |
96 | [email protected] "}" | 96 | [email protected] "}" |
97 | [email protected] "\n\n " | 97 | [email protected] "\n\n " |
98 | ENUM_DEF@229..300 | 98 | [email protected] |
99 | [email protected] "enum" | 99 | [email protected] "enum" |
100 | [email protected] " " | 100 | [email protected] " " |
101 | [email protected] | 101 | [email protected] |
102 | [email protected] "Test3" | 102 | [email protected] "Test3" |
103 | [email protected] " " | 103 | [email protected] " " |
104 | ENUM_[email protected] | 104 | [email protected] |
105 | [email protected] "{" | 105 | [email protected] "{" |
106 | [email protected] "\n " | 106 | [email protected] "\n " |
107 | ENUM_[email protected] | 107 | [email protected] |
108 | [email protected] | 108 | [email protected] |
109 | [email protected] "StillFine" | 109 | [email protected] "StillFine" |
110 | [email protected] " " | 110 | [email protected] " " |
111 | RECORD_FIELD_DEF_[email protected] | 111 | [email protected] |
112 | [email protected] "{" | 112 | [email protected] "{" |
113 | [email protected] "\n " | 113 | [email protected] "\n " |
114 | RECORD_FIELD_DEF@274..282 | 114 | [email protected] |
115 | [email protected] | 115 | [email protected] |
116 | [email protected] "def" | 116 | [email protected] "def" |
117 | [email protected] ":" | 117 | [email protected] ":" |
@@ -132,7 +132,7 @@ [email protected] | |||
132 | [email protected] | 132 | [email protected] |
133 | [email protected] "{" | 133 | [email protected] "{" |
134 | [email protected] "\n " | 134 | [email protected] "\n " |
135 | ENUM_DEF@316..453 | 135 | [email protected] |
136 | [email protected] "// fail again" | 136 | [email protected] "// fail again" |
137 | [email protected] "\n " | 137 | [email protected] "\n " |
138 | [email protected] "enum" | 138 | [email protected] "enum" |
@@ -140,15 +140,15 @@ [email protected] | |||
140 | [email protected] | 140 | [email protected] |
141 | [email protected] "Test4" | 141 | [email protected] "Test4" |
142 | [email protected] " " | 142 | [email protected] " " |
143 | ENUM_[email protected] | 143 | [email protected] |
144 | [email protected] "{" | 144 | [email protected] "{" |
145 | [email protected] "\n " | 145 | [email protected] "\n " |
146 | ENUM_[email protected] | 146 | [email protected] |
147 | [email protected] | 147 | [email protected] |
148 | [email protected] "Nope" | 148 | [email protected] "Nope" |
149 | TUPLE_FIELD_DEF_[email protected] | 149 | [email protected] |
150 | [email protected] "(" | 150 | [email protected] "(" |
151 | TUPLE_FIELD_DEF@368..371 | 151 | [email protected] |
152 | [email protected] | 152 | [email protected] |
153 | [email protected] | 153 | [email protected] |
154 | [email protected] | 154 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast index 254ff546a..7e4b11c27 100644 --- a/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0026_imp_recovery.rast | |||
@@ -1,7 +1,7 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..14 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | TYP[email protected] | 4 | GENERIC[email protected] |
5 | [email protected] "<" | 5 | [email protected] "<" |
6 | [email protected] | 6 | [email protected] |
7 | [email protected] | 7 | [email protected] |
@@ -17,9 +17,9 @@ [email protected] | |||
17 | [email protected] "Clone" | 17 | [email protected] "Clone" |
18 | [email protected] ">" | 18 | [email protected] ">" |
19 | [email protected] "\n" | 19 | [email protected] "\n" |
20 | IMPL_DEF@15..37 | 20 | [email protected] |
21 | [email protected] "impl" | 21 | [email protected] "impl" |
22 | TYP[email protected] | 22 | GENERIC[email protected] |
23 | [email protected] "<" | 23 | [email protected] "<" |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] | 25 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast index 4d6461d1e..a8e42e6ea 100644 --- a/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast +++ b/crates/ra_syntax/test_data/parser/err/0027_incomplere_where_for.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..29 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -13,7 +13,7 @@ [email protected] | |||
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "for" | 15 | [email protected] "for" |
16 | TYP[email protected] | 16 | GENERIC[email protected] |
17 | [email protected] "<" | 17 | [email protected] "<" |
18 | [email protected] | 18 | [email protected] |
19 | [email protected] "\'a" | 19 | [email protected] "\'a" |
diff --git a/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast b/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast index 0da8f59f0..bfcd0149e 100644 --- a/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast +++ b/crates/ra_syntax/test_data/parser/err/0029_field_completion.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..23 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast index 515819e42..55ff3943f 100644 --- a/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0031_block_inner_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..349 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast index c6859eca8..ec9f556aa 100644 --- a/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0032_match_arms_inner_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..292 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast index 53e445459..063532e02 100644 --- a/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast +++ b/crates/ra_syntax/test_data/parser/err/0033_match_arms_outer_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..88 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast index 1b2ac5011..303a49576 100644 --- a/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast +++ b/crates/ra_syntax/test_data/parser/err/0034_bad_box_pattern.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..89 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast index 0415085b0..2f03709eb 100644 --- a/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast +++ b/crates/ra_syntax/test_data/parser/err/0035_use_recover.rast | |||
@@ -34,7 +34,7 @@ [email protected] | |||
34 | [email protected] | 34 | [email protected] |
35 | [email protected] "use" | 35 | [email protected] "use" |
36 | [email protected] "\n" | 36 | [email protected] "\n" |
37 | FN_DEF@38..47 | 37 | [email protected] |
38 | [email protected] "fn" | 38 | [email protected] "fn" |
39 | [email protected] " " | 39 | [email protected] " " |
40 | [email protected] | 40 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast index bc446e3df..faf87d6e5 100644 --- a/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast +++ b/crates/ra_syntax/test_data/parser/err/0037_visibility_in_traits.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..117 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -17,7 +17,7 @@ [email protected] | |||
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "{" | 18 | [email protected] "{" |
19 | [email protected] "\n " | 19 | [email protected] "\n " |
20 | FN_DEF@20..31 | 20 | [email protected] |
21 | [email protected] "fn" | 21 | [email protected] "fn" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] | 23 | [email protected] |
@@ -30,7 +30,7 @@ [email protected] | |||
30 | [email protected] "{" | 30 | [email protected] "{" |
31 | [email protected] "}" | 31 | [email protected] "}" |
32 | [email protected] "\n " | 32 | [email protected] "\n " |
33 | FN_DEF@36..51 | 33 | [email protected] |
34 | [email protected] | 34 | [email protected] |
35 | [email protected] "pub" | 35 | [email protected] "pub" |
36 | [email protected] " " | 36 | [email protected] " " |
@@ -46,7 +46,7 @@ [email protected] | |||
46 | [email protected] "{" | 46 | [email protected] "{" |
47 | [email protected] "}" | 47 | [email protected] "}" |
48 | [email protected] "\n " | 48 | [email protected] "\n " |
49 | TYPE_ALIAS_DEF@56..81 | 49 | [email protected] |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] "pub" | 51 | [email protected] "pub" |
52 | [email protected] "(" | 52 | [email protected] "(" |
@@ -65,7 +65,7 @@ [email protected] | |||
65 | [email protected] ")" | 65 | [email protected] ")" |
66 | [email protected] ";" | 66 | [email protected] ";" |
67 | [email protected] "\n " | 67 | [email protected] "\n " |
68 | CONST_DEF@86..115 | 68 | [email protected] |
69 | [email protected] | 69 | [email protected] |
70 | [email protected] "pub" | 70 | [email protected] "pub" |
71 | [email protected] "(" | 71 | [email protected] "(" |
diff --git a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast index 21db9ee85..bed7ad6c3 100644 --- a/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast +++ b/crates/ra_syntax/test_data/parser/err/0038_endless_inclusive_range.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..32 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast index ec950381b..a98c31b0c 100644 --- a/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast +++ b/crates/ra_syntax/test_data/parser/err/0039_lambda_recovery.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..82 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0043_default_const.rast b/crates/ra_syntax/test_data/parser/err/0043_default_const.rast index 6ca1a4870..51ad2a846 100644 --- a/crates/ra_syntax/test_data/parser/err/0043_default_const.rast +++ b/crates/ra_syntax/test_data/parser/err/0043_default_const.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..38 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -14,7 +14,7 @@ [email protected] | |||
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "default" | 15 | [email protected] "default" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | CONST_DEF@20..36 | 17 | [email protected] |
18 | [email protected] "const" | 18 | [email protected] "const" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast b/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast index cb90f28bc..082625c13 100644 --- a/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast +++ b/crates/ra_syntax/test_data/parser/err/0044_unexpected_for_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..30 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -9,7 +9,7 @@ [email protected] | |||
9 | [email protected] " " | 9 | [email protected] " " |
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "for" | 11 | [email protected] "for" |
12 | TYP[email protected] | 12 | GENERIC[email protected] |
13 | [email protected] "<" | 13 | [email protected] "<" |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "\'a" | 15 | [email protected] "\'a" |
@@ -26,7 +26,7 @@ [email protected] | |||
26 | [email protected] "u32" | 26 | [email protected] "u32" |
27 | [email protected] ";" | 27 | [email protected] ";" |
28 | [email protected] "\n" | 28 | [email protected] "\n" |
29 | TYPE_ALIAS_DEF@31..64 | 29 | [email protected] |
30 | [email protected] "type" | 30 | [email protected] "type" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
@@ -36,7 +36,7 @@ [email protected] | |||
36 | [email protected] " " | 36 | [email protected] " " |
37 | [email protected] | 37 | [email protected] |
38 | [email protected] "for" | 38 | [email protected] "for" |
39 | TYP[email protected] | 39 | GENERIC[email protected] |
40 | [email protected] "<" | 40 | [email protected] "<" |
41 | [email protected] | 41 | [email protected] |
42 | [email protected] "\'a" | 42 | [email protected] "\'a" |
@@ -57,7 +57,7 @@ [email protected] | |||
57 | [email protected] ")" | 57 | [email protected] ")" |
58 | [email protected] ";" | 58 | [email protected] ";" |
59 | [email protected] "\n" | 59 | [email protected] "\n" |
60 | TYPE_ALIAS_DEF@65..95 | 60 | [email protected] |
61 | [email protected] "type" | 61 | [email protected] "type" |
62 | [email protected] " " | 62 | [email protected] " " |
63 | [email protected] | 63 | [email protected] |
@@ -67,7 +67,7 @@ [email protected] | |||
67 | [email protected] " " | 67 | [email protected] " " |
68 | [email protected] | 68 | [email protected] |
69 | [email protected] "for" | 69 | [email protected] "for" |
70 | TYP[email protected] | 70 | GENERIC[email protected] |
71 | [email protected] "<" | 71 | [email protected] "<" |
72 | [email protected] | 72 | [email protected] |
73 | [email protected] "\'a" | 73 | [email protected] "\'a" |
@@ -83,7 +83,7 @@ [email protected] | |||
83 | [email protected] "]" | 83 | [email protected] "]" |
84 | [email protected] ";" | 84 | [email protected] ";" |
85 | [email protected] "\n" | 85 | [email protected] "\n" |
86 | TYPE_ALIAS_DEF@96..149 | 86 | [email protected] |
87 | [email protected] "type" | 87 | [email protected] "type" |
88 | [email protected] " " | 88 | [email protected] " " |
89 | [email protected] | 89 | [email protected] |
@@ -93,7 +93,7 @@ [email protected] | |||
93 | [email protected] " " | 93 | [email protected] " " |
94 | [email protected] | 94 | [email protected] |
95 | [email protected] "for" | 95 | [email protected] "for" |
96 | TYP[email protected] | 96 | GENERIC[email protected] |
97 | [email protected] "<" | 97 | [email protected] "<" |
98 | [email protected] | 98 | [email protected] |
99 | [email protected] "\'a" | 99 | [email protected] "\'a" |
@@ -101,7 +101,7 @@ [email protected] | |||
101 | [email protected] " " | 101 | [email protected] " " |
102 | [email protected] | 102 | [email protected] |
103 | [email protected] "for" | 103 | [email protected] "for" |
104 | TYP[email protected] | 104 | GENERIC[email protected] |
105 | [email protected] "<" | 105 | [email protected] "<" |
106 | [email protected] | 106 | [email protected] |
107 | [email protected] "\'b" | 107 | [email protected] "\'b" |
@@ -136,12 +136,12 @@ [email protected] | |||
136 | [email protected] ")" | 136 | [email protected] ")" |
137 | [email protected] ";" | 137 | [email protected] ";" |
138 | [email protected] "\n" | 138 | [email protected] "\n" |
139 | FN_DEF@150..238 | 139 | [email protected] |
140 | [email protected] "fn" | 140 | [email protected] "fn" |
141 | [email protected] " " | 141 | [email protected] " " |
142 | [email protected] | 142 | [email protected] |
143 | [email protected] "for_for_for" | 143 | [email protected] "for_for_for" |
144 | TYP[email protected] | 144 | GENERIC[email protected] |
145 | [email protected] "<" | 145 | [email protected] "<" |
146 | [email protected] | 146 | [email protected] |
147 | [email protected] | 147 | [email protected] |
@@ -156,7 +156,7 @@ [email protected] | |||
156 | [email protected] "\n " | 156 | [email protected] "\n " |
157 | [email protected] | 157 | [email protected] |
158 | [email protected] "for" | 158 | [email protected] "for" |
159 | TYP[email protected] | 159 | GENERIC[email protected] |
160 | [email protected] "<" | 160 | [email protected] "<" |
161 | [email protected] | 161 | [email protected] |
162 | [email protected] "\'a" | 162 | [email protected] "\'a" |
@@ -164,7 +164,7 @@ [email protected] | |||
164 | [email protected] " " | 164 | [email protected] " " |
165 | [email protected] | 165 | [email protected] |
166 | [email protected] "for" | 166 | [email protected] "for" |
167 | TYP[email protected] | 167 | GENERIC[email protected] |
168 | [email protected] "<" | 168 | [email protected] "<" |
169 | [email protected] | 169 | [email protected] |
170 | [email protected] "\'b" | 170 | [email protected] "\'b" |
@@ -172,7 +172,7 @@ [email protected] | |||
172 | [email protected] " " | 172 | [email protected] " " |
173 | [email protected] | 173 | [email protected] |
174 | [email protected] "for" | 174 | [email protected] "for" |
175 | TYP[email protected] | 175 | GENERIC[email protected] |
176 | [email protected] "<" | 176 | [email protected] "<" |
177 | [email protected] | 177 | [email protected] |
178 | [email protected] "\'c" | 178 | [email protected] "\'c" |
diff --git a/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast b/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast index e46456384..df29017e7 100644 --- a/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast +++ b/crates/ra_syntax/test_data/parser/err/0163_weird_blocks.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..82 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/fragments/item/ok/0000_fn.rast b/crates/ra_syntax/test_data/parser/fragments/item/ok/0000_fn.rast index f1e78f388..93c429e12 100644 --- a/crates/ra_syntax/test_data/parser/fragments/item/ok/0000_fn.rast +++ b/crates/ra_syntax/test_data/parser/fragments/item/ok/0000_fn.rast | |||
@@ -1,4 +1,4 @@ | |||
1 | FN_DEF@0..11 | 1 | [email protected] |
2 | [email protected] "fn" | 2 | [email protected] "fn" |
3 | [email protected] " " | 3 | [email protected] " " |
4 | [email protected] | 4 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs b/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs index 0e6e0ccc3..f1d0dc343 100644 --- a/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs +++ b/crates/ra_syntax/test_data/parser/fuzz-failures/0000.rs | |||
@@ -86,7 +86,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax | |||
86 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { | 86 | fn reparser(node: SyntaxNodeRef) -> Option<fn(&mut Parser)> { |
87 | let res = match node.kind() { | 87 | let res = match node.kind() { |
88 | BLOCK => grammar::block, | 88 | BLOCK => grammar::block, |
89 | RECORD_FIELD_DEF_LIST => grammar::record_field_def_list, | 89 | RECORD_FIELD_LIST => grammar::record_field_list, |
90 | _ => return None, | 90 | _ => return None, |
91 | }; | 91 | }; |
92 | Some(res) | 92 | Some(res) |
@@ -138,7 +138,7 @@ fn find_reparsable_node(node: SyntaxNodeRef, range: TextRange) -> Option<(Syntax | |||
138 | let res = match node.kind() { | 138 | let res = match node.kind() { |
139 | ; | 139 | ; |
140 | let end = u32::from(range.end()) as usize; | 140 | let end = u32::from(range.end()) as usize; |
141 | text.replaT => grammar::record_field_def_list, | 141 | text.replaT => grammar::record_field_list, |
142 | _ => return None, | 142 | _ => return None, |
143 | }; | 143 | }; |
144 | Some(res) | 144 | Some(res) |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast index bf70ebca4..0b9bbec07 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0001_array_type_missing_semi.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast index 75668c818..a4271fc87 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0002_misplaced_label_err.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..29 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -17,7 +17,7 @@ [email protected] | |||
17 | [email protected] "\'loop" | 17 | [email protected] "\'loop" |
18 | [email protected] ":" | 18 | [email protected] ":" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | IMPL_DEF@23..27 | 20 | [email protected] |
21 | [email protected] "impl" | 21 | [email protected] "impl" |
22 | [email protected] "\n" | 22 | [email protected] "\n" |
23 | [email protected] "}" | 23 | [email protected] "}" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast index 95bcc3c0a..2409eefe7 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0003_pointer_type_no_mutability.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..13 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast index 2d0253aa0..29d6b3974 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0004_impl_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "}" | 13 | [email protected] "}" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | IMPL_DEF@13..33 | 15 | [email protected] |
16 | [email protected] "impl" | 16 | [email protected] "impl" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
@@ -33,10 +33,10 @@ [email protected] | |||
33 | [email protected] "{" | 33 | [email protected] "{" |
34 | [email protected] "}" | 34 | [email protected] "}" |
35 | [email protected] "\n" | 35 | [email protected] "\n" |
36 | IMPL_DEF@34..38 | 36 | [email protected] |
37 | [email protected] "impl" | 37 | [email protected] "impl" |
38 | [email protected] " " | 38 | [email protected] " " |
39 | IMPL_DEF@39..54 | 39 | [email protected] |
40 | [email protected] "impl" | 40 | [email protected] "impl" |
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] | 42 | [email protected] |
@@ -49,7 +49,7 @@ [email protected] | |||
49 | [email protected] "{" | 49 | [email protected] "{" |
50 | [email protected] "}" | 50 | [email protected] "}" |
51 | [email protected] "\n" | 51 | [email protected] "\n" |
52 | IMPL_DEF@55..70 | 52 | [email protected] |
53 | [email protected] "impl" | 53 | [email protected] "impl" |
54 | [email protected] " " | 54 | [email protected] " " |
55 | [email protected] | 55 | [email protected] |
@@ -60,7 +60,7 @@ [email protected] | |||
60 | [email protected] " " | 60 | [email protected] " " |
61 | [email protected] "for" | 61 | [email protected] "for" |
62 | [email protected] " " | 62 | [email protected] " " |
63 | IMPL_DEF@71..86 | 63 | [email protected] |
64 | [email protected] "impl" | 64 | [email protected] "impl" |
65 | [email protected] " " | 65 | [email protected] " " |
66 | [email protected] | 66 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast index 90202d764..776022fd9 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0005_fn_pointer_type_missing_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..15 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast index c789e8d82..cc0f8bcaf 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0006_unsafe_block_in_mod.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..10 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] "}" | 20 | [email protected] "}" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | FN_DEF@22..32 | 22 | [email protected] |
23 | [email protected] "fn" | 23 | [email protected] "fn" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | [email protected] | 25 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast index cd24313d4..3f3a7f1b9 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0007_async_without_semicolon.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..29 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast index c5fa7a404..63a10127d 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0008_pub_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast index 4e3fa704e..8fd8d5e59 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0009_attr_on_expr_not_allowed.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..47 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast index e1abc5633..fa14e1e6d 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_bad_tuple_index_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..46 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast index 53f7ebaf9..a6e6552a9 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0010_wrong_order_fns.rast | |||
@@ -2,7 +2,7 @@ [email protected] | |||
2 | [email protected] | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | FN_DEF@7..24 | 5 | [email protected] |
6 | [email protected] "async" | 6 | [email protected] "async" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | [email protected] "fn" | 8 | [email protected] "fn" |
@@ -17,7 +17,7 @@ [email protected] | |||
17 | [email protected] "{" | 17 | [email protected] "{" |
18 | [email protected] "}" | 18 | [email protected] "}" |
19 | [email protected] "\n" | 19 | [email protected] "\n" |
20 | CONST_DEF@25..46 | 20 | [email protected] |
21 | [email protected] "unsafe" | 21 | [email protected] "unsafe" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] "const" | 23 | [email protected] "const" |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast index ebcc26e0d..8d761b907 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0013_static_underscore.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STATIC_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "static" | 3 | [email protected] "static" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast index 5501dc5a6..acd72094b 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_default_fn_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..61 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -14,7 +14,7 @@ [email protected] | |||
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "default" | 15 | [email protected] "default" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | TYPE_ALIAS_DEF@22..35 | 17 | [email protected] |
18 | [email protected] "type" | 18 | [email protected] "type" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | [email protected] |
@@ -35,7 +35,7 @@ [email protected] | |||
35 | [email protected] | 35 | [email protected] |
36 | [email protected] "default" | 36 | [email protected] "default" |
37 | [email protected] " " | 37 | [email protected] " " |
38 | FN_DEF@48..59 | 38 | [email protected] |
39 | [email protected] "fn" | 39 | [email protected] "fn" |
40 | [email protected] " " | 40 | [email protected] " " |
41 | [email protected] | 41 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast index a9de44b57..a81c442c0 100644 --- a/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast +++ b/crates/ra_syntax/test_data/parser/inline/err/0014_record_literal_before_ellipsis_recovery.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..44 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,16 +11,16 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | RECORD_LIT@16..42 | 14 | RECORD_EXPR@16..42 |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "S" | 18 | [email protected] "S" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | RECORD_EXPR_[email protected] |
21 | [email protected] "{" | 21 | [email protected] "{" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] | 23 | RECORD_EXPR_[email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "field" | 25 | [email protected] "field" |
26 | [email protected] " " | 26 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast index f422acdda..c7289e400 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0001_trait_item_list.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..82 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | TYPE_ALIAS_DEF@13..27 | 14 | [email protected] |
15 | [email protected] "type" | 15 | [email protected] "type" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -27,7 +27,7 @@ [email protected] | |||
27 | [email protected] "Clone" | 27 | [email protected] "Clone" |
28 | [email protected] ";" | 28 | [email protected] ";" |
29 | [email protected] "\n " | 29 | [email protected] "\n " |
30 | CONST_DEF@32..45 | 30 | [email protected] |
31 | [email protected] "const" | 31 | [email protected] "const" |
32 | [email protected] " " | 32 | [email protected] " " |
33 | [email protected] | 33 | [email protected] |
@@ -41,7 +41,7 @@ [email protected] | |||
41 | [email protected] "i32" | 41 | [email protected] "i32" |
42 | [email protected] ";" | 42 | [email protected] ";" |
43 | [email protected] "\n " | 43 | [email protected] "\n " |
44 | FN_DEF@50..61 | 44 | [email protected] |
45 | [email protected] "fn" | 45 | [email protected] "fn" |
46 | [email protected] " " | 46 | [email protected] " " |
47 | [email protected] | 47 | [email protected] |
@@ -54,7 +54,7 @@ [email protected] | |||
54 | [email protected] "{" | 54 | [email protected] "{" |
55 | [email protected] "}" | 55 | [email protected] "}" |
56 | [email protected] "\n " | 56 | [email protected] "\n " |
57 | FN_DEF@66..80 | 57 | [email protected] |
58 | [email protected] "fn" | 58 | [email protected] "fn" |
59 | [email protected] " " | 59 | [email protected] " " |
60 | [email protected] | 60 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast index cd0892451..b0f2b5888 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0003_where_pred_for.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..53 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "for_trait" | 6 | [email protected] "for_trait" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] "\n " | 19 | [email protected] "\n " |
20 | [email protected] | 20 | [email protected] |
21 | [email protected] "for" | 21 | [email protected] "for" |
22 | TYP[email protected] | 22 | GENERIC[email protected] |
23 | [email protected] "<" | 23 | [email protected] "<" |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "\'a" | 25 | [email protected] "\'a" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast index 20eba09f5..ace8ad050 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0004_value_parameters_no_patterns.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..38 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast index 6c8c1e24b..8e0252ce7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0005_function_type_params.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..27 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "foo" | 6 | [email protected] "foo" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast index 0cd1dffc9..ae61cbad8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0006_self_param.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..127 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@13..26 | 14 | [email protected] |
15 | [email protected] "fn" | 15 | [email protected] "fn" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -26,7 +26,7 @@ [email protected] | |||
26 | [email protected] "{" | 26 | [email protected] "{" |
27 | [email protected] "}" | 27 | [email protected] "}" |
28 | [email protected] "\n " | 28 | [email protected] "\n " |
29 | FN_DEF@31..46 | 29 | [email protected] |
30 | [email protected] "fn" | 30 | [email protected] "fn" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
@@ -43,7 +43,7 @@ [email protected] | |||
43 | [email protected] "{" | 43 | [email protected] "{" |
44 | [email protected] "}" | 44 | [email protected] "}" |
45 | [email protected] "\n " | 45 | [email protected] "\n " |
46 | FN_DEF@51..69 | 46 | [email protected] |
47 | [email protected] "fn" | 47 | [email protected] "fn" |
48 | [email protected] " " | 48 | [email protected] " " |
49 | [email protected] | 49 | [email protected] |
@@ -62,7 +62,7 @@ [email protected] | |||
62 | [email protected] "{" | 62 | [email protected] "{" |
63 | [email protected] "}" | 63 | [email protected] "}" |
64 | [email protected] "\n " | 64 | [email protected] "\n " |
65 | FN_DEF@74..103 | 65 | [email protected] |
66 | [email protected] "fn" | 66 | [email protected] "fn" |
67 | [email protected] " " | 67 | [email protected] " " |
68 | [email protected] | 68 | [email protected] |
@@ -95,7 +95,7 @@ [email protected] | |||
95 | [email protected] "{" | 95 | [email protected] "{" |
96 | [email protected] "}" | 96 | [email protected] "}" |
97 | [email protected] "\n " | 97 | [email protected] "\n " |
98 | FN_DEF@108..125 | 98 | [email protected] |
99 | [email protected] "fn" | 99 | [email protected] "fn" |
100 | [email protected] " " | 100 | [email protected] " " |
101 | [email protected] | 101 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast index 7cb9e1d55..e95688f56 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0007_type_param_bounds.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..34 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast index 10eb31d68..3ce2acfae 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0008_path_part.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..102 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast index 425e5196c..f62826fd5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0009_loop_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..25 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast index d823c08fc..66a609346 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0011_field_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..47 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast index 283442a8b..28c94bfd6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0012_type_item_where_clause.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..30 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast index e2e871dda..845b32e6d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0013_pointer_type_mut.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -16,7 +16,7 @@ [email protected] | |||
16 | [email protected] ")" | 16 | [email protected] ")" |
17 | [email protected] ";" | 17 | [email protected] ";" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
19 | TYPE_ALIAS_DEF@18..35 | 19 | [email protected] |
20 | [email protected] "type" | 20 | [email protected] "type" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast index a60940fcf..b1d5106ce 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0014_never_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..15 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast index 422912e3c..104e153ce 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0015_continue_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..68 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast b/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast index 69b82e33c..625ab4c2d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0016_unsafe_trait.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "trait" | 5 | [email protected] "trait" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast index 61a0b22f4..c131df1c9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0017_array_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast index 79148e953..20b2b6c19 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0018_arb_self_types.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..68 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@13..33 | 14 | [email protected] |
15 | [email protected] "fn" | 15 | [email protected] "fn" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -35,7 +35,7 @@ [email protected] | |||
35 | [email protected] "{" | 35 | [email protected] "{" |
36 | [email protected] "}" | 36 | [email protected] "}" |
37 | [email protected] "\n " | 37 | [email protected] "\n " |
38 | FN_DEF@38..66 | 38 | [email protected] |
39 | [email protected] "fn" | 39 | [email protected] "fn" |
40 | [email protected] " " | 40 | [email protected] " " |
41 | [email protected] | 41 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast index 10d6b2fde..7db38ea4d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0019_unary_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..43 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast index 31b5b6616..ca0702aba 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0021_impl_item_list.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..88 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | TYPE_ALIAS_DEF@13..26 | 14 | [email protected] |
15 | [email protected] "type" | 15 | [email protected] "type" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -26,7 +26,7 @@ [email protected] | |||
26 | [email protected] "i32" | 26 | [email protected] "i32" |
27 | [email protected] ";" | 27 | [email protected] ";" |
28 | [email protected] "\n " | 28 | [email protected] "\n " |
29 | CONST_DEF@31..49 | 29 | [email protected] |
30 | [email protected] "const" | 30 | [email protected] "const" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
@@ -45,7 +45,7 @@ [email protected] | |||
45 | [email protected] "92" | 45 | [email protected] "92" |
46 | [email protected] ";" | 46 | [email protected] ";" |
47 | [email protected] "\n " | 47 | [email protected] "\n " |
48 | FN_DEF@54..65 | 48 | [email protected] |
49 | [email protected] "fn" | 49 | [email protected] "fn" |
50 | [email protected] " " | 50 | [email protected] " " |
51 | [email protected] | 51 | [email protected] |
@@ -58,7 +58,7 @@ [email protected] | |||
58 | [email protected] "{" | 58 | [email protected] "{" |
59 | [email protected] "}" | 59 | [email protected] "}" |
60 | [email protected] "\n " | 60 | [email protected] "\n " |
61 | FN_DEF@70..86 | 61 | [email protected] |
62 | [email protected] "fn" | 62 | [email protected] "fn" |
63 | [email protected] " " | 63 | [email protected] " " |
64 | [email protected] | 64 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast index 1b810607e..50742cbcf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0022_crate_visibility.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..20 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "pub" | 4 | [email protected] "pub" |
5 | [email protected] "(" | 5 | [email protected] "(" |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "S" | 12 | [email protected] "S" |
13 | [email protected] ";" | 13 | [email protected] ";" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | STRUCT_DEF@21..40 | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] "pub" | 17 | [email protected] "pub" |
18 | [email protected] "(" | 18 | [email protected] "(" |
@@ -25,7 +25,7 @@ [email protected] | |||
25 | [email protected] "S" | 25 | [email protected] "S" |
26 | [email protected] ";" | 26 | [email protected] ";" |
27 | [email protected] "\n" | 27 | [email protected] "\n" |
28 | STRUCT_DEF@41..60 | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "pub" | 30 | [email protected] "pub" |
31 | [email protected] "(" | 31 | [email protected] "(" |
@@ -38,7 +38,7 @@ [email protected] | |||
38 | [email protected] "S" | 38 | [email protected] "S" |
39 | [email protected] ";" | 39 | [email protected] ";" |
40 | [email protected] "\n" | 40 | [email protected] "\n" |
41 | STRUCT_DEF@61..80 | 41 | [email protected] |
42 | [email protected] | 42 | [email protected] |
43 | [email protected] "pub" | 43 | [email protected] "pub" |
44 | [email protected] "(" | 44 | [email protected] "(" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast index 17687617b..57008e5fe 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0023_placeholder_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..21 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast index 7eb27d5e1..dea0c73f7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0024_slice_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..38 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast index 0a6d77f45..fd819ea37 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0025_slice_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..14 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast index b4598768e..e5f550347 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0026_tuple_pat_fields.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..96 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast index b824c10a8..9e76d881e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0027_ref_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..51 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast index 93f5c738c..f45f3cab8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0028_impl_trait_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..42 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast index fabb09937..e096b3a1f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0029_cast_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..88 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0030_cond.rast b/crates/ra_syntax/test_data/parser/inline/ok/0030_cond.rast index 3aed26732..381284dc5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0030_cond.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0030_cond.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..37 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -41,7 +41,7 @@ [email protected] | |||
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] "}" | 42 | [email protected] "}" |
43 | [email protected] "\n" | 43 | [email protected] "\n" |
44 | FN_DEF@38..196 | 44 | [email protected] |
45 | [email protected] "fn" | 45 | [email protected] "fn" |
46 | [email protected] " " | 46 | [email protected] " " |
47 | [email protected] | 47 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast index 899b63aac..ffe1a3a01 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0031_while_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..92 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast index 72705e148..79a5ee339 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0032_fn_pointer_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..14 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -14,7 +14,7 @@ [email protected] | |||
14 | [email protected] ")" | 14 | [email protected] ")" |
15 | [email protected] ";" | 15 | [email protected] ";" |
16 | [email protected] "\n" | 16 | [email protected] "\n" |
17 | TYPE_ALIAS_DEF@15..36 | 17 | [email protected] |
18 | [email protected] "type" | 18 | [email protected] "type" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | [email protected] |
@@ -31,7 +31,7 @@ [email protected] | |||
31 | [email protected] ")" | 31 | [email protected] ")" |
32 | [email protected] ";" | 32 | [email protected] ";" |
33 | [email protected] "\n" | 33 | [email protected] "\n" |
34 | TYPE_ALIAS_DEF@37..69 | 34 | [email protected] |
35 | [email protected] "type" | 35 | [email protected] "type" |
36 | [email protected] " " | 36 | [email protected] " " |
37 | [email protected] | 37 | [email protected] |
@@ -53,7 +53,7 @@ [email protected] | |||
53 | [email protected] ")" | 53 | [email protected] ")" |
54 | [email protected] ";" | 54 | [email protected] ";" |
55 | [email protected] "\n" | 55 | [email protected] "\n" |
56 | TYPE_ALIAS_DEF@70..112 | 56 | [email protected] |
57 | [email protected] "type" | 57 | [email protected] "type" |
58 | [email protected] " " | 58 | [email protected] " " |
59 | [email protected] | 59 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast index 784fbb592..c522f76cf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0033_reference_type;.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..13 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -14,7 +14,7 @@ [email protected] | |||
14 | [email protected] ")" | 14 | [email protected] ")" |
15 | [email protected] ";" | 15 | [email protected] ";" |
16 | [email protected] "\n" | 16 | [email protected] "\n" |
17 | TYPE_ALIAS_DEF@14..35 | 17 | [email protected] |
18 | [email protected] "type" | 18 | [email protected] "type" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | [email protected] |
@@ -31,7 +31,7 @@ [email protected] | |||
31 | [email protected] ")" | 31 | [email protected] ")" |
32 | [email protected] ";" | 32 | [email protected] ";" |
33 | [email protected] "\n" | 33 | [email protected] "\n" |
34 | TYPE_ALIAS_DEF@36..53 | 34 | [email protected] |
35 | [email protected] "type" | 35 | [email protected] "type" |
36 | [email protected] " " | 36 | [email protected] " " |
37 | [email protected] | 37 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast index e064aafaf..f905def6f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0034_break_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..101 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0036_unsafe_extern_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0036_unsafe_extern_fn.rast index cf5825593..293b1d64c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0036_unsafe_extern_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0036_unsafe_extern_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..29 | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast index fbd90bc0f..b6379e62f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0037_qual_paths.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -32,7 +32,7 @@ [email protected] | |||
32 | [email protected] "Output" | 32 | [email protected] "Output" |
33 | [email protected] ";" | 33 | [email protected] ";" |
34 | [email protected] "\n" | 34 | [email protected] "\n" |
35 | FN_DEF@27..70 | 35 | [email protected] |
36 | [email protected] "fn" | 36 | [email protected] "fn" |
37 | [email protected] " " | 37 | [email protected] " " |
38 | [email protected] | 38 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast index a767f145d..64e705fb3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0038_full_range_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast index e92ea2bf2..2185d3c91 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0039_type_arg.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..45 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast index aa582516a..db5bd2849 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0040_crate_keyword_vis.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..19 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "crate" | 4 | [email protected] "crate" |
5 | [email protected] " " | 5 | [email protected] " " |
@@ -16,16 +16,16 @@ [email protected] | |||
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
19 | STRUCT_DEF@20..49 | 19 | [email protected] |
20 | [email protected] "struct" | 20 | [email protected] "struct" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "S" | 23 | [email protected] "S" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | RECORD_FIELD_DEF_[email protected] | 25 | [email protected] |
26 | [email protected] "{" | 26 | [email protected] "{" |
27 | [email protected] " " | 27 | [email protected] " " |
28 | RECORD_FIELD_DEF@31..47 | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "crate" | 30 | [email protected] "crate" |
31 | [email protected] " " | 31 | [email protected] " " |
@@ -41,14 +41,14 @@ [email protected] | |||
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] "}" | 42 | [email protected] "}" |
43 | [email protected] "\n" | 43 | [email protected] "\n" |
44 | STRUCT_DEF@50..70 | 44 | [email protected] |
45 | [email protected] "struct" | 45 | [email protected] "struct" |
46 | [email protected] " " | 46 | [email protected] " " |
47 | [email protected] | 47 | [email protected] |
48 | [email protected] "T" | 48 | [email protected] "T" |
49 | TUPLE_FIELD_DEF_[email protected] | 49 | [email protected] |
50 | [email protected] "(" | 50 | [email protected] "(" |
51 | TUPLE_FIELD_DEF@59..68 | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] "crate" | 53 | [email protected] "crate" |
54 | [email protected] " " | 54 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast index 884ab2dbf..3638462f8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0041_trait_item.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..41 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "T" | 6 | [email protected] "T" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -52,12 +52,12 @@ [email protected] | |||
52 | [email protected] "{" | 52 | [email protected] "{" |
53 | [email protected] "}" | 53 | [email protected] "}" |
54 | [email protected] "\n" | 54 | [email protected] "\n" |
55 | TRAIT_DEF@42..100 | 55 | [email protected] |
56 | [email protected] "trait" | 56 | [email protected] "trait" |
57 | [email protected] " " | 57 | [email protected] " " |
58 | [email protected] | 58 | [email protected] |
59 | [email protected] "X" | 59 | [email protected] "X" |
60 | TYP[email protected] | 60 | GENERIC[email protected] |
61 | [email protected] "<" | 61 | [email protected] "<" |
62 | [email protected] | 62 | [email protected] |
63 | [email protected] | 63 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast index 0c1c6e877..40875ae1e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0042_call_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..117 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0044_block_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0044_block_items.rast index c23b3b67c..1fd3cd0e7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0044_block_items.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0044_block_items.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | FN_DEF@9..18 | 14 | [email protected] |
15 | [email protected] "fn" | 15 | [email protected] "fn" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast index 9ca2165ba..d4235a8b1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0045_param_list_opt_patterns.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..34 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "foo" | 6 | [email protected] "foo" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast index c28dc9d61..e89284c14 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0046_singleton_tuple_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..16 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast index 8a6b5a8fc..d6dfa83b7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0047_unsafe_default_impl.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "default" | 5 | [email protected] "default" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast index b209f67f8..37757ccd4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0048_path_type_with_bounds.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -38,7 +38,7 @@ [email protected] | |||
38 | [email protected] "{" | 38 | [email protected] "{" |
39 | [email protected] "}" | 39 | [email protected] "}" |
40 | [email protected] "\n" | 40 | [email protected] "\n" |
41 | FN_DEF@27..57 | 41 | [email protected] |
42 | [email protected] "fn" | 42 | [email protected] "fn" |
43 | [email protected] " " | 43 | [email protected] " " |
44 | [email protected] | 44 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast index 5f1429102..a5bf55131 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0050_fn_decl.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..21 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -8,7 +8,7 @@ [email protected] | |||
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] " " | 10 | [email protected] " " |
11 | FN_DEF@10..19 | 11 | [email protected] |
12 | [email protected] "fn" | 12 | [email protected] "fn" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast index 798ef2a48..6330dbf9e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0051_unit_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast index 0d2f5ff56..9bc36bea7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0052_path_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..13 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -14,7 +14,7 @@ [email protected] | |||
14 | [email protected] "Foo" | 14 | [email protected] "Foo" |
15 | [email protected] ";" | 15 | [email protected] ";" |
16 | [email protected] "\n" | 16 | [email protected] "\n" |
17 | TYPE_ALIAS_DEF@14..29 | 17 | [email protected] |
18 | [email protected] "type" | 18 | [email protected] "type" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | [email protected] |
@@ -30,7 +30,7 @@ [email protected] | |||
30 | [email protected] "Foo" | 30 | [email protected] "Foo" |
31 | [email protected] ";" | 31 | [email protected] ";" |
32 | [email protected] "\n" | 32 | [email protected] "\n" |
33 | TYPE_ALIAS_DEF@30..49 | 33 | [email protected] |
34 | [email protected] "type" | 34 | [email protected] "type" |
35 | [email protected] " " | 35 | [email protected] " " |
36 | [email protected] | 36 | [email protected] |
@@ -49,7 +49,7 @@ [email protected] | |||
49 | [email protected] "Foo" | 49 | [email protected] "Foo" |
50 | [email protected] ";" | 50 | [email protected] ";" |
51 | [email protected] "\n" | 51 | [email protected] "\n" |
52 | TYPE_ALIAS_DEF@50..70 | 52 | [email protected] |
53 | [email protected] "type" | 53 | [email protected] "type" |
54 | [email protected] " " | 54 | [email protected] " " |
55 | [email protected] | 55 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast index 70232a3b2..2bfb52453 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0053_path_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..90 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast index 6362aa02d..9ae271817 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0054_record_field_attrs.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..63 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..60 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "#" | 13 | [email protected] "#" |
14 | [email protected] "[" | 14 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0055_literal_pattern.rast b/crates/ra_syntax/test_data/parser/inline/ok/0055_literal_pattern.rast index 03c52525e..68bb43852 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0055_literal_pattern.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0055_literal_pattern.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..112 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast index 24f89b83f..28129c50c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0056_where_clause.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..115 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0057_const_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0057_const_fn.rast index bb43d1eaf..97548a5ee 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0057_const_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0057_const_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "const" | 3 | [email protected] "const" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast index 8bd94a868..3e72f9671 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0058_range_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..111 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast b/crates/ra_syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast index 9210f155c..fa659c19b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0059_match_arms_commas.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..82 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast index 850465d82..a9ae1aa59 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0061_record_lit.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..111 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,28 +12,28 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | [email protected] | 14 | [email protected] |
15 | RECORD_LIT@15..19 | 15 | RECORD_EXPR@15..19 |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] | 18 | [email protected] |
19 | [email protected] "S" | 19 | [email protected] "S" |
20 | [email protected] " " | 20 | [email protected] " " |
21 | [email protected] | 21 | RECORD_EXPR_[email protected] |
22 | [email protected] "{" | 22 | [email protected] "{" |
23 | [email protected] "}" | 23 | [email protected] "}" |
24 | [email protected] ";" | 24 | [email protected] ";" |
25 | [email protected] "\n " | 25 | [email protected] "\n " |
26 | [email protected] | 26 | [email protected] |
27 | RECORD_LIT@25..40 | 27 | RECORD_EXPR@25..40 |
28 | [email protected] | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] | 30 | [email protected] |
31 | [email protected] "S" | 31 | [email protected] "S" |
32 | [email protected] " " | 32 | [email protected] " " |
33 | [email protected] | 33 | RECORD_EXPR_[email protected] |
34 | [email protected] "{" | 34 | [email protected] "{" |
35 | [email protected] " " | 35 | [email protected] " " |
36 | [email protected] | 36 | RECORD_EXPR_[email protected] |
37 | [email protected] | 37 | [email protected] |
38 | [email protected] | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
@@ -41,7 +41,7 @@ [email protected] | |||
41 | [email protected] "x" | 41 | [email protected] "x" |
42 | [email protected] "," | 42 | [email protected] "," |
43 | [email protected] " " | 43 | [email protected] " " |
44 | [email protected] | 44 | RECORD_EXPR_[email protected] |
45 | [email protected] | 45 | [email protected] |
46 | [email protected] "y" | 46 | [email protected] "y" |
47 | [email protected] ":" | 47 | [email protected] ":" |
@@ -54,16 +54,16 @@ [email protected] | |||
54 | [email protected] ";" | 54 | [email protected] ";" |
55 | [email protected] "\n " | 55 | [email protected] "\n " |
56 | [email protected] | 56 | [email protected] |
57 | RECORD_LIT@46..82 | 57 | RECORD_EXPR@46..82 |
58 | [email protected] | 58 | [email protected] |
59 | [email protected] | 59 | [email protected] |
60 | [email protected] | 60 | [email protected] |
61 | [email protected] "S" | 61 | [email protected] "S" |
62 | [email protected] " " | 62 | [email protected] " " |
63 | [email protected] | 63 | RECORD_EXPR_[email protected] |
64 | [email protected] "{" | 64 | [email protected] "{" |
65 | [email protected] " " | 65 | [email protected] " " |
66 | [email protected] | 66 | RECORD_EXPR_[email protected] |
67 | [email protected] | 67 | [email protected] |
68 | [email protected] | 68 | [email protected] |
69 | [email protected] | 69 | [email protected] |
@@ -71,7 +71,7 @@ [email protected] | |||
71 | [email protected] "x" | 71 | [email protected] "x" |
72 | [email protected] "," | 72 | [email protected] "," |
73 | [email protected] " " | 73 | [email protected] " " |
74 | [email protected] | 74 | RECORD_EXPR_[email protected] |
75 | [email protected] | 75 | [email protected] |
76 | [email protected] "y" | 76 | [email protected] "y" |
77 | [email protected] ":" | 77 | [email protected] ":" |
@@ -100,16 +100,16 @@ [email protected] | |||
100 | [email protected] ";" | 100 | [email protected] ";" |
101 | [email protected] "\n " | 101 | [email protected] "\n " |
102 | [email protected] | 102 | [email protected] |
103 | RECORD_LIT@88..108 | 103 | RECORD_EXPR@88..108 |
104 | [email protected] | 104 | [email protected] |
105 | [email protected] | 105 | [email protected] |
106 | [email protected] | 106 | [email protected] |
107 | [email protected] "TupleStruct" | 107 | [email protected] "TupleStruct" |
108 | [email protected] " " | 108 | [email protected] " " |
109 | [email protected] | 109 | RECORD_EXPR_[email protected] |
110 | [email protected] "{" | 110 | [email protected] "{" |
111 | [email protected] " " | 111 | [email protected] " " |
112 | [email protected] | 112 | RECORD_EXPR_[email protected] |
113 | [email protected] | 113 | [email protected] |
114 | [email protected] "0" | 114 | [email protected] "0" |
115 | [email protected] ":" | 115 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast index 02656df31..de8217064 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0062_mod_contents.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -57,7 +57,7 @@ [email protected] | |||
57 | [email protected] "{" | 57 | [email protected] "{" |
58 | [email protected] "}" | 58 | [email protected] "}" |
59 | [email protected] "\n" | 59 | [email protected] "\n" |
60 | STRUCT_DEF@60..69 | 60 | [email protected] |
61 | [email protected] "struct" | 61 | [email protected] "struct" |
62 | [email protected] " " | 62 | [email protected] " " |
63 | [email protected] | 63 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast index 31178f86e..4368930cc 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0063_impl_def_neg.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..19 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "!" | 5 | [email protected] "!" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast index 445d8d309..587160003 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0064_if_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..136 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast index 8e10f3673..629fea99d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0065_dyn_trait_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..41 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast index 177bb5514..37ca478e6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0066_match_arm.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..166 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -49,14 +49,14 @@ [email protected] | |||
49 | [email protected] " " | 49 | [email protected] " " |
50 | [email protected] ">" | 50 | [email protected] ">" |
51 | [email protected] " " | 51 | [email protected] " " |
52 | RECORD_LIT@63..77 | 52 | RECORD_EXPR@63..77 |
53 | [email protected] | 53 | [email protected] |
54 | [email protected] | 54 | [email protected] |
55 | [email protected] | 55 | [email protected] |
56 | [email protected] "Test" | 56 | [email protected] "Test" |
57 | [email protected] | 57 | RECORD_EXPR_[email protected] |
58 | [email protected] "{" | 58 | [email protected] "{" |
59 | [email protected] | 59 | RECORD_EXPR_[email protected] |
60 | [email protected] | 60 | [email protected] |
61 | [email protected] "field" | 61 | [email protected] "field" |
62 | [email protected] ":" | 62 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast index ec2496072..6589e4795 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0068_union_items.rast | |||
@@ -1,24 +1,24 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | UNION_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "union" | 3 | [email protected] "union" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "Foo" | 6 | [email protected] "Foo" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "}" | 10 | [email protected] "}" |
11 | [email protected] "\n" | 11 | [email protected] "\n" |
12 | UNION_DEF@13..50 | 12 | [email protected] |
13 | [email protected] "union" | 13 | [email protected] "union" |
14 | [email protected] " " | 14 | [email protected] " " |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] "Foo" | 16 | [email protected] "Foo" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | RECORD_FIELD_DEF_[email protected] | 18 | [email protected] |
19 | [email protected] "{" | 19 | [email protected] "{" |
20 | [email protected] "\n " | 20 | [email protected] "\n " |
21 | RECORD_FIELD_DEF@29..35 | 21 | [email protected] |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "a" | 23 | [email protected] "a" |
24 | [email protected] ":" | 24 | [email protected] ":" |
@@ -30,7 +30,7 @@ [email protected] | |||
30 | [email protected] "i32" | 30 | [email protected] "i32" |
31 | [email protected] "," | 31 | [email protected] "," |
32 | [email protected] "\n " | 32 | [email protected] "\n " |
33 | RECORD_FIELD_DEF@41..47 | 33 | [email protected] |
34 | [email protected] | 34 | [email protected] |
35 | [email protected] "b" | 35 | [email protected] "b" |
36 | [email protected] ":" | 36 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast b/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast index f8ff7079b..4c1165dc8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0070_stmt_bin_expr_ambiguity.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..45 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast index 07b3d1435..673d396ee 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0071_match_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..96 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -72,13 +72,13 @@ [email protected] | |||
72 | [email protected] | 72 | [email protected] |
73 | [email protected] "{" | 73 | [email protected] "{" |
74 | [email protected] " " | 74 | [email protected] " " |
75 | RECORD_LIT@84..88 | 75 | RECORD_EXPR@84..88 |
76 | [email protected] | 76 | [email protected] |
77 | [email protected] | 77 | [email protected] |
78 | [email protected] | 78 | [email protected] |
79 | [email protected] "S" | 79 | [email protected] "S" |
80 | [email protected] " " | 80 | [email protected] " " |
81 | [email protected] | 81 | RECORD_EXPR_[email protected] |
82 | [email protected] "{" | 82 | [email protected] "{" |
83 | [email protected] "}" | 83 | [email protected] "}" |
84 | [email protected] " " | 84 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast index 665f716a8..437d7ac04 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0072_return_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..39 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast index cc871ac0c..00cce69e6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0073_type_item_type_params.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "Result" | 6 | [email protected] "Result" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast b/crates/ra_syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast index 3fd3a4391..3ca70f021 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0074_stmt_postfix_expr_ambiguity.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..83 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast index 97c6e6a9d..5cefc5076 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0075_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..9 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "}" | 13 | [email protected] "}" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | FN_DEF@10..31 | 15 | [email protected] |
16 | [email protected] "fn" | 16 | [email protected] "fn" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
@@ -38,7 +38,7 @@ [email protected] | |||
38 | [email protected] " " | 38 | [email protected] " " |
39 | [email protected] "}" | 39 | [email protected] "}" |
40 | [email protected] "\n" | 40 | [email protected] "\n" |
41 | FN_DEF@32..48 | 41 | [email protected] |
42 | [email protected] "fn" | 42 | [email protected] "fn" |
43 | [email protected] " " | 43 | [email protected] " " |
44 | [email protected] | 44 | [email protected] |
@@ -62,7 +62,7 @@ [email protected] | |||
62 | [email protected] " " | 62 | [email protected] " " |
63 | [email protected] "}" | 63 | [email protected] "}" |
64 | [email protected] "\n" | 64 | [email protected] "\n" |
65 | FN_DEF@49..64 | 65 | [email protected] |
66 | [email protected] "fn" | 66 | [email protected] "fn" |
67 | [email protected] " " | 67 | [email protected] " " |
68 | [email protected] | 68 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast b/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast index e2c1a507d..96217a7fd 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0076_function_where_clause.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..28 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "foo" | 6 | [email protected] "foo" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast index 4f3a8ed24..33e6fb93f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0077_try_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast index a08e16fab..2befc8388 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0078_type_item.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..15 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast index 26825ef86..209711fc4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0079_impl_def.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast index 462d1a8bb..3c80846db 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0080_postfix_range.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..88 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast index b26ac2d36..e7629ac03 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0081_for_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..28 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -9,7 +9,7 @@ [email protected] | |||
9 | [email protected] " " | 9 | [email protected] " " |
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "for" | 11 | [email protected] "for" |
12 | TYP[email protected] | 12 | GENERIC[email protected] |
13 | [email protected] "<" | 13 | [email protected] "<" |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "\'a" | 15 | [email protected] "\'a" |
@@ -29,7 +29,7 @@ [email protected] | |||
29 | [email protected] ")" | 29 | [email protected] ")" |
30 | [email protected] ";" | 30 | [email protected] ";" |
31 | [email protected] "\n" | 31 | [email protected] "\n" |
32 | TYPE_ALIAS_DEF@29..81 | 32 | [email protected] |
33 | [email protected] "type" | 33 | [email protected] "type" |
34 | [email protected] " " | 34 | [email protected] " " |
35 | [email protected] | 35 | [email protected] |
@@ -39,7 +39,7 @@ [email protected] | |||
39 | [email protected] " " | 39 | [email protected] " " |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] "for" | 41 | [email protected] "for" |
42 | TYP[email protected] | 42 | GENERIC[email protected] |
43 | [email protected] "<" | 43 | [email protected] "<" |
44 | [email protected] | 44 | [email protected] |
45 | [email protected] "\'a" | 45 | [email protected] "\'a" |
@@ -74,7 +74,7 @@ [email protected] | |||
74 | [email protected] ")" | 74 | [email protected] ")" |
75 | [email protected] ";" | 75 | [email protected] ";" |
76 | [email protected] "\n" | 76 | [email protected] "\n" |
77 | TYPE_ALIAS_DEF@82..120 | 77 | [email protected] |
78 | [email protected] "type" | 78 | [email protected] "type" |
79 | [email protected] " " | 79 | [email protected] " " |
80 | [email protected] | 80 | [email protected] |
@@ -84,7 +84,7 @@ [email protected] | |||
84 | [email protected] " " | 84 | [email protected] " " |
85 | [email protected] | 85 | [email protected] |
86 | [email protected] "for" | 86 | [email protected] "for" |
87 | TYP[email protected] | 87 | GENERIC[email protected] |
88 | [email protected] "<" | 88 | [email protected] "<" |
89 | [email protected] | 89 | [email protected] |
90 | [email protected] "\'a" | 90 | [email protected] "\'a" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast index 58bdf7e34..1563b1988 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0082_ref_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..199 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast index 217b07e59..cdbc40fe0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0083_struct_items.rast | |||
@@ -1,39 +1,39 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "Foo" | 6 | [email protected] "Foo" |
7 | [email protected] ";" | 7 | [email protected] ";" |
8 | [email protected] "\n" | 8 | [email protected] "\n" |
9 | STRUCT_DEF@12..25 | 9 | [email protected] |
10 | [email protected] "struct" | 10 | [email protected] "struct" |
11 | [email protected] " " | 11 | [email protected] " " |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "Foo" | 13 | [email protected] "Foo" |
14 | [email protected] " " | 14 | [email protected] " " |
15 | RECORD_FIELD_DEF_[email protected] | 15 | [email protected] |
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
19 | STRUCT_DEF@26..39 | 19 | [email protected] |
20 | [email protected] "struct" | 20 | [email protected] "struct" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "Foo" | 23 | [email protected] "Foo" |
24 | TUPLE_FIELD_DEF_[email protected] | 24 | [email protected] |
25 | [email protected] "(" | 25 | [email protected] "(" |
26 | [email protected] ")" | 26 | [email protected] ")" |
27 | [email protected] ";" | 27 | [email protected] ";" |
28 | [email protected] "\n" | 28 | [email protected] "\n" |
29 | STRUCT_DEF@40..66 | 29 | [email protected] |
30 | [email protected] "struct" | 30 | [email protected] "struct" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "Foo" | 33 | [email protected] "Foo" |
34 | TUPLE_FIELD_DEF_[email protected] | 34 | [email protected] |
35 | [email protected] "(" | 35 | [email protected] "(" |
36 | TUPLE_FIELD_DEF@51..57 | 36 | [email protected] |
37 | [email protected] | 37 | [email protected] |
38 | [email protected] | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
@@ -41,7 +41,7 @@ [email protected] | |||
41 | [email protected] "String" | 41 | [email protected] "String" |
42 | [email protected] "," | 42 | [email protected] "," |
43 | [email protected] " " | 43 | [email protected] " " |
44 | TUPLE_FIELD_DEF@59..64 | 44 | [email protected] |
45 | [email protected] | 45 | [email protected] |
46 | [email protected] | 46 | [email protected] |
47 | [email protected] | 47 | [email protected] |
@@ -50,16 +50,16 @@ [email protected] | |||
50 | [email protected] ")" | 50 | [email protected] ")" |
51 | [email protected] ";" | 51 | [email protected] ";" |
52 | [email protected] "\n" | 52 | [email protected] "\n" |
53 | STRUCT_DEF@67..105 | 53 | [email protected] |
54 | [email protected] "struct" | 54 | [email protected] "struct" |
55 | [email protected] " " | 55 | [email protected] " " |
56 | [email protected] | 56 | [email protected] |
57 | [email protected] "Foo" | 57 | [email protected] "Foo" |
58 | [email protected] " " | 58 | [email protected] " " |
59 | RECORD_FIELD_DEF_[email protected] | 59 | [email protected] |
60 | [email protected] "{" | 60 | [email protected] "{" |
61 | [email protected] "\n " | 61 | [email protected] "\n " |
62 | RECORD_FIELD_DEF@84..90 | 62 | [email protected] |
63 | [email protected] | 63 | [email protected] |
64 | [email protected] "a" | 64 | [email protected] "a" |
65 | [email protected] ":" | 65 | [email protected] ":" |
@@ -71,7 +71,7 @@ [email protected] | |||
71 | [email protected] "i32" | 71 | [email protected] "i32" |
72 | [email protected] "," | 72 | [email protected] "," |
73 | [email protected] "\n " | 73 | [email protected] "\n " |
74 | RECORD_FIELD_DEF@96..102 | 74 | [email protected] |
75 | [email protected] | 75 | [email protected] |
76 | [email protected] "b" | 76 | [email protected] "b" |
77 | [email protected] ":" | 77 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast index 9cd8910d4..ee8894966 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0084_paren_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..15 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast b/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast index 9fcb7899e..ded36949a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0085_expr_literals.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..188 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0086_function_ret_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0086_function_ret_type.rast index a42abc189..70e05a859 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0086_function_ret_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0086_function_ret_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "}" | 13 | [email protected] "}" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | FN_DEF@12..29 | 15 | [email protected] |
16 | [email protected] "fn" | 16 | [email protected] "fn" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast index e3223cee5..43c09affe 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0087_unsafe_impl.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "impl" | 5 | [email protected] "impl" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast b/crates/ra_syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast index 7e71d7373..34f520994 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0088_break_ambiguity.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..87 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0089_extern_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0089_extern_fn.rast index 48aaf1004..405b6a259 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0089_extern_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0089_extern_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..18 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "extern" | 4 | [email protected] "extern" |
5 | [email protected] " " | 5 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast index cee2bc906..2ef026e37 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0090_type_param_default.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast b/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast index 7efa4c34d..0cac9ac43 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0091_auto_trait.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..15 | 2 | [email protected] |
3 | [email protected] "auto" | 3 | [email protected] "auto" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "trait" | 5 | [email protected] "trait" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast index 1e2d7db7c..95686977f 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0092_fn_pointer_type_with_ret.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast index aed81f9b0..82f03f9c1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0093_index_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..25 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast b/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast index fad27be66..0ef11c682 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0094_unsafe_auto_trait.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..22 | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "auto" | 5 | [email protected] "auto" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast index 67d9595d3..25706d2a4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0095_placeholder_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..25 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast index 031e74652..cb5316a0d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0096_no_semi_after_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..166 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast index 8a839a4a6..0a1b21d6e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0097_default_impl.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..19 | 2 | [email protected] |
3 | [email protected] "default" | 3 | [email protected] "default" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "impl" | 5 | [email protected] "impl" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0098_const_unsafe_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0098_const_unsafe_fn.rast index 816e49310..32a77ba49 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0098_const_unsafe_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0098_const_unsafe_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..24 | 2 | [email protected] |
3 | [email protected] "const" | 3 | [email protected] "const" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "unsafe" | 5 | [email protected] "unsafe" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rast index d48ef865c..1627556c8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0099_param_list.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..9 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "}" | 13 | [email protected] "}" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | FN_DEF@10..25 | 15 | [email protected] |
16 | [email protected] "fn" | 16 | [email protected] "fn" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
@@ -36,7 +36,7 @@ [email protected] | |||
36 | [email protected] "{" | 36 | [email protected] "{" |
37 | [email protected] "}" | 37 | [email protected] "}" |
38 | [email protected] "\n" | 38 | [email protected] "\n" |
39 | FN_DEF@26..43 | 39 | [email protected] |
40 | [email protected] "fn" | 40 | [email protected] "fn" |
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] | 42 | [email protected] |
@@ -62,7 +62,7 @@ [email protected] | |||
62 | [email protected] "{" | 62 | [email protected] "{" |
63 | [email protected] "}" | 63 | [email protected] "}" |
64 | [email protected] "\n" | 64 | [email protected] "\n" |
65 | FN_DEF@44..66 | 65 | [email protected] |
66 | [email protected] "fn" | 66 | [email protected] "fn" |
67 | [email protected] " " | 67 | [email protected] " " |
68 | [email protected] | 68 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast index e4455cd3e..766de4efe 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0100_for_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..32 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0101_unsafe_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0101_unsafe_fn.rast index 8a8743060..73c94e5d4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0101_unsafe_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0101_unsafe_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "unsafe" | 3 | [email protected] "unsafe" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast index 9f966ff8a..fe1c290c3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0102_record_field_pat_list.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..118 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast index 9b3bef04e..c4c0a0568 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0103_array_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..54 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast index e3c4cfeb3..3f53d60c0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0104_path_fn_trait_args.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..28 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast index e64717152..51a6c5170 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0106_lambda_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..133 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast index 98963dc62..b2961b0ff 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0107_method_call_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..48 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast index ea603e2c9..ca7e4a5c3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0108_tuple_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..39 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0109_label.rast b/crates/ra_syntax/test_data/parser/inline/ok/0109_label.rast index 30ff96a7c..a6a169f1b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0109_label.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0109_label.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..73 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast index b58f40ac1..432318da0 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0111_tuple_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..93 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast index b67714c17..3cd554d45 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0112_bind_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..145 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast index 5de480da9..d761c1c68 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0113_nocontentexpr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..49 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast index 01d717d6b..0e1594dc4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0114_tuple_struct_where.rast | |||
@@ -1,18 +1,18 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..33 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "Test" | 6 | [email protected] "Test" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "T" | 11 | [email protected] "T" |
12 | [email protected] ">" | 12 | [email protected] ">" |
13 | TUPLE_FIELD_DEF_[email protected] | 13 | [email protected] |
14 | [email protected] "(" | 14 | [email protected] "(" |
15 | TUPLE_FIELD_DEF@15..16 | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] | 18 | [email protected] |
@@ -40,20 +40,20 @@ [email protected] | |||
40 | [email protected] "Clone" | 40 | [email protected] "Clone" |
41 | [email protected] ";" | 41 | [email protected] ";" |
42 | [email protected] "\n" | 42 | [email protected] "\n" |
43 | STRUCT_DEF@34..52 | 43 | [email protected] |
44 | [email protected] "struct" | 44 | [email protected] "struct" |
45 | [email protected] " " | 45 | [email protected] " " |
46 | [email protected] | 46 | [email protected] |
47 | [email protected] "Test" | 47 | [email protected] "Test" |
48 | TYP[email protected] | 48 | GENERIC[email protected] |
49 | [email protected] "<" | 49 | [email protected] "<" |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "T" | 52 | [email protected] "T" |
53 | [email protected] ">" | 53 | [email protected] ">" |
54 | TUPLE_FIELD_DEF_[email protected] | 54 | [email protected] |
55 | [email protected] "(" | 55 | [email protected] "(" |
56 | TUPLE_FIELD_DEF@49..50 | 56 | [email protected] |
57 | [email protected] | 57 | [email protected] |
58 | [email protected] | 58 | [email protected] |
59 | [email protected] | 59 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast index 3c0ef9005..4d09c9f50 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0115_tuple_field_attrs.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..59 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | TUPLE_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "(" | 9 | [email protected] "(" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | TUPLE_FIELD_DEF@15..55 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "#" | 13 | [email protected] "#" |
14 | [email protected] "[" | 14 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast index ddfcf974e..f3d4ad72c 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0117_macro_call_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..16 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -18,7 +18,7 @@ [email protected] | |||
18 | [email protected] ")" | 18 | [email protected] ")" |
19 | [email protected] ";" | 19 | [email protected] ";" |
20 | [email protected] "\n" | 20 | [email protected] "\n" |
21 | TYPE_ALIAS_DEF@17..40 | 21 | [email protected] |
22 | [email protected] "type" | 22 | [email protected] "type" |
23 | [email protected] " " | 23 | [email protected] " " |
24 | [email protected] | 24 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast index ea54347fc..141a7b203 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_impl_inner_attributes.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | ENUM_DEF@0..8 | 2 | [email protected] |
3 | [email protected] "enum" | 3 | [email protected] "enum" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "F" | 6 | [email protected] "F" |
7 | ENUM_[email protected] | 7 | [email protected] |
8 | [email protected] "{" | 8 | [email protected] "{" |
9 | [email protected] "}" | 9 | [email protected] "}" |
10 | [email protected] "\n" | 10 | [email protected] "\n" |
11 | IMPL_DEF@9..93 | 11 | [email protected] |
12 | [email protected] "impl" | 12 | [email protected] "impl" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0118_match_guard.rast b/crates/ra_syntax/test_data/parser/inline/ok/0118_match_guard.rast index e152c6b6c..aaaf803b7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0118_match_guard.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0118_match_guard.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..57 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast b/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast index b283ab804..4b5f9cdc9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0120_match_arms_inner_attribute.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..138 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast b/crates/ra_syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast index 9d5470914..54cc3be3a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0121_match_arms_outer_attributes.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..258 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast b/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast index ada2fc54e..edac8d5d9 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0122_generic_lifetime_type_attribute.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..63 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "foo" | 6 | [email protected] "foo" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast index b3a33c14d..f155743cf 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0123_param_list_vararg.rast | |||
@@ -8,7 +8,7 @@ [email protected] | |||
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] " " | 10 | [email protected] " " |
11 | FN_DEF@13..54 | 11 | [email protected] |
12 | [email protected] "fn" | 12 | [email protected] "fn" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0124_async_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0124_async_fn.rast index 6178dfe59..a7df188bd 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0124_async_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0124_async_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "async" | 3 | [email protected] "async" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast index ced59b7c1..aa4d7a784 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_crate_keyword_path.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast index 97611f7f3..54ea2c7c6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0125_record_literal_field_with_attr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..45 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,16 +11,16 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | RECORD_LIT@16..43 | 14 | RECORD_EXPR@16..43 |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "S" | 18 | [email protected] "S" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | [email protected] | 20 | RECORD_EXPR_[email protected] |
21 | [email protected] "{" | 21 | [email protected] "{" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] | 23 | RECORD_EXPR_[email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "#" | 25 | [email protected] "#" |
26 | [email protected] "[" | 26 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast index 09221fc54..0342e64f3 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0126_attr_on_expr_stmt.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..81 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast index 93cc41533..3b46e5b47 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0127_attr_on_last_expr_in_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..46 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0128_combined_fns.rast b/crates/ra_syntax/test_data/parser/inline/ok/0128_combined_fns.rast index 0901f2348..98a20f36d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0128_combined_fns.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0128_combined_fns.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..24 | 2 | [email protected] |
3 | [email protected] "async" | 3 | [email protected] "async" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "unsafe" | 5 | [email protected] "unsafe" |
@@ -16,7 +16,7 @@ [email protected] | |||
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
19 | FN_DEF@25..49 | 19 | [email protected] |
20 | [email protected] "const" | 20 | [email protected] "const" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] "unsafe" | 22 | [email protected] "unsafe" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast index 28291afc2..e283966ca 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0129_marco_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..32 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast index bb94a05c6..931e81f27 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_let_stmt.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..134 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast index 8f2f144c7..0fe3bf582 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0130_try_block_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..32 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast index 4a1c2b3a4..d47071a91 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0131_existential_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..36 | 2 | [email protected] |
3 | [email protected] "existential" | 3 | [email protected] "existential" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "type" | 5 | [email protected] "type" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast index 87ac42748..48f483813 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_box_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..105 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast index 3772cb64b..b8d26a53a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0132_default_fn_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..68 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "{" | 20 | [email protected] "{" |
21 | [email protected] "\n " | 21 | [email protected] "\n " |
22 | TYPE_ALIAS_DEF@21..42 | 22 | [email protected] |
23 | [email protected] "default" | 23 | [email protected] "default" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | [email protected] "type" | 25 | [email protected] "type" |
@@ -36,7 +36,7 @@ [email protected] | |||
36 | [email protected] "Bar" | 36 | [email protected] "Bar" |
37 | [email protected] ";" | 37 | [email protected] ";" |
38 | [email protected] "\n " | 38 | [email protected] "\n " |
39 | FN_DEF@47..66 | 39 | [email protected] |
40 | [email protected] "default" | 40 | [email protected] "default" |
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] "fn" | 42 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast index b330a0932..429a0506e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0134_nocontentexpr_after_item.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..110 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,21 +11,21 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | ENUM_DEF@27..75 | 14 | [email protected] |
15 | [email protected] "enum" | 15 | [email protected] "enum" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] "LocalEnum" | 18 | [email protected] "LocalEnum" |
19 | [email protected] " " | 19 | [email protected] " " |
20 | ENUM_[email protected] | 20 | [email protected] |
21 | [email protected] "{" | 21 | [email protected] "{" |
22 | [email protected] "\n " | 22 | [email protected] "\n " |
23 | ENUM_[email protected] | 23 | [email protected] |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "One" | 25 | [email protected] "One" |
26 | [email protected] "," | 26 | [email protected] "," |
27 | [email protected] "\n " | 27 | [email protected] "\n " |
28 | ENUM_[email protected] | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "Two" | 30 | [email protected] "Two" |
31 | [email protected] "," | 31 | [email protected] "," |
@@ -33,7 +33,7 @@ [email protected] | |||
33 | [email protected] "}" | 33 | [email protected] "}" |
34 | [email protected] ";" | 34 | [email protected] ";" |
35 | [email protected] "\n " | 35 | [email protected] "\n " |
36 | FN_DEF@81..90 | 36 | [email protected] |
37 | [email protected] "fn" | 37 | [email protected] "fn" |
38 | [email protected] " " | 38 | [email protected] " " |
39 | [email protected] | 39 | [email protected] |
@@ -47,13 +47,13 @@ [email protected] | |||
47 | [email protected] "}" | 47 | [email protected] "}" |
48 | [email protected] ";" | 48 | [email protected] ";" |
49 | [email protected] "\n " | 49 | [email protected] "\n " |
50 | STRUCT_DEF@96..107 | 50 | [email protected] |
51 | [email protected] "struct" | 51 | [email protected] "struct" |
52 | [email protected] " " | 52 | [email protected] " " |
53 | [email protected] | 53 | [email protected] |
54 | [email protected] "S" | 54 | [email protected] "S" |
55 | [email protected] " " | 55 | [email protected] " " |
56 | RECORD_FIELD_DEF_[email protected] | 56 | [email protected] |
57 | [email protected] "{" | 57 | [email protected] "{" |
58 | [email protected] "}" | 58 | [email protected] "}" |
59 | [email protected] ";" | 59 | [email protected] ";" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast index 8e8d9e992..923effe38 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0137_await_expr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..66 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast index c457851c9..157513565 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_associated_type_bounds.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..58 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "print_all" | 6 | [email protected] "print_all" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast index ea325831e..a7f87c020 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_expression_after_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..51 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -22,14 +22,14 @@ [email protected] | |||
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] "=" | 23 | [email protected] "=" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | RECORD_LIT@26..33 | 25 | RECORD_EXPR@26..33 |
26 | [email protected] | 26 | [email protected] |
27 | [email protected] | 27 | [email protected] |
28 | [email protected] | 28 | [email protected] |
29 | [email protected] "F" | 29 | [email protected] "F" |
30 | [email protected] | 30 | RECORD_EXPR_[email protected] |
31 | [email protected] "{" | 31 | [email protected] "{" |
32 | [email protected] | 32 | RECORD_EXPR_[email protected] |
33 | [email protected] | 33 | [email protected] |
34 | [email protected] "x" | 34 | [email protected] "x" |
35 | [email protected] ":" | 35 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast index 9135de9df..6403ff8d5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0138_self_param_outer_attr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..25 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast index 14610a0a2..36fd2997b 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0139_param_outer_arg.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..27 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast index e6be8b7e4..d11019076 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0142_for_range_from.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..50 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast index 57fba5fd5..09fd9e9b8 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0143_box_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..117 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast index 8d8b9597b..8d0f1ead5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0144_dot_dot_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..554 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast index 7c092d518..b41ef4098 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0145_record_field_pat.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..62 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast b/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast index 8382a4f96..2d0c83458 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0146_as_precedence.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..42 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast index 4b9b8e0ab..9312eab65 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0147_const_param.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..23 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] "const" | 10 | [email protected] "const" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast index 3c00a2647..0c35bf2b7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_array_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | CONST_DEF@0..39 | 2 | [email protected] |
3 | [email protected] "const" | 3 | [email protected] "const" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast index 77e12cad6..8f197a19d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0150_impl_type_params.rast | |||
@@ -1,7 +1,7 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..28 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | TYP[email protected] | 4 | GENERIC[email protected] |
5 | [email protected] "<" | 5 | [email protected] "<" |
6 | [email protected] | 6 | [email protected] |
7 | [email protected] "const" | 7 | [email protected] "const" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast index 48d73a4e7..cc220e534 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0151_trait_alias.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..18 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "Z" | 6 | [email protected] "Z" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -31,12 +31,12 @@ [email protected] | |||
31 | [email protected] ">" | 31 | [email protected] ">" |
32 | [email protected] ";" | 32 | [email protected] ";" |
33 | [email protected] "\n" | 33 | [email protected] "\n" |
34 | TRAIT_DEF@19..51 | 34 | [email protected] |
35 | [email protected] "trait" | 35 | [email protected] "trait" |
36 | [email protected] " " | 36 | [email protected] " " |
37 | [email protected] | 37 | [email protected] |
38 | [email protected] "Z" | 38 | [email protected] "Z" |
39 | TYP[email protected] | 39 | GENERIC[email protected] |
40 | [email protected] "<" | 40 | [email protected] "<" |
41 | [email protected] | 41 | [email protected] |
42 | [email protected] | 42 | [email protected] |
@@ -82,12 +82,12 @@ [email protected] | |||
82 | [email protected] "Copy" | 82 | [email protected] "Copy" |
83 | [email protected] ";" | 83 | [email protected] ";" |
84 | [email protected] "\n" | 84 | [email protected] "\n" |
85 | TRAIT_DEF@52..82 | 85 | [email protected] |
86 | [email protected] "trait" | 86 | [email protected] "trait" |
87 | [email protected] " " | 87 | [email protected] " " |
88 | [email protected] | 88 | [email protected] |
89 | [email protected] "Z" | 89 | [email protected] "Z" |
90 | TYP[email protected] | 90 | GENERIC[email protected] |
91 | [email protected] "<" | 91 | [email protected] "<" |
92 | [email protected] | 92 | [email protected] |
93 | [email protected] | 93 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast index f43dfbe63..2905c5f1a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0152_arg_with_attr.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..33 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast index 861065362..69b4d73d7 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0154_fn_pointer_param_ident_path.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..24 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -25,7 +25,7 @@ [email protected] | |||
25 | [email protected] ")" | 25 | [email protected] ")" |
26 | [email protected] ";" | 26 | [email protected] ";" |
27 | [email protected] "\n" | 27 | [email protected] "\n" |
28 | TYPE_ALIAS_DEF@25..54 | 28 | [email protected] |
29 | [email protected] "type" | 29 | [email protected] "type" |
30 | [email protected] " " | 30 | [email protected] " " |
31 | [email protected] | 31 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast index ecac05950..c63a55a56 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0155_closure_params.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..62 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rast b/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rast index 092833417..3b8dfefc6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0156_fn_def_param.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..29 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0156_or_pattern.rast b/crates/ra_syntax/test_data/parser/inline/ok/0156_or_pattern.rast index 88d512f1a..4d4c41f1a 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0156_or_pattern.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0156_or_pattern.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..129 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast index fad9df007..ccca045b6 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_fn_pointer_unnamed_arg.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..22 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast index e8a0e9ddd..a2e05eb2e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0157_variant_discriminant.rast | |||
@@ -1,19 +1,19 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | ENUM_DEF@0..22 | 2 | [email protected] |
3 | [email protected] "enum" | 3 | [email protected] "enum" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "E" | 6 | [email protected] "E" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | ENUM_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] " " | 10 | [email protected] " " |
11 | ENUM_[email protected] | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "X" | 13 | [email protected] "X" |
14 | TUPLE_FIELD_DEF_[email protected] | 14 | [email protected] |
15 | [email protected] "(" | 15 | [email protected] "(" |
16 | TUPLE_FIELD_DEF@11..14 | 16 | [email protected] |
17 | [email protected] | 17 | [email protected] |
18 | [email protected] | 18 | [email protected] |
19 | [email protected] | 19 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast index bd9e8d40f..8ae24b9c1 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_binop_resets_statementness.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..27 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast index 08333a325..9c071ec2e 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0158_lambda_ret_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..33 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast b/crates/ra_syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast index 5f09e4f4a..fb46d4ce4 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0159_try_macro_fallback.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast index 9efebd8b8..9e9a5f9c5 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0161_labeled_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..22 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast b/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast index 4991f2c36..ca9a1183d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0162_unsafe_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..21 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast index c0b8c0300..1269621dc 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..49 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "{" | 20 | [email protected] "{" |
21 | [email protected] "\n " | 21 | [email protected] "\n " |
22 | FN_DEF@21..47 | 22 | [email protected] |
23 | [email protected] "default" | 23 | [email protected] "default" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | [email protected] "unsafe" | 25 | [email protected] "unsafe" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast index e0c338297..6bfe925af 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0163_default_unsafe_impl.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "default" | 3 | [email protected] "default" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "unsafe" | 5 | [email protected] "unsafe" |
diff --git a/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast index 868899275..f5e20b93d 100644 --- a/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast +++ b/crates/ra_syntax/test_data/parser/inline/ok/0164_type_path_in_pattern.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..32 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast index 705f7e001..a171fe7a8 100644 --- a/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0001_struct_item.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..31 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -20,10 +20,10 @@ [email protected] | |||
20 | [email protected] "Copy" | 20 | [email protected] "Copy" |
21 | [email protected] ">" | 21 | [email protected] ">" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | RECORD_FIELD_DEF_[email protected] | 23 | [email protected] |
24 | [email protected] "{" | 24 | [email protected] "{" |
25 | [email protected] "\n " | 25 | [email protected] "\n " |
26 | RECORD_FIELD_DEF@24..28 | 26 | [email protected] |
27 | [email protected] | 27 | [email protected] |
28 | [email protected] "f" | 28 | [email protected] "f" |
29 | [email protected] ":" | 29 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast b/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast index a1d546491..362892b91 100644 --- a/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast +++ b/crates/ra_syntax/test_data/parser/ok/0002_struct_item_field.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..25 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..23 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "foo" | 13 | [email protected] "foo" |
14 | [email protected] ":" | 14 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0005_fn_item.rast b/crates/ra_syntax/test_data/parser/ok/0005_fn_item.rast index 0ec237f8e..a7a2b11a7 100644 --- a/crates/ra_syntax/test_data/parser/ok/0005_fn_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0005_fn_item.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast index 37b452ec4..b2c1d791f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0008_mod_item.rast | |||
@@ -26,7 +26,7 @@ [email protected] | |||
26 | [email protected] | 26 | [email protected] |
27 | [email protected] "{" | 27 | [email protected] "{" |
28 | [email protected] "\n " | 28 | [email protected] "\n " |
29 | FN_DEF@31..47 | 29 | [email protected] |
30 | [email protected] "fn" | 30 | [email protected] "fn" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
@@ -40,13 +40,13 @@ [email protected] | |||
40 | [email protected] "\n " | 40 | [email protected] "\n " |
41 | [email protected] "}" | 41 | [email protected] "}" |
42 | [email protected] "\n " | 42 | [email protected] "\n " |
43 | STRUCT_DEF@52..63 | 43 | [email protected] |
44 | [email protected] "struct" | 44 | [email protected] "struct" |
45 | [email protected] " " | 45 | [email protected] " " |
46 | [email protected] | 46 | [email protected] |
47 | [email protected] "S" | 47 | [email protected] "S" |
48 | [email protected] " " | 48 | [email protected] " " |
49 | RECORD_FIELD_DEF_[email protected] | 49 | [email protected] |
50 | [email protected] "{" | 50 | [email protected] "{" |
51 | [email protected] "}" | 51 | [email protected] "}" |
52 | [email protected] "\n" | 52 | [email protected] "\n" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast b/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast index 0b9bc58e8..478fdba75 100644 --- a/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast +++ b/crates/ra_syntax/test_data/parser/ok/0011_outer_attribute.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..34 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "#" | 4 | [email protected] "#" |
5 | [email protected] "[" | 5 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast b/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast index 980b34049..83a93b5a9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast +++ b/crates/ra_syntax/test_data/parser/ok/0012_visibility.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..9 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "}" | 13 | [email protected] "}" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | FN_DEF@10..23 | 15 | [email protected] |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] "pub" | 17 | [email protected] "pub" |
18 | [email protected] " " | 18 | [email protected] " " |
@@ -28,7 +28,7 @@ [email protected] | |||
28 | [email protected] "{" | 28 | [email protected] "{" |
29 | [email protected] "}" | 29 | [email protected] "}" |
30 | [email protected] "\n" | 30 | [email protected] "\n" |
31 | FN_DEF@24..44 | 31 | [email protected] |
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "pub" | 33 | [email protected] "pub" |
34 | [email protected] "(" | 34 | [email protected] "(" |
@@ -47,7 +47,7 @@ [email protected] | |||
47 | [email protected] "{" | 47 | [email protected] "{" |
48 | [email protected] "}" | 48 | [email protected] "}" |
49 | [email protected] "\n" | 49 | [email protected] "\n" |
50 | FN_DEF@45..65 | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "pub" | 52 | [email protected] "pub" |
53 | [email protected] "(" | 53 | [email protected] "(" |
@@ -66,7 +66,7 @@ [email protected] | |||
66 | [email protected] "{" | 66 | [email protected] "{" |
67 | [email protected] "}" | 67 | [email protected] "}" |
68 | [email protected] "\n" | 68 | [email protected] "\n" |
69 | FN_DEF@66..97 | 69 | [email protected] |
70 | [email protected] | 70 | [email protected] |
71 | [email protected] "pub" | 71 | [email protected] "pub" |
72 | [email protected] "(" | 72 | [email protected] "(" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast index 95656d19b..b15f41dd7 100644 --- a/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast +++ b/crates/ra_syntax/test_data/parser/ok/0016_struct_flavors.rast | |||
@@ -1,41 +1,41 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..9 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "A" | 6 | [email protected] "A" |
7 | [email protected] ";" | 7 | [email protected] ";" |
8 | [email protected] "\n" | 8 | [email protected] "\n" |
9 | STRUCT_DEF@10..21 | 9 | [email protected] |
10 | [email protected] "struct" | 10 | [email protected] "struct" |
11 | [email protected] " " | 11 | [email protected] " " |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "B" | 13 | [email protected] "B" |
14 | [email protected] " " | 14 | [email protected] " " |
15 | RECORD_FIELD_DEF_[email protected] | 15 | [email protected] |
16 | [email protected] "{" | 16 | [email protected] "{" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n" | 18 | [email protected] "\n" |
19 | STRUCT_DEF@22..33 | 19 | [email protected] |
20 | [email protected] "struct" | 20 | [email protected] "struct" |
21 | [email protected] " " | 21 | [email protected] " " |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] "C" | 23 | [email protected] "C" |
24 | TUPLE_FIELD_DEF_[email protected] | 24 | [email protected] |
25 | [email protected] "(" | 25 | [email protected] "(" |
26 | [email protected] ")" | 26 | [email protected] ")" |
27 | [email protected] ";" | 27 | [email protected] ";" |
28 | [email protected] "\n\n" | 28 | [email protected] "\n\n" |
29 | STRUCT_DEF@35..74 | 29 | [email protected] |
30 | [email protected] "struct" | 30 | [email protected] "struct" |
31 | [email protected] " " | 31 | [email protected] " " |
32 | [email protected] | 32 | [email protected] |
33 | [email protected] "D" | 33 | [email protected] "D" |
34 | [email protected] " " | 34 | [email protected] " " |
35 | RECORD_FIELD_DEF_[email protected] | 35 | [email protected] |
36 | [email protected] "{" | 36 | [email protected] "{" |
37 | [email protected] "\n " | 37 | [email protected] "\n " |
38 | RECORD_FIELD_DEF@50..56 | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] "a" | 40 | [email protected] "a" |
41 | [email protected] ":" | 41 | [email protected] ":" |
@@ -47,7 +47,7 @@ [email protected] | |||
47 | [email protected] "u32" | 47 | [email protected] "u32" |
48 | [email protected] "," | 48 | [email protected] "," |
49 | [email protected] "\n " | 49 | [email protected] "\n " |
50 | RECORD_FIELD_DEF@62..72 | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "pub" | 52 | [email protected] "pub" |
53 | [email protected] " " | 53 | [email protected] " " |
@@ -63,14 +63,14 @@ [email protected] | |||
63 | [email protected] "\n" | 63 | [email protected] "\n" |
64 | [email protected] "}" | 64 | [email protected] "}" |
65 | [email protected] "\n\n" | 65 | [email protected] "\n\n" |
66 | STRUCT_DEF@76..96 | 66 | [email protected] |
67 | [email protected] "struct" | 67 | [email protected] "struct" |
68 | [email protected] " " | 68 | [email protected] " " |
69 | [email protected] | 69 | [email protected] |
70 | [email protected] "E" | 70 | [email protected] "E" |
71 | TUPLE_FIELD_DEF_[email protected] | 71 | [email protected] |
72 | [email protected] "(" | 72 | [email protected] "(" |
73 | TUPLE_FIELD_DEF@85..90 | 73 | [email protected] |
74 | [email protected] | 74 | [email protected] |
75 | [email protected] "pub" | 75 | [email protected] "pub" |
76 | [email protected] " " | 76 | [email protected] " " |
@@ -81,7 +81,7 @@ [email protected] | |||
81 | [email protected] "x" | 81 | [email protected] "x" |
82 | [email protected] "," | 82 | [email protected] "," |
83 | [email protected] " " | 83 | [email protected] " " |
84 | TUPLE_FIELD_DEF@92..93 | 84 | [email protected] |
85 | [email protected] | 85 | [email protected] |
86 | [email protected] | 86 | [email protected] |
87 | [email protected] | 87 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0017_attr_trailing_comma.rast b/crates/ra_syntax/test_data/parser/ok/0017_attr_trailing_comma.rast index 964cbf5dd..a3e091ad3 100644 --- a/crates/ra_syntax/test_data/parser/ok/0017_attr_trailing_comma.rast +++ b/crates/ra_syntax/test_data/parser/ok/0017_attr_trailing_comma.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..22 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "#" | 4 | [email protected] "#" |
5 | [email protected] "[" | 5 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast index 451634e3f..630aa0708 100644 --- a/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast +++ b/crates/ra_syntax/test_data/parser/ok/0018_struct_type_params.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..13 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S1" | 6 | [email protected] "S1" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -12,20 +12,20 @@ [email protected] | |||
12 | [email protected] ">" | 12 | [email protected] ">" |
13 | [email protected] ";" | 13 | [email protected] ";" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | STRUCT_DEF@14..32 | 15 | [email protected] |
16 | [email protected] "struct" | 16 | [email protected] "struct" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
19 | [email protected] "S2" | 19 | [email protected] "S2" |
20 | TYP[email protected] | 20 | GENERIC[email protected] |
21 | [email protected] "<" | 21 | [email protected] "<" |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] | 23 | [email protected] |
24 | [email protected] "T" | 24 | [email protected] "T" |
25 | [email protected] ">" | 25 | [email protected] ">" |
26 | TUPLE_FIELD_DEF_[email protected] | 26 | [email protected] |
27 | [email protected] "(" | 27 | [email protected] "(" |
28 | TUPLE_FIELD_DEF@27..30 | 28 | [email protected] |
29 | [email protected] | 29 | [email protected] |
30 | [email protected] | 30 | [email protected] |
31 | [email protected] | 31 | [email protected] |
@@ -34,22 +34,22 @@ [email protected] | |||
34 | [email protected] ")" | 34 | [email protected] ")" |
35 | [email protected] ";" | 35 | [email protected] ";" |
36 | [email protected] "\n" | 36 | [email protected] "\n" |
37 | STRUCT_DEF@33..56 | 37 | [email protected] |
38 | [email protected] "struct" | 38 | [email protected] "struct" |
39 | [email protected] " " | 39 | [email protected] " " |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] "S3" | 41 | [email protected] "S3" |
42 | TYP[email protected] | 42 | GENERIC[email protected] |
43 | [email protected] "<" | 43 | [email protected] "<" |
44 | [email protected] | 44 | [email protected] |
45 | [email protected] | 45 | [email protected] |
46 | [email protected] "T" | 46 | [email protected] "T" |
47 | [email protected] ">" | 47 | [email protected] ">" |
48 | [email protected] " " | 48 | [email protected] " " |
49 | RECORD_FIELD_DEF_[email protected] | 49 | [email protected] |
50 | [email protected] "{" | 50 | [email protected] "{" |
51 | [email protected] " " | 51 | [email protected] " " |
52 | RECORD_FIELD_DEF@48..54 | 52 | [email protected] |
53 | [email protected] | 53 | [email protected] |
54 | [email protected] "u" | 54 | [email protected] "u" |
55 | [email protected] ":" | 55 | [email protected] ":" |
@@ -62,34 +62,34 @@ [email protected] | |||
62 | [email protected] " " | 62 | [email protected] " " |
63 | [email protected] "}" | 63 | [email protected] "}" |
64 | [email protected] "\n\n" | 64 | [email protected] "\n\n" |
65 | STRUCT_DEF@58..70 | 65 | [email protected] |
66 | [email protected] "struct" | 66 | [email protected] "struct" |
67 | [email protected] " " | 67 | [email protected] " " |
68 | [email protected] | 68 | [email protected] |
69 | [email protected] "S4" | 69 | [email protected] "S4" |
70 | TYP[email protected] | 70 | GENERIC[email protected] |
71 | [email protected] "<" | 71 | [email protected] "<" |
72 | [email protected] ">" | 72 | [email protected] ">" |
73 | [email protected] ";" | 73 | [email protected] ";" |
74 | [email protected] "\n" | 74 | [email protected] "\n" |
75 | STRUCT_DEF@71..85 | 75 | [email protected] |
76 | [email protected] "struct" | 76 | [email protected] "struct" |
77 | [email protected] " " | 77 | [email protected] " " |
78 | [email protected] | 78 | [email protected] |
79 | [email protected] "S5" | 79 | [email protected] "S5" |
80 | TYP[email protected] | 80 | GENERIC[email protected] |
81 | [email protected] "<" | 81 | [email protected] "<" |
82 | [email protected] | 82 | [email protected] |
83 | [email protected] "\'a" | 83 | [email protected] "\'a" |
84 | [email protected] ">" | 84 | [email protected] ">" |
85 | [email protected] ";" | 85 | [email protected] ";" |
86 | [email protected] "\n" | 86 | [email protected] "\n" |
87 | STRUCT_DEF@86..101 | 87 | [email protected] |
88 | [email protected] "struct" | 88 | [email protected] "struct" |
89 | [email protected] " " | 89 | [email protected] " " |
90 | [email protected] | 90 | [email protected] |
91 | [email protected] "S6" | 91 | [email protected] "S6" |
92 | TYP[email protected] | 92 | GENERIC[email protected] |
93 | [email protected] "<" | 93 | [email protected] "<" |
94 | [email protected] | 94 | [email protected] |
95 | [email protected] "\'a" | 95 | [email protected] "\'a" |
@@ -97,12 +97,12 @@ [email protected] | |||
97 | [email protected] ">" | 97 | [email protected] ">" |
98 | [email protected] ";" | 98 | [email protected] ";" |
99 | [email protected] "\n" | 99 | [email protected] "\n" |
100 | STRUCT_DEF@102..120 | 100 | [email protected] |
101 | [email protected] "struct" | 101 | [email protected] "struct" |
102 | [email protected] " " | 102 | [email protected] " " |
103 | [email protected] | 103 | [email protected] |
104 | [email protected] "S7" | 104 | [email protected] "S7" |
105 | TYP[email protected] | 105 | GENERIC[email protected] |
106 | [email protected] "<" | 106 | [email protected] "<" |
107 | [email protected] | 107 | [email protected] |
108 | [email protected] "\'a" | 108 | [email protected] "\'a" |
@@ -112,12 +112,12 @@ [email protected] | |||
112 | [email protected] ">" | 112 | [email protected] ">" |
113 | [email protected] ";" | 113 | [email protected] ";" |
114 | [email protected] "\n" | 114 | [email protected] "\n" |
115 | STRUCT_DEF@121..142 | 115 | [email protected] |
116 | [email protected] "struct" | 116 | [email protected] "struct" |
117 | [email protected] " " | 117 | [email protected] " " |
118 | [email protected] | 118 | [email protected] |
119 | [email protected] "S8" | 119 | [email protected] "S8" |
120 | TYP[email protected] | 120 | GENERIC[email protected] |
121 | [email protected] "<" | 121 | [email protected] "<" |
122 | [email protected] | 122 | [email protected] |
123 | [email protected] "\'a" | 123 | [email protected] "\'a" |
@@ -130,12 +130,12 @@ [email protected] | |||
130 | [email protected] ">" | 130 | [email protected] ">" |
131 | [email protected] ";" | 131 | [email protected] ";" |
132 | [email protected] "\n" | 132 | [email protected] "\n" |
133 | STRUCT_DEF@143..166 | 133 | [email protected] |
134 | [email protected] "struct" | 134 | [email protected] "struct" |
135 | [email protected] " " | 135 | [email protected] " " |
136 | [email protected] | 136 | [email protected] |
137 | [email protected] "S9" | 137 | [email protected] "S9" |
138 | TYP[email protected] | 138 | GENERIC[email protected] |
139 | [email protected] "<" | 139 | [email protected] "<" |
140 | [email protected] | 140 | [email protected] |
141 | [email protected] "\'a" | 141 | [email protected] "\'a" |
@@ -149,12 +149,12 @@ [email protected] | |||
149 | [email protected] ">" | 149 | [email protected] ">" |
150 | [email protected] ";" | 150 | [email protected] ";" |
151 | [email protected] "\n" | 151 | [email protected] "\n" |
152 | STRUCT_DEF@167..183 | 152 | [email protected] |
153 | [email protected] "struct" | 153 | [email protected] "struct" |
154 | [email protected] " " | 154 | [email protected] " " |
155 | [email protected] | 155 | [email protected] |
156 | [email protected] "S10" | 156 | [email protected] "S10" |
157 | TYP[email protected] | 157 | GENERIC[email protected] |
158 | [email protected] "<" | 158 | [email protected] "<" |
159 | [email protected] | 159 | [email protected] |
160 | [email protected] "\'a" | 160 | [email protected] "\'a" |
@@ -162,12 +162,12 @@ [email protected] | |||
162 | [email protected] ">" | 162 | [email protected] ">" |
163 | [email protected] ";" | 163 | [email protected] ";" |
164 | [email protected] "\n" | 164 | [email protected] "\n" |
165 | STRUCT_DEF@184..203 | 165 | [email protected] |
166 | [email protected] "struct" | 166 | [email protected] "struct" |
167 | [email protected] " " | 167 | [email protected] " " |
168 | [email protected] | 168 | [email protected] |
169 | [email protected] "S11" | 169 | [email protected] "S11" |
170 | TYP[email protected] | 170 | GENERIC[email protected] |
171 | [email protected] "<" | 171 | [email protected] "<" |
172 | [email protected] | 172 | [email protected] |
173 | [email protected] "\'a" | 173 | [email protected] "\'a" |
@@ -178,12 +178,12 @@ [email protected] | |||
178 | [email protected] ">" | 178 | [email protected] ">" |
179 | [email protected] ";" | 179 | [email protected] ";" |
180 | [email protected] "\n" | 180 | [email protected] "\n" |
181 | STRUCT_DEF@204..233 | 181 | [email protected] |
182 | [email protected] "struct" | 182 | [email protected] "struct" |
183 | [email protected] " " | 183 | [email protected] " " |
184 | [email protected] | 184 | [email protected] |
185 | [email protected] "S12" | 185 | [email protected] "S12" |
186 | TYP[email protected] | 186 | GENERIC[email protected] |
187 | [email protected] "<" | 187 | [email protected] "<" |
188 | [email protected] | 188 | [email protected] |
189 | [email protected] "\'a" | 189 | [email protected] "\'a" |
@@ -202,12 +202,12 @@ [email protected] | |||
202 | [email protected] ">" | 202 | [email protected] ">" |
203 | [email protected] ";" | 203 | [email protected] ";" |
204 | [email protected] "\n\n" | 204 | [email protected] "\n\n" |
205 | STRUCT_DEF@235..249 | 205 | [email protected] |
206 | [email protected] "struct" | 206 | [email protected] "struct" |
207 | [email protected] " " | 207 | [email protected] " " |
208 | [email protected] | 208 | [email protected] |
209 | [email protected] "S13" | 209 | [email protected] "S13" |
210 | TYP[email protected] | 210 | GENERIC[email protected] |
211 | [email protected] "<" | 211 | [email protected] "<" |
212 | [email protected] | 212 | [email protected] |
213 | [email protected] | 213 | [email protected] |
@@ -215,12 +215,12 @@ [email protected] | |||
215 | [email protected] ">" | 215 | [email protected] ">" |
216 | [email protected] ";" | 216 | [email protected] ";" |
217 | [email protected] "\n" | 217 | [email protected] "\n" |
218 | STRUCT_DEF@250..267 | 218 | [email protected] |
219 | [email protected] "struct" | 219 | [email protected] "struct" |
220 | [email protected] " " | 220 | [email protected] " " |
221 | [email protected] | 221 | [email protected] |
222 | [email protected] "S14" | 222 | [email protected] "S14" |
223 | TYP[email protected] | 223 | GENERIC[email protected] |
224 | [email protected] "<" | 224 | [email protected] "<" |
225 | [email protected] | 225 | [email protected] |
226 | [email protected] | 226 | [email protected] |
@@ -233,12 +233,12 @@ [email protected] | |||
233 | [email protected] ">" | 233 | [email protected] ">" |
234 | [email protected] ";" | 234 | [email protected] ";" |
235 | [email protected] "\n" | 235 | [email protected] "\n" |
236 | STRUCT_DEF@268..289 | 236 | [email protected] |
237 | [email protected] "struct" | 237 | [email protected] "struct" |
238 | [email protected] " " | 238 | [email protected] " " |
239 | [email protected] | 239 | [email protected] |
240 | [email protected] "S15" | 240 | [email protected] "S15" |
241 | TYP[email protected] | 241 | GENERIC[email protected] |
242 | [email protected] "<" | 242 | [email protected] "<" |
243 | [email protected] | 243 | [email protected] |
244 | [email protected] "\'a" | 244 | [email protected] "\'a" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast index f767e9e19..c3df00814 100644 --- a/crates/ra_syntax/test_data/parser/ok/0019_enums.rast +++ b/crates/ra_syntax/test_data/parser/ok/0019_enums.rast | |||
@@ -1,78 +1,78 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | ENUM_DEF@0..11 | 2 | [email protected] |
3 | [email protected] "enum" | 3 | [email protected] "enum" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "E1" | 6 | [email protected] "E1" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | ENUM_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n" | 10 | [email protected] "\n" |
11 | [email protected] "}" | 11 | [email protected] "}" |
12 | [email protected] "\n\n" | 12 | [email protected] "\n\n" |
13 | ENUM_DEF@13..27 | 13 | [email protected] |
14 | [email protected] "enum" | 14 | [email protected] "enum" |
15 | [email protected] " " | 15 | [email protected] " " |
16 | [email protected] | 16 | [email protected] |
17 | [email protected] "E2" | 17 | [email protected] "E2" |
18 | TYP[email protected] | 18 | GENERIC[email protected] |
19 | [email protected] "<" | 19 | [email protected] "<" |
20 | [email protected] | 20 | [email protected] |
21 | [email protected] | 21 | [email protected] |
22 | [email protected] "T" | 22 | [email protected] "T" |
23 | [email protected] ">" | 23 | [email protected] ">" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | ENUM_[email protected] | 25 | [email protected] |
26 | [email protected] "{" | 26 | [email protected] "{" |
27 | [email protected] "\n" | 27 | [email protected] "\n" |
28 | [email protected] "}" | 28 | [email protected] "}" |
29 | [email protected] "\n\n" | 29 | [email protected] "\n\n" |
30 | ENUM_DEF@29..46 | 30 | [email protected] |
31 | [email protected] "enum" | 31 | [email protected] "enum" |
32 | [email protected] " " | 32 | [email protected] " " |
33 | [email protected] | 33 | [email protected] |
34 | [email protected] "E3" | 34 | [email protected] "E3" |
35 | [email protected] " " | 35 | [email protected] " " |
36 | ENUM_[email protected] | 36 | [email protected] |
37 | [email protected] "{" | 37 | [email protected] "{" |
38 | [email protected] "\n " | 38 | [email protected] "\n " |
39 | ENUM_[email protected] | 39 | [email protected] |
40 | [email protected] | 40 | [email protected] |
41 | [email protected] "X" | 41 | [email protected] "X" |
42 | [email protected] "\n" | 42 | [email protected] "\n" |
43 | [email protected] "}" | 43 | [email protected] "}" |
44 | [email protected] "\n\n" | 44 | [email protected] "\n\n" |
45 | ENUM_DEF@48..66 | 45 | [email protected] |
46 | [email protected] "enum" | 46 | [email protected] "enum" |
47 | [email protected] " " | 47 | [email protected] " " |
48 | [email protected] | 48 | [email protected] |
49 | [email protected] "E4" | 49 | [email protected] "E4" |
50 | [email protected] " " | 50 | [email protected] " " |
51 | ENUM_[email protected] | 51 | [email protected] |
52 | [email protected] "{" | 52 | [email protected] "{" |
53 | [email protected] "\n " | 53 | [email protected] "\n " |
54 | ENUM_[email protected] | 54 | [email protected] |
55 | [email protected] | 55 | [email protected] |
56 | [email protected] "X" | 56 | [email protected] "X" |
57 | [email protected] "," | 57 | [email protected] "," |
58 | [email protected] "\n" | 58 | [email protected] "\n" |
59 | [email protected] "}" | 59 | [email protected] "}" |
60 | [email protected] "\n\n" | 60 | [email protected] "\n\n" |
61 | ENUM_DEF@68..181 | 61 | [email protected] |
62 | [email protected] "enum" | 62 | [email protected] "enum" |
63 | [email protected] " " | 63 | [email protected] " " |
64 | [email protected] | 64 | [email protected] |
65 | [email protected] "E5" | 65 | [email protected] "E5" |
66 | [email protected] " " | 66 | [email protected] " " |
67 | ENUM_[email protected] | 67 | [email protected] |
68 | [email protected] "{" | 68 | [email protected] "{" |
69 | [email protected] "\n " | 69 | [email protected] "\n " |
70 | ENUM_[email protected] | 70 | [email protected] |
71 | [email protected] | 71 | [email protected] |
72 | [email protected] "A" | 72 | [email protected] "A" |
73 | [email protected] "," | 73 | [email protected] "," |
74 | [email protected] "\n " | 74 | [email protected] "\n " |
75 | ENUM_[email protected] | 75 | [email protected] |
76 | [email protected] | 76 | [email protected] |
77 | [email protected] "B" | 77 | [email protected] "B" |
78 | [email protected] " " | 78 | [email protected] " " |
@@ -82,14 +82,14 @@ [email protected] | |||
82 | [email protected] "92" | 82 | [email protected] "92" |
83 | [email protected] "," | 83 | [email protected] "," |
84 | [email protected] "\n " | 84 | [email protected] "\n " |
85 | ENUM_[email protected] | 85 | [email protected] |
86 | [email protected] | 86 | [email protected] |
87 | [email protected] "C" | 87 | [email protected] "C" |
88 | [email protected] " " | 88 | [email protected] " " |
89 | RECORD_FIELD_DEF_[email protected] | 89 | [email protected] |
90 | [email protected] "{" | 90 | [email protected] "{" |
91 | [email protected] "\n " | 91 | [email protected] "\n " |
92 | RECORD_FIELD_DEF@113..119 | 92 | [email protected] |
93 | [email protected] | 93 | [email protected] |
94 | [email protected] "a" | 94 | [email protected] "a" |
95 | [email protected] ":" | 95 | [email protected] ":" |
@@ -101,7 +101,7 @@ [email protected] | |||
101 | [email protected] "u32" | 101 | [email protected] "u32" |
102 | [email protected] "," | 102 | [email protected] "," |
103 | [email protected] "\n " | 103 | [email protected] "\n " |
104 | RECORD_FIELD_DEF@129..139 | 104 | [email protected] |
105 | [email protected] | 105 | [email protected] |
106 | [email protected] "pub" | 106 | [email protected] "pub" |
107 | [email protected] " " | 107 | [email protected] " " |
@@ -119,21 +119,21 @@ [email protected] | |||
119 | [email protected] "}" | 119 | [email protected] "}" |
120 | [email protected] "," | 120 | [email protected] "," |
121 | [email protected] "\n " | 121 | [email protected] "\n " |
122 | ENUM_[email protected] | 122 | [email protected] |
123 | [email protected] | 123 | [email protected] |
124 | [email protected] "F" | 124 | [email protected] "F" |
125 | [email protected] " " | 125 | [email protected] " " |
126 | RECORD_FIELD_DEF_[email protected] | 126 | [email protected] |
127 | [email protected] "{" | 127 | [email protected] "{" |
128 | [email protected] "}" | 128 | [email protected] "}" |
129 | [email protected] "," | 129 | [email protected] "," |
130 | [email protected] "\n " | 130 | [email protected] "\n " |
131 | ENUM_[email protected] | 131 | [email protected] |
132 | [email protected] | 132 | [email protected] |
133 | [email protected] "D" | 133 | [email protected] "D" |
134 | TUPLE_FIELD_DEF_[email protected] | 134 | [email protected] |
135 | [email protected] "(" | 135 | [email protected] "(" |
136 | TUPLE_FIELD_DEF@164..167 | 136 | [email protected] |
137 | [email protected] | 137 | [email protected] |
138 | [email protected] | 138 | [email protected] |
139 | [email protected] | 139 | [email protected] |
@@ -143,10 +143,10 @@ [email protected] | |||
143 | [email protected] ")" | 143 | [email protected] ")" |
144 | [email protected] "," | 144 | [email protected] "," |
145 | [email protected] "\n " | 145 | [email protected] "\n " |
146 | ENUM_[email protected] | 146 | [email protected] |
147 | [email protected] | 147 | [email protected] |
148 | [email protected] "E" | 148 | [email protected] "E" |
149 | TUPLE_FIELD_DEF_[email protected] | 149 | [email protected] |
150 | [email protected] "(" | 150 | [email protected] "(" |
151 | [email protected] ")" | 151 | [email protected] ")" |
152 | [email protected] "," | 152 | [email protected] "," |
diff --git a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast index 4fb4baf56..9bdc50e1e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast +++ b/crates/ra_syntax/test_data/parser/ok/0020_type_param_bounds.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "A" | 6 | [email protected] "A" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -12,12 +12,12 @@ [email protected] | |||
12 | [email protected] ">" | 12 | [email protected] ">" |
13 | [email protected] ";" | 13 | [email protected] ";" |
14 | [email protected] "\n" | 14 | [email protected] "\n" |
15 | STRUCT_DEF@13..26 | 15 | [email protected] |
16 | [email protected] "struct" | 16 | [email protected] "struct" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
19 | [email protected] "B" | 19 | [email protected] "B" |
20 | TYP[email protected] | 20 | GENERIC[email protected] |
21 | [email protected] "<" | 21 | [email protected] "<" |
22 | [email protected] | 22 | [email protected] |
23 | [email protected] | 23 | [email protected] |
@@ -27,12 +27,12 @@ [email protected] | |||
27 | [email protected] ">" | 27 | [email protected] ">" |
28 | [email protected] ";" | 28 | [email protected] ";" |
29 | [email protected] "\n" | 29 | [email protected] "\n" |
30 | STRUCT_DEF@27..43 | 30 | [email protected] |
31 | [email protected] "struct" | 31 | [email protected] "struct" |
32 | [email protected] " " | 32 | [email protected] " " |
33 | [email protected] | 33 | [email protected] |
34 | [email protected] "C" | 34 | [email protected] "C" |
35 | TYP[email protected] | 35 | GENERIC[email protected] |
36 | [email protected] "<" | 36 | [email protected] "<" |
37 | [email protected] | 37 | [email protected] |
38 | [email protected] | 38 | [email protected] |
@@ -45,12 +45,12 @@ [email protected] | |||
45 | [email protected] ">" | 45 | [email protected] ">" |
46 | [email protected] ";" | 46 | [email protected] ";" |
47 | [email protected] "\n" | 47 | [email protected] "\n" |
48 | STRUCT_DEF@44..63 | 48 | [email protected] |
49 | [email protected] "struct" | 49 | [email protected] "struct" |
50 | [email protected] " " | 50 | [email protected] " " |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] "D" | 52 | [email protected] "D" |
53 | TYP[email protected] | 53 | GENERIC[email protected] |
54 | [email protected] "<" | 54 | [email protected] "<" |
55 | [email protected] | 55 | [email protected] |
56 | [email protected] | 56 | [email protected] |
@@ -66,12 +66,12 @@ [email protected] | |||
66 | [email protected] ">" | 66 | [email protected] ">" |
67 | [email protected] ";" | 67 | [email protected] ";" |
68 | [email protected] "\n" | 68 | [email protected] "\n" |
69 | STRUCT_DEF@64..86 | 69 | [email protected] |
70 | [email protected] "struct" | 70 | [email protected] "struct" |
71 | [email protected] " " | 71 | [email protected] " " |
72 | [email protected] | 72 | [email protected] |
73 | [email protected] "E" | 73 | [email protected] "E" |
74 | TYP[email protected] | 74 | GENERIC[email protected] |
75 | [email protected] "<" | 75 | [email protected] "<" |
76 | [email protected] | 76 | [email protected] |
77 | [email protected] | 77 | [email protected] |
@@ -90,12 +90,12 @@ [email protected] | |||
90 | [email protected] ">" | 90 | [email protected] ">" |
91 | [email protected] ";" | 91 | [email protected] ";" |
92 | [email protected] "\n" | 92 | [email protected] "\n" |
93 | STRUCT_DEF@87..116 | 93 | [email protected] |
94 | [email protected] "struct" | 94 | [email protected] "struct" |
95 | [email protected] " " | 95 | [email protected] " " |
96 | [email protected] | 96 | [email protected] |
97 | [email protected] "F" | 97 | [email protected] "F" |
98 | TYP[email protected] | 98 | GENERIC[email protected] |
99 | [email protected] "<" | 99 | [email protected] "<" |
100 | [email protected] | 100 | [email protected] |
101 | [email protected] | 101 | [email protected] |
@@ -122,12 +122,12 @@ [email protected] | |||
122 | [email protected] ">" | 122 | [email protected] ">" |
123 | [email protected] ";" | 123 | [email protected] ";" |
124 | [email protected] "\n" | 124 | [email protected] "\n" |
125 | STRUCT_DEF@117..143 | 125 | [email protected] |
126 | [email protected] "struct" | 126 | [email protected] "struct" |
127 | [email protected] " " | 127 | [email protected] " " |
128 | [email protected] | 128 | [email protected] |
129 | [email protected] "G" | 129 | [email protected] "G" |
130 | TYP[email protected] | 130 | GENERIC[email protected] |
131 | [email protected] "<" | 131 | [email protected] "<" |
132 | [email protected] | 132 | [email protected] |
133 | [email protected] | 133 | [email protected] |
@@ -153,12 +153,12 @@ [email protected] | |||
153 | [email protected] ">" | 153 | [email protected] ">" |
154 | [email protected] ";" | 154 | [email protected] ";" |
155 | [email protected] "\n" | 155 | [email protected] "\n" |
156 | STRUCT_DEF@144..180 | 156 | [email protected] |
157 | [email protected] "struct" | 157 | [email protected] "struct" |
158 | [email protected] " " | 158 | [email protected] " " |
159 | [email protected] | 159 | [email protected] |
160 | [email protected] "H" | 160 | [email protected] "H" |
161 | TYP[email protected] | 161 | GENERIC[email protected] |
162 | [email protected] "<" | 162 | [email protected] "<" |
163 | [email protected] | 163 | [email protected] |
164 | [email protected] | 164 | [email protected] |
@@ -194,12 +194,12 @@ [email protected] | |||
194 | [email protected] ">" | 194 | [email protected] ">" |
195 | [email protected] ";" | 195 | [email protected] ";" |
196 | [email protected] "\n" | 196 | [email protected] "\n" |
197 | STRUCT_DEF@181..199 | 197 | [email protected] |
198 | [email protected] "struct" | 198 | [email protected] "struct" |
199 | [email protected] " " | 199 | [email protected] " " |
200 | [email protected] | 200 | [email protected] |
201 | [email protected] "I" | 201 | [email protected] "I" |
202 | TYP[email protected] | 202 | GENERIC[email protected] |
203 | [email protected] "<" | 203 | [email protected] "<" |
204 | [email protected] | 204 | [email protected] |
205 | [email protected] | 205 | [email protected] |
@@ -217,12 +217,12 @@ [email protected] | |||
217 | [email protected] ">" | 217 | [email protected] ">" |
218 | [email protected] ";" | 218 | [email protected] ";" |
219 | [email protected] "\n" | 219 | [email protected] "\n" |
220 | STRUCT_DEF@200..250 | 220 | [email protected] |
221 | [email protected] "struct" | 221 | [email protected] "struct" |
222 | [email protected] " " | 222 | [email protected] " " |
223 | [email protected] | 223 | [email protected] |
224 | [email protected] "K" | 224 | [email protected] "K" |
225 | TYP[email protected] | 225 | GENERIC[email protected] |
226 | [email protected] "<" | 226 | [email protected] "<" |
227 | [email protected] | 227 | [email protected] |
228 | [email protected] "\'a" | 228 | [email protected] "\'a" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0021_extern_fn.rast b/crates/ra_syntax/test_data/parser/ok/0021_extern_fn.rast index 873791f50..5524efaaf 100644 --- a/crates/ra_syntax/test_data/parser/ok/0021_extern_fn.rast +++ b/crates/ra_syntax/test_data/parser/ok/0021_extern_fn.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..19 | 2 | [email protected] |
3 | [email protected] | 3 | [email protected] |
4 | [email protected] "extern" | 4 | [email protected] "extern" |
5 | [email protected] " " | 5 | [email protected] " " |
@@ -16,7 +16,7 @@ [email protected] | |||
16 | [email protected] "\n" | 16 | [email protected] "\n" |
17 | [email protected] "}" | 17 | [email protected] "}" |
18 | [email protected] "\n\n" | 18 | [email protected] "\n\n" |
19 | FN_DEF@21..44 | 19 | [email protected] |
20 | [email protected] | 20 | [email protected] |
21 | [email protected] "extern" | 21 | [email protected] "extern" |
22 | [email protected] " " | 22 | [email protected] " " |
@@ -35,7 +35,7 @@ [email protected] | |||
35 | [email protected] "\n" | 35 | [email protected] "\n" |
36 | [email protected] "}" | 36 | [email protected] "}" |
37 | [email protected] "\n\n" | 37 | [email protected] "\n\n" |
38 | FN_DEF@46..70 | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] "extern" | 40 | [email protected] "extern" |
41 | [email protected] " " | 41 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast b/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast index 97d90dc75..9374cf5e9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast +++ b/crates/ra_syntax/test_data/parser/ok/0023_static_items.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STATIC_DEF@0..20 | 2 | [email protected] |
3 | [email protected] "static" | 3 | [email protected] "static" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -18,7 +18,7 @@ [email protected] | |||
18 | [email protected] "1" | 18 | [email protected] "1" |
19 | [email protected] ";" | 19 | [email protected] ";" |
20 | [email protected] "\n" | 20 | [email protected] "\n" |
21 | STATIC_DEF@21..46 | 21 | [email protected] |
22 | [email protected] "static" | 22 | [email protected] "static" |
23 | [email protected] " " | 23 | [email protected] " " |
24 | [email protected] "mut" | 24 | [email protected] "mut" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast b/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast index d241f034c..dd1b9c9a0 100644 --- a/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0024_const_item.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | CONST_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "const" | 3 | [email protected] "const" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] "_" | 5 | [email protected] "_" |
@@ -17,7 +17,7 @@ [email protected] | |||
17 | [email protected] "0" | 17 | [email protected] "0" |
18 | [email protected] ";" | 18 | [email protected] ";" |
19 | [email protected] "\n" | 19 | [email protected] "\n" |
20 | CONST_DEF@18..38 | 20 | [email protected] |
21 | [email protected] "const" | 21 | [email protected] "const" |
22 | [email protected] " " | 22 | [email protected] " " |
23 | [email protected] | 23 | [email protected] |
@@ -36,7 +36,7 @@ [email protected] | |||
36 | [email protected] "92" | 36 | [email protected] "92" |
37 | [email protected] ";" | 37 | [email protected] ";" |
38 | [email protected] "\n" | 38 | [email protected] "\n" |
39 | CONST_DEF@39..63 | 39 | [email protected] |
40 | [email protected] "const" | 40 | [email protected] "const" |
41 | [email protected] " " | 41 | [email protected] " " |
42 | [email protected] "mut" | 42 | [email protected] "mut" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0025_extern_fn_in_block.rast b/crates/ra_syntax/test_data/parser/ok/0025_extern_fn_in_block.rast index 5701f566e..bb6527b48 100644 --- a/crates/ra_syntax/test_data/parser/ok/0025_extern_fn_in_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0025_extern_fn_in_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..34 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@16..32 | 14 | [email protected] |
15 | [email protected] | 15 | [email protected] |
16 | [email protected] "extern" | 16 | [email protected] "extern" |
17 | [email protected] " " | 17 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/ok/0026_const_fn_in_block.rast b/crates/ra_syntax/test_data/parser/ok/0026_const_fn_in_block.rast index b029d8692..5bcf54deb 100644 --- a/crates/ra_syntax/test_data/parser/ok/0026_const_fn_in_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0026_const_fn_in_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..33 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@16..31 | 14 | [email protected] |
15 | [email protected] "const" | 15 | [email protected] "const" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] "fn" | 17 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast b/crates/ra_syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast index 299bbd136..a7cc12295 100644 --- a/crates/ra_syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0027_unsafe_fn_in_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..52 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@16..32 | 14 | [email protected] |
15 | [email protected] "unsafe" | 15 | [email protected] "unsafe" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] "fn" | 17 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast b/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast index de3c4b786..efe018484 100644 --- a/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast +++ b/crates/ra_syntax/test_data/parser/ok/0028_operator_binding_power.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..247 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast b/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast index dc47d68a6..47e46f009 100644 --- a/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast +++ b/crates/ra_syntax/test_data/parser/ok/0029_range_forms.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..152 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast b/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast index 86c3b46c4..93f766149 100644 --- a/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast +++ b/crates/ra_syntax/test_data/parser/ok/0030_string_suffixes.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..111 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0030_traits.rast b/crates/ra_syntax/test_data/parser/ok/0030_traits.rast index 63693de4f..280d4cb82 100644 --- a/crates/ra_syntax/test_data/parser/ok/0030_traits.rast +++ b/crates/ra_syntax/test_data/parser/ok/0030_traits.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..36 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -8,7 +8,7 @@ [email protected] | |||
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | FN_DEF@21..34 | 11 | [email protected] |
12 | [email protected] "fn" | 12 | [email protected] "fn" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
@@ -20,7 +20,7 @@ [email protected] | |||
20 | [email protected] "\n" | 20 | [email protected] "\n" |
21 | [email protected] "}" | 21 | [email protected] "}" |
22 | [email protected] "\n\n" | 22 | [email protected] "\n\n" |
23 | TRAIT_DEF@38..95 | 23 | [email protected] |
24 | [email protected] "trait" | 24 | [email protected] "trait" |
25 | [email protected] " " | 25 | [email protected] " " |
26 | [email protected] | 26 | [email protected] |
@@ -29,7 +29,7 @@ [email protected] | |||
29 | [email protected] | 29 | [email protected] |
30 | [email protected] "{" | 30 | [email protected] "{" |
31 | [email protected] "\n " | 31 | [email protected] "\n " |
32 | FN_DEF@64..93 | 32 | [email protected] |
33 | [email protected] "fn" | 33 | [email protected] "fn" |
34 | [email protected] " " | 34 | [email protected] " " |
35 | [email protected] | 35 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0031_extern.rast b/crates/ra_syntax/test_data/parser/ok/0031_extern.rast index ea285f52f..0509f7504 100644 --- a/crates/ra_syntax/test_data/parser/ok/0031_extern.rast +++ b/crates/ra_syntax/test_data/parser/ok/0031_extern.rast | |||
@@ -6,7 +6,7 @@ [email protected] | |||
6 | [email protected] | 6 | [email protected] |
7 | [email protected] "{" | 7 | [email protected] "{" |
8 | [email protected] "\n " | 8 | [email protected] "\n " |
9 | FN_DEF@13..87 | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "pub" | 11 | [email protected] "pub" |
12 | [email protected] " " | 12 | [email protected] " " |
@@ -69,7 +69,7 @@ [email protected] | |||
69 | [email protected] "c_int" | 69 | [email protected] "c_int" |
70 | [email protected] ";" | 70 | [email protected] ";" |
71 | [email protected] "\n " | 71 | [email protected] "\n " |
72 | FN_DEF@92..167 | 72 | [email protected] |
73 | [email protected] | 73 | [email protected] |
74 | [email protected] "pub" | 74 | [email protected] "pub" |
75 | [email protected] " " | 75 | [email protected] " " |
@@ -134,7 +134,7 @@ [email protected] | |||
134 | [email protected] "c_int" | 134 | [email protected] "c_int" |
135 | [email protected] ";" | 135 | [email protected] ";" |
136 | [email protected] "\n " | 136 | [email protected] "\n " |
137 | FN_DEF@172..276 | 137 | [email protected] |
138 | [email protected] | 138 | [email protected] |
139 | [email protected] "pub" | 139 | [email protected] "pub" |
140 | [email protected] " " | 140 | [email protected] " " |
@@ -199,7 +199,7 @@ [email protected] | |||
199 | [email protected] "c_int" | 199 | [email protected] "c_int" |
200 | [email protected] ";" | 200 | [email protected] ";" |
201 | [email protected] "\n " | 201 | [email protected] "\n " |
202 | FN_DEF@281..341 | 202 | [email protected] |
203 | [email protected] | 203 | [email protected] |
204 | [email protected] "pub" | 204 | [email protected] "pub" |
205 | [email protected] " " | 205 | [email protected] " " |
@@ -248,7 +248,7 @@ [email protected] | |||
248 | [email protected] "c_int" | 248 | [email protected] "c_int" |
249 | [email protected] ";" | 249 | [email protected] ";" |
250 | [email protected] "\n " | 250 | [email protected] "\n " |
251 | FN_DEF@346..469 | 251 | [email protected] |
252 | [email protected] | 252 | [email protected] |
253 | [email protected] "pub" | 253 | [email protected] "pub" |
254 | [email protected] " " | 254 | [email protected] " " |
@@ -317,7 +317,7 @@ [email protected] | |||
317 | [email protected] "c_int" | 317 | [email protected] "c_int" |
318 | [email protected] ";" | 318 | [email protected] ";" |
319 | [email protected] "\n " | 319 | [email protected] "\n " |
320 | FN_DEF@474..691 | 320 | [email protected] |
321 | [email protected] | 321 | [email protected] |
322 | [email protected] "pub" | 322 | [email protected] "pub" |
323 | [email protected] " " | 323 | [email protected] " " |
@@ -416,7 +416,7 @@ [email protected] | |||
416 | [email protected] "c_int" | 416 | [email protected] "c_int" |
417 | [email protected] ";" | 417 | [email protected] ";" |
418 | [email protected] "\n " | 418 | [email protected] "\n " |
419 | FN_DEF@696..864 | 419 | [email protected] |
420 | [email protected] | 420 | [email protected] |
421 | [email protected] "pub" | 421 | [email protected] "pub" |
422 | [email protected] " " | 422 | [email protected] " " |
@@ -510,7 +510,7 @@ [email protected] | |||
510 | [email protected] "c_int" | 510 | [email protected] "c_int" |
511 | [email protected] ";" | 511 | [email protected] ";" |
512 | [email protected] "\n " | 512 | [email protected] "\n " |
513 | FN_DEF@869..992 | 513 | [email protected] |
514 | [email protected] | 514 | [email protected] |
515 | [email protected] "pub" | 515 | [email protected] "pub" |
516 | [email protected] " " | 516 | [email protected] " " |
@@ -579,7 +579,7 @@ [email protected] | |||
579 | [email protected] "c_int" | 579 | [email protected] "c_int" |
580 | [email protected] ";" | 580 | [email protected] ";" |
581 | [email protected] "\n " | 581 | [email protected] "\n " |
582 | FN_DEF@997..1173 | 582 | [email protected] |
583 | [email protected] | 583 | [email protected] |
584 | [email protected] "pub" | 584 | [email protected] "pub" |
585 | [email protected] " " | 585 | [email protected] " " |
@@ -690,7 +690,7 @@ [email protected] | |||
690 | [email protected] "ssize_t" | 690 | [email protected] "ssize_t" |
691 | [email protected] ";" | 691 | [email protected] ";" |
692 | [email protected] "\n " | 692 | [email protected] "\n " |
693 | FN_DEF@1178..1289 | 693 | [email protected] |
694 | [email protected] | 694 | [email protected] |
695 | [email protected] "pub" | 695 | [email protected] "pub" |
696 | [email protected] " " | 696 | [email protected] " " |
@@ -771,7 +771,7 @@ [email protected] | |||
771 | [email protected] "ssize_t" | 771 | [email protected] "ssize_t" |
772 | [email protected] ";" | 772 | [email protected] ";" |
773 | [email protected] "\n " | 773 | [email protected] "\n " |
774 | FN_DEF@1294..1481 | 774 | [email protected] |
775 | [email protected] | 775 | [email protected] |
776 | [email protected] "pub" | 776 | [email protected] "pub" |
777 | [email protected] " " | 777 | [email protected] " " |
@@ -888,7 +888,7 @@ [email protected] | |||
888 | [email protected] "ssize_t" | 888 | [email protected] "ssize_t" |
889 | [email protected] ";" | 889 | [email protected] ";" |
890 | [email protected] "\n " | 890 | [email protected] "\n " |
891 | FN_DEF@1486..1595 | 891 | [email protected] |
892 | [email protected] | 892 | [email protected] |
893 | [email protected] "pub" | 893 | [email protected] "pub" |
894 | [email protected] " " | 894 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast index 8d76c4e0b..10da87c71 100644 --- a/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast +++ b/crates/ra_syntax/test_data/parser/ok/0032_where_for.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..115 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "test_serialization" | 6 | [email protected] "test_serialization" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -38,7 +38,7 @@ [email protected] | |||
38 | [email protected] | 38 | [email protected] |
39 | [email protected] | 39 | [email protected] |
40 | [email protected] "for" | 40 | [email protected] "for" |
41 | TYP[email protected] | 41 | GENERIC[email protected] |
42 | [email protected] "<" | 42 | [email protected] "<" |
43 | [email protected] | 43 | [email protected] |
44 | [email protected] "\'de" | 44 | [email protected] "\'de" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast b/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast index 13b730ded..b3f29638c 100644 --- a/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast +++ b/crates/ra_syntax/test_data/parser/ok/0033_label_break.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..505 | 2 | [email protected] |
3 | [email protected] "// format with label ..." | 3 | [email protected] "// format with label ..." |
4 | [email protected] "\n" | 4 | [email protected] "\n" |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast b/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast index 21874ae3a..5ad8c570d 100644 --- a/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast +++ b/crates/ra_syntax/test_data/parser/ok/0034_crate_path_in_call.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..61 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast index bbdf896d1..b04a505ea 100644 --- a/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0035_weird_exprs.rast | |||
@@ -120,7 +120,7 @@ [email protected] | |||
120 | [email protected] "\n\n" | 120 | [email protected] "\n\n" |
121 | [email protected] "// Just a grab bag of ..." | 121 | [email protected] "// Just a grab bag of ..." |
122 | [email protected] "\n\n" | 122 | [email protected] "\n\n" |
123 | FN_DEF@520..572 | 123 | [email protected] |
124 | [email protected] "fn" | 124 | [email protected] "fn" |
125 | [email protected] " " | 125 | [email protected] " " |
126 | [email protected] | 126 | [email protected] |
@@ -166,7 +166,7 @@ [email protected] | |||
166 | [email protected] " " | 166 | [email protected] " " |
167 | [email protected] "}" | 167 | [email protected] "}" |
168 | [email protected] "\n\n" | 168 | [email protected] "\n\n" |
169 | FN_DEF@574..624 | 169 | [email protected] |
170 | [email protected] "fn" | 170 | [email protected] "fn" |
171 | [email protected] " " | 171 | [email protected] " " |
172 | [email protected] | 172 | [email protected] |
@@ -178,7 +178,7 @@ [email protected] | |||
178 | [email protected] | 178 | [email protected] |
179 | [email protected] "{" | 179 | [email protected] "{" |
180 | [email protected] "\n " | 180 | [email protected] "\n " |
181 | FN_DEF@591..607 | 181 | [email protected] |
182 | [email protected] "fn" | 182 | [email protected] "fn" |
183 | [email protected] " " | 183 | [email protected] " " |
184 | [email protected] | 184 | [email protected] |
@@ -217,7 +217,7 @@ [email protected] | |||
217 | [email protected] "\n" | 217 | [email protected] "\n" |
218 | [email protected] "}" | 218 | [email protected] "}" |
219 | [email protected] "\n\n" | 219 | [email protected] "\n\n" |
220 | FN_DEF@626..816 | 220 | [email protected] |
221 | [email protected] "fn" | 221 | [email protected] "fn" |
222 | [email protected] " " | 222 | [email protected] " " |
223 | [email protected] | 223 | [email protected] |
@@ -229,7 +229,7 @@ [email protected] | |||
229 | [email protected] | 229 | [email protected] |
230 | [email protected] "{" | 230 | [email protected] "{" |
231 | [email protected] "\n " | 231 | [email protected] "\n " |
232 | FN_DEF@642..720 | 232 | [email protected] |
233 | [email protected] "fn" | 233 | [email protected] "fn" |
234 | [email protected] " " | 234 | [email protected] " " |
235 | [email protected] | 235 | [email protected] |
@@ -407,7 +407,7 @@ [email protected] | |||
407 | [email protected] "\n" | 407 | [email protected] "\n" |
408 | [email protected] "}" | 408 | [email protected] "}" |
409 | [email protected] "\n\n" | 409 | [email protected] "\n\n" |
410 | FN_DEF@818..1322 | 410 | [email protected] |
411 | [email protected] "fn" | 411 | [email protected] "fn" |
412 | [email protected] " " | 412 | [email protected] " " |
413 | [email protected] | 413 | [email protected] |
@@ -572,7 +572,7 @@ [email protected] | |||
572 | [email protected] "\n" | 572 | [email protected] "\n" |
573 | [email protected] "}" | 573 | [email protected] "}" |
574 | [email protected] "\n\n" | 574 | [email protected] "\n\n" |
575 | FN_DEF@1324..1539 | 575 | [email protected] |
576 | [email protected] "fn" | 576 | [email protected] "fn" |
577 | [email protected] " " | 577 | [email protected] " " |
578 | [email protected] | 578 | [email protected] |
@@ -809,7 +809,7 @@ [email protected] | |||
809 | [email protected] "\n" | 809 | [email protected] "\n" |
810 | [email protected] "}" | 810 | [email protected] "}" |
811 | [email protected] "\n\n" | 811 | [email protected] "\n\n" |
812 | FN_DEF@1541..1741 | 812 | [email protected] |
813 | [email protected] "fn" | 813 | [email protected] "fn" |
814 | [email protected] " " | 814 | [email protected] " " |
815 | [email protected] | 815 | [email protected] |
@@ -830,7 +830,7 @@ [email protected] | |||
830 | [email protected] | 830 | [email protected] |
831 | [email protected] "{" | 831 | [email protected] "{" |
832 | [email protected] "\n " | 832 | [email protected] "\n " |
833 | FN_DEF@1575..1598 | 833 | [email protected] |
834 | [email protected] "fn" | 834 | [email protected] "fn" |
835 | [email protected] " " | 835 | [email protected] " " |
836 | [email protected] | 836 | [email protected] |
@@ -988,7 +988,7 @@ [email protected] | |||
988 | [email protected] "\n" | 988 | [email protected] "\n" |
989 | [email protected] "}" | 989 | [email protected] "}" |
990 | [email protected] "\n\n" | 990 | [email protected] "\n\n" |
991 | FN_DEF@1743..1904 | 991 | [email protected] |
992 | [email protected] "fn" | 992 | [email protected] "fn" |
993 | [email protected] " " | 993 | [email protected] " " |
994 | [email protected] | 994 | [email protected] |
@@ -1131,7 +1131,7 @@ [email protected] | |||
1131 | [email protected] "\n" | 1131 | [email protected] "\n" |
1132 | [email protected] "}" | 1132 | [email protected] "}" |
1133 | [email protected] "\n\n" | 1133 | [email protected] "\n\n" |
1134 | FN_DEF@1906..1960 | 1134 | [email protected] |
1135 | [email protected] "fn" | 1135 | [email protected] "fn" |
1136 | [email protected] " " | 1136 | [email protected] " " |
1137 | [email protected] | 1137 | [email protected] |
@@ -1166,7 +1166,7 @@ [email protected] | |||
1166 | [email protected] " " | 1166 | [email protected] " " |
1167 | [email protected] "}" | 1167 | [email protected] "}" |
1168 | [email protected] "\n\n" | 1168 | [email protected] "\n\n" |
1169 | FN_DEF@1962..2198 | 1169 | [email protected] |
1170 | [email protected] "fn" | 1170 | [email protected] "fn" |
1171 | [email protected] " " | 1171 | [email protected] " " |
1172 | [email protected] | 1172 | [email protected] |
@@ -1284,7 +1284,7 @@ [email protected] | |||
1284 | [email protected] "\n" | 1284 | [email protected] "\n" |
1285 | [email protected] "}" | 1285 | [email protected] "}" |
1286 | [email protected] "\n\n" | 1286 | [email protected] "\n\n" |
1287 | FN_DEF@2200..2693 | 1287 | [email protected] |
1288 | [email protected] "fn" | 1288 | [email protected] "fn" |
1289 | [email protected] " " | 1289 | [email protected] " " |
1290 | [email protected] | 1290 | [email protected] |
@@ -1468,7 +1468,7 @@ [email protected] | |||
1468 | [email protected] "\n" | 1468 | [email protected] "\n" |
1469 | [email protected] "}" | 1469 | [email protected] "}" |
1470 | [email protected] "\n\n" | 1470 | [email protected] "\n\n" |
1471 | FN_DEF@2695..2832 | 1471 | [email protected] |
1472 | [email protected] "fn" | 1472 | [email protected] "fn" |
1473 | [email protected] " " | 1473 | [email protected] " " |
1474 | [email protected] | 1474 | [email protected] |
@@ -1548,7 +1548,7 @@ [email protected] | |||
1548 | [email protected] "\n" | 1548 | [email protected] "\n" |
1549 | [email protected] "}" | 1549 | [email protected] "}" |
1550 | [email protected] "\n\n" | 1550 | [email protected] "\n\n" |
1551 | FN_DEF@2834..2906 | 1551 | [email protected] |
1552 | [email protected] "fn" | 1552 | [email protected] "fn" |
1553 | [email protected] " " | 1553 | [email protected] " " |
1554 | [email protected] | 1554 | [email protected] |
@@ -1560,21 +1560,21 @@ [email protected] | |||
1560 | [email protected] | 1560 | [email protected] |
1561 | [email protected] "{" | 1561 | [email protected] "{" |
1562 | [email protected] "\n " | 1562 | [email protected] "\n " |
1563 | UNION_DEF@2851..2904 | 1563 | [email protected] |
1564 | [email protected] "union" | 1564 | [email protected] "union" |
1565 | [email protected] " " | 1565 | [email protected] " " |
1566 | [email protected] | 1566 | [email protected] |
1567 | [email protected] "union" | 1567 | [email protected] "union" |
1568 | TYP[email protected] | 1568 | GENERIC[email protected] |
1569 | [email protected] "<" | 1569 | [email protected] "<" |
1570 | [email protected] | 1570 | [email protected] |
1571 | [email protected] "\'union" | 1571 | [email protected] "\'union" |
1572 | [email protected] ">" | 1572 | [email protected] ">" |
1573 | [email protected] " " | 1573 | [email protected] " " |
1574 | RECORD_FIELD_DEF_[email protected] | 1574 | [email protected] |
1575 | [email protected] "{" | 1575 | [email protected] "{" |
1576 | [email protected] " " | 1576 | [email protected] " " |
1577 | RECORD_FIELD_DEF@2873..2901 | 1577 | [email protected] |
1578 | [email protected] | 1578 | [email protected] |
1579 | [email protected] "union" | 1579 | [email protected] "union" |
1580 | [email protected] ":" | 1580 | [email protected] ":" |
@@ -1599,7 +1599,7 @@ [email protected] | |||
1599 | [email protected] "\n" | 1599 | [email protected] "\n" |
1600 | [email protected] "}" | 1600 | [email protected] "}" |
1601 | [email protected] "\n\n" | 1601 | [email protected] "\n\n" |
1602 | FN_DEF@2908..3042 | 1602 | [email protected] |
1603 | [email protected] "fn" | 1603 | [email protected] "fn" |
1604 | [email protected] " " | 1604 | [email protected] " " |
1605 | [email protected] | 1605 | [email protected] |
@@ -1722,7 +1722,7 @@ [email protected] | |||
1722 | [email protected] "\n" | 1722 | [email protected] "\n" |
1723 | [email protected] "}" | 1723 | [email protected] "}" |
1724 | [email protected] "\n\n" | 1724 | [email protected] "\n\n" |
1725 | FN_DEF@3044..3514 | 1725 | [email protected] |
1726 | [email protected] "fn" | 1726 | [email protected] "fn" |
1727 | [email protected] " " | 1727 | [email protected] " " |
1728 | [email protected] | 1728 | [email protected] |
@@ -2056,7 +2056,7 @@ [email protected] | |||
2056 | [email protected] "\n" | 2056 | [email protected] "\n" |
2057 | [email protected] "}" | 2057 | [email protected] "}" |
2058 | [email protected] "\n\n" | 2058 | [email protected] "\n\n" |
2059 | FN_DEF@3516..3552 | 2059 | [email protected] |
2060 | [email protected] "fn" | 2060 | [email protected] "fn" |
2061 | [email protected] " " | 2061 | [email protected] " " |
2062 | [email protected] | 2062 | [email protected] |
@@ -2090,7 +2090,7 @@ [email protected] | |||
2090 | [email protected] "\n" | 2090 | [email protected] "\n" |
2091 | [email protected] "}" | 2091 | [email protected] "}" |
2092 | [email protected] "\n\n" | 2092 | [email protected] "\n\n" |
2093 | FN_DEF@3554..3812 | 2093 | [email protected] |
2094 | [email protected] | 2094 | [email protected] |
2095 | [email protected] "pub" | 2095 | [email protected] "pub" |
2096 | [email protected] " " | 2096 | [email protected] " " |
diff --git a/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast b/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast index a64a82e94..c4da317b9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast +++ b/crates/ra_syntax/test_data/parser/ok/0036_fully_qualified.rast | |||
@@ -1,7 +1,7 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | [email protected] "// https://github.com ..." | 2 | [email protected] "// https://github.com ..." |
3 | [email protected] "\n\n" | 3 | [email protected] "\n\n" |
4 | FN_DEF@62..156 | 4 | [email protected] |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "pub" | 6 | [email protected] "pub" |
7 | [email protected] " " | 7 | [email protected] " " |
@@ -9,7 +9,7 @@ [email protected] | |||
9 | [email protected] " " | 9 | [email protected] " " |
10 | [email protected] | 10 | [email protected] |
11 | [email protected] "foo" | 11 | [email protected] "foo" |
12 | TYP[email protected] | 12 | GENERIC[email protected] |
13 | [email protected] "<" | 13 | [email protected] "<" |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] | 15 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0038_where_pred_type.rast b/crates/ra_syntax/test_data/parser/ok/0038_where_pred_type.rast index 7fd414090..22168eaf1 100644 --- a/crates/ra_syntax/test_data/parser/ok/0038_where_pred_type.rast +++ b/crates/ra_syntax/test_data/parser/ok/0038_where_pred_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..34 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0039_raw_fn_item.rast b/crates/ra_syntax/test_data/parser/ok/0039_raw_fn_item.rast index 17be2c238..68a366354 100644 --- a/crates/ra_syntax/test_data/parser/ok/0039_raw_fn_item.rast +++ b/crates/ra_syntax/test_data/parser/ok/0039_raw_fn_item.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..14 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast b/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast index 5640bae0a..8cfc14f49 100644 --- a/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast +++ b/crates/ra_syntax/test_data/parser/ok/0040_raw_struct_item_field.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | STRUCT_DEF@0..27 | 2 | [email protected] |
3 | [email protected] "struct" | 3 | [email protected] "struct" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "S" | 6 | [email protected] "S" |
7 | [email protected] " " | 7 | [email protected] " " |
8 | RECORD_FIELD_DEF_[email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | RECORD_FIELD_DEF@15..25 | 11 | [email protected] |
12 | [email protected] | 12 | [email protected] |
13 | [email protected] "r#foo" | 13 | [email protected] "r#foo" |
14 | [email protected] ":" | 14 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast b/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast index acf32a852..92ede8ccb 100644 --- a/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast +++ b/crates/ra_syntax/test_data/parser/ok/0041_raw_keywords.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..59 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast index 573edc081..ed29b0812 100644 --- a/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast +++ b/crates/ra_syntax/test_data/parser/ok/0042_ufcs_call_list.rast | |||
@@ -1,14 +1,14 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | [email protected] "// https://github.com ..." | 2 | [email protected] "// https://github.com ..." |
3 | [email protected] "\n\n" | 3 | [email protected] "\n\n" |
4 | STRUCT_DEF@62..73 | 4 | [email protected] |
5 | [email protected] "struct" | 5 | [email protected] "struct" |
6 | [email protected] " " | 6 | [email protected] " " |
7 | [email protected] | 7 | [email protected] |
8 | [email protected] "Foo" | 8 | [email protected] "Foo" |
9 | [email protected] ";" | 9 | [email protected] ";" |
10 | [email protected] "\n\n" | 10 | [email protected] "\n\n" |
11 | IMPL_DEF@75..141 | 11 | [email protected] |
12 | [email protected] "impl" | 12 | [email protected] "impl" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
@@ -20,7 +20,7 @@ [email protected] | |||
20 | [email protected] | 20 | [email protected] |
21 | [email protected] "{" | 21 | [email protected] "{" |
22 | [email protected] "\n " | 22 | [email protected] "\n " |
23 | FN_DEF@90..139 | 23 | [email protected] |
24 | [email protected] "fn" | 24 | [email protected] "fn" |
25 | [email protected] " " | 25 | [email protected] " " |
26 | [email protected] | 26 | [email protected] |
@@ -55,7 +55,7 @@ [email protected] | |||
55 | [email protected] "\n" | 55 | [email protected] "\n" |
56 | [email protected] "}" | 56 | [email protected] "}" |
57 | [email protected] "\n\n" | 57 | [email protected] "\n\n" |
58 | FN_DEF@143..161 | 58 | [email protected] |
59 | [email protected] "fn" | 59 | [email protected] "fn" |
60 | [email protected] " " | 60 | [email protected] " " |
61 | [email protected] | 61 | [email protected] |
@@ -78,7 +78,7 @@ [email protected] | |||
78 | [email protected] "{" | 78 | [email protected] "{" |
79 | [email protected] "}" | 79 | [email protected] "}" |
80 | [email protected] "\n\n" | 80 | [email protected] "\n\n" |
81 | FN_DEF@163..198 | 81 | [email protected] |
82 | [email protected] "fn" | 82 | [email protected] "fn" |
83 | [email protected] " " | 83 | [email protected] " " |
84 | [email protected] | 84 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast index 900eeb445..adc4a22e9 100644 --- a/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast +++ b/crates/ra_syntax/test_data/parser/ok/0043_complex_assignment.rast | |||
@@ -1,16 +1,16 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | [email protected] "// https://github.com ..." | 2 | [email protected] "// https://github.com ..." |
3 | [email protected] "\n\n" | 3 | [email protected] "\n\n" |
4 | STRUCT_DEF@62..90 | 4 | [email protected] |
5 | [email protected] "struct" | 5 | [email protected] "struct" |
6 | [email protected] " " | 6 | [email protected] " " |
7 | [email protected] | 7 | [email protected] |
8 | [email protected] "Repr" | 8 | [email protected] "Repr" |
9 | [email protected] " " | 9 | [email protected] " " |
10 | RECORD_FIELD_DEF_[email protected] | 10 | [email protected] |
11 | [email protected] "{" | 11 | [email protected] "{" |
12 | [email protected] " " | 12 | [email protected] " " |
13 | RECORD_FIELD_DEF@76..88 | 13 | [email protected] |
14 | [email protected] | 14 | [email protected] |
15 | [email protected] "raw" | 15 | [email protected] "raw" |
16 | [email protected] ":" | 16 | [email protected] ":" |
@@ -30,7 +30,7 @@ [email protected] | |||
30 | [email protected] " " | 30 | [email protected] " " |
31 | [email protected] "}" | 31 | [email protected] "}" |
32 | [email protected] "\n\n" | 32 | [email protected] "\n\n" |
33 | FN_DEF@92..159 | 33 | [email protected] |
34 | [email protected] "fn" | 34 | [email protected] "fn" |
35 | [email protected] " " | 35 | [email protected] " " |
36 | [email protected] | 36 | [email protected] |
@@ -46,16 +46,16 @@ [email protected] | |||
46 | [email protected] | 46 | [email protected] |
47 | [email protected] | 47 | [email protected] |
48 | [email protected] | 48 | [email protected] |
49 | RECORD_LIT@107..124 | 49 | RECORD_EXPR@107..124 |
50 | [email protected] | 50 | [email protected] |
51 | [email protected] | 51 | [email protected] |
52 | [email protected] | 52 | [email protected] |
53 | [email protected] "Repr" | 53 | [email protected] "Repr" |
54 | [email protected] " " | 54 | [email protected] " " |
55 | [email protected] | 55 | RECORD_EXPR_[email protected] |
56 | [email protected] "{" | 56 | [email protected] "{" |
57 | [email protected] " " | 57 | [email protected] " " |
58 | [email protected] | 58 | RECORD_EXPR_[email protected] |
59 | [email protected] | 59 | [email protected] |
60 | [email protected] "raw" | 60 | [email protected] "raw" |
61 | [email protected] ":" | 61 | [email protected] ":" |
@@ -83,14 +83,14 @@ [email protected] | |||
83 | [email protected] "\n " | 83 | [email protected] "\n " |
84 | [email protected] | 84 | [email protected] |
85 | [email protected] | 85 | [email protected] |
86 | RECORD_LIT@141..154 | 86 | RECORD_EXPR@141..154 |
87 | [email protected] | 87 | [email protected] |
88 | [email protected] | 88 | [email protected] |
89 | [email protected] | 89 | [email protected] |
90 | [email protected] "Repr" | 90 | [email protected] "Repr" |
91 | [email protected] | 91 | RECORD_EXPR_[email protected] |
92 | [email protected] "{" | 92 | [email protected] "{" |
93 | [email protected] | 93 | RECORD_EXPR_[email protected] |
94 | [email protected] | 94 | [email protected] |
95 | [email protected] "raw" | 95 | [email protected] "raw" |
96 | [email protected] ":" | 96 | [email protected] ":" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast index 6d941487b..c9e6d88eb 100644 --- a/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0044_let_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..165 | 2 | [email protected] |
3 | [email protected] "// https://github.com ..." | 3 | [email protected] "// https://github.com ..." |
4 | [email protected] "\n" | 4 | [email protected] "\n" |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast index 69aa0ba4d..139ce9046 100644 --- a/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0045_block_inner_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..461 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -89,7 +89,7 @@ [email protected] | |||
89 | [email protected] "\n\n" | 89 | [email protected] "\n\n" |
90 | [email protected] "// https://github.com ..." | 90 | [email protected] "// https://github.com ..." |
91 | [email protected] "\n" | 91 | [email protected] "\n" |
92 | IMPL_DEF@524..685 | 92 | [email protected] |
93 | [email protected] "impl" | 93 | [email protected] "impl" |
94 | [email protected] " " | 94 | [email protected] " " |
95 | [email protected] | 95 | [email protected] |
@@ -101,7 +101,7 @@ [email protected] | |||
101 | [email protected] | 101 | [email protected] |
102 | [email protected] "{" | 102 | [email protected] "{" |
103 | [email protected] "\n " | 103 | [email protected] "\n " |
104 | FN_DEF@544..683 | 104 | [email protected] |
105 | [email protected] "fn" | 105 | [email protected] "fn" |
106 | [email protected] " " | 106 | [email protected] " " |
107 | [email protected] | 107 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast index 38e44e48a..7a54fa113 100644 --- a/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast +++ b/crates/ra_syntax/test_data/parser/ok/0047_minus_in_inner_pattern.rast | |||
@@ -1,7 +1,7 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | [email protected] "// https://github.com ..." | 2 | [email protected] "// https://github.com ..." |
3 | [email protected] "\n\n" | 3 | [email protected] "\n\n" |
4 | FN_DEF@62..341 | 4 | [email protected] |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
6 | [email protected] " " | 6 | [email protected] " " |
7 | [email protected] | 7 | [email protected] |
@@ -256,21 +256,21 @@ [email protected] | |||
256 | [email protected] "\n" | 256 | [email protected] "\n" |
257 | [email protected] "}" | 257 | [email protected] "}" |
258 | [email protected] "\n\n" | 258 | [email protected] "\n\n" |
259 | ENUM_DEF@343..367 | 259 | [email protected] |
260 | [email protected] "enum" | 260 | [email protected] "enum" |
261 | [email protected] " " | 261 | [email protected] " " |
262 | [email protected] | 262 | [email protected] |
263 | [email protected] "A" | 263 | [email protected] "A" |
264 | [email protected] " " | 264 | [email protected] " " |
265 | ENUM_[email protected] | 265 | [email protected] |
266 | [email protected] "{" | 266 | [email protected] "{" |
267 | [email protected] "\n " | 267 | [email protected] "\n " |
268 | ENUM_[email protected] | 268 | [email protected] |
269 | [email protected] | 269 | [email protected] |
270 | [email protected] "B" | 270 | [email protected] "B" |
271 | TUPLE_FIELD_DEF_[email protected] | 271 | [email protected] |
272 | [email protected] "(" | 272 | [email protected] "(" |
273 | TUPLE_FIELD_DEF@358..360 | 273 | [email protected] |
274 | [email protected] | 274 | [email protected] |
275 | [email protected] | 275 | [email protected] |
276 | [email protected] | 276 | [email protected] |
@@ -278,7 +278,7 @@ [email protected] | |||
278 | [email protected] "i8" | 278 | [email protected] "i8" |
279 | [email protected] "," | 279 | [email protected] "," |
280 | [email protected] " " | 280 | [email protected] " " |
281 | TUPLE_FIELD_DEF@362..364 | 281 | [email protected] |
282 | [email protected] | 282 | [email protected] |
283 | [email protected] | 283 | [email protected] |
284 | [email protected] | 284 | [email protected] |
@@ -288,7 +288,7 @@ [email protected] | |||
288 | [email protected] "\n" | 288 | [email protected] "\n" |
289 | [email protected] "}" | 289 | [email protected] "}" |
290 | [email protected] "\n\n" | 290 | [email protected] "\n\n" |
291 | FN_DEF@369..394 | 291 | [email protected] |
292 | [email protected] "fn" | 292 | [email protected] "fn" |
293 | [email protected] " " | 293 | [email protected] " " |
294 | [email protected] | 294 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast b/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast index 28233c5d0..662576e5f 100644 --- a/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast +++ b/crates/ra_syntax/test_data/parser/ok/0048_compound_assignment.rast | |||
@@ -1,7 +1,7 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | [email protected] "// https://github.com ..." | 2 | [email protected] "// https://github.com ..." |
3 | [email protected] "\n\n" | 3 | [email protected] "\n\n" |
4 | FN_DEF@60..256 | 4 | [email protected] |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
6 | [email protected] " " | 6 | [email protected] " " |
7 | [email protected] | 7 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast b/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast index 0569488f8..57ecad3cf 100644 --- a/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0049_async_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..45 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast index 7847da085..798e81ca6 100644 --- a/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast +++ b/crates/ra_syntax/test_data/parser/ok/0050_async_block_as_argument.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..52 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -52,7 +52,7 @@ [email protected] | |||
52 | [email protected] "{" | 52 | [email protected] "{" |
53 | [email protected] "}" | 53 | [email protected] "}" |
54 | [email protected] "\n\n" | 54 | [email protected] "\n\n" |
55 | FN_DEF@54..94 | 55 | [email protected] |
56 | [email protected] "fn" | 56 | [email protected] "fn" |
57 | [email protected] " " | 57 | [email protected] " " |
58 | [email protected] | 58 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast index 919c690de..2cc849784 100644 --- a/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast +++ b/crates/ra_syntax/test_data/parser/ok/0051_parameter_attrs.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..37 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -41,7 +41,7 @@ [email protected] | |||
41 | [email protected] "{" | 41 | [email protected] "{" |
42 | [email protected] "}" | 42 | [email protected] "}" |
43 | [email protected] "\n" | 43 | [email protected] "\n" |
44 | FN_DEF@38..62 | 44 | [email protected] |
45 | [email protected] "fn" | 45 | [email protected] "fn" |
46 | [email protected] " " | 46 | [email protected] " " |
47 | [email protected] | 47 | [email protected] |
@@ -83,7 +83,7 @@ [email protected] | |||
83 | [email protected] | 83 | [email protected] |
84 | [email protected] "{" | 84 | [email protected] "{" |
85 | [email protected] " " | 85 | [email protected] " " |
86 | FN_DEF@77..126 | 86 | [email protected] |
87 | [email protected] "fn" | 87 | [email protected] "fn" |
88 | [email protected] " " | 88 | [email protected] " " |
89 | [email protected] | 89 | [email protected] |
@@ -132,12 +132,12 @@ [email protected] | |||
132 | [email protected] " " | 132 | [email protected] " " |
133 | [email protected] "}" | 133 | [email protected] "}" |
134 | [email protected] "\n\n" | 134 | [email protected] "\n\n" |
135 | FN_DEF@130..172 | 135 | [email protected] |
136 | [email protected] "fn" | 136 | [email protected] "fn" |
137 | [email protected] " " | 137 | [email protected] " " |
138 | [email protected] | 138 | [email protected] |
139 | [email protected] "foo" | 139 | [email protected] "foo" |
140 | TYP[email protected] | 140 | GENERIC[email protected] |
141 | [email protected] "<" | 141 | [email protected] "<" |
142 | [email protected] | 142 | [email protected] |
143 | [email protected] | 143 | [email protected] |
@@ -186,7 +186,7 @@ [email protected] | |||
186 | [email protected] "{" | 186 | [email protected] "{" |
187 | [email protected] "}" | 187 | [email protected] "}" |
188 | [email protected] "\n\n" | 188 | [email protected] "\n\n" |
189 | TRAIT_DEF@174..236 | 189 | [email protected] |
190 | [email protected] "trait" | 190 | [email protected] "trait" |
191 | [email protected] " " | 191 | [email protected] " " |
192 | [email protected] | 192 | [email protected] |
@@ -195,7 +195,7 @@ [email protected] | |||
195 | [email protected] | 195 | [email protected] |
196 | [email protected] "{" | 196 | [email protected] "{" |
197 | [email protected] "\n " | 197 | [email protected] "\n " |
198 | FN_DEF@190..234 | 198 | [email protected] |
199 | [email protected] "fn" | 199 | [email protected] "fn" |
200 | [email protected] " " | 200 | [email protected] " " |
201 | [email protected] | 201 | [email protected] |
@@ -251,7 +251,7 @@ [email protected] | |||
251 | [email protected] "\n" | 251 | [email protected] "\n" |
252 | [email protected] "}" | 252 | [email protected] "}" |
253 | [email protected] "\n\n" | 253 | [email protected] "\n\n" |
254 | IMPL_DEF@238..519 | 254 | [email protected] |
255 | [email protected] "impl" | 255 | [email protected] "impl" |
256 | [email protected] " " | 256 | [email protected] " " |
257 | [email protected] | 257 | [email protected] |
@@ -263,7 +263,7 @@ [email protected] | |||
263 | [email protected] | 263 | [email protected] |
264 | [email protected] "{" | 264 | [email protected] "{" |
265 | [email protected] "\n " | 265 | [email protected] "\n " |
266 | FN_DEF@252..277 | 266 | [email protected] |
267 | [email protected] "fn" | 267 | [email protected] "fn" |
268 | [email protected] " " | 268 | [email protected] " " |
269 | [email protected] | 269 | [email protected] |
@@ -287,7 +287,7 @@ [email protected] | |||
287 | [email protected] "{" | 287 | [email protected] "{" |
288 | [email protected] "}" | 288 | [email protected] "}" |
289 | [email protected] "\n " | 289 | [email protected] "\n " |
290 | FN_DEF@283..305 | 290 | [email protected] |
291 | [email protected] "fn" | 291 | [email protected] "fn" |
292 | [email protected] " " | 292 | [email protected] " " |
293 | [email protected] | 293 | [email protected] |
@@ -311,7 +311,7 @@ [email protected] | |||
311 | [email protected] "{" | 311 | [email protected] "{" |
312 | [email protected] "}" | 312 | [email protected] "}" |
313 | [email protected] "\n " | 313 | [email protected] "\n " |
314 | FN_DEF@311..334 | 314 | [email protected] |
315 | [email protected] "fn" | 315 | [email protected] "fn" |
316 | [email protected] " " | 316 | [email protected] " " |
317 | [email protected] | 317 | [email protected] |
@@ -336,12 +336,12 @@ [email protected] | |||
336 | [email protected] "{" | 336 | [email protected] "{" |
337 | [email protected] "}" | 337 | [email protected] "}" |
338 | [email protected] "\n " | 338 | [email protected] "\n " |
339 | FN_DEF@340..371 | 339 | [email protected] |
340 | [email protected] "fn" | 340 | [email protected] "fn" |
341 | [email protected] " " | 341 | [email protected] " " |
342 | [email protected] | 342 | [email protected] |
343 | [email protected] "g3" | 343 | [email protected] "g3" |
344 | TYP[email protected] | 344 | GENERIC[email protected] |
345 | [email protected] "<" | 345 | [email protected] "<" |
346 | [email protected] | 346 | [email protected] |
347 | [email protected] "\'a" | 347 | [email protected] "\'a" |
@@ -368,12 +368,12 @@ [email protected] | |||
368 | [email protected] "{" | 368 | [email protected] "{" |
369 | [email protected] "}" | 369 | [email protected] "}" |
370 | [email protected] "\n " | 370 | [email protected] "\n " |
371 | FN_DEF@377..407 | 371 | [email protected] |
372 | [email protected] "fn" | 372 | [email protected] "fn" |
373 | [email protected] " " | 373 | [email protected] " " |
374 | [email protected] | 374 | [email protected] |
375 | [email protected] "g4" | 375 | [email protected] "g4" |
376 | TYP[email protected] | 376 | GENERIC[email protected] |
377 | [email protected] "<" | 377 | [email protected] "<" |
378 | [email protected] | 378 | [email protected] |
379 | [email protected] "\'a" | 379 | [email protected] "\'a" |
@@ -400,12 +400,12 @@ [email protected] | |||
400 | [email protected] "{" | 400 | [email protected] "{" |
401 | [email protected] "}" | 401 | [email protected] "}" |
402 | [email protected] "\n " | 402 | [email protected] "\n " |
403 | FN_DEF@413..447 | 403 | [email protected] |
404 | [email protected] "fn" | 404 | [email protected] "fn" |
405 | [email protected] " " | 405 | [email protected] " " |
406 | [email protected] | 406 | [email protected] |
407 | [email protected] "g5" | 407 | [email protected] "g5" |
408 | TYP[email protected] | 408 | GENERIC[email protected] |
409 | [email protected] "<" | 409 | [email protected] "<" |
410 | [email protected] | 410 | [email protected] |
411 | [email protected] "\'a" | 411 | [email protected] "\'a" |
@@ -434,7 +434,7 @@ [email protected] | |||
434 | [email protected] "{" | 434 | [email protected] "{" |
435 | [email protected] "}" | 435 | [email protected] "}" |
436 | [email protected] "\n " | 436 | [email protected] "\n " |
437 | FN_DEF@453..480 | 437 | [email protected] |
438 | [email protected] "fn" | 438 | [email protected] "fn" |
439 | [email protected] " " | 439 | [email protected] " " |
440 | [email protected] | 440 | [email protected] |
@@ -465,7 +465,7 @@ [email protected] | |||
465 | [email protected] "{" | 465 | [email protected] "{" |
466 | [email protected] "}" | 466 | [email protected] "}" |
467 | [email protected] "\n " | 467 | [email protected] "\n " |
468 | FN_DEF@486..517 | 468 | [email protected] |
469 | [email protected] "fn" | 469 | [email protected] "fn" |
470 | [email protected] " " | 470 | [email protected] " " |
471 | [email protected] | 471 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast index 65cfa7bc5..a30000398 100644 --- a/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast +++ b/crates/ra_syntax/test_data/parser/ok/0052_for_range_block.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..79 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast index d6aec7ab9..e3997ac5b 100644 --- a/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast +++ b/crates/ra_syntax/test_data/parser/ok/0054_qual_path_in_type_arg.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..26 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -35,7 +35,7 @@ [email protected] | |||
35 | [email protected] "{" | 35 | [email protected] "{" |
36 | [email protected] "}" | 36 | [email protected] "}" |
37 | [email protected] "\n\n" | 37 | [email protected] "\n\n" |
38 | FN_DEF@28..56 | 38 | [email protected] |
39 | [email protected] "fn" | 39 | [email protected] "fn" |
40 | [email protected] " " | 40 | [email protected] " " |
41 | [email protected] | 41 | [email protected] |
@@ -77,7 +77,7 @@ [email protected] | |||
77 | [email protected] "{" | 77 | [email protected] "{" |
78 | [email protected] "}" | 78 | [email protected] "}" |
79 | [email protected] "\n\n" | 79 | [email protected] "\n\n" |
80 | FN_DEF@58..87 | 80 | [email protected] |
81 | [email protected] "fn" | 81 | [email protected] "fn" |
82 | [email protected] " " | 82 | [email protected] " " |
83 | [email protected] | 83 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast b/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast index 9e0cec35f..7447d516e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast +++ b/crates/ra_syntax/test_data/parser/ok/0055_dot_dot_dot.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TYPE_ALIAS_DEF@0..12 | 2 | [email protected] |
3 | [email protected] "type" | 3 | [email protected] "type" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -12,7 +12,7 @@ [email protected] | |||
12 | [email protected] ")" | 12 | [email protected] ")" |
13 | [email protected] ";" | 13 | [email protected] ";" |
14 | [email protected] "\n\n" | 14 | [email protected] "\n\n" |
15 | FN_DEF@14..48 | 15 | [email protected] |
16 | [email protected] "fn" | 16 | [email protected] "fn" |
17 | [email protected] " " | 17 | [email protected] " " |
18 | [email protected] | 18 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0056_neq_in_type.rast b/crates/ra_syntax/test_data/parser/ok/0056_neq_in_type.rast index 7fa3033ac..3ef916e55 100644 --- a/crates/ra_syntax/test_data/parser/ok/0056_neq_in_type.rast +++ b/crates/ra_syntax/test_data/parser/ok/0056_neq_in_type.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..70 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast index d93968016..53410a1ee 100644 --- a/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast +++ b/crates/ra_syntax/test_data/parser/ok/0057_loop_in_call.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..17 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -23,7 +23,7 @@ [email protected] | |||
23 | [email protected] "{" | 23 | [email protected] "{" |
24 | [email protected] "}" | 24 | [email protected] "}" |
25 | [email protected] "\n\n" | 25 | [email protected] "\n\n" |
26 | FN_DEF@19..50 | 26 | [email protected] |
27 | [email protected] "fn" | 27 | [email protected] "fn" |
28 | [email protected] " " | 28 | [email protected] " " |
29 | [email protected] | 29 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast b/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast index b5c72ee36..a1dfd58f2 100644 --- a/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast +++ b/crates/ra_syntax/test_data/parser/ok/0058_unary_expr_precedence.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..78 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast b/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast index ddcb139c1..767b516a2 100644 --- a/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast +++ b/crates/ra_syntax/test_data/parser/ok/0059_loops_in_parens.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..104 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast b/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast index 098152fc3..1fd1a2888 100644 --- a/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast +++ b/crates/ra_syntax/test_data/parser/ok/0060_as_range.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..55 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast b/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast index c6e982976..ba49c115b 100644 --- a/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast +++ b/crates/ra_syntax/test_data/parser/ok/0061_match_full_range.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..34 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast index bf791ee2b..0c22c31a4 100644 --- a/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast +++ b/crates/ra_syntax/test_data/parser/ok/0062_macro_2.0.rast | |||
@@ -51,7 +51,7 @@ [email protected] | |||
51 | [email protected] "\n" | 51 | [email protected] "\n" |
52 | [email protected] "}" | 52 | [email protected] "}" |
53 | [email protected] "\n\n" | 53 | [email protected] "\n\n" |
54 | FN_DEF@95..348 | 54 | [email protected] |
55 | [email protected] | 55 | [email protected] |
56 | [email protected] "#" | 56 | [email protected] "#" |
57 | [email protected] "[" | 57 | [email protected] "[" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast index 40619b46e..facce8167 100644 --- a/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast +++ b/crates/ra_syntax/test_data/parser/ok/0063_trait_fn_patterns.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | TRAIT_DEF@0..169 | 2 | [email protected] |
3 | [email protected] "trait" | 3 | [email protected] "trait" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -8,7 +8,7 @@ [email protected] | |||
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | FN_DEF@14..46 | 11 | [email protected] |
12 | [email protected] "fn" | 12 | [email protected] "fn" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
@@ -50,7 +50,7 @@ [email protected] | |||
50 | [email protected] "{" | 50 | [email protected] "{" |
51 | [email protected] "}" | 51 | [email protected] "}" |
52 | [email protected] "\n " | 52 | [email protected] "\n " |
53 | FN_DEF@51..74 | 53 | [email protected] |
54 | [email protected] "fn" | 54 | [email protected] "fn" |
55 | [email protected] " " | 55 | [email protected] " " |
56 | [email protected] | 56 | [email protected] |
@@ -92,7 +92,7 @@ [email protected] | |||
92 | [email protected] "{" | 92 | [email protected] "{" |
93 | [email protected] "}" | 93 | [email protected] "}" |
94 | [email protected] "\n " | 94 | [email protected] "\n " |
95 | FN_DEF@79..108 | 95 | [email protected] |
96 | [email protected] "fn" | 96 | [email protected] "fn" |
97 | [email protected] " " | 97 | [email protected] " " |
98 | [email protected] | 98 | [email protected] |
@@ -123,7 +123,7 @@ [email protected] | |||
123 | [email protected] "{" | 123 | [email protected] "{" |
124 | [email protected] "}" | 124 | [email protected] "}" |
125 | [email protected] "\n " | 125 | [email protected] "\n " |
126 | FN_DEF@113..135 | 126 | [email protected] |
127 | [email protected] "fn" | 127 | [email protected] "fn" |
128 | [email protected] " " | 128 | [email protected] " " |
129 | [email protected] | 129 | [email protected] |
@@ -155,7 +155,7 @@ [email protected] | |||
155 | [email protected] "{" | 155 | [email protected] "{" |
156 | [email protected] "}" | 156 | [email protected] "}" |
157 | [email protected] "\n " | 157 | [email protected] "\n " |
158 | FN_DEF@140..167 | 158 | [email protected] |
159 | [email protected] "fn" | 159 | [email protected] "fn" |
160 | [email protected] " " | 160 | [email protected] " " |
161 | [email protected] | 161 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast index 5a9f07c89..7adedb02e 100644 --- a/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast +++ b/crates/ra_syntax/test_data/parser/ok/0063_variadic_fun.rast | |||
@@ -8,7 +8,7 @@ [email protected] | |||
8 | [email protected] | 8 | [email protected] |
9 | [email protected] "{" | 9 | [email protected] "{" |
10 | [email protected] "\n " | 10 | [email protected] "\n " |
11 | FN_DEF@17..40 | 11 | [email protected] |
12 | [email protected] "fn" | 12 | [email protected] "fn" |
13 | [email protected] " " | 13 | [email protected] " " |
14 | [email protected] | 14 | [email protected] |
@@ -37,7 +37,7 @@ [email protected] | |||
37 | [email protected] ")" | 37 | [email protected] ")" |
38 | [email protected] ";" | 38 | [email protected] ";" |
39 | [email protected] "\n " | 39 | [email protected] "\n " |
40 | FN_DEF@45..70 | 40 | [email protected] |
41 | [email protected] "fn" | 41 | [email protected] "fn" |
42 | [email protected] " " | 42 | [email protected] " " |
43 | [email protected] | 43 | [email protected] |
@@ -69,7 +69,7 @@ [email protected] | |||
69 | [email protected] ")" | 69 | [email protected] ")" |
70 | [email protected] ";" | 70 | [email protected] ";" |
71 | [email protected] "\n " | 71 | [email protected] "\n " |
72 | FN_DEF@75..123 | 72 | [email protected] |
73 | [email protected] "fn" | 73 | [email protected] "fn" |
74 | [email protected] " " | 74 | [email protected] " " |
75 | [email protected] | 75 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast index 7b026e33b..453757c3c 100644 --- a/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast +++ b/crates/ra_syntax/test_data/parser/ok/0064_impl_fn_params.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..136 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -11,7 +11,7 @@ [email protected] | |||
11 | [email protected] | 11 | [email protected] |
12 | [email protected] "{" | 12 | [email protected] "{" |
13 | [email protected] "\n " | 13 | [email protected] "\n " |
14 | FN_DEF@13..45 | 14 | [email protected] |
15 | [email protected] "fn" | 15 | [email protected] "fn" |
16 | [email protected] " " | 16 | [email protected] " " |
17 | [email protected] | 17 | [email protected] |
@@ -53,7 +53,7 @@ [email protected] | |||
53 | [email protected] "{" | 53 | [email protected] "{" |
54 | [email protected] "}" | 54 | [email protected] "}" |
55 | [email protected] "\n " | 55 | [email protected] "\n " |
56 | FN_DEF@50..73 | 56 | [email protected] |
57 | [email protected] "fn" | 57 | [email protected] "fn" |
58 | [email protected] " " | 58 | [email protected] " " |
59 | [email protected] | 59 | [email protected] |
@@ -95,7 +95,7 @@ [email protected] | |||
95 | [email protected] "{" | 95 | [email protected] "{" |
96 | [email protected] "}" | 96 | [email protected] "}" |
97 | [email protected] "\n " | 97 | [email protected] "\n " |
98 | FN_DEF@78..107 | 98 | [email protected] |
99 | [email protected] "fn" | 99 | [email protected] "fn" |
100 | [email protected] " " | 100 | [email protected] " " |
101 | [email protected] | 101 | [email protected] |
@@ -126,7 +126,7 @@ [email protected] | |||
126 | [email protected] "{" | 126 | [email protected] "{" |
127 | [email protected] "}" | 127 | [email protected] "}" |
128 | [email protected] "\n " | 128 | [email protected] "\n " |
129 | FN_DEF@112..134 | 129 | [email protected] |
130 | [email protected] "fn" | 130 | [email protected] "fn" |
131 | [email protected] " " | 131 | [email protected] " " |
132 | [email protected] | 132 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0065_comment_newline.rast b/crates/ra_syntax/test_data/parser/ok/0065_comment_newline.rast index d1fffdd63..29bd38c05 100644 --- a/crates/ra_syntax/test_data/parser/ok/0065_comment_newline.rast +++ b/crates/ra_syntax/test_data/parser/ok/0065_comment_newline.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..25 | 2 | [email protected] |
3 | [email protected] "/// Example" | 3 | [email protected] "/// Example" |
4 | [email protected] "\n\n" | 4 | [email protected] "\n\n" |
5 | [email protected] "fn" | 5 | [email protected] "fn" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast index eb2f8eb3c..2c699ffcb 100644 --- a/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast +++ b/crates/ra_syntax/test_data/parser/ok/0065_plus_after_fn_trait_bound.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..39 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "f" | 6 | [email protected] "f" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
diff --git a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast index 584b2faf1..6246a31a6 100644 --- a/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast +++ b/crates/ra_syntax/test_data/parser/ok/0066_default_const.rast | |||
@@ -1,5 +1,5 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | IMPL_DEF@0..45 | 2 | [email protected] |
3 | [email protected] "impl" | 3 | [email protected] "impl" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] | 19 | [email protected] |
20 | [email protected] "{" | 20 | [email protected] "{" |
21 | [email protected] "\n " | 21 | [email protected] "\n " |
22 | CONST_DEF@19..43 | 22 | [email protected] |
23 | [email protected] "default" | 23 | [email protected] "default" |
24 | [email protected] " " | 24 | [email protected] " " |
25 | [email protected] "const" | 25 | [email protected] "const" |
diff --git a/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast b/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast index 503585103..a368ac1e8 100644 --- a/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast +++ b/crates/ra_syntax/test_data/parser/ok/0067_where_for_pred.rast | |||
@@ -1,10 +1,10 @@ | |||
1 | [email protected] | 1 | [email protected] |
2 | FN_DEF@0..55 | 2 | [email protected] |
3 | [email protected] "fn" | 3 | [email protected] "fn" |
4 | [email protected] " " | 4 | [email protected] " " |
5 | [email protected] | 5 | [email protected] |
6 | [email protected] "for_trait" | 6 | [email protected] "for_trait" |
7 | TYP[email protected] | 7 | GENERIC[email protected] |
8 | [email protected] "<" | 8 | [email protected] "<" |
9 | [email protected] | 9 | [email protected] |
10 | [email protected] | 10 | [email protected] |
@@ -19,7 +19,7 @@ [email protected] | |||
19 | [email protected] "\n " | 19 | [email protected] "\n " |
20 | [email protected] | 20 | [email protected] |
21 | [email protected] "for" | 21 | [email protected] "for" |
22 | TYP[email protected] | 22 | GENERIC[email protected] |
23 | [email protected] "<" | 23 | [email protected] "<" |
24 | [email protected] | 24 | [email protected] |
25 | [email protected] "\'a" | 25 | [email protected] "\'a" |
@@ -59,12 +59,12 @@ [email protected] | |||
59 | [email protected] "\n" | 59 | [email protected] "\n" |
60 | [email protected] "}" | 60 | [email protected] "}" |
61 | [email protected] "\n" | 61 | [email protected] "\n" |
62 | FN_DEF@56..107 | 62 | [email protected] |
63 | [email protected] "fn" | 63 | [email protected] "fn" |
64 | [email protected] " " | 64 | [email protected] " " |
65 | [email protected] | 65 | [email protected] |
66 | [email protected] "for_ref" | 66 | [email protected] "for_ref" |
67 | TYP[email protected] | 67 | GENERIC[email protected] |
68 | [email protected] "<" | 68 | [email protected] "<" |
69 | [email protected] | 69 | [email protected] |
70 | [email protected] | 70 | [email protected] |
@@ -79,7 +79,7 @@ [email protected] | |||
79 | [email protected] "\n " | 79 | [email protected] "\n " |
80 | [email protected] | 80 | [email protected] |
81 | [email protected] "for" | 81 | [email protected] "for" |
82 | TYP[email protected] | 82 | GENERIC[email protected] |
83 | [email protected] "<" | 83 | [email protected] "<" |
84 | [email protected] | 84 | [email protected] |
85 | [email protected] "\'a" | 85 | [email protected] "\'a" |
@@ -110,12 +110,12 @@ [email protected] | |||
110 | [email protected] "\n" | 110 | [email protected] "\n" |
111 | [email protected] "}" | 111 | [email protected] "}" |
112 | [email protected] "\n" | 112 | [email protected] "\n" |
113 | FN_DEF@108..170 | 113 | [email protected] |
114 | [email protected] "fn" | 114 | [email protected] "fn" |
115 | [email protected] " " | 115 | [email protected] " " |
116 | [email protected] | 116 | [email protected] |
117 | [email protected] "for_parens" | 117 | [email protected] "for_parens" |
118 | TYP[email protected] | 118 | GENERIC[email protected] |
119 | [email protected] "<" | 119 | [email protected] "<" |
120 | [email protected] | 120 | [email protected] |
121 | [email protected] | 121 | [email protected] |
@@ -130,7 +130,7 @@ [email protected] | |||
130 | [email protected] "\n " | 130 | [email protected] "\n " |
131 | [email protected] | 131 | [email protected] |
132 | [email protected] "for" | 132 | [email protected] "for" |
133 | TYP[email protected] | 133 | GENERIC[email protected] |
134 | [email protected] "<" | 134 | [email protected] "<" |
135 | [email protected] | 135 | [email protected] |
136 | [email protected] "\'a" | 136 | [email protected] "\'a" |
@@ -177,12 +177,12 @@ [email protected] | |||
177 | [email protected] "\n" | 177 | [email protected] "\n" |
178 | [email protected] "}" | 178 | [email protected] "}" |
179 | [email protected] "\n" | 179 | [email protected] "\n" |
180 | FN_DEF@171..223 | 180 | [email protected] |
181 | [email protected] "fn" | 181 | [email protected] "fn" |
182 | [email protected] " " | 182 | [email protected] " " |
183 | [email protected] | 183 | [email protected] |
184 | [email protected] "for_slice" | 184 | [email protected] "for_slice" |
185 | TYP[email protected] | 185 | GENERIC[email protected] |
186 | [email protected] "<" | 186 | [email protected] "<" |
187 | [email protected] | 187 | [email protected] |
188 | [email protected] | 188 | [email protected] |
@@ -197,7 +197,7 @@ [email protected] | |||
197 | [email protected] "\n " | 197 | [email protected] "\n " |
198 | [email protected] | 198 | [email protected] |
199 | [email protected] "for" | 199 | [email protected] "for" |
200 | TYP[email protected] | 200 | GENERIC[email protected] |
201 | [email protected] "<" | 201 | [email protected] "<" |
202 | [email protected] | 202 | [email protected] |
203 | [email protected] "\'a" | 203 | [email protected] "\'a" |
@@ -231,12 +231,12 @@ [email protected] | |||
231 | [email protected] "\n" | 231 | [email protected] "\n" |
232 | [email protected] "}" | 232 | [email protected] "}" |
233 | [email protected] "\n" | 233 | [email protected] "\n" |
234 | FN_DEF@224..300 | 234 | [email protected] |
235 | [email protected] "fn" | 235 | [email protected] "fn" |
236 | [email protected] " " | 236 | [email protected] " " |
237 | [email protected] | 237 | [email protected] |
238 | [email protected] "for_qpath" | 238 | [email protected] "for_qpath" |
239 | TYP[email protected] | 239 | GENERIC[email protected] |
240 | [email protected] "<" | 240 | [email protected] "<" |
241 | [email protected] | 241 | [email protected] |
242 | [email protected] | 242 | [email protected] |
@@ -264,7 +264,7 @@ [email protected] | |||
264 | [email protected] "\n " | 264 | [email protected] "\n " |
265 | [email protected] | 265 | [email protected] |
266 | [email protected] "for" | 266 | [email protected] "for" |
267 | TYP[email protected] | 267 | GENERIC[email protected] |
268 | [email protected] "<" | 268 | [email protected] "<" |
269 | [email protected] | 269 | [email protected] |
270 | [email protected] "\'a" | 270 | [email protected] "\'a" |
@@ -313,12 +313,12 @@ [email protected] | |||
313 | [email protected] "\n" | 313 | [email protected] "\n" |
314 | [email protected] "}" | 314 | [email protected] "}" |
315 | [email protected] "\n" | 315 | [email protected] "\n" |
316 | FN_DEF@301..373 | 316 | [email protected] |
317 | [email protected] "fn" | 317 | [email protected] "fn" |
318 | [email protected] " " | 318 | [email protected] " " |
319 | [email protected] | 319 | [email protected] |
320 | [email protected] "for_for_fn" | 320 | [email protected] "for_for_fn" |
321 | TYP[email protected] | 321 | GENERIC[email protected] |
322 | [email protected] "<" | 322 | [email protected] "<" |
323 | [email protected] | 323 | [email protected] |
324 | [email protected] | 324 | [email protected] |
@@ -333,7 +333,7 @@ [email protected] | |||
333 | [email protected] "\n " | 333 | [email protected] "\n " |
334 | [email protected] | 334 | [email protected] |
335 | [email protected] "for" | 335 | [email protected] "for" |
336 | TYP[email protected] | 336 | GENERIC[email protected] |
337 | [email protected] "<" | 337 | [email protected] "<" |
338 | [email protected] | 338 | [email protected] |
339 | [email protected] "\'a" | 339 | [email protected] "\'a" |
@@ -341,7 +341,7 @@ [email protected] | |||
341 | [email protected] " " | 341 | [email protected] " " |
342 | [email protected] | 342 | [email protected] |
343 | [email protected] "for" | 343 | [email protected] "for" |
344 | TYP[email protected] | 344 | GENERIC[email protected] |
345 | [email protected] "<" | 345 | [email protected] "<" |
346 | [email protected] | 346 | [email protected] |
347 | [email protected] "\'b" | 347 | [email protected] "\'b" |
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml index 931fc61ed..02c1371ac 100644 --- a/crates/rust-analyzer/Cargo.toml +++ b/crates/rust-analyzer/Cargo.toml | |||
@@ -20,7 +20,7 @@ env_logger = { version = "0.7.1", default-features = false } | |||
20 | itertools = "0.9.0" | 20 | itertools = "0.9.0" |
21 | jod-thread = "0.1.0" | 21 | jod-thread = "0.1.0" |
22 | log = "0.4.8" | 22 | log = "0.4.8" |
23 | lsp-types = { version = "0.78.0", features = ["proposed"] } | 23 | lsp-types = { version = "0.79.0", features = ["proposed"] } |
24 | parking_lot = "0.11.0" | 24 | parking_lot = "0.11.0" |
25 | pico-args = "0.3.1" | 25 | pico-args = "0.3.1" |
26 | oorandom = "11.1.2" | 26 | oorandom = "11.1.2" |
@@ -42,7 +42,7 @@ ra_syntax = { path = "../ra_syntax" } | |||
42 | ra_text_edit = { path = "../ra_text_edit" } | 42 | ra_text_edit = { path = "../ra_text_edit" } |
43 | vfs = { path = "../vfs" } | 43 | vfs = { path = "../vfs" } |
44 | vfs-notify = { path = "../vfs-notify" } | 44 | vfs-notify = { path = "../vfs-notify" } |
45 | ra_cfg = { path = "../ra_cfg"} | 45 | ra_cfg = { path = "../ra_cfg" } |
46 | ra_toolchain = { path = "../ra_toolchain" } | 46 | ra_toolchain = { path = "../ra_toolchain" } |
47 | 47 | ||
48 | # This should only be used in CLI | 48 | # This should only be used in CLI |
diff --git a/crates/rust-analyzer/src/bin/args.rs b/crates/rust-analyzer/src/bin/args.rs index 741a2a951..f16e35d86 100644 --- a/crates/rust-analyzer/src/bin/args.rs +++ b/crates/rust-analyzer/src/bin/args.rs | |||
@@ -8,7 +8,7 @@ use std::{env, fmt::Write, path::PathBuf}; | |||
8 | use anyhow::{bail, Result}; | 8 | use anyhow::{bail, Result}; |
9 | use pico_args::Arguments; | 9 | use pico_args::Arguments; |
10 | use ra_ssr::{SsrPattern, SsrRule}; | 10 | use ra_ssr::{SsrPattern, SsrRule}; |
11 | use rust_analyzer::cli::{BenchWhat, Position, Verbosity}; | 11 | use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat, Position, Verbosity}; |
12 | use vfs::AbsPathBuf; | 12 | use vfs::AbsPathBuf; |
13 | 13 | ||
14 | pub(crate) struct Args { | 14 | pub(crate) struct Args { |
@@ -24,23 +24,8 @@ pub(crate) enum Command { | |||
24 | Highlight { | 24 | Highlight { |
25 | rainbow: bool, | 25 | rainbow: bool, |
26 | }, | 26 | }, |
27 | Stats { | 27 | AnalysisStats(AnalysisStatsCmd), |
28 | randomize: bool, | 28 | Bench(BenchCmd), |
29 | parallel: bool, | ||
30 | memory_usage: bool, | ||
31 | only: Option<String>, | ||
32 | with_deps: bool, | ||
33 | path: PathBuf, | ||
34 | load_output_dirs: bool, | ||
35 | with_proc_macro: bool, | ||
36 | }, | ||
37 | Bench { | ||
38 | memory_usage: bool, | ||
39 | path: PathBuf, | ||
40 | what: BenchWhat, | ||
41 | load_output_dirs: bool, | ||
42 | with_proc_macro: bool, | ||
43 | }, | ||
44 | Diagnostics { | 29 | Diagnostics { |
45 | path: PathBuf, | 30 | path: PathBuf, |
46 | load_output_dirs: bool, | 31 | load_output_dirs: bool, |
@@ -199,7 +184,7 @@ ARGS: | |||
199 | trailing.pop().unwrap().into() | 184 | trailing.pop().unwrap().into() |
200 | }; | 185 | }; |
201 | 186 | ||
202 | Command::Stats { | 187 | Command::AnalysisStats(AnalysisStatsCmd { |
203 | randomize, | 188 | randomize, |
204 | parallel, | 189 | parallel, |
205 | memory_usage, | 190 | memory_usage, |
@@ -208,7 +193,7 @@ ARGS: | |||
208 | path, | 193 | path, |
209 | load_output_dirs, | 194 | load_output_dirs, |
210 | with_proc_macro, | 195 | with_proc_macro, |
211 | } | 196 | }) |
212 | } | 197 | } |
213 | "analysis-bench" => { | 198 | "analysis-bench" => { |
214 | if matches.contains(["-h", "--help"]) { | 199 | if matches.contains(["-h", "--help"]) { |
@@ -256,7 +241,13 @@ ARGS: | |||
256 | let memory_usage = matches.contains("--memory-usage"); | 241 | let memory_usage = matches.contains("--memory-usage"); |
257 | let load_output_dirs = matches.contains("--load-output-dirs"); | 242 | let load_output_dirs = matches.contains("--load-output-dirs"); |
258 | let with_proc_macro = matches.contains("--with-proc-macro"); | 243 | let with_proc_macro = matches.contains("--with-proc-macro"); |
259 | Command::Bench { memory_usage, path, what, load_output_dirs, with_proc_macro } | 244 | Command::Bench(BenchCmd { |
245 | memory_usage, | ||
246 | path, | ||
247 | what, | ||
248 | load_output_dirs, | ||
249 | with_proc_macro, | ||
250 | }) | ||
260 | } | 251 | } |
261 | "diagnostics" => { | 252 | "diagnostics" => { |
262 | if matches.contains(["-h", "--help"]) { | 253 | if matches.contains(["-h", "--help"]) { |
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs index a473c9165..ff8234495 100644 --- a/crates/rust-analyzer/src/bin/main.rs +++ b/crates/rust-analyzer/src/bin/main.rs | |||
@@ -33,36 +33,8 @@ fn main() -> Result<()> { | |||
33 | args::Command::Parse { no_dump } => cli::parse(no_dump)?, | 33 | args::Command::Parse { no_dump } => cli::parse(no_dump)?, |
34 | args::Command::Symbols => cli::symbols()?, | 34 | args::Command::Symbols => cli::symbols()?, |
35 | args::Command::Highlight { rainbow } => cli::highlight(rainbow)?, | 35 | args::Command::Highlight { rainbow } => cli::highlight(rainbow)?, |
36 | args::Command::Stats { | 36 | args::Command::AnalysisStats(cmd) => cmd.run(args.verbosity)?, |
37 | randomize, | 37 | args::Command::Bench(cmd) => cmd.run(args.verbosity)?, |
38 | parallel, | ||
39 | memory_usage, | ||
40 | only, | ||
41 | with_deps, | ||
42 | path, | ||
43 | load_output_dirs, | ||
44 | with_proc_macro, | ||
45 | } => cli::analysis_stats( | ||
46 | args.verbosity, | ||
47 | memory_usage, | ||
48 | path.as_ref(), | ||
49 | only.as_ref().map(String::as_ref), | ||
50 | with_deps, | ||
51 | randomize, | ||
52 | parallel, | ||
53 | load_output_dirs, | ||
54 | with_proc_macro, | ||
55 | )?, | ||
56 | args::Command::Bench { memory_usage, path, what, load_output_dirs, with_proc_macro } => { | ||
57 | cli::analysis_bench( | ||
58 | args.verbosity, | ||
59 | path.as_ref(), | ||
60 | what, | ||
61 | memory_usage, | ||
62 | load_output_dirs, | ||
63 | with_proc_macro, | ||
64 | )? | ||
65 | } | ||
66 | args::Command::Diagnostics { path, load_output_dirs, with_proc_macro, all } => { | 38 | args::Command::Diagnostics { path, load_output_dirs, with_proc_macro, all } => { |
67 | cli::diagnostics(path.as_ref(), load_output_dirs, with_proc_macro, all)? | 39 | cli::diagnostics(path.as_ref(), load_output_dirs, with_proc_macro, all)? |
68 | } | 40 | } |
diff --git a/crates/rust-analyzer/src/cli.rs b/crates/rust-analyzer/src/cli.rs index a9b9c8923..1034d11bd 100644 --- a/crates/rust-analyzer/src/cli.rs +++ b/crates/rust-analyzer/src/cli.rs | |||
@@ -14,8 +14,8 @@ use ra_ide::Analysis; | |||
14 | use ra_prof::profile; | 14 | use ra_prof::profile; |
15 | use ra_syntax::{AstNode, SourceFile}; | 15 | use ra_syntax::{AstNode, SourceFile}; |
16 | 16 | ||
17 | pub use analysis_bench::{analysis_bench, BenchWhat, Position}; | 17 | pub use analysis_bench::{BenchCmd, BenchWhat, Position}; |
18 | pub use analysis_stats::analysis_stats; | 18 | pub use analysis_stats::AnalysisStatsCmd; |
19 | pub use diagnostics::diagnostics; | 19 | pub use diagnostics::diagnostics; |
20 | pub use load_cargo::load_cargo; | 20 | pub use load_cargo::load_cargo; |
21 | pub use ssr::{apply_ssr_rules, search_for_patterns}; | 21 | pub use ssr::{apply_ssr_rules, search_for_patterns}; |
diff --git a/crates/rust-analyzer/src/cli/analysis_bench.rs b/crates/rust-analyzer/src/cli/analysis_bench.rs index 076184ad6..c54ee5f4d 100644 --- a/crates/rust-analyzer/src/cli/analysis_bench.rs +++ b/crates/rust-analyzer/src/cli/analysis_bench.rs | |||
@@ -1,8 +1,8 @@ | |||
1 | //! Benchmark operations like highlighting or goto definition. | 1 | //! Benchmark operations like highlighting or goto definition. |
2 | 2 | ||
3 | use std::{env, path::Path, str::FromStr, sync::Arc, time::Instant}; | 3 | use std::{env, path::PathBuf, str::FromStr, sync::Arc, time::Instant}; |
4 | 4 | ||
5 | use anyhow::{format_err, Result}; | 5 | use anyhow::{bail, format_err, Result}; |
6 | use ra_db::{ | 6 | use ra_db::{ |
7 | salsa::{Database, Durability}, | 7 | salsa::{Database, Durability}, |
8 | FileId, | 8 | FileId, |
@@ -15,6 +15,14 @@ use crate::{ | |||
15 | print_memory_usage, | 15 | print_memory_usage, |
16 | }; | 16 | }; |
17 | 17 | ||
18 | pub struct BenchCmd { | ||
19 | pub path: PathBuf, | ||
20 | pub what: BenchWhat, | ||
21 | pub memory_usage: bool, | ||
22 | pub load_output_dirs: bool, | ||
23 | pub with_proc_macro: bool, | ||
24 | } | ||
25 | |||
18 | pub enum BenchWhat { | 26 | pub enum BenchWhat { |
19 | Highlight { path: AbsPathBuf }, | 27 | Highlight { path: AbsPathBuf }, |
20 | Complete(Position), | 28 | Complete(Position), |
@@ -30,85 +38,80 @@ pub struct Position { | |||
30 | impl FromStr for Position { | 38 | impl FromStr for Position { |
31 | type Err = anyhow::Error; | 39 | type Err = anyhow::Error; |
32 | fn from_str(s: &str) -> Result<Self> { | 40 | fn from_str(s: &str) -> Result<Self> { |
33 | let (path_line, column) = rsplit_at_char(s, ':')?; | 41 | let mut split = s.rsplitn(3, ':'); |
34 | let (path, line) = rsplit_at_char(path_line, ':')?; | 42 | match (split.next(), split.next(), split.next()) { |
35 | let path = env::current_dir().unwrap().join(path); | 43 | (Some(column), Some(line), Some(path)) => { |
36 | let path = AbsPathBuf::assert(path); | 44 | let path = env::current_dir().unwrap().join(path); |
37 | Ok(Position { path, line: line.parse()?, column: column.parse()? }) | 45 | let path = AbsPathBuf::assert(path); |
46 | Ok(Position { path, line: line.parse()?, column: column.parse()? }) | ||
47 | } | ||
48 | _ => bail!("position should be in file:line:column format: {:?}", s), | ||
49 | } | ||
38 | } | 50 | } |
39 | } | 51 | } |
40 | 52 | ||
41 | fn rsplit_at_char(s: &str, c: char) -> Result<(&str, &str)> { | 53 | impl BenchCmd { |
42 | let idx = s.rfind(c).ok_or_else(|| format_err!("no `{}` in {}", c, s))?; | 54 | pub fn run(self, verbosity: Verbosity) -> Result<()> { |
43 | Ok((&s[..idx], &s[idx + 1..])) | 55 | ra_prof::init(); |
44 | } | ||
45 | 56 | ||
46 | pub fn analysis_bench( | 57 | let start = Instant::now(); |
47 | verbosity: Verbosity, | 58 | eprint!("loading: "); |
48 | path: &Path, | 59 | let (mut host, vfs) = load_cargo(&self.path, self.load_output_dirs, self.with_proc_macro)?; |
49 | what: BenchWhat, | 60 | eprintln!("{:?}\n", start.elapsed()); |
50 | memory_usage: bool, | 61 | |
51 | load_output_dirs: bool, | 62 | let file_id = { |
52 | with_proc_macro: bool, | 63 | let path = match &self.what { |
53 | ) -> Result<()> { | 64 | BenchWhat::Highlight { path } => path, |
54 | ra_prof::init(); | 65 | BenchWhat::Complete(pos) | BenchWhat::GotoDef(pos) => &pos.path, |
55 | 66 | }; | |
56 | let start = Instant::now(); | 67 | let path = path.clone().into(); |
57 | eprint!("loading: "); | 68 | vfs.file_id(&path).ok_or_else(|| format_err!("Can't find {}", path))? |
58 | let (mut host, vfs) = load_cargo(path, load_output_dirs, with_proc_macro)?; | ||
59 | eprintln!("{:?}\n", start.elapsed()); | ||
60 | |||
61 | let file_id = { | ||
62 | let path = match &what { | ||
63 | BenchWhat::Highlight { path } => path, | ||
64 | BenchWhat::Complete(pos) | BenchWhat::GotoDef(pos) => &pos.path, | ||
65 | }; | 69 | }; |
66 | let path = path.clone().into(); | ||
67 | vfs.file_id(&path).ok_or_else(|| format_err!("Can't find {}", path))? | ||
68 | }; | ||
69 | |||
70 | match &what { | ||
71 | BenchWhat::Highlight { .. } => { | ||
72 | let res = do_work(&mut host, file_id, |analysis| { | ||
73 | analysis.diagnostics(file_id, true).unwrap(); | ||
74 | analysis.highlight_as_html(file_id, false).unwrap() | ||
75 | }); | ||
76 | if verbosity.is_verbose() { | ||
77 | println!("\n{}", res); | ||
78 | } | ||
79 | } | ||
80 | BenchWhat::Complete(pos) | BenchWhat::GotoDef(pos) => { | ||
81 | let is_completion = matches!(what, BenchWhat::Complete(..)); | ||
82 | 70 | ||
83 | let offset = host | 71 | match &self.what { |
84 | .analysis() | 72 | BenchWhat::Highlight { .. } => { |
85 | .file_line_index(file_id)? | ||
86 | .offset(LineCol { line: pos.line - 1, col_utf16: pos.column }); | ||
87 | let file_position = FilePosition { file_id, offset }; | ||
88 | |||
89 | if is_completion { | ||
90 | let options = CompletionConfig::default(); | ||
91 | let res = do_work(&mut host, file_id, |analysis| { | 73 | let res = do_work(&mut host, file_id, |analysis| { |
92 | analysis.completions(&options, file_position) | 74 | analysis.diagnostics(file_id, true).unwrap(); |
75 | analysis.highlight_as_html(file_id, false).unwrap() | ||
93 | }); | 76 | }); |
94 | if verbosity.is_verbose() { | 77 | if verbosity.is_verbose() { |
95 | println!("\n{:#?}", res); | 78 | println!("\n{}", res); |
96 | } | 79 | } |
97 | } else { | 80 | } |
98 | let res = | 81 | BenchWhat::Complete(pos) | BenchWhat::GotoDef(pos) => { |
99 | do_work(&mut host, file_id, |analysis| analysis.goto_definition(file_position)); | 82 | let is_completion = matches!(self.what, BenchWhat::Complete(..)); |
100 | if verbosity.is_verbose() { | 83 | |
101 | println!("\n{:#?}", res); | 84 | let offset = host |
85 | .analysis() | ||
86 | .file_line_index(file_id)? | ||
87 | .offset(LineCol { line: pos.line - 1, col_utf16: pos.column }); | ||
88 | let file_position = FilePosition { file_id, offset }; | ||
89 | |||
90 | if is_completion { | ||
91 | let options = CompletionConfig::default(); | ||
92 | let res = do_work(&mut host, file_id, |analysis| { | ||
93 | analysis.completions(&options, file_position) | ||
94 | }); | ||
95 | if verbosity.is_verbose() { | ||
96 | println!("\n{:#?}", res); | ||
97 | } | ||
98 | } else { | ||
99 | let res = do_work(&mut host, file_id, |analysis| { | ||
100 | analysis.goto_definition(file_position) | ||
101 | }); | ||
102 | if verbosity.is_verbose() { | ||
103 | println!("\n{:#?}", res); | ||
104 | } | ||
102 | } | 105 | } |
103 | } | 106 | } |
104 | } | 107 | } |
105 | } | ||
106 | 108 | ||
107 | if memory_usage { | 109 | if self.memory_usage { |
108 | print_memory_usage(host, vfs); | 110 | print_memory_usage(host, vfs); |
109 | } | 111 | } |
110 | 112 | ||
111 | Ok(()) | 113 | Ok(()) |
114 | } | ||
112 | } | 115 | } |
113 | 116 | ||
114 | fn do_work<F: Fn(&Analysis) -> T, T>(host: &mut AnalysisHost, file_id: FileId, work: F) -> T { | 117 | fn do_work<F: Fn(&Analysis) -> T, T>(host: &mut AnalysisHost, file_id: FileId, work: F) -> T { |
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs index 187a0ebe6..721d41a58 100644 --- a/crates/rust-analyzer/src/cli/analysis_stats.rs +++ b/crates/rust-analyzer/src/cli/analysis_stats.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! errors. | 2 | //! errors. |
3 | 3 | ||
4 | use std::{ | 4 | use std::{ |
5 | path::Path, | 5 | path::PathBuf, |
6 | time::{SystemTime, UNIX_EPOCH}, | 6 | time::{SystemTime, UNIX_EPOCH}, |
7 | }; | 7 | }; |
8 | 8 | ||
@@ -39,278 +39,290 @@ impl<DB: ParallelDatabase> Clone for Snap<salsa::Snapshot<DB>> { | |||
39 | } | 39 | } |
40 | } | 40 | } |
41 | 41 | ||
42 | pub fn analysis_stats( | 42 | pub struct AnalysisStatsCmd { |
43 | verbosity: Verbosity, | 43 | pub randomize: bool, |
44 | memory_usage: bool, | 44 | pub parallel: bool, |
45 | path: &Path, | 45 | pub memory_usage: bool, |
46 | only: Option<&str>, | 46 | pub only: Option<String>, |
47 | with_deps: bool, | 47 | pub with_deps: bool, |
48 | randomize: bool, | 48 | pub path: PathBuf, |
49 | parallel: bool, | 49 | pub load_output_dirs: bool, |
50 | load_output_dirs: bool, | 50 | pub with_proc_macro: bool, |
51 | with_proc_macro: bool, | 51 | } |
52 | ) -> Result<()> { | ||
53 | let mut rng = { | ||
54 | let seed = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64; | ||
55 | Rand32::new(seed) | ||
56 | }; | ||
57 | 52 | ||
58 | let mut db_load_sw = StopWatch::start().memory(memory_usage); | 53 | impl AnalysisStatsCmd { |
59 | let (host, vfs) = load_cargo(path, load_output_dirs, with_proc_macro)?; | 54 | pub fn run(self, verbosity: Verbosity) -> Result<()> { |
60 | let db = host.raw_database(); | 55 | let mut rng = { |
61 | eprintln!("Database loaded {}", db_load_sw.elapsed()); | 56 | let seed = SystemTime::now().duration_since(UNIX_EPOCH).unwrap().as_millis() as u64; |
57 | Rand32::new(seed) | ||
58 | }; | ||
62 | 59 | ||
63 | let mut analysis_sw = StopWatch::start().memory(memory_usage); | 60 | let mut db_load_sw = self.stop_watch(); |
64 | let mut num_crates = 0; | 61 | let (host, vfs) = load_cargo(&self.path, self.load_output_dirs, self.with_proc_macro)?; |
65 | let mut visited_modules = FxHashSet::default(); | 62 | let db = host.raw_database(); |
66 | let mut visit_queue = Vec::new(); | 63 | eprintln!("Database loaded {}", db_load_sw.elapsed()); |
67 | 64 | ||
68 | let mut krates = Crate::all(db); | 65 | let mut analysis_sw = self.stop_watch(); |
69 | if randomize { | 66 | let mut num_crates = 0; |
70 | shuffle(&mut rng, &mut krates); | 67 | let mut visited_modules = FxHashSet::default(); |
71 | } | 68 | let mut visit_queue = Vec::new(); |
72 | for krate in krates { | ||
73 | let module = krate.root_module(db).expect("crate without root module"); | ||
74 | let file_id = module.definition_source(db).file_id; | ||
75 | let file_id = file_id.original_file(db); | ||
76 | let source_root = db.file_source_root(file_id); | ||
77 | let source_root = db.source_root(source_root); | ||
78 | if !source_root.is_library || with_deps { | ||
79 | num_crates += 1; | ||
80 | visit_queue.push(module); | ||
81 | } | ||
82 | } | ||
83 | 69 | ||
84 | if randomize { | 70 | let mut krates = Crate::all(db); |
85 | shuffle(&mut rng, &mut visit_queue); | 71 | if self.randomize { |
86 | } | 72 | shuffle(&mut rng, &mut krates); |
73 | } | ||
74 | for krate in krates { | ||
75 | let module = krate.root_module(db).expect("crate without root module"); | ||
76 | let file_id = module.definition_source(db).file_id; | ||
77 | let file_id = file_id.original_file(db); | ||
78 | let source_root = db.file_source_root(file_id); | ||
79 | let source_root = db.source_root(source_root); | ||
80 | if !source_root.is_library || self.with_deps { | ||
81 | num_crates += 1; | ||
82 | visit_queue.push(module); | ||
83 | } | ||
84 | } | ||
87 | 85 | ||
88 | eprintln!("Crates in this dir: {}", num_crates); | 86 | if self.randomize { |
89 | let mut num_decls = 0; | 87 | shuffle(&mut rng, &mut visit_queue); |
90 | let mut funcs = Vec::new(); | 88 | } |
91 | while let Some(module) = visit_queue.pop() { | ||
92 | if visited_modules.insert(module) { | ||
93 | visit_queue.extend(module.children(db)); | ||
94 | 89 | ||
95 | for decl in module.declarations(db) { | 90 | eprintln!("Crates in this dir: {}", num_crates); |
96 | num_decls += 1; | 91 | let mut num_decls = 0; |
97 | if let ModuleDef::Function(f) = decl { | 92 | let mut funcs = Vec::new(); |
98 | funcs.push(f); | 93 | while let Some(module) = visit_queue.pop() { |
99 | } | 94 | if visited_modules.insert(module) { |
100 | } | 95 | visit_queue.extend(module.children(db)); |
101 | 96 | ||
102 | for impl_def in module.impl_defs(db) { | 97 | for decl in module.declarations(db) { |
103 | for item in impl_def.items(db) { | ||
104 | num_decls += 1; | 98 | num_decls += 1; |
105 | if let AssocItem::Function(f) = item { | 99 | if let ModuleDef::Function(f) = decl { |
106 | funcs.push(f); | 100 | funcs.push(f); |
107 | } | 101 | } |
108 | } | 102 | } |
103 | |||
104 | for impl_def in module.impl_defs(db) { | ||
105 | for item in impl_def.items(db) { | ||
106 | num_decls += 1; | ||
107 | if let AssocItem::Function(f) = item { | ||
108 | funcs.push(f); | ||
109 | } | ||
110 | } | ||
111 | } | ||
109 | } | 112 | } |
110 | } | 113 | } |
111 | } | 114 | eprintln!("Total modules found: {}", visited_modules.len()); |
112 | eprintln!("Total modules found: {}", visited_modules.len()); | 115 | eprintln!("Total declarations: {}", num_decls); |
113 | eprintln!("Total declarations: {}", num_decls); | 116 | eprintln!("Total functions: {}", funcs.len()); |
114 | eprintln!("Total functions: {}", funcs.len()); | 117 | eprintln!("Item Collection: {}", analysis_sw.elapsed()); |
115 | eprintln!("Item Collection: {}", analysis_sw.elapsed()); | ||
116 | |||
117 | if randomize { | ||
118 | shuffle(&mut rng, &mut funcs); | ||
119 | } | ||
120 | 118 | ||
121 | let mut bar = match verbosity { | 119 | if self.randomize { |
122 | Verbosity::Quiet | Verbosity::Spammy => ProgressReport::hidden(), | 120 | shuffle(&mut rng, &mut funcs); |
123 | _ if parallel => ProgressReport::hidden(), | 121 | } |
124 | _ => ProgressReport::new(funcs.len() as u64), | ||
125 | }; | ||
126 | 122 | ||
127 | if parallel { | 123 | let mut bar = match verbosity { |
128 | let mut inference_sw = StopWatch::start().memory(memory_usage); | 124 | Verbosity::Quiet | Verbosity::Spammy => ProgressReport::hidden(), |
129 | let snap = Snap(db.snapshot()); | 125 | _ if self.parallel => ProgressReport::hidden(), |
130 | funcs | 126 | _ => ProgressReport::new(funcs.len() as u64), |
131 | .par_iter() | 127 | }; |
132 | .map_with(snap, |snap, &f| { | ||
133 | let f_id = FunctionId::from(f); | ||
134 | snap.0.body(f_id.into()); | ||
135 | snap.0.infer(f_id.into()); | ||
136 | }) | ||
137 | .count(); | ||
138 | eprintln!("Parallel Inference: {}", inference_sw.elapsed()); | ||
139 | } | ||
140 | 128 | ||
141 | let mut inference_sw = StopWatch::start().memory(memory_usage); | 129 | if self.parallel { |
142 | bar.tick(); | 130 | let mut inference_sw = self.stop_watch(); |
143 | let mut num_exprs = 0; | 131 | let snap = Snap(db.snapshot()); |
144 | let mut num_exprs_unknown = 0; | 132 | funcs |
145 | let mut num_exprs_partially_unknown = 0; | 133 | .par_iter() |
146 | let mut num_type_mismatches = 0; | 134 | .map_with(snap, |snap, &f| { |
147 | for f in funcs { | 135 | let f_id = FunctionId::from(f); |
148 | let name = f.name(db); | 136 | snap.0.body(f_id.into()); |
149 | let full_name = f | 137 | snap.0.infer(f_id.into()); |
150 | .module(db) | 138 | }) |
151 | .path_to_root(db) | 139 | .count(); |
152 | .into_iter() | 140 | eprintln!("Parallel Inference: {}", inference_sw.elapsed()); |
153 | .rev() | ||
154 | .filter_map(|it| it.name(db)) | ||
155 | .chain(Some(f.name(db))) | ||
156 | .join("::"); | ||
157 | if let Some(only_name) = only { | ||
158 | if name.to_string() != only_name && full_name != only_name { | ||
159 | continue; | ||
160 | } | ||
161 | } | ||
162 | let mut msg = format!("processing: {}", full_name); | ||
163 | if verbosity.is_verbose() { | ||
164 | let src = f.source(db); | ||
165 | let original_file = src.file_id.original_file(db); | ||
166 | let path = vfs.file_path(original_file); | ||
167 | let syntax_range = src.value.syntax().text_range(); | ||
168 | format_to!(msg, " ({} {:?})", path, syntax_range); | ||
169 | } | ||
170 | if verbosity.is_spammy() { | ||
171 | bar.println(msg.to_string()); | ||
172 | } | 141 | } |
173 | bar.set_message(&msg); | 142 | |
174 | let f_id = FunctionId::from(f); | 143 | let mut inference_sw = self.stop_watch(); |
175 | let body = db.body(f_id.into()); | 144 | bar.tick(); |
176 | let inference_result = db.infer(f_id.into()); | 145 | let mut num_exprs = 0; |
177 | let (previous_exprs, previous_unknown, previous_partially_unknown) = | 146 | let mut num_exprs_unknown = 0; |
178 | (num_exprs, num_exprs_unknown, num_exprs_partially_unknown); | 147 | let mut num_exprs_partially_unknown = 0; |
179 | for (expr_id, _) in body.exprs.iter() { | 148 | let mut num_type_mismatches = 0; |
180 | let ty = &inference_result[expr_id]; | 149 | for f in funcs { |
181 | num_exprs += 1; | 150 | let name = f.name(db); |
182 | if let Ty::Unknown = ty { | 151 | let full_name = f |
183 | num_exprs_unknown += 1; | 152 | .module(db) |
184 | } else { | 153 | .path_to_root(db) |
185 | let mut is_partially_unknown = false; | 154 | .into_iter() |
186 | ty.walk(&mut |ty| { | 155 | .rev() |
187 | if let Ty::Unknown = ty { | 156 | .filter_map(|it| it.name(db)) |
188 | is_partially_unknown = true; | 157 | .chain(Some(f.name(db))) |
189 | } | 158 | .join("::"); |
190 | }); | 159 | if let Some(only_name) = self.only.as_deref() { |
191 | if is_partially_unknown { | 160 | if name.to_string() != only_name && full_name != only_name { |
192 | num_exprs_partially_unknown += 1; | 161 | continue; |
193 | } | 162 | } |
194 | } | 163 | } |
195 | if only.is_some() && verbosity.is_spammy() { | 164 | let mut msg = format!("processing: {}", full_name); |
196 | // in super-verbose mode for just one function, we print every single expression | 165 | if verbosity.is_verbose() { |
197 | let (_, sm) = db.body_with_source_map(f_id.into()); | 166 | let src = f.source(db); |
198 | let src = sm.expr_syntax(expr_id); | 167 | let original_file = src.file_id.original_file(db); |
199 | if let Ok(src) = src { | 168 | let path = vfs.file_path(original_file); |
200 | let node = { | 169 | let syntax_range = src.value.syntax().text_range(); |
201 | let root = db.parse_or_expand(src.file_id).unwrap(); | 170 | format_to!(msg, " ({} {:?})", path, syntax_range); |
202 | src.value.to_node(&root) | 171 | } |
203 | }; | 172 | if verbosity.is_spammy() { |
204 | let original_file = src.file_id.original_file(db); | 173 | bar.println(msg.to_string()); |
205 | let line_index = host.analysis().file_line_index(original_file).unwrap(); | 174 | } |
206 | let text_range = node.syntax().text_range(); | 175 | bar.set_message(&msg); |
207 | let (start, end) = ( | 176 | let f_id = FunctionId::from(f); |
208 | line_index.line_col(text_range.start()), | 177 | let body = db.body(f_id.into()); |
209 | line_index.line_col(text_range.end()), | 178 | let inference_result = db.infer(f_id.into()); |
210 | ); | 179 | let (previous_exprs, previous_unknown, previous_partially_unknown) = |
211 | bar.println(format!( | 180 | (num_exprs, num_exprs_unknown, num_exprs_partially_unknown); |
212 | "{}:{}-{}:{}: {}", | 181 | for (expr_id, _) in body.exprs.iter() { |
213 | start.line + 1, | 182 | let ty = &inference_result[expr_id]; |
214 | start.col_utf16, | 183 | num_exprs += 1; |
215 | end.line + 1, | 184 | if let Ty::Unknown = ty { |
216 | end.col_utf16, | 185 | num_exprs_unknown += 1; |
217 | ty.display(db) | ||
218 | )); | ||
219 | } else { | 186 | } else { |
220 | bar.println(format!("unknown location: {}", ty.display(db))); | 187 | let mut is_partially_unknown = false; |
188 | ty.walk(&mut |ty| { | ||
189 | if let Ty::Unknown = ty { | ||
190 | is_partially_unknown = true; | ||
191 | } | ||
192 | }); | ||
193 | if is_partially_unknown { | ||
194 | num_exprs_partially_unknown += 1; | ||
195 | } | ||
221 | } | 196 | } |
222 | } | 197 | if self.only.is_some() && verbosity.is_spammy() { |
223 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { | 198 | // in super-verbose mode for just one function, we print every single expression |
224 | num_type_mismatches += 1; | ||
225 | if verbosity.is_verbose() { | ||
226 | let (_, sm) = db.body_with_source_map(f_id.into()); | 199 | let (_, sm) = db.body_with_source_map(f_id.into()); |
227 | let src = sm.expr_syntax(expr_id); | 200 | let src = sm.expr_syntax(expr_id); |
228 | if let Ok(src) = src { | 201 | if let Ok(src) = src { |
229 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly | 202 | let node = { |
230 | // But also, we should just turn the type mismatches into diagnostics and provide these | 203 | let root = db.parse_or_expand(src.file_id).unwrap(); |
231 | let root = db.parse_or_expand(src.file_id).unwrap(); | 204 | src.value.to_node(&root) |
232 | let node = src.map(|e| e.to_node(&root).syntax().clone()); | 205 | }; |
233 | let original_range = original_range(db, node.as_ref()); | 206 | let original_file = src.file_id.original_file(db); |
234 | let path = vfs.file_path(original_range.file_id); | 207 | let line_index = host.analysis().file_line_index(original_file).unwrap(); |
235 | let line_index = | 208 | let text_range = node.syntax().text_range(); |
236 | host.analysis().file_line_index(original_range.file_id).unwrap(); | ||
237 | let text_range = original_range.range; | ||
238 | let (start, end) = ( | 209 | let (start, end) = ( |
239 | line_index.line_col(text_range.start()), | 210 | line_index.line_col(text_range.start()), |
240 | line_index.line_col(text_range.end()), | 211 | line_index.line_col(text_range.end()), |
241 | ); | 212 | ); |
242 | bar.println(format!( | 213 | bar.println(format!( |
243 | "{} {}:{}-{}:{}: Expected {}, got {}", | 214 | "{}:{}-{}:{}: {}", |
244 | path, | ||
245 | start.line + 1, | 215 | start.line + 1, |
246 | start.col_utf16, | 216 | start.col_utf16, |
247 | end.line + 1, | 217 | end.line + 1, |
248 | end.col_utf16, | 218 | end.col_utf16, |
249 | mismatch.expected.display(db), | 219 | ty.display(db) |
250 | mismatch.actual.display(db) | ||
251 | )); | 220 | )); |
252 | } else { | 221 | } else { |
253 | bar.println(format!( | 222 | bar.println(format!("unknown location: {}", ty.display(db))); |
254 | "{}: Expected {}, got {}", | 223 | } |
255 | name, | 224 | } |
256 | mismatch.expected.display(db), | 225 | if let Some(mismatch) = inference_result.type_mismatch_for_expr(expr_id) { |
257 | mismatch.actual.display(db) | 226 | num_type_mismatches += 1; |
258 | )); | 227 | if verbosity.is_verbose() { |
228 | let (_, sm) = db.body_with_source_map(f_id.into()); | ||
229 | let src = sm.expr_syntax(expr_id); | ||
230 | if let Ok(src) = src { | ||
231 | // FIXME: it might be nice to have a function (on Analysis?) that goes from Source<T> -> (LineCol, LineCol) directly | ||
232 | // But also, we should just turn the type mismatches into diagnostics and provide these | ||
233 | let root = db.parse_or_expand(src.file_id).unwrap(); | ||
234 | let node = src.map(|e| e.to_node(&root).syntax().clone()); | ||
235 | let original_range = original_range(db, node.as_ref()); | ||
236 | let path = vfs.file_path(original_range.file_id); | ||
237 | let line_index = | ||
238 | host.analysis().file_line_index(original_range.file_id).unwrap(); | ||
239 | let text_range = original_range.range; | ||
240 | let (start, end) = ( | ||
241 | line_index.line_col(text_range.start()), | ||
242 | line_index.line_col(text_range.end()), | ||
243 | ); | ||
244 | bar.println(format!( | ||
245 | "{} {}:{}-{}:{}: Expected {}, got {}", | ||
246 | path, | ||
247 | start.line + 1, | ||
248 | start.col_utf16, | ||
249 | end.line + 1, | ||
250 | end.col_utf16, | ||
251 | mismatch.expected.display(db), | ||
252 | mismatch.actual.display(db) | ||
253 | )); | ||
254 | } else { | ||
255 | bar.println(format!( | ||
256 | "{}: Expected {}, got {}", | ||
257 | name, | ||
258 | mismatch.expected.display(db), | ||
259 | mismatch.actual.display(db) | ||
260 | )); | ||
261 | } | ||
259 | } | 262 | } |
260 | } | 263 | } |
261 | } | 264 | } |
265 | if verbosity.is_spammy() { | ||
266 | bar.println(format!( | ||
267 | "In {}: {} exprs, {} unknown, {} partial", | ||
268 | full_name, | ||
269 | num_exprs - previous_exprs, | ||
270 | num_exprs_unknown - previous_unknown, | ||
271 | num_exprs_partially_unknown - previous_partially_unknown | ||
272 | )); | ||
273 | } | ||
274 | bar.inc(1); | ||
262 | } | 275 | } |
263 | if verbosity.is_spammy() { | 276 | bar.finish_and_clear(); |
264 | bar.println(format!( | 277 | eprintln!("Total expressions: {}", num_exprs); |
265 | "In {}: {} exprs, {} unknown, {} partial", | 278 | eprintln!( |
266 | full_name, | 279 | "Expressions of unknown type: {} ({}%)", |
267 | num_exprs - previous_exprs, | 280 | num_exprs_unknown, |
268 | num_exprs_unknown - previous_unknown, | 281 | if num_exprs > 0 { num_exprs_unknown * 100 / num_exprs } else { 100 } |
269 | num_exprs_partially_unknown - previous_partially_unknown | 282 | ); |
270 | )); | 283 | report_metric("unknown type", num_exprs_unknown, "#"); |
271 | } | ||
272 | bar.inc(1); | ||
273 | } | ||
274 | bar.finish_and_clear(); | ||
275 | eprintln!("Total expressions: {}", num_exprs); | ||
276 | eprintln!( | ||
277 | "Expressions of unknown type: {} ({}%)", | ||
278 | num_exprs_unknown, | ||
279 | if num_exprs > 0 { num_exprs_unknown * 100 / num_exprs } else { 100 } | ||
280 | ); | ||
281 | report_metric("unknown type", num_exprs_unknown, "#"); | ||
282 | 284 | ||
283 | eprintln!( | 285 | eprintln!( |
284 | "Expressions of partially unknown type: {} ({}%)", | 286 | "Expressions of partially unknown type: {} ({}%)", |
285 | num_exprs_partially_unknown, | 287 | num_exprs_partially_unknown, |
286 | if num_exprs > 0 { num_exprs_partially_unknown * 100 / num_exprs } else { 100 } | 288 | if num_exprs > 0 { num_exprs_partially_unknown * 100 / num_exprs } else { 100 } |
287 | ); | 289 | ); |
288 | 290 | ||
289 | eprintln!("Type mismatches: {}", num_type_mismatches); | 291 | eprintln!("Type mismatches: {}", num_type_mismatches); |
290 | report_metric("type mismatches", num_type_mismatches, "#"); | 292 | report_metric("type mismatches", num_type_mismatches, "#"); |
291 | 293 | ||
292 | eprintln!("Inference: {}", inference_sw.elapsed()); | 294 | eprintln!("Inference: {}", inference_sw.elapsed()); |
293 | 295 | ||
294 | let total_span = analysis_sw.elapsed(); | 296 | let total_span = analysis_sw.elapsed(); |
295 | eprintln!("Total: {}", total_span); | 297 | eprintln!("Total: {}", total_span); |
296 | report_metric("total time", total_span.time.as_millis() as u64, "ms"); | 298 | report_metric("total time", total_span.time.as_millis() as u64, "ms"); |
297 | if let Some(instructions) = total_span.instructions { | 299 | if let Some(instructions) = total_span.instructions { |
298 | report_metric("total instructions", instructions, "#instr"); | 300 | report_metric("total instructions", instructions, "#instr"); |
299 | } | 301 | } |
300 | if let Some(memory) = total_span.memory { | 302 | if let Some(memory) = total_span.memory { |
301 | report_metric("total memory", memory.allocated.megabytes() as u64, "MB"); | 303 | report_metric("total memory", memory.allocated.megabytes() as u64, "MB"); |
302 | } | 304 | } |
303 | 305 | ||
304 | if memory_usage { | 306 | if self.memory_usage { |
305 | print_memory_usage(host, vfs); | 307 | print_memory_usage(host, vfs); |
308 | } | ||
309 | |||
310 | Ok(()) | ||
306 | } | 311 | } |
307 | 312 | ||
308 | Ok(()) | 313 | fn stop_watch(&self) -> StopWatch { |
314 | StopWatch::start().memory(self.memory_usage) | ||
315 | } | ||
309 | } | 316 | } |
310 | 317 | ||
311 | fn shuffle<T>(rng: &mut Rand32, slice: &mut [T]) { | 318 | fn shuffle<T>(rng: &mut Rand32, slice: &mut [T]) { |
312 | for i in (1..slice.len()).rev() { | 319 | for i in 0..slice.len() { |
313 | let idx = rng.rand_range(0..i as u32) as usize; | 320 | randomize_first(rng, &mut slice[i..]); |
314 | slice.swap(idx, i) | 321 | } |
322 | |||
323 | fn randomize_first<T>(rng: &mut Rand32, slice: &mut [T]) { | ||
324 | assert!(!slice.is_empty()); | ||
325 | let idx = rng.rand_range(0..slice.len() as u32) as usize; | ||
326 | slice.swap(0, idx); | ||
315 | } | 327 | } |
316 | } | 328 | } |
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs index 87a1367ac..e73b3a211 100644 --- a/crates/rust-analyzer/src/handlers.rs +++ b/crates/rust-analyzer/src/handlers.rs | |||
@@ -26,7 +26,7 @@ use ra_project_model::TargetKind; | |||
26 | use ra_syntax::{algo, ast, AstNode, SyntaxKind, TextRange, TextSize}; | 26 | use ra_syntax::{algo, ast, AstNode, SyntaxKind, TextRange, TextSize}; |
27 | use serde::{Deserialize, Serialize}; | 27 | use serde::{Deserialize, Serialize}; |
28 | use serde_json::to_value; | 28 | use serde_json::to_value; |
29 | use stdx::{format_to, split_delim}; | 29 | use stdx::{format_to, split_once}; |
30 | 30 | ||
31 | use crate::{ | 31 | use crate::{ |
32 | cargo_target_spec::CargoTargetSpec, | 32 | cargo_target_spec::CargoTargetSpec, |
@@ -865,7 +865,7 @@ pub(crate) fn handle_resolve_code_action( | |||
865 | .map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect()); | 865 | .map(|it| it.into_iter().filter_map(from_proto::assist_kind).collect()); |
866 | 866 | ||
867 | let assists = snap.analysis.resolved_assists(&snap.config.assist, frange)?; | 867 | let assists = snap.analysis.resolved_assists(&snap.config.assist, frange)?; |
868 | let (id_string, index) = split_delim(¶ms.id, ':').unwrap(); | 868 | let (id_string, index) = split_once(¶ms.id, ':').unwrap(); |
869 | let index = index.parse::<usize>().unwrap(); | 869 | let index = index.parse::<usize>().unwrap(); |
870 | let assist = &assists[index]; | 870 | let assist = &assists[index]; |
871 | assert!(assist.assist.id.0 == id_string); | 871 | assert!(assist.assist.id.0 == id_string); |
@@ -924,10 +924,10 @@ pub(crate) fn handle_code_lens( | |||
924 | .filter(|it| { | 924 | .filter(|it| { |
925 | matches!( | 925 | matches!( |
926 | it.kind, | 926 | it.kind, |
927 | SyntaxKind::TRAIT_DEF | 927 | SyntaxKind::TRAIT |
928 | | SyntaxKind::STRUCT_DEF | 928 | | SyntaxKind::STRUCT |
929 | | SyntaxKind::ENUM_DEF | 929 | | SyntaxKind::ENUM |
930 | | SyntaxKind::UNION_DEF | 930 | | SyntaxKind::UNION |
931 | ) | 931 | ) |
932 | }) | 932 | }) |
933 | .map(|it| { | 933 | .map(|it| { |
@@ -1095,7 +1095,7 @@ pub(crate) fn handle_call_hierarchy_prepare( | |||
1095 | let RangeInfo { range: _, info: navs } = nav_info; | 1095 | let RangeInfo { range: _, info: navs } = nav_info; |
1096 | let res = navs | 1096 | let res = navs |
1097 | .into_iter() | 1097 | .into_iter() |
1098 | .filter(|it| it.kind == SyntaxKind::FN_DEF) | 1098 | .filter(|it| it.kind == SyntaxKind::FN) |
1099 | .map(|it| to_proto::call_hierarchy_item(&snap, it)) | 1099 | .map(|it| to_proto::call_hierarchy_item(&snap, it)) |
1100 | .collect::<Result<Vec<_>>>()?; | 1100 | .collect::<Result<Vec<_>>>()?; |
1101 | 1101 | ||
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index c6935c029..fadcc5853 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -31,18 +31,18 @@ pub(crate) fn range(line_index: &LineIndex, range: TextRange) -> lsp_types::Rang | |||
31 | 31 | ||
32 | pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { | 32 | pub(crate) fn symbol_kind(syntax_kind: SyntaxKind) -> lsp_types::SymbolKind { |
33 | match syntax_kind { | 33 | match syntax_kind { |
34 | SyntaxKind::FN_DEF => lsp_types::SymbolKind::Function, | 34 | SyntaxKind::FN => lsp_types::SymbolKind::Function, |
35 | SyntaxKind::STRUCT_DEF => lsp_types::SymbolKind::Struct, | 35 | SyntaxKind::STRUCT => lsp_types::SymbolKind::Struct, |
36 | SyntaxKind::ENUM_DEF => lsp_types::SymbolKind::Enum, | 36 | SyntaxKind::ENUM => lsp_types::SymbolKind::Enum, |
37 | SyntaxKind::ENUM_VARIANT => lsp_types::SymbolKind::EnumMember, | 37 | SyntaxKind::VARIANT => lsp_types::SymbolKind::EnumMember, |
38 | SyntaxKind::TRAIT_DEF => lsp_types::SymbolKind::Interface, | 38 | SyntaxKind::TRAIT => lsp_types::SymbolKind::Interface, |
39 | SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, | 39 | SyntaxKind::MACRO_CALL => lsp_types::SymbolKind::Function, |
40 | SyntaxKind::MODULE => lsp_types::SymbolKind::Module, | 40 | SyntaxKind::MODULE => lsp_types::SymbolKind::Module, |
41 | SyntaxKind::TYPE_ALIAS_DEF => lsp_types::SymbolKind::TypeParameter, | 41 | SyntaxKind::TYPE_ALIAS => lsp_types::SymbolKind::TypeParameter, |
42 | SyntaxKind::RECORD_FIELD_DEF => lsp_types::SymbolKind::Field, | 42 | SyntaxKind::RECORD_FIELD => lsp_types::SymbolKind::Field, |
43 | SyntaxKind::STATIC_DEF => lsp_types::SymbolKind::Constant, | 43 | SyntaxKind::STATIC => lsp_types::SymbolKind::Constant, |
44 | SyntaxKind::CONST_DEF => lsp_types::SymbolKind::Constant, | 44 | SyntaxKind::CONST => lsp_types::SymbolKind::Constant, |
45 | SyntaxKind::IMPL_DEF => lsp_types::SymbolKind::Object, | 45 | SyntaxKind::IMPL => lsp_types::SymbolKind::Object, |
46 | _ => lsp_types::SymbolKind::Variable, | 46 | _ => lsp_types::SymbolKind::Variable, |
47 | } | 47 | } |
48 | } | 48 | } |
diff --git a/crates/stdx/src/lib.rs b/crates/stdx/src/lib.rs index ea0e6b949..b65875c96 100644 --- a/crates/stdx/src/lib.rs +++ b/crates/stdx/src/lib.rs | |||
@@ -109,9 +109,18 @@ pub fn replace(buf: &mut String, from: char, to: &str) { | |||
109 | *buf = buf.replace(from, to) | 109 | *buf = buf.replace(from, to) |
110 | } | 110 | } |
111 | 111 | ||
112 | pub fn split_delim(haystack: &str, delim: char) -> Option<(&str, &str)> { | 112 | // https://github.com/rust-lang/rust/issues/74773 |
113 | let idx = haystack.find(delim)?; | 113 | pub fn split_once(haystack: &str, delim: char) -> Option<(&str, &str)> { |
114 | Some((&haystack[..idx], &haystack[idx + delim.len_utf8()..])) | 114 | let mut split = haystack.splitn(2, delim); |
115 | let prefix = split.next()?; | ||
116 | let suffix = split.next()?; | ||
117 | Some((prefix, suffix)) | ||
118 | } | ||
119 | pub fn rsplit_once(haystack: &str, delim: char) -> Option<(&str, &str)> { | ||
120 | let mut split = haystack.rsplitn(2, delim); | ||
121 | let suffix = split.next()?; | ||
122 | let prefix = split.next()?; | ||
123 | Some((prefix, suffix)) | ||
115 | } | 124 | } |
116 | 125 | ||
117 | pub fn trim_indent(mut text: &str) -> String { | 126 | pub fn trim_indent(mut text: &str) -> String { |
diff --git a/crates/test_utils/src/fixture.rs b/crates/test_utils/src/fixture.rs index ed764046b..e40b61a94 100644 --- a/crates/test_utils/src/fixture.rs +++ b/crates/test_utils/src/fixture.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | //! rust-analyzer database from a single string. | 2 | //! rust-analyzer database from a single string. |
3 | 3 | ||
4 | use rustc_hash::FxHashMap; | 4 | use rustc_hash::FxHashMap; |
5 | use stdx::{lines_with_ends, split_delim, trim_indent}; | 5 | use stdx::{lines_with_ends, split_once, trim_indent}; |
6 | 6 | ||
7 | #[derive(Debug, Eq, PartialEq)] | 7 | #[derive(Debug, Eq, PartialEq)] |
8 | pub struct Fixture { | 8 | pub struct Fixture { |
@@ -71,14 +71,14 @@ impl Fixture { | |||
71 | let mut cfg_key_values = Vec::new(); | 71 | let mut cfg_key_values = Vec::new(); |
72 | let mut env = FxHashMap::default(); | 72 | let mut env = FxHashMap::default(); |
73 | for component in components[1..].iter() { | 73 | for component in components[1..].iter() { |
74 | let (key, value) = split_delim(component, ':').unwrap(); | 74 | let (key, value) = split_once(component, ':').unwrap(); |
75 | match key { | 75 | match key { |
76 | "crate" => krate = Some(value.to_string()), | 76 | "crate" => krate = Some(value.to_string()), |
77 | "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), | 77 | "deps" => deps = value.split(',').map(|it| it.to_string()).collect(), |
78 | "edition" => edition = Some(value.to_string()), | 78 | "edition" => edition = Some(value.to_string()), |
79 | "cfg" => { | 79 | "cfg" => { |
80 | for entry in value.split(',') { | 80 | for entry in value.split(',') { |
81 | match split_delim(entry, '=') { | 81 | match split_once(entry, '=') { |
82 | Some((k, v)) => cfg_key_values.push((k.to_string(), v.to_string())), | 82 | Some((k, v)) => cfg_key_values.push((k.to_string(), v.to_string())), |
83 | None => cfg_atoms.push(entry.to_string()), | 83 | None => cfg_atoms.push(entry.to_string()), |
84 | } | 84 | } |
@@ -86,7 +86,7 @@ impl Fixture { | |||
86 | } | 86 | } |
87 | "env" => { | 87 | "env" => { |
88 | for key in value.split(',') { | 88 | for key in value.split(',') { |
89 | if let Some((k, v)) = split_delim(key, '=') { | 89 | if let Some((k, v)) = split_once(key, '=') { |
90 | env.insert(k.into(), v.into()); | 90 | env.insert(k.into(), v.into()); |
91 | } | 91 | } |
92 | } | 92 | } |
diff --git a/docs/dev/syntax.md b/docs/dev/syntax.md index c2864bbbc..d4bc4b07c 100644 --- a/docs/dev/syntax.md +++ b/docs/dev/syntax.md | |||
@@ -82,7 +82,7 @@ Points of note: | |||
82 | An input like `fn f() { 90 + 2 }` might be parsed as | 82 | An input like `fn f() { 90 + 2 }` might be parsed as |
83 | 83 | ||
84 | ``` | 84 | ``` |
85 | FN_DEF@0..17 | 85 | [email protected] |
86 | [email protected] "fn" | 86 | [email protected] "fn" |
87 | [email protected] " " | 87 | [email protected] " " |
88 | [email protected] | 88 | [email protected] |
@@ -342,7 +342,7 @@ pub struct FnDef { | |||
342 | impl AstNode for FnDef { | 342 | impl AstNode for FnDef { |
343 | fn cast(syntax: SyntaxNode) -> Option<Self> { | 343 | fn cast(syntax: SyntaxNode) -> Option<Self> { |
344 | match kind { | 344 | match kind { |
345 | FN_DEF => Some(FnDef { syntax }), | 345 | FN => Some(FnDef { syntax }), |
346 | _ => None, | 346 | _ => None, |
347 | } | 347 | } |
348 | } | 348 | } |
diff --git a/xtask/src/ast_src.rs b/xtask/src/ast_src.rs index 3a58217c4..114898e38 100644 --- a/xtask/src/ast_src.rs +++ b/xtask/src/ast_src.rs | |||
@@ -93,19 +93,19 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
93 | ], | 93 | ], |
94 | nodes: &[ | 94 | nodes: &[ |
95 | "SOURCE_FILE", | 95 | "SOURCE_FILE", |
96 | "STRUCT_DEF", | 96 | "STRUCT", |
97 | "UNION_DEF", | 97 | "UNION", |
98 | "ENUM_DEF", | 98 | "ENUM", |
99 | "FN_DEF", | 99 | "FN", |
100 | "RET_TYPE", | 100 | "RET_TYPE", |
101 | "EXTERN_CRATE", | 101 | "EXTERN_CRATE", |
102 | "MODULE", | 102 | "MODULE", |
103 | "USE", | 103 | "USE", |
104 | "STATIC_DEF", | 104 | "STATIC", |
105 | "CONST_DEF", | 105 | "CONST", |
106 | "TRAIT_DEF", | 106 | "TRAIT", |
107 | "IMPL_DEF", | 107 | "IMPL", |
108 | "TYPE_ALIAS_DEF", | 108 | "TYPE_ALIAS", |
109 | "MACRO_CALL", | 109 | "MACRO_CALL", |
110 | "TOKEN_TREE", | 110 | "TOKEN_TREE", |
111 | "MACRO_DEF", | 111 | "MACRO_DEF", |
@@ -159,9 +159,9 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
159 | "MATCH_ARM_LIST", | 159 | "MATCH_ARM_LIST", |
160 | "MATCH_ARM", | 160 | "MATCH_ARM", |
161 | "MATCH_GUARD", | 161 | "MATCH_GUARD", |
162 | "RECORD_LIT", | 162 | "RECORD_EXPR", |
163 | "RECORD_FIELD_LIST", | 163 | "RECORD_EXPR_FIELD_LIST", |
164 | "RECORD_FIELD", | 164 | "RECORD_EXPR_FIELD", |
165 | "EFFECT_EXPR", | 165 | "EFFECT_EXPR", |
166 | "BOX_EXPR", | 166 | "BOX_EXPR", |
167 | // postfix | 167 | // postfix |
@@ -179,12 +179,12 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
179 | "BIN_EXPR", | 179 | "BIN_EXPR", |
180 | "EXTERN_BLOCK", | 180 | "EXTERN_BLOCK", |
181 | "EXTERN_ITEM_LIST", | 181 | "EXTERN_ITEM_LIST", |
182 | "ENUM_VARIANT", | 182 | "VARIANT", |
183 | "RECORD_FIELD_DEF_LIST", | 183 | "RECORD_FIELD_LIST", |
184 | "RECORD_FIELD_DEF", | 184 | "RECORD_FIELD", |
185 | "TUPLE_FIELD_DEF_LIST", | 185 | "TUPLE_FIELD_LIST", |
186 | "TUPLE_FIELD_DEF", | 186 | "TUPLE_FIELD", |
187 | "ENUM_VARIANT_LIST", | 187 | "VARIANT_LIST", |
188 | "ITEM_LIST", | 188 | "ITEM_LIST", |
189 | "ASSOC_ITEM_LIST", | 189 | "ASSOC_ITEM_LIST", |
190 | "ATTR", | 190 | "ATTR", |
@@ -203,7 +203,8 @@ pub(crate) const KINDS_SRC: KindsSrc = KindsSrc { | |||
203 | "NAME_REF", | 203 | "NAME_REF", |
204 | "LET_STMT", | 204 | "LET_STMT", |
205 | "EXPR_STMT", | 205 | "EXPR_STMT", |
206 | "TYPE_PARAM_LIST", | 206 | "GENERIC_PARAM_LIST", |
207 | "GENERIC_PARAM", | ||
207 | "LIFETIME_PARAM", | 208 | "LIFETIME_PARAM", |
208 | "TYPE_PARAM", | 209 | "TYPE_PARAM", |
209 | "CONST_PARAM", | 210 | "CONST_PARAM", |
@@ -242,14 +243,13 @@ pub(crate) struct AstNodeSrc { | |||
242 | #[derive(Debug, Eq, PartialEq)] | 243 | #[derive(Debug, Eq, PartialEq)] |
243 | pub(crate) enum Field { | 244 | pub(crate) enum Field { |
244 | Token(String), | 245 | Token(String), |
245 | Node { name: String, src: FieldSrc }, | 246 | Node { name: String, ty: String, cardinality: Cardinality }, |
246 | } | 247 | } |
247 | 248 | ||
248 | #[derive(Debug, Eq, PartialEq)] | 249 | #[derive(Debug, Eq, PartialEq)] |
249 | pub(crate) enum FieldSrc { | 250 | pub(crate) enum Cardinality { |
250 | Shorthand, | 251 | Optional, |
251 | Optional(String), | 252 | Many, |
252 | Many(String), | ||
253 | } | 253 | } |
254 | 254 | ||
255 | #[derive(Debug)] | 255 | #[derive(Debug)] |
diff --git a/xtask/src/codegen/gen_syntax.rs b/xtask/src/codegen/gen_syntax.rs index c77fc8a8d..45b788bdb 100644 --- a/xtask/src/codegen/gen_syntax.rs +++ b/xtask/src/codegen/gen_syntax.rs | |||
@@ -13,7 +13,7 @@ use quote::{format_ident, quote}; | |||
13 | use ungrammar::{Grammar, Rule}; | 13 | use ungrammar::{Grammar, Rule}; |
14 | 14 | ||
15 | use crate::{ | 15 | use crate::{ |
16 | ast_src::{AstEnumSrc, AstNodeSrc, AstSrc, Field, FieldSrc, KindsSrc, KINDS_SRC}, | 16 | ast_src::{AstEnumSrc, AstNodeSrc, AstSrc, Cardinality, Field, KindsSrc, KINDS_SRC}, |
17 | codegen::{self, update, Mode}, | 17 | codegen::{self, update, Mode}, |
18 | project_root, Result, | 18 | project_root, Result, |
19 | }; | 19 | }; |
@@ -307,7 +307,7 @@ fn generate_syntax_kinds(grammar: KindsSrc<'_>) -> Result<String> { | |||
307 | 307 | ||
308 | let ast = quote! { | 308 | let ast = quote! { |
309 | #![allow(bad_style, missing_docs, unreachable_pub)] | 309 | #![allow(bad_style, missing_docs, unreachable_pub)] |
310 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT_DEF`. | 310 | /// The kind of syntax node, e.g. `IDENT`, `USE_KW`, or `STRUCT`. |
311 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] | 311 | #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)] |
312 | #[repr(u16)] | 312 | #[repr(u16)] |
313 | pub enum SyntaxKind { | 313 | pub enum SyntaxKind { |
@@ -431,7 +431,7 @@ fn pluralize(s: &str) -> String { | |||
431 | 431 | ||
432 | impl Field { | 432 | impl Field { |
433 | fn is_many(&self) -> bool { | 433 | fn is_many(&self) -> bool { |
434 | matches!(self, Field::Node { src: FieldSrc::Many(_), .. }) | 434 | matches!(self, Field::Node { cardinality: Cardinality::Many, .. }) |
435 | } | 435 | } |
436 | fn token_kind(&self) -> Option<proc_macro2::TokenStream> { | 436 | fn token_kind(&self) -> Option<proc_macro2::TokenStream> { |
437 | match self { | 437 | match self { |
@@ -471,23 +471,18 @@ impl Field { | |||
471 | "::" => "coloncolon", | 471 | "::" => "coloncolon", |
472 | "#" => "pound", | 472 | "#" => "pound", |
473 | "?" => "question_mark", | 473 | "?" => "question_mark", |
474 | "," => "comma", | ||
474 | _ => name, | 475 | _ => name, |
475 | }; | 476 | }; |
476 | format_ident!("{}_token", name) | 477 | format_ident!("{}_token", name) |
477 | } | 478 | } |
478 | Field::Node { name, src } => match src { | 479 | Field::Node { name, .. } => format_ident!("{}", name), |
479 | FieldSrc::Shorthand => format_ident!("{}", to_lower_snake_case(name)), | ||
480 | _ => format_ident!("{}", name), | ||
481 | }, | ||
482 | } | 480 | } |
483 | } | 481 | } |
484 | fn ty(&self) -> proc_macro2::Ident { | 482 | fn ty(&self) -> proc_macro2::Ident { |
485 | match self { | 483 | match self { |
486 | Field::Token(_) => format_ident!("SyntaxToken"), | 484 | Field::Token(_) => format_ident!("SyntaxToken"), |
487 | Field::Node { name, src } => match src { | 485 | Field::Node { ty, .. } => format_ident!("{}", ty), |
488 | FieldSrc::Optional(ty) | FieldSrc::Many(ty) => format_ident!("{}", ty), | ||
489 | FieldSrc::Shorthand => format_ident!("{}", name), | ||
490 | }, | ||
491 | } | 486 | } |
492 | } | 487 | } |
493 | } | 488 | } |
@@ -514,7 +509,7 @@ fn lower(grammar: &Grammar) -> AstSrc { | |||
514 | } | 509 | } |
515 | None => { | 510 | None => { |
516 | let mut fields = Vec::new(); | 511 | let mut fields = Vec::new(); |
517 | lower_rule(&mut fields, grammar, rule); | 512 | lower_rule(&mut fields, grammar, None, rule); |
518 | res.nodes.push(AstNodeSrc { doc: Vec::new(), name, traits: Vec::new(), fields }); | 513 | res.nodes.push(AstNodeSrc { doc: Vec::new(), name, traits: Vec::new(), fields }); |
519 | } | 514 | } |
520 | } | 515 | } |
@@ -542,17 +537,20 @@ fn lower_enum(grammar: &Grammar, rule: &Rule) -> Option<Vec<String>> { | |||
542 | Some(variants) | 537 | Some(variants) |
543 | } | 538 | } |
544 | 539 | ||
545 | fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) { | 540 | fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, label: Option<&String>, rule: &Rule) { |
546 | if lower_comma_list(acc, grammar, rule) { | 541 | if lower_comma_list(acc, grammar, label, rule) { |
547 | return; | 542 | return; |
548 | } | 543 | } |
549 | 544 | ||
550 | match rule { | 545 | match rule { |
551 | Rule::Node(node) => { | 546 | Rule::Node(node) => { |
552 | let field = Field::Node { name: grammar[*node].name.clone(), src: FieldSrc::Shorthand }; | 547 | let ty = grammar[*node].name.clone(); |
548 | let name = label.cloned().unwrap_or_else(|| to_lower_snake_case(&ty)); | ||
549 | let field = Field::Node { name, ty, cardinality: Cardinality::Optional }; | ||
553 | acc.push(field); | 550 | acc.push(field); |
554 | } | 551 | } |
555 | Rule::Token(token) => { | 552 | Rule::Token(token) => { |
553 | assert!(label.is_none()); | ||
556 | let mut name = grammar[*token].name.clone(); | 554 | let mut name = grammar[*token].name.clone(); |
557 | if name != "int_number" && name != "string" { | 555 | if name != "int_number" && name != "string" { |
558 | if "[]{}()".contains(&name) { | 556 | if "[]{}()".contains(&name) { |
@@ -564,48 +562,35 @@ fn lower_rule(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) { | |||
564 | } | 562 | } |
565 | Rule::Rep(inner) => { | 563 | Rule::Rep(inner) => { |
566 | if let Rule::Node(node) = &**inner { | 564 | if let Rule::Node(node) = &**inner { |
567 | let name = grammar[*node].name.clone(); | 565 | let ty = grammar[*node].name.clone(); |
568 | let label = pluralize(&to_lower_snake_case(&name)); | 566 | let name = label.cloned().unwrap_or_else(|| pluralize(&to_lower_snake_case(&ty))); |
569 | let field = Field::Node { name: label.clone(), src: FieldSrc::Many(name) }; | 567 | let field = Field::Node { name, ty, cardinality: Cardinality::Many }; |
570 | acc.push(field); | 568 | acc.push(field); |
571 | return; | 569 | return; |
572 | } | 570 | } |
573 | todo!("{:?}", rule) | 571 | todo!("{:?}", rule) |
574 | } | 572 | } |
575 | Rule::Labeled { label, rule } => { | 573 | Rule::Labeled { label: l, rule } => { |
576 | let node = match &**rule { | 574 | assert!(label.is_none()); |
577 | Rule::Rep(inner) | Rule::Opt(inner) => match &**inner { | 575 | lower_rule(acc, grammar, Some(l), rule); |
578 | Rule::Node(node) => node, | ||
579 | _ => todo!("{:?}", rule), | ||
580 | }, | ||
581 | Rule::Node(node) => node, | ||
582 | _ => todo!("{:?}", rule), | ||
583 | }; | ||
584 | let field = Field::Node { | ||
585 | name: label.clone(), | ||
586 | src: match &**rule { | ||
587 | Rule::Rep(_) => FieldSrc::Many(grammar[*node].name.clone()), | ||
588 | _ => FieldSrc::Optional(grammar[*node].name.clone()), | ||
589 | }, | ||
590 | }; | ||
591 | acc.push(field); | ||
592 | } | 576 | } |
593 | Rule::Seq(rules) | Rule::Alt(rules) => { | 577 | Rule::Seq(rules) | Rule::Alt(rules) => { |
594 | for rule in rules { | 578 | for rule in rules { |
595 | lower_rule(acc, grammar, rule) | 579 | lower_rule(acc, grammar, label, rule) |
596 | } | 580 | } |
597 | } | 581 | } |
598 | Rule::Opt(rule) => lower_rule(acc, grammar, rule), | 582 | Rule::Opt(rule) => lower_rule(acc, grammar, label, rule), |
599 | } | 583 | } |
600 | } | 584 | } |
601 | 585 | ||
602 | // (T (',' T)* ','?)? | 586 | // (T (',' T)* ','?) |
603 | fn lower_comma_list(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) -> bool { | 587 | fn lower_comma_list( |
588 | acc: &mut Vec<Field>, | ||
589 | grammar: &Grammar, | ||
590 | label: Option<&String>, | ||
591 | rule: &Rule, | ||
592 | ) -> bool { | ||
604 | let rule = match rule { | 593 | let rule = match rule { |
605 | Rule::Opt(it) => it, | ||
606 | _ => return false, | ||
607 | }; | ||
608 | let rule = match &**rule { | ||
609 | Rule::Seq(it) => it, | 594 | Rule::Seq(it) => it, |
610 | _ => return false, | 595 | _ => return false, |
611 | }; | 596 | }; |
@@ -623,9 +608,9 @@ fn lower_comma_list(acc: &mut Vec<Field>, grammar: &Grammar, rule: &Rule) -> boo | |||
623 | [comma, Rule::Node(n)] if comma == &**trailing_comma && n == node => (), | 608 | [comma, Rule::Node(n)] if comma == &**trailing_comma && n == node => (), |
624 | _ => return false, | 609 | _ => return false, |
625 | } | 610 | } |
626 | let name = grammar[*node].name.clone(); | 611 | let ty = grammar[*node].name.clone(); |
627 | let label = pluralize(&to_lower_snake_case(&name)); | 612 | let name = label.cloned().unwrap_or_else(|| pluralize(&to_lower_snake_case(&ty))); |
628 | let field = Field::Node { name: label.clone(), src: FieldSrc::Many(name) }; | 613 | let field = Field::Node { name, ty, cardinality: Cardinality::Many }; |
629 | acc.push(field); | 614 | acc.push(field); |
630 | true | 615 | true |
631 | } | 616 | } |
@@ -659,7 +644,9 @@ fn extract_enums(ast: &mut AstSrc) { | |||
659 | } | 644 | } |
660 | if to_remove.len() == enm.variants.len() { | 645 | if to_remove.len() == enm.variants.len() { |
661 | node.remove_field(to_remove); | 646 | node.remove_field(to_remove); |
662 | node.fields.push(Field::Node { name: enm.name.clone(), src: FieldSrc::Shorthand }); | 647 | let ty = enm.name.clone(); |
648 | let name = to_lower_snake_case(&ty); | ||
649 | node.fields.push(Field::Node { name, ty, cardinality: Cardinality::Optional }); | ||
663 | } | 650 | } |
664 | } | 651 | } |
665 | } | 652 | } |
@@ -670,10 +657,9 @@ fn extract_struct_traits(ast: &mut AstSrc) { | |||
670 | ("AttrsOwner", &["attrs"]), | 657 | ("AttrsOwner", &["attrs"]), |
671 | ("NameOwner", &["name"]), | 658 | ("NameOwner", &["name"]), |
672 | ("VisibilityOwner", &["visibility"]), | 659 | ("VisibilityOwner", &["visibility"]), |
673 | ("TypeParamsOwner", &["type_param_list", "where_clause"]), | 660 | ("GenericParamsOwner", &["generic_param_list", "where_clause"]), |
674 | ("TypeBoundsOwner", &["type_bound_list", "colon_token"]), | 661 | ("TypeBoundsOwner", &["type_bound_list", "colon_token"]), |
675 | ("ModuleItemOwner", &["items"]), | 662 | ("ModuleItemOwner", &["items"]), |
676 | ("TypeAscriptionOwner", &["ascribed_type"]), | ||
677 | ("LoopBodyOwner", &["label", "loop_body"]), | 663 | ("LoopBodyOwner", &["label", "loop_body"]), |
678 | ("ArgListOwner", &["arg_list"]), | 664 | ("ArgListOwner", &["arg_list"]), |
679 | ]; | 665 | ]; |
diff --git a/xtask/src/codegen/rust.ungram b/xtask/src/codegen/rust.ungram index 449b0242f..375df301f 100644 --- a/xtask/src/codegen/rust.ungram +++ b/xtask/src/codegen/rust.ungram | |||
@@ -4,19 +4,19 @@ SourceFile = | |||
4 | Item* | 4 | Item* |
5 | 5 | ||
6 | Item = | 6 | Item = |
7 | ConstDef | 7 | Const |
8 | | EnumDef | 8 | | Enum |
9 | | ExternBlock | 9 | | ExternBlock |
10 | | ExternCrate | 10 | | ExternCrate |
11 | | FnDef | 11 | | Fn |
12 | | ImplDef | 12 | | Impl |
13 | | MacroCall | 13 | | MacroCall |
14 | | Module | 14 | | Module |
15 | | StaticDef | 15 | | Static |
16 | | StructDef | 16 | | Struct |
17 | | TraitDef | 17 | | Trait |
18 | | TypeAliasDef | 18 | | TypeAlias |
19 | | UnionDef | 19 | | Union |
20 | | Use | 20 | | Use |
21 | 21 | ||
22 | Module = | 22 | Module = |
@@ -42,78 +42,149 @@ UseTree = | |||
42 | UseTreeList = | 42 | UseTreeList = |
43 | '{' (UseTree (',' UseTree)* ','?)? '}' | 43 | '{' (UseTree (',' UseTree)* ','?)? '}' |
44 | 44 | ||
45 | FnDef = | 45 | Fn = |
46 | Attr* Visibility? Abi? 'const' 'default' 'async' 'unsafe' 'fn' Name TypeParamList? | 46 | Attr* Visibility? |
47 | ParamList RetType? | 47 | 'default'? ('async' | 'const')? 'unsafe'? Abi? |
48 | 'fn' Name GenericParamList? ParamList RetType? | ||
48 | WhereClause? | 49 | WhereClause? |
49 | (body:BlockExpr | ';') | 50 | (body:BlockExpr | ';') |
50 | 51 | ||
52 | Abi = | ||
53 | 'extern' 'string'? | ||
54 | |||
55 | ParamList = | ||
56 | '('( | ||
57 | SelfParam | ||
58 | | (SelfParam ',')? (Param (',' Param)* ','?)? | ||
59 | )')' | ||
60 | |||
61 | SelfParam = | ||
62 | Attr* ( | ||
63 | ('&' 'lifetime'?)? 'mut'? 'self' | ||
64 | | 'mut'? 'self' ':' ty:TypeRef | ||
65 | ) | ||
66 | |||
67 | Param = | ||
68 | Attr* ( | ||
69 | Pat (':' ty:TypeRef) | ||
70 | | ty:TypeRef | ||
71 | | '...' | ||
72 | ) | ||
73 | |||
51 | RetType = | 74 | RetType = |
52 | '->' TypeRef | 75 | '->' ty:TypeRef |
76 | |||
77 | TypeAlias = | ||
78 | Attr* Visibility? 'default'? 'type' Name GenericParamList? (':' TypeBoundList?)? WhereClause? | ||
79 | '=' ty:TypeRef ';' | ||
53 | 80 | ||
54 | StructDef = | 81 | Struct = |
55 | Attr* Visibility? 'struct' Name TypeParamList? ( | 82 | Attr* Visibility? 'struct' Name GenericParamList? ( |
56 | WhereClause? (RecordFieldDefList | ';') | 83 | WhereClause? (RecordFieldList | ';') |
57 | | TupleFieldDefList WhereClause? ';' | 84 | | TupleFieldList WhereClause? ';' |
58 | ) | 85 | ) |
59 | 86 | ||
60 | UnionDef = | 87 | RecordFieldList = |
61 | Attr* Visibility? 'union' Name TypeParamList? WhereClause? | 88 | '{' fields:(RecordField (',' RecordField)* ','?)? '}' |
62 | RecordFieldDefList | 89 | |
90 | RecordField = | ||
91 | Attr* Visibility? Name ':' ty:TypeRef | ||
63 | 92 | ||
64 | RecordFieldDefList = | 93 | TupleFieldList = |
65 | '{' fields:RecordFieldDef* '}' | 94 | '(' fields:(TupleField (',' TupleField)* ','?)? ')' |
66 | 95 | ||
67 | RecordFieldDef = | 96 | TupleField = |
68 | Attr* Visibility? Name ':' ascribed_type:TypeRef | 97 | Attr* Visibility? ty:TypeRef |
69 | 98 | ||
70 | TupleFieldDefList = | 99 | FieldList = |
71 | '(' fields:TupleFieldDef* ')' | 100 | RecordFieldList |
101 | | TupleFieldList | ||
72 | 102 | ||
73 | TupleFieldDef = | 103 | Enum = |
74 | Attr* Visibility? Name TypeRef | 104 | Attr* Visibility? 'enum' Name GenericParamList? WhereClause? |
105 | VariantList | ||
75 | 106 | ||
76 | FieldDefList = | 107 | VariantList = |
77 | RecordFieldDefList | 108 | '{' (Variant (',' Variant)* ','?)? '}' |
78 | | TupleFieldDefList | ||
79 | 109 | ||
80 | EnumDef = | 110 | Variant = |
81 | Attr* Visibility? 'enum' Name TypeParamList? WhereClause? | 111 | Attr* Visibility? Name FieldList ('=' Expr)? |
82 | variant_list:EnumVariantList | ||
83 | 112 | ||
84 | EnumVariantList = | 113 | Union = |
85 | '{' variants:EnumVariant* '}' | 114 | Attr* Visibility? 'union' Name GenericParamList? WhereClause? |
115 | RecordFieldList | ||
116 | |||
117 | Const = | ||
118 | Attr* Visibility? 'default'? 'const' (Name | '_') ':' ty:TypeRef | ||
119 | '=' body:Expr ';' | ||
86 | 120 | ||
87 | EnumVariant = | 121 | Static = |
88 | Attr* Visibility? Name FieldDefList ('=' Expr)? | 122 | Attr* Visibility? 'static'? 'mut'? Name ':' ty:TypeRef |
123 | '=' body:Expr ';' | ||
89 | 124 | ||
90 | TraitDef = | 125 | Trait = |
91 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name TypeParamList | 126 | Attr* Visibility? 'unsafe'? 'auto'? 'trait' Name GenericParamList |
92 | (':' TypeBoundList?)? WhereClause | 127 | (':' TypeBoundList?)? WhereClause |
93 | AssocItemList | 128 | AssocItemList |
94 | 129 | ||
95 | AssocItemList = | 130 | AssocItemList = |
96 | '{' AssocItem* '}' | 131 | '{' Attr* AssocItem* '}' |
97 | 132 | ||
98 | ConstDef = | 133 | AssocItem = |
99 | Attr* Visibility? 'default'? 'const' Name ':' ascribed_type:TypeRef | 134 | Fn |
100 | '=' body:Expr ';' | 135 | | TypeAlias |
136 | | Const | ||
137 | | MacroCall | ||
101 | 138 | ||
102 | StaticDef = | 139 | Impl = |
103 | Attr* Visibility? 'static'? 'mut'? 'static' Name ':' ascribed_type:TypeRef | 140 | Attr* Visibility? |
104 | '=' body:Expr ';' | 141 | 'default'? 'unsafe'? 'impl' 'const'? GenericParamList? ( |
142 | TypeRef | ||
143 | | '!'? TypeRef 'for' TypeRef | ||
144 | ) WhereClause? | ||
145 | AssocItemList | ||
105 | 146 | ||
106 | TypeAliasDef = | 147 | ExternBlock = |
107 | Attr* Visibility? 'default'? 'type' Name TypeParamList? WhereClause? (':' TypeBoundList?)? | 148 | Attr* Abi ExternItemList |
108 | '=' TypeRef ';' | ||
109 | 149 | ||
110 | ImplDef = | 150 | ExternItemList = |
111 | Attr* Visibility? 'const'? 'default'? 'unsafe'? 'impl' TypeParamList? '!'? 'for' | 151 | '{' Attr* ExternItem* '}' |
112 | WhereClause? | 152 | |
113 | AssocItemList | 153 | ExternItem = |
154 | Fn | Static | MacroCall | ||
155 | |||
156 | GenericParamList = | ||
157 | '<' (GenericParam (',' GenericParam)* ','?)? '>' | ||
158 | |||
159 | GenericParam = | ||
160 | LifetimeParam | ||
161 | | TypeParam | ||
162 | | ConstParam | ||
163 | |||
164 | TypeParam = | ||
165 | Attr* Name (':' TypeBoundList?)? | ||
166 | ('=' default_type:TypeRef)? | ||
167 | |||
168 | ConstParam = | ||
169 | Attr* 'const' Name ':' ty:TypeRef | ||
170 | ('=' default_val:Expr)? | ||
171 | |||
172 | LifetimeParam = | ||
173 | Attr* 'lifetime' | ||
174 | |||
175 | Visibility = | ||
176 | 'pub' ('(' | ||
177 | 'super' | ||
178 | | 'self' | ||
179 | | 'crate' | ||
180 | | 'in' Path | ||
181 | ')')? | ||
182 | |||
183 | Attr = | ||
184 | '#' '!'? '[' Path ('=' Literal | TokenTree)? ']' | ||
114 | 185 | ||
115 | ParenType = | 186 | ParenType = |
116 | '(' TypeRef ')' | 187 | '(' ty:TypeRef ')' |
117 | 188 | ||
118 | TupleType = | 189 | TupleType = |
119 | '(' fields:TypeRef* ')' | 190 | '(' fields:TypeRef* ')' |
@@ -125,16 +196,16 @@ PathType = | |||
125 | Path | 196 | Path |
126 | 197 | ||
127 | PointerType = | 198 | PointerType = |
128 | '*' ('const' | 'mut') TypeRef | 199 | '*' ('const' | 'mut') ty:TypeRef |
129 | 200 | ||
130 | ArrayType = | 201 | ArrayType = |
131 | '[' TypeRef ';' Expr ']' | 202 | '[' ty:TypeRef ';' Expr ']' |
132 | 203 | ||
133 | SliceType = | 204 | SliceType = |
134 | '[' TypeRef ']' | 205 | '[' ty:TypeRef ']' |
135 | 206 | ||
136 | ReferenceType = | 207 | ReferenceType = |
137 | '&' 'lifetime'? 'mut'? TypeRef | 208 | '&' 'lifetime'? 'mut'? ty:TypeRef |
138 | 209 | ||
139 | PlaceholderType = | 210 | PlaceholderType = |
140 | '_' | 211 | '_' |
@@ -143,7 +214,7 @@ FnPointerType = | |||
143 | Abi 'unsafe'? 'fn' ParamList RetType? | 214 | Abi 'unsafe'? 'fn' ParamList RetType? |
144 | 215 | ||
145 | ForType = | 216 | ForType = |
146 | 'for' TypeParamList TypeRef | 217 | 'for' GenericParamList ty:TypeRef |
147 | 218 | ||
148 | ImplTraitType = | 219 | ImplTraitType = |
149 | 'impl' TypeBoundList | 220 | 'impl' TypeBoundList |
@@ -231,7 +302,7 @@ TryExpr = | |||
231 | Attr* Expr '?' | 302 | Attr* Expr '?' |
232 | 303 | ||
233 | CastExpr = | 304 | CastExpr = |
234 | Attr* Expr 'as' TypeRef | 305 | Attr* Expr 'as' ty:TypeRef |
235 | 306 | ||
236 | RefExpr = | 307 | RefExpr = |
237 | Attr* '&' ('raw' | 'mut' | 'const') Expr | 308 | Attr* '&' ('raw' | 'mut' | 'const') Expr |
@@ -263,16 +334,16 @@ MatchArm = | |||
263 | MatchGuard = | 334 | MatchGuard = |
264 | 'if' Expr | 335 | 'if' Expr |
265 | 336 | ||
266 | RecordLit = | 337 | RecordExpr = |
267 | Path RecordFieldList | 338 | Path RecordExprFieldList |
268 | 339 | ||
269 | RecordFieldList = | 340 | RecordExprFieldList = |
270 | '{' | 341 | '{' |
271 | fields:RecordField* | 342 | fields:RecordExprField* |
272 | ('..' spread:Expr)? | 343 | ('..' spread:Expr)? |
273 | '}' | 344 | '}' |
274 | 345 | ||
275 | RecordField = | 346 | RecordExprField = |
276 | Attr* NameRef (':' Expr)? | 347 | Attr* NameRef (':' Expr)? |
277 | 348 | ||
278 | OrPat = | 349 | OrPat = |
@@ -330,9 +401,6 @@ TupleStructPat = | |||
330 | TuplePat = | 401 | TuplePat = |
331 | '(' args:Pat* ')' | 402 | '(' args:Pat* ')' |
332 | 403 | ||
333 | Visibility = | ||
334 | 'pub' ('(' 'super' | 'self' | 'crate' | 'in' Path ')')? | ||
335 | |||
336 | Name = | 404 | Name = |
337 | 'ident' | 405 | 'ident' |
338 | 406 | ||
@@ -355,27 +423,6 @@ MacroStmts = | |||
355 | statements:Stmt* | 423 | statements:Stmt* |
356 | Expr? | 424 | Expr? |
357 | 425 | ||
358 | Attr = | ||
359 | '#' '!'? '[' Path ('=' input:AttrInput)? ']' | ||
360 | |||
361 | TypeParamList = | ||
362 | '<' | ||
363 | TypeParam* | ||
364 | LifetimeParam* | ||
365 | ConstParam* | ||
366 | '>' | ||
367 | |||
368 | TypeParam = | ||
369 | Attr* Name (':' TypeBoundList?)? | ||
370 | ('=' default_type:TypeRef)? | ||
371 | |||
372 | ConstParam = | ||
373 | Attr* 'const' Name ':' ascribed_type:TypeRef | ||
374 | ('=' default_val:Expr)? | ||
375 | |||
376 | LifetimeParam = | ||
377 | Attr* 'lifetime' | ||
378 | |||
379 | TypeBound = | 426 | TypeBound = |
380 | 'lifetime' | 'const'? TypeRef | 427 | 'lifetime' | 'const'? TypeRef |
381 | 428 | ||
@@ -383,31 +430,18 @@ TypeBoundList = | |||
383 | bounds:TypeBound* | 430 | bounds:TypeBound* |
384 | 431 | ||
385 | WherePred = | 432 | WherePred = |
386 | ('for' TypeParamList)? ('lifetime' | TypeRef) ':' TypeBoundList | 433 | ('for' GenericParamList)? ('lifetime' | TypeRef) ':' TypeBoundList |
387 | 434 | ||
388 | WhereClause = | 435 | WhereClause = |
389 | 'where' predicates:WherePred* | 436 | 'where' predicates:WherePred* |
390 | 437 | ||
391 | Abi = | ||
392 | 'string' | ||
393 | |||
394 | ExprStmt = | 438 | ExprStmt = |
395 | Attr* Expr ';' | 439 | Attr* Expr ';' |
396 | 440 | ||
397 | LetStmt = | 441 | LetStmt = |
398 | Attr* 'let' Pat (':' ascribed_type:TypeRef) | 442 | Attr* 'let' Pat (':' ty:TypeRef) |
399 | '=' initializer:Expr ';' | 443 | '=' initializer:Expr ';' |
400 | 444 | ||
401 | ParamList = | ||
402 | '(' SelfParam Param* ')' | ||
403 | |||
404 | SelfParam = | ||
405 | Attr* ('&' 'lifetime'?)? 'mut'? 'self' (':' ascribed_type:TypeRef) | ||
406 | |||
407 | Param = | ||
408 | Attr* Pat (':' ascribed_type:TypeRef) | ||
409 | | '...' | ||
410 | |||
411 | Path = | 445 | Path = |
412 | (qualifier:Path '::')? segment:PathSegment | 446 | (qualifier:Path '::')? segment:PathSegment |
413 | 447 | ||
@@ -435,19 +469,10 @@ LifetimeArg = | |||
435 | ConstArg = | 469 | ConstArg = |
436 | Literal | BlockExpr BlockExpr | 470 | Literal | BlockExpr BlockExpr |
437 | 471 | ||
438 | ExternBlock = | ||
439 | Attr* Abi ExternItemList | ||
440 | |||
441 | ExternItemList = | ||
442 | '{' extern_items:ExternItem* '}' | ||
443 | |||
444 | MetaItem = | ||
445 | Path '=' AttrInput nested_meta_items:MetaItem* | ||
446 | |||
447 | AdtDef = | 472 | AdtDef = |
448 | StructDef | 473 | Struct |
449 | | EnumDef | 474 | | Enum |
450 | | UnionDef | 475 | | Union |
451 | 476 | ||
452 | TypeRef = | 477 | TypeRef = |
453 | ParenType | 478 | ParenType |
@@ -464,19 +489,6 @@ TypeRef = | |||
464 | | ImplTraitType | 489 | | ImplTraitType |
465 | | DynTraitType | 490 | | DynTraitType |
466 | 491 | ||
467 | AssocItem = | ||
468 | FnDef | ||
469 | | TypeAliasDef | ||
470 | | ConstDef | ||
471 | | MacroCall | ||
472 | |||
473 | ExternItem = | ||
474 | FnDef | StaticDef | ||
475 | |||
476 | AttrInput = | ||
477 | Literal | ||
478 | | TokenTree | ||
479 | |||
480 | Stmt = | 492 | Stmt = |
481 | LetStmt | 493 | LetStmt |
482 | | ExprStmt | 494 | | ExprStmt |
@@ -514,7 +526,7 @@ Expr = | |||
514 | | BlockExpr | 526 | | BlockExpr |
515 | | ReturnExpr | 527 | | ReturnExpr |
516 | | MatchExpr | 528 | | MatchExpr |
517 | | RecordLit | 529 | | RecordExpr |
518 | | CallExpr | 530 | | CallExpr |
519 | | IndexExpr | 531 | | IndexExpr |
520 | | MethodCallExpr | 532 | | MethodCallExpr |