diff options
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/data.rs | 8 | ||||
-rw-r--r-- | crates/hir_def/src/item_tree.rs | 8 | ||||
-rw-r--r-- | crates/hir_def/src/type_ref.rs | 4 |
3 files changed, 9 insertions, 11 deletions
diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index 8732b1e3e..135a6698e 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs | |||
@@ -123,11 +123,10 @@ impl TypeAliasData { | |||
123 | let loc = typ.lookup(db); | 123 | let loc = typ.lookup(db); |
124 | let item_tree = loc.id.item_tree(db); | 124 | let item_tree = loc.id.item_tree(db); |
125 | let typ = &item_tree[loc.id.value]; | 125 | let typ = &item_tree[loc.id.value]; |
126 | let type_ref = typ.type_ref.clone(); | ||
127 | 126 | ||
128 | Arc::new(TypeAliasData { | 127 | Arc::new(TypeAliasData { |
129 | name: typ.name.clone(), | 128 | name: typ.name.clone(), |
130 | type_ref: type_ref, | 129 | type_ref: typ.type_ref.clone(), |
131 | visibility: item_tree[typ.visibility].clone(), | 130 | visibility: item_tree[typ.visibility].clone(), |
132 | is_extern: typ.is_extern, | 131 | is_extern: typ.is_extern, |
133 | bounds: typ.bounds.to_vec(), | 132 | bounds: typ.bounds.to_vec(), |
@@ -203,13 +202,12 @@ impl ImplData { | |||
203 | let item_tree = impl_loc.id.item_tree(db); | 202 | let item_tree = impl_loc.id.item_tree(db); |
204 | let impl_def = &item_tree[impl_loc.id.value]; | 203 | let impl_def = &item_tree[impl_loc.id.value]; |
205 | let target_trait = impl_def.target_trait.clone(); | 204 | let target_trait = impl_def.target_trait.clone(); |
205 | let self_ty = impl_def.self_ty.clone(); | ||
206 | let is_negative = impl_def.is_negative; | 206 | let is_negative = impl_def.is_negative; |
207 | let module_id = impl_loc.container; | 207 | let module_id = impl_loc.container; |
208 | let container = AssocContainerId::ImplId(id); | 208 | let container = AssocContainerId::ImplId(id); |
209 | let file_id = impl_loc.id.file_id(); | 209 | let mut expander = Expander::new(db, impl_loc.id.file_id(), module_id); |
210 | let self_ty = impl_def.self_ty.clone(); | ||
211 | 210 | ||
212 | let mut expander = Expander::new(db, file_id, module_id); | ||
213 | let items = collect_items( | 211 | let items = collect_items( |
214 | db, | 212 | db, |
215 | module_id, | 213 | module_id, |
diff --git a/crates/hir_def/src/item_tree.rs b/crates/hir_def/src/item_tree.rs index fed285505..16a94a058 100644 --- a/crates/hir_def/src/item_tree.rs +++ b/crates/hir_def/src/item_tree.rs | |||
@@ -104,10 +104,10 @@ impl ItemTree { | |||
104 | // items and expanded during block DefMap computation | 104 | // items and expanded during block DefMap computation |
105 | return Default::default(); | 105 | return Default::default(); |
106 | }, | 106 | }, |
107 | ast::Type(_ty) => { | 107 | ast::Type(ty) => { |
108 | // FIXME: This occurs because macros in type position are treated as inner | 108 | // Types can contain inner items. We return an empty item tree in this case, but |
109 | // items and expanded during block DefMap computation | 109 | // still need to collect inner items. |
110 | return Default::default(); | 110 | ctx.lower_inner_items(ty.syntax()) |
111 | }, | 111 | }, |
112 | ast::Expr(e) => { | 112 | ast::Expr(e) => { |
113 | // Macros can expand to expressions. We return an empty item tree in this case, but | 113 | // Macros can expand to expressions. We return an empty item tree in this case, but |
diff --git a/crates/hir_def/src/type_ref.rs b/crates/hir_def/src/type_ref.rs index cf8a584ab..e18712d24 100644 --- a/crates/hir_def/src/type_ref.rs +++ b/crates/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 hir_expand::{ast_id_map::FileAstId, name::Name, ExpandResult, InFile}; | 4 | use hir_expand::{name::Name, AstId, ExpandResult, InFile}; |
5 | use syntax::ast; | 5 | use syntax::ast; |
6 | 6 | ||
7 | use crate::{ | 7 | use crate::{ |
@@ -91,7 +91,7 @@ pub enum TypeRef { | |||
91 | // For | 91 | // For |
92 | ImplTrait(Vec<TypeBound>), | 92 | ImplTrait(Vec<TypeBound>), |
93 | DynTrait(Vec<TypeBound>), | 93 | DynTrait(Vec<TypeBound>), |
94 | Macro(InFile<FileAstId<ast::MacroCall>>), | 94 | Macro(AstId<ast::MacroCall>), |
95 | Error, | 95 | Error, |
96 | } | 96 | } |
97 | 97 | ||