diff options
Diffstat (limited to 'crates/ra_hir/src/impl_block.rs')
-rw-r--r-- | crates/ra_hir/src/impl_block.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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 @@ | |||
3 | use rustc_hash::FxHashMap; | 3 | use rustc_hash::FxHashMap; |
4 | use std::sync::Arc; | 4 | use std::sync::Arc; |
5 | 5 | ||
6 | use hir_def::{attr::Attr, type_ref::TypeRef}; | 6 | use hir_def::{attr::Attr, hygiene::Hygiene, type_ref::TypeRef}; |
7 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; | 7 | use ra_arena::{impl_arena_id, map::ArenaMap, Arena, RawId}; |
8 | use ra_cfg::CfgOptions; | 8 | use ra_cfg::CfgOptions; |
9 | use ra_syntax::{ | 9 | use 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, ¯o_call, db); | 251 | let attrs = Attr::from_attrs_owner(¯o_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(¯o_call)); | 259 | let ast_id = AstId::new(file_id, db.ast_id_map(file_id).ast_id(¯o_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 | { |