diff options
author | Edwin Cheng <[email protected]> | 2020-05-01 13:58:24 +0100 |
---|---|---|
committer | Edwin Cheng <[email protected]> | 2020-05-01 13:58:24 +0100 |
commit | 7bbdeb43a4972300779a8d30c7323445c1105f44 (patch) | |
tree | ed3691683ae40d1dd4dbfadf5b5cf5d38a3530d4 /crates | |
parent | e4267967a8ee3b35d902931cecf06bb4e19f86c5 (diff) |
Make AttrQuery copyable
Diffstat (limited to 'crates')
-rw-r--r-- | crates/ra_hir_def/src/attr.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir_def/src/nameres/raw.rs | 24 |
2 files changed, 15 insertions, 10 deletions
diff --git a/crates/ra_hir_def/src/attr.rs b/crates/ra_hir_def/src/attr.rs index 5a86af8ba..576cd0c65 100644 --- a/crates/ra_hir_def/src/attr.rs +++ b/crates/ra_hir_def/src/attr.rs | |||
@@ -140,6 +140,7 @@ impl Attr { | |||
140 | } | 140 | } |
141 | } | 141 | } |
142 | 142 | ||
143 | #[derive(Debug, Clone, Copy)] | ||
143 | pub struct AttrQuery<'a> { | 144 | pub struct AttrQuery<'a> { |
144 | attrs: &'a Attrs, | 145 | attrs: &'a Attrs, |
145 | key: &'static str, | 146 | key: &'static str, |
diff --git a/crates/ra_hir_def/src/nameres/raw.rs b/crates/ra_hir_def/src/nameres/raw.rs index aed9dcc72..a71503c76 100644 --- a/crates/ra_hir_def/src/nameres/raw.rs +++ b/crates/ra_hir_def/src/nameres/raw.rs | |||
@@ -404,16 +404,20 @@ impl RawItemsCollector { | |||
404 | let ast_id = self.source_ast_id_map.ast_id(&m); | 404 | let ast_id = self.source_ast_id_map.ast_id(&m); |
405 | 405 | ||
406 | // FIXME: cfg_attr | 406 | // FIXME: cfg_attr |
407 | let export = attrs.by_key("macro_export").exists(); | 407 | let export_attr = attrs.by_key("macro_export"); |
408 | let local_inner = | 408 | |
409 | attrs.by_key("macro_export").tt_values().map(|it| &it.token_trees).flatten().any( | 409 | let export = export_attr.exists(); |
410 | |it| match it { | 410 | let local_inner = if export { |
411 | tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => { | 411 | export_attr.tt_values().map(|it| &it.token_trees).flatten().any(|it| match it { |
412 | ident.text.contains("local_inner_macros") | 412 | tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => { |
413 | } | 413 | ident.text.contains("local_inner_macros") |
414 | _ => false, | 414 | } |
415 | }, | 415 | _ => false, |
416 | ); | 416 | }) |
417 | } else { | ||
418 | false | ||
419 | }; | ||
420 | |||
417 | let builtin = attrs.by_key("rustc_builtin_macro").exists(); | 421 | let builtin = attrs.by_key("rustc_builtin_macro").exists(); |
418 | 422 | ||
419 | let m = self.raw_items.macros.alloc(MacroData { | 423 | let m = self.raw_items.macros.alloc(MacroData { |