let loc = typ.lookup(db);
let item_tree = loc.id.item_tree(db);
let typ = &item_tree[loc.id.value];
- let type_ref = typ.type_ref.clone();
Arc::new(TypeAliasData {
name: typ.name.clone(),
- type_ref: type_ref,
+ type_ref: typ.type_ref.clone(),
visibility: item_tree[typ.visibility].clone(),
is_extern: typ.is_extern,
bounds: typ.bounds.to_vec(),
let item_tree = impl_loc.id.item_tree(db);
let impl_def = &item_tree[impl_loc.id.value];
let target_trait = impl_def.target_trait.clone();
+ let self_ty = impl_def.self_ty.clone();
let is_negative = impl_def.is_negative;
let module_id = impl_loc.container;
let container = AssocContainerId::ImplId(id);
- let file_id = impl_loc.id.file_id();
- let self_ty = impl_def.self_ty.clone();
+ let mut expander = Expander::new(db, impl_loc.id.file_id(), module_id);
- let mut expander = Expander::new(db, file_id, module_id);
let items = collect_items(
db,
module_id,
// items and expanded during block DefMap computation
return Default::default();
},
- ast::Type(_ty) => {
- // FIXME: This occurs because macros in type position are treated as inner
- // items and expanded during block DefMap computation
- return Default::default();
+ ast::Type(ty) => {
+ // Types can contain inner items. We return an empty item tree in this case, but
+ // still need to collect inner items.
+ ctx.lower_inner_items(ty.syntax())
},
ast::Expr(e) => {
// Macros can expand to expressions. We return an empty item tree in this case, but
//! HIR for references to types. Paths in these are not yet resolved. They can
//! be directly created from an ast::TypeRef, without further queries.
-use hir_expand::{ast_id_map::FileAstId, name::Name, ExpandResult, InFile};
+use hir_expand::{name::Name, AstId, ExpandResult, InFile};
use syntax::ast;
use crate::{
// For
ImplTrait(Vec<TypeBound>),
DynTrait(Vec<TypeBound>),
- Macro(InFile<FileAstId<ast::MacroCall>>),
+ Macro(AstId<ast::MacroCall>),
Error,
}