hir_ty: Expand macros at type position

This commit is contained in:
cynecx 2021-04-10 17:49:12 +02:00
parent fb2d284f28
commit cf3b4f1e20
17 changed files with 434 additions and 81 deletions

View file

@ -6,6 +6,7 @@ use std::{cell::RefCell, fmt, iter::successors};
use base_db::{FileId, FileRange};
use hir_def::{
body,
resolver::{self, HasResolver, Resolver, TypeNs},
AsMacroCall, FunctionId, TraitId, VariantId,
};
@ -854,7 +855,8 @@ impl<'a> SemanticsScope<'a> {
/// necessary a heuristic, as it doesn't take hygiene into account.
pub fn speculative_resolve(&self, path: &ast::Path) -> Option<PathResolution> {
let hygiene = Hygiene::new(self.db.upcast(), self.file_id);
let path = Path::from_src(path.clone(), &hygiene)?;
let ctx = body::LowerCtx::with_hygiene(&hygiene);
let path = Path::from_src(path.clone(), &ctx)?;
resolve_hir_path(self.db, &self.resolver, &path)
}
}