mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Don't recreate Hygiene unnecessarily
This commit is contained in:
parent
b7c443569a
commit
f742943a4b
9 changed files with 35 additions and 51 deletions
|
@ -1065,7 +1065,7 @@ impl<'db> SemanticsImpl<'db> {
|
|||
|
||||
fn resolve_type(&self, ty: &ast::Type) -> Option<Type> {
|
||||
let analyze = self.analyze(ty.syntax())?;
|
||||
let ctx = body::LowerCtx::new(self.db.upcast(), analyze.file_id);
|
||||
let ctx = body::LowerCtx::with_file_id(self.db.upcast(), analyze.file_id);
|
||||
let ty = hir_ty::TyLoweringContext::new(self.db, &analyze.resolver)
|
||||
.lower_ty(&crate::TypeRef::from_ast(&ctx, ty.clone()));
|
||||
Some(Type::new_with_resolver(self.db, &analyze.resolver, ty))
|
||||
|
@ -1672,7 +1672,7 @@ impl<'a> SemanticsScope<'a> {
|
|||
/// Resolve a path as-if it was written at the given scope. This is
|
||||
/// necessary a heuristic, as it doesn't take hygiene into account.
|
||||
pub fn speculative_resolve(&self, path: &ast::Path) -> Option<PathResolution> {
|
||||
let ctx = body::LowerCtx::new(self.db.upcast(), self.file_id);
|
||||
let ctx = body::LowerCtx::with_file_id(self.db.upcast(), self.file_id);
|
||||
let path = Path::from_src(path.clone(), &ctx)?;
|
||||
resolve_hir_path(self.db, &self.resolver, &path)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue