mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +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> {
|
pub struct AttrQuery<'a> {
|
||||||
attrs: &'a Attrs,
|
attrs: &'a Attrs,
|
||||||
key: &'static str,
|
key: &'static str,
|
||||||
|
|
|
@ -404,16 +404,20 @@ impl RawItemsCollector {
|
||||||
let ast_id = self.source_ast_id_map.ast_id(&m);
|
let ast_id = self.source_ast_id_map.ast_id(&m);
|
||||||
|
|
||||||
// FIXME: cfg_attr
|
// FIXME: cfg_attr
|
||||||
let export = attrs.by_key("macro_export").exists();
|
let export_attr = attrs.by_key("macro_export");
|
||||||
let local_inner =
|
|
||||||
attrs.by_key("macro_export").tt_values().map(|it| &it.token_trees).flatten().any(
|
let export = export_attr.exists();
|
||||||
|it| match it {
|
let local_inner = if export {
|
||||||
tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => {
|
export_attr.tt_values().map(|it| &it.token_trees).flatten().any(|it| match it {
|
||||||
ident.text.contains("local_inner_macros")
|
tt::TokenTree::Leaf(tt::Leaf::Ident(ident)) => {
|
||||||
}
|
ident.text.contains("local_inner_macros")
|
||||||
_ => false,
|
}
|
||||||
},
|
_ => false,
|
||||||
);
|
})
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
};
|
||||||
|
|
||||||
let builtin = attrs.by_key("rustc_builtin_macro").exists();
|
let builtin = attrs.by_key("rustc_builtin_macro").exists();
|
||||||
|
|
||||||
let m = self.raw_items.macros.alloc(MacroData {
|
let m = self.raw_items.macros.alloc(MacroData {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue