mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
hir_ty: Expand macros at type position
This commit is contained in:
parent
fb2d284f28
commit
cf3b4f1e20
17 changed files with 434 additions and 81 deletions
|
@ -15,7 +15,7 @@ use hir_def::{
|
|||
generics::{TypeParamProvenance, WherePredicate, WherePredicateTypeTarget},
|
||||
path::{GenericArg, Path, PathSegment, PathSegments},
|
||||
resolver::{HasResolver, Resolver, TypeNs},
|
||||
type_ref::{TraitRef as HirTraitRef, TypeBound, TypeRef},
|
||||
type_ref::{expand_type_ref, TraitRef as HirTraitRef, TypeBound, TypeRef},
|
||||
AdtId, AssocContainerId, AssocItemId, ConstId, ConstParamId, EnumId, EnumVariantId, FunctionId,
|
||||
GenericDefId, HasModule, ImplId, LocalFieldId, Lookup, StaticId, StructId, TraitId,
|
||||
TypeAliasId, TypeParamId, UnionId, VariantId,
|
||||
|
@ -287,6 +287,16 @@ impl<'a> TyLoweringContext<'a> {
|
|||
}
|
||||
}
|
||||
}
|
||||
mt @ TypeRef::Macro(_) => {
|
||||
if let Some(module_id) = self.resolver.module() {
|
||||
match expand_type_ref(self.db.upcast(), module_id, mt) {
|
||||
Some(type_ref) => self.lower_ty(type_ref.as_ref()),
|
||||
None => TyKind::Error.intern(&Interner),
|
||||
}
|
||||
} else {
|
||||
TyKind::Error.intern(&Interner)
|
||||
}
|
||||
}
|
||||
TypeRef::Error => TyKind::Error.intern(&Interner),
|
||||
};
|
||||
(ty, res)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue