mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
Make AttrQuery copyable
This commit is contained in:
parent
e4267967a8
commit
7bbdeb43a4
2 changed files with 15 additions and 10 deletions
|
@ -140,6 +140,7 @@ impl Attr {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct AttrQuery<'a> {
|
||||
attrs: &'a Attrs,
|
||||
key: &'static str,
|
||||
|
|
|
@ -404,16 +404,20 @@ impl RawItemsCollector {
|
|||
let ast_id = self.source_ast_id_map.ast_id(&m);
|
||||
|
||||
// FIXME: cfg_attr
|
||||
let export = attrs.by_key("macro_export").exists();
|
||||
let local_inner =
|
||||
attrs.by_key("macro_export").tt_values().map(|it| &it.token_trees).flatten().any(
|
||||
|it| match it {
|
||||
tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => {
|
||||
ident.text.contains("local_inner_macros")
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
);
|
||||
let export_attr = attrs.by_key("macro_export");
|
||||
|
||||
let export = export_attr.exists();
|
||||
let local_inner = if export {
|
||||
export_attr.tt_values().map(|it| &it.token_trees).flatten().any(|it| match it {
|
||||
tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => {
|
||||
ident.text.contains("local_inner_macros")
|
||||
}
|
||||
_ => false,
|
||||
})
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
let builtin = attrs.by_key("rustc_builtin_macro").exists();
|
||||
|
||||
let m = self.raw_items.macros.alloc(MacroData {
|
||||
|
|
Loading…
Reference in a new issue