aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r--crates/ra_hir_expand/src/ast_id_map.rs2
-rw-r--r--crates/ra_hir_expand/src/builtin_derive.rs10
-rw-r--r--crates/ra_hir_expand/src/db.rs4
-rw-r--r--crates/ra_hir_expand/src/lib.rs6
-rw-r--r--crates/ra_hir_expand/src/proc_macro.rs2
5 files changed, 12 insertions, 12 deletions
diff --git a/crates/ra_hir_expand/src/ast_id_map.rs b/crates/ra_hir_expand/src/ast_id_map.rs
index f4d31526a..8bfe1b4ba 100644
--- a/crates/ra_hir_expand/src/ast_id_map.rs
+++ b/crates/ra_hir_expand/src/ast_id_map.rs
@@ -73,7 +73,7 @@ impl AstIdMap {
73 // change parent's id. This means that, say, adding a new function to a 73 // change parent's id. This means that, say, adding a new function to a
74 // trait does not change ids of top-level items, which helps caching. 74 // trait does not change ids of top-level items, which helps caching.
75 bfs(node, |it| { 75 bfs(node, |it| {
76 if let Some(module_item) = ast::ModuleItem::cast(it) { 76 if let Some(module_item) = ast::Item::cast(it) {
77 res.alloc(module_item.syntax()); 77 res.alloc(module_item.syntax());
78 } 78 }
79 }); 79 });
diff --git a/crates/ra_hir_expand/src/builtin_derive.rs b/crates/ra_hir_expand/src/builtin_derive.rs
index f2d664863..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
5use ra_parser::FragmentKind; 5use ra_parser::FragmentKind;
6use ra_syntax::{ 6use 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)
@@ -276,7 +276,7 @@ mod tests {
276 let file_id = file_pos.file_id; 276 let file_id = file_pos.file_id;
277 let parsed = db.parse(file_id); 277 let parsed = db.parse(file_id);
278 let items: Vec<_> = 278 let items: Vec<_> =
279 parsed.syntax_node().descendants().filter_map(ast::ModuleItem::cast).collect(); 279 parsed.syntax_node().descendants().filter_map(ast::Item::cast).collect();
280 280
281 let ast_id_map = db.ast_id_map(file_id.into()); 281 let ast_id_map = db.ast_id_map(file_id.into());
282 282
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index e0ad1567f..f3b7cd492 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -379,14 +379,14 @@ fn to_fragment_kind(db: &dyn AstDatabase, id: MacroCallId) -> FragmentKind {
379 379
380 FOR_EXPR => FragmentKind::Expr, 380 FOR_EXPR => FragmentKind::Expr,
381 PATH_EXPR => FragmentKind::Expr, 381 PATH_EXPR => FragmentKind::Expr,
382 LAMBDA_EXPR => FragmentKind::Expr, 382 CLOSURE_EXPR => FragmentKind::Expr,
383 CONDITION => FragmentKind::Expr, 383 CONDITION => FragmentKind::Expr,
384 BREAK_EXPR => FragmentKind::Expr, 384 BREAK_EXPR => FragmentKind::Expr,
385 RETURN_EXPR => FragmentKind::Expr, 385 RETURN_EXPR => FragmentKind::Expr,
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_expand/src/lib.rs b/crates/ra_hir_expand/src/lib.rs
index d9e31ac20..2e8d63691 100644
--- a/crates/ra_hir_expand/src/lib.rs
+++ b/crates/ra_hir_expand/src/lib.rs
@@ -159,7 +159,7 @@ impl HirFileId {
159 } 159 }
160 160
161 /// Indicate it is macro file generated for builtin derive 161 /// Indicate it is macro file generated for builtin derive
162 pub fn is_builtin_derive(&self, db: &dyn db::AstDatabase) -> Option<InFile<ast::ModuleItem>> { 162 pub fn is_builtin_derive(&self, db: &dyn db::AstDatabase) -> Option<InFile<ast::Item>> {
163 match self.0 { 163 match self.0 {
164 HirFileIdRepr::FileId(_) => None, 164 HirFileIdRepr::FileId(_) => None,
165 HirFileIdRepr::MacroFile(macro_file) => { 165 HirFileIdRepr::MacroFile(macro_file) => {
@@ -174,7 +174,7 @@ impl HirFileId {
174 MacroDefKind::BuiltInDerive(_) => loc.kind.node(db), 174 MacroDefKind::BuiltInDerive(_) => loc.kind.node(db),
175 _ => return None, 175 _ => return None,
176 }; 176 };
177 Some(item.with_value(ast::ModuleItem::cast(item.value.clone())?)) 177 Some(item.with_value(ast::Item::cast(item.value.clone())?))
178 } 178 }
179 } 179 }
180 } 180 }
@@ -258,7 +258,7 @@ pub struct MacroCallLoc {
258#[derive(Debug, Clone, PartialEq, Eq, Hash)] 258#[derive(Debug, Clone, PartialEq, Eq, Hash)]
259pub enum MacroCallKind { 259pub enum MacroCallKind {
260 FnLike(AstId<ast::MacroCall>), 260 FnLike(AstId<ast::MacroCall>),
261 Attr(AstId<ast::ModuleItem>, String), 261 Attr(AstId<ast::Item>, String),
262} 262}
263 263
264impl MacroCallKind { 264impl MacroCallKind {
diff --git a/crates/ra_hir_expand/src/proc_macro.rs b/crates/ra_hir_expand/src/proc_macro.rs
index 04c026004..2c0ec41d2 100644
--- a/crates/ra_hir_expand/src/proc_macro.rs
+++ b/crates/ra_hir_expand/src/proc_macro.rs
@@ -101,7 +101,7 @@ fn remove_derive_attrs(tt: &tt::Subtree) -> Option<tt::Subtree> {
101} 101}
102 102
103#[cfg(test)] 103#[cfg(test)]
104mod test { 104mod tests {
105 use super::*; 105 use super::*;
106 use test_utils::assert_eq_text; 106 use test_utils::assert_eq_text;
107 107