aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/impl_block.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/impl_block.rs')
-rw-r--r--crates/ra_hir/src/impl_block.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/ra_hir/src/impl_block.rs b/crates/ra_hir/src/impl_block.rs
index 518330713..b1a014074 100644
--- a/crates/ra_hir/src/impl_block.rs
+++ b/crates/ra_hir/src/impl_block.rs
@@ -4,6 +4,7 @@ use 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, type_ref::TypeRef};
7use hir_expand::hygiene::Hygiene;
7use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; 8use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId};
8use ra_cfg::CfgOptions; 9use ra_cfg::CfgOptions;
9use ra_syntax::{ 10use ra_syntax::{
@@ -227,10 +228,11 @@ impl ModuleImplBlocks {
227 owner: &dyn ast::ModuleItemOwner, 228 owner: &dyn ast::ModuleItemOwner,
228 file_id: HirFileId, 229 file_id: HirFileId,
229 ) { 230 ) {
231 let hygiene = Hygiene::new(db, file_id);
230 for item in owner.items_with_macros() { 232 for item in owner.items_with_macros() {
231 match item { 233 match item {
232 ast::ItemOrMacro::Item(ast::ModuleItem::ImplBlock(impl_block_ast)) => { 234 ast::ItemOrMacro::Item(ast::ModuleItem::ImplBlock(impl_block_ast)) => {
233 let attrs = Attr::from_attrs_owner(file_id, &impl_block_ast, db); 235 let attrs = Attr::from_attrs_owner(&impl_block_ast, &hygiene);
234 if attrs.map_or(false, |attrs| { 236 if attrs.map_or(false, |attrs| {
235 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false)) 237 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false))
236 }) { 238 }) {
@@ -247,7 +249,7 @@ impl ModuleImplBlocks {
247 } 249 }
248 ast::ItemOrMacro::Item(_) => (), 250 ast::ItemOrMacro::Item(_) => (),
249 ast::ItemOrMacro::Macro(macro_call) => { 251 ast::ItemOrMacro::Macro(macro_call) => {
250 let attrs = Attr::from_attrs_owner(file_id, &macro_call, db); 252 let attrs = Attr::from_attrs_owner(&macro_call, &hygiene);
251 if attrs.map_or(false, |attrs| { 253 if attrs.map_or(false, |attrs| {
252 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false)) 254 attrs.iter().any(|attr| attr.is_cfg_enabled(cfg_options) == Some(false))
253 }) { 255 }) {
@@ -256,9 +258,8 @@ impl ModuleImplBlocks {
256 258
257 //FIXME: we should really cut down on the boilerplate required to process a macro 259 //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)); 260 let ast_id = AstId::new(file_id, db.ast_id_map(file_id).ast_id(&macro_call));
259 if let Some(path) = macro_call 261 if let Some(path) =
260 .path() 262 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 { 263 {
263 if let Some(def) = self.module.resolver(db).resolve_path_as_macro(db, &path) 264 if let Some(def) = self.module.resolver(db).resolve_path_as_macro(db, &path)
264 { 265 {