diff options
author | Jonas Schievink <[email protected]> | 2021-05-06 18:59:54 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-05-06 18:59:54 +0100 |
commit | 976a3226fe0f145dfefd473e9fecd63d58aca50e (patch) | |
tree | 59dd6c2e4cc81c3f9285d47e5a44e370110818c7 /crates/hir/src | |
parent | b37b709459a4ff881a91965ebf0c39e3a449c304 (diff) |
Don't store call-site text offsets in hygiene info
Diffstat (limited to 'crates/hir/src')
-rw-r--r-- | crates/hir/src/attrs.rs | 2 | ||||
-rw-r--r-- | crates/hir/src/lib.rs | 2 | ||||
-rw-r--r-- | crates/hir/src/semantics.rs | 2 | ||||
-rw-r--r-- | crates/hir/src/source_analyzer.rs | 7 |
4 files changed, 7 insertions, 6 deletions
diff --git a/crates/hir/src/attrs.rs b/crates/hir/src/attrs.rs index 4a11622fc..e8fa3c56e 100644 --- a/crates/hir/src/attrs.rs +++ b/crates/hir/src/attrs.rs | |||
@@ -112,7 +112,7 @@ fn resolve_doc_path( | |||
112 | AttrDefId::MacroDefId(_) => return None, | 112 | AttrDefId::MacroDefId(_) => return None, |
113 | }; | 113 | }; |
114 | let path = ast::Path::parse(link).ok()?; | 114 | let path = ast::Path::parse(link).ok()?; |
115 | let modpath = ModPath::from_src(path, &Hygiene::new_unhygienic()).unwrap(); | 115 | let modpath = ModPath::from_src(db.upcast(), path, &Hygiene::new_unhygienic()).unwrap(); |
116 | let resolved = resolver.resolve_module_path_in_items(db.upcast(), &modpath); | 116 | let resolved = resolver.resolve_module_path_in_items(db.upcast(), &modpath); |
117 | if resolved == PerNs::none() { | 117 | if resolved == PerNs::none() { |
118 | if let Some(trait_id) = resolver.resolve_module_path_in_trait_items(db.upcast(), &modpath) { | 118 | if let Some(trait_id) = resolver.resolve_module_path_in_trait_items(db.upcast(), &modpath) { |
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 6fcc58f61..f876339de 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -1666,7 +1666,7 @@ impl Impl { | |||
1666 | .value | 1666 | .value |
1667 | .attrs() | 1667 | .attrs() |
1668 | .filter_map(|it| { | 1668 | .filter_map(|it| { |
1669 | let path = ModPath::from_src(it.path()?, &hygenic)?; | 1669 | let path = ModPath::from_src(db.upcast(), it.path()?, &hygenic)?; |
1670 | if path.as_ident()?.to_string() == "derive" { | 1670 | if path.as_ident()?.to_string() == "derive" { |
1671 | Some(it) | 1671 | Some(it) |
1672 | } else { | 1672 | } else { |
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs index 62500602a..d53d81c07 100644 --- a/crates/hir/src/semantics.rs +++ b/crates/hir/src/semantics.rs | |||
@@ -855,7 +855,7 @@ impl<'a> SemanticsScope<'a> { | |||
855 | /// necessary a heuristic, as it doesn't take hygiene into account. | 855 | /// necessary a heuristic, as it doesn't take hygiene into account. |
856 | pub fn speculative_resolve(&self, path: &ast::Path) -> Option<PathResolution> { | 856 | pub fn speculative_resolve(&self, path: &ast::Path) -> Option<PathResolution> { |
857 | let ctx = body::LowerCtx::new(self.db.upcast(), self.file_id); | 857 | let ctx = body::LowerCtx::new(self.db.upcast(), self.file_id); |
858 | let path = Path::from_src(path.clone(), &ctx)?; | 858 | let path = Path::from_src(self.db.upcast(), path.clone(), &ctx)?; |
859 | resolve_hir_path(self.db, &self.resolver, &path) | 859 | resolve_hir_path(self.db, &self.resolver, &path) |
860 | } | 860 | } |
861 | } | 861 | } |
diff --git a/crates/hir/src/source_analyzer.rs b/crates/hir/src/source_analyzer.rs index 0895bd6f1..186421cbd 100644 --- a/crates/hir/src/source_analyzer.rs +++ b/crates/hir/src/source_analyzer.rs | |||
@@ -204,7 +204,8 @@ impl SourceAnalyzer { | |||
204 | macro_call: InFile<&ast::MacroCall>, | 204 | macro_call: InFile<&ast::MacroCall>, |
205 | ) -> Option<MacroDef> { | 205 | ) -> Option<MacroDef> { |
206 | let ctx = body::LowerCtx::new(db.upcast(), macro_call.file_id); | 206 | let ctx = body::LowerCtx::new(db.upcast(), macro_call.file_id); |
207 | let path = macro_call.value.path().and_then(|ast| Path::from_src(ast, &ctx))?; | 207 | let path = |
208 | macro_call.value.path().and_then(|ast| Path::from_src(db.upcast(), ast, &ctx))?; | ||
208 | self.resolver.resolve_path_as_macro(db.upcast(), path.mod_path()).map(|it| it.into()) | 209 | self.resolver.resolve_path_as_macro(db.upcast(), path.mod_path()).map(|it| it.into()) |
209 | } | 210 | } |
210 | 211 | ||
@@ -283,8 +284,8 @@ impl SourceAnalyzer { | |||
283 | 284 | ||
284 | // This must be a normal source file rather than macro file. | 285 | // This must be a normal source file rather than macro file. |
285 | let hygiene = Hygiene::new(db.upcast(), self.file_id); | 286 | let hygiene = Hygiene::new(db.upcast(), self.file_id); |
286 | let ctx = body::LowerCtx::with_hygiene(&hygiene); | 287 | let ctx = body::LowerCtx::with_hygiene(db.upcast(), &hygiene); |
287 | let hir_path = Path::from_src(path.clone(), &ctx)?; | 288 | let hir_path = Path::from_src(db.upcast(), path.clone(), &ctx)?; |
288 | 289 | ||
289 | // Case where path is a qualifier of another path, e.g. foo::bar::Baz where we | 290 | // Case where path is a qualifier of another path, e.g. foo::bar::Baz where we |
290 | // trying to resolve foo::bar. | 291 | // trying to resolve foo::bar. |