diff options
author | Jonas Schievink <[email protected]> | 2021-03-18 00:28:40 +0000 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-03-18 00:28:55 +0000 |
commit | 94b3b32c9882ad206df4f11f2f8de0be70a615f4 (patch) | |
tree | 4e7fef8aa9626ae753f281e19fd2c98c2b41a5a3 /crates/hir_def | |
parent | 62c059ea74be10abe594d56daf9ee44480c06dfb (diff) |
Support `#[cfg]` on all associated items
Diffstat (limited to 'crates/hir_def')
-rw-r--r-- | crates/hir_def/src/data.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/hir_def/src/data.rs b/crates/hir_def/src/data.rs index e976e419e..2c70b3bc0 100644 --- a/crates/hir_def/src/data.rs +++ b/crates/hir_def/src/data.rs | |||
@@ -256,17 +256,17 @@ fn collect_items( | |||
256 | 256 | ||
257 | let mut items = Vec::new(); | 257 | let mut items = Vec::new(); |
258 | for item in assoc_items { | 258 | for item in assoc_items { |
259 | let attrs = item_tree.attrs(db, module.krate, ModItem::from(item).into()); | ||
260 | if !attrs.is_cfg_enabled(&cfg_options) { | ||
261 | continue; | ||
262 | } | ||
263 | |||
259 | match item { | 264 | match item { |
260 | AssocItem::Function(id) => { | 265 | AssocItem::Function(id) => { |
261 | let item = &item_tree[id]; | 266 | let item = &item_tree[id]; |
262 | let attrs = item_tree.attrs(db, module.krate, ModItem::from(id).into()); | ||
263 | if !attrs.is_cfg_enabled(&cfg_options) { | ||
264 | continue; | ||
265 | } | ||
266 | let def = FunctionLoc { container, id: ItemTreeId::new(file_id, id) }.intern(db); | 267 | let def = FunctionLoc { container, id: ItemTreeId::new(file_id, id) }.intern(db); |
267 | items.push((item.name.clone(), def.into())); | 268 | items.push((item.name.clone(), def.into())); |
268 | } | 269 | } |
269 | // FIXME: cfg? | ||
270 | AssocItem::Const(id) => { | 270 | AssocItem::Const(id) => { |
271 | let item = &item_tree[id]; | 271 | let item = &item_tree[id]; |
272 | let name = match item.name.clone() { | 272 | let name = match item.name.clone() { |