aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir')
-rw-r--r--crates/ra_hir/src/expr/lower.rs4
-rw-r--r--crates/ra_hir/src/impl_block.rs12
2 files changed, 9 insertions, 7 deletions
diff --git a/crates/ra_hir/src/expr/lower.rs b/crates/ra_hir/src/expr/lower.rs
index ad029b868..575d78198 100644
--- a/crates/ra_hir/src/expr/lower.rs
+++ b/crates/ra_hir/src/expr/lower.rs
@@ -1,6 +1,7 @@
1//! FIXME: write short doc here 1//! FIXME: write short doc here
2 2
3use hir_def::{ 3use hir_def::{
4 hygiene::Hygiene,
4 name::{self, AsName, Name}, 5 name::{self, AsName, Name},
5 path::GenericArgs, 6 path::GenericArgs,
6 type_ref::TypeRef, 7 type_ref::TypeRef,
@@ -597,7 +598,8 @@ where
597 } 598 }
598 599
599 fn parse_path(&mut self, path: ast::Path) -> Option<Path> { 600 fn parse_path(&mut self, path: ast::Path) -> Option<Path> {
600 Path::from_src(Source { ast: path, file_id: self.current_file_id }, self.db) 601 let hygiene = Hygiene::new(self.db, self.current_file_id);
602 Path::from_src(path, &hygiene)
601 } 603 }
602} 604}
603 605
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 518330713..9e4a40017 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -3,7 +3,7 @@
3use rustc_hash::FxHashMap; 3use rustc_hash::FxHashMap;
4use std::sync::Arc; 4use std::sync::Arc;
5 5
6use hir_def::{attr::Attr, type_ref::TypeRef}; 6use hir_def::{attr::Attr, hygiene::Hygiene, type_ref::TypeRef};
7use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; 7use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
8use ra_cfg::CfgOptions; 8use ra_cfg::CfgOptions;
9use ra_syntax::{ 9use ra_syntax::{
@@ -227,10 +227,11 @@ impl ModuleImplBlocks {
227 owner: &dyn ast::ModuleItemOwner, 227 owner: &dyn ast::ModuleItemOwner,
228 file_id: HirFileId, 228 file_id: HirFileId,
229 ) { 229 ) {
230 let hygiene = Hygiene::new(db, file_id);
230 for item in owner.items_with_macros() { 231 for item in owner.items_with_macros() {
231 match item { 232 match item {
232 ast::ItemOrMacro::Item(ast::ModuleItem::ImplBlock(impl_block_ast)) => { 233 ast::ItemOrMacro::Item(ast::ModuleItem::ImplBlock(impl_block_ast)) => {
233 let attrs = Attr::from_attrs_owner(file_id, &impl_block_ast, db); 234 let attrs = Attr::from_attrs_owner(&impl_block_ast, &hygiene);
234 if attrs.map_or(false, |attrs| { 235 if attrs.map_or(false, |attrs| {
235 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false)) 236 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false))
236 }) { 237 }) {
@@ -247,7 +248,7 @@ impl ModuleImplBlocks {
247 } 248 }
248 ast::ItemOrMacro::Item(_) => (), 249 ast::ItemOrMacro::Item(_) => (),
249 ast::ItemOrMacro::Macro(macro_call) => { 250 ast::ItemOrMacro::Macro(macro_call) => {
250 let attrs = Attr::from_attrs_owner(file_id, &macro_call, db); 251 let attrs = Attr::from_attrs_owner(&macro_call, &hygiene);
251 if attrs.map_or(false, |attrs| { 252 if attrs.map_or(false, |attrs| {
252 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false)) 253 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false))
253 }) { 254 }) {
@@ -256,9 +257,8 @@ impl ModuleImplBlocks {
256 257
257 //FIXME: we should really cut down on the boilerplate required to process a macro 258 //FIXME: we should really cut down on the boilerplate required to process a macro
258 let ast_id = AstId::new(file_id, db.ast_id_map(file_id).ast_id(&macro_call)); 259 let ast_id = AstId::new(file_id, db.ast_id_map(file_id).ast_id(&macro_call));
259 if let Some(path) = macro_call 260 if let Some(path) =
260 .path() 261 macro_call.path().and_then(|path| Path::from_src(path, &hygiene))
261 .and_then(|path| Path::from_src(Source { ast: path, file_id }, db))
262 { 262 {
263 if let Some(def) = self.module.resolver(db).resolve_path_as_macro(db, &path) 263 if let Some(def) = self.module.resolver(db).resolve_path_as_macro(db, &path)
264 { 264 {