From 976a3226fe0f145dfefd473e9fecd63d58aca50e Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Thu, 6 May 2021 19:59:54 +0200 Subject: Don't store call-site text offsets in hygiene info --- crates/hir_def/src/path.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'crates/hir_def/src/path.rs') diff --git a/crates/hir_def/src/path.rs b/crates/hir_def/src/path.rs index 509f77850..64bff318e 100644 --- a/crates/hir_def/src/path.rs +++ b/crates/hir_def/src/path.rs @@ -7,7 +7,7 @@ use std::{ sync::Arc, }; -use crate::{body::LowerCtx, intern::Interned, type_ref::LifetimeRef}; +use crate::{body::LowerCtx, db::DefDatabase, intern::Interned, type_ref::LifetimeRef}; use base_db::CrateId; use hir_expand::{ hygiene::Hygiene, @@ -47,9 +47,9 @@ pub enum ImportAlias { } impl ModPath { - pub fn from_src(path: ast::Path, hygiene: &Hygiene) -> Option { - let ctx = LowerCtx::with_hygiene(hygiene); - lower::lower_path(path, &ctx).map(|it| (*it.mod_path).clone()) + pub fn from_src(db: &dyn DefDatabase, path: ast::Path, hygiene: &Hygiene) -> Option { + let ctx = LowerCtx::with_hygiene(db, hygiene); + lower::lower_path(db, path, &ctx).map(|it| (*it.mod_path).clone()) } pub fn from_segments(kind: PathKind, segments: impl IntoIterator) -> ModPath { @@ -64,12 +64,13 @@ impl ModPath { /// Calls `cb` with all paths, represented by this use item. pub(crate) fn expand_use_item( + db: &dyn DefDatabase, item_src: InFile, hygiene: &Hygiene, mut cb: impl FnMut(ModPath, &ast::UseTree, /* is_glob */ bool, Option), ) { if let Some(tree) = item_src.value.use_tree() { - lower::lower_use_tree(None, tree, hygiene, &mut cb); + lower::lower_use_tree(db, None, tree, hygiene, &mut cb); } } @@ -168,8 +169,8 @@ pub enum GenericArg { impl Path { /// Converts an `ast::Path` to `Path`. Works with use trees. /// It correctly handles `$crate` based path from macro call. - pub fn from_src(path: ast::Path, ctx: &LowerCtx) -> Option { - lower::lower_path(path, ctx) + pub fn from_src(db: &dyn DefDatabase, path: ast::Path, ctx: &LowerCtx) -> Option { + lower::lower_path(db, path, ctx) } /// Converts a known mod path to `Path`. -- cgit v1.2.3