about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-01-01 02:03:23 +0000
committerbors <bors@rust-lang.org>2022-01-01 02:03:23 +0000
commitc9cf9c65072a35585f9521ab95044f32d5fcb9ec (patch)
treeda4d7b058007b67b96335ce0a9720758f99b45a8 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parent4d2e0fd96ccbb9ade41f1a3f07b14b7437f8e4ef (diff)
parent047275a68266033b2d7646e5380d8491ec550677 (diff)
downloadrust-c9cf9c65072a35585f9521ab95044f32d5fcb9ec.tar.gz
rust-c9cf9c65072a35585f9521ab95044f32d5fcb9ec.zip
Auto merge of #92294 - Kobzol:rustdoc-meta-kind, r=GuillaumeGomez
Add Attribute::meta_kind

The `AttrItem::meta` function is being called on a lot of places, however almost always the caller is only interested in the `kind` of the result `MetaItem`. Before, the `path`  had to be cloned in order to get the kind, now it does not have to be.

There is a larger related "problem". In a lot of places, something wants to know contents of attributes. This is accessed through `Attribute::meta_item_list`, which calls `AttrItem::meta` (now `AttrItem::meta_kind`), among other methods. When this function is called, the meta item list has to be recreated from scratch. Everytime something asks a simple question (like is this item/list of attributes `#[doc(hidden)]`?), the tokens of the attribute(s) are cloned, parsed and the results are allocated on the heap. That seems really unnecessary. What would be the best way to cache this? Turn `meta_item_list` into a query perhaps? Related PR: https://github.com/rust-lang/rust/pull/92227

r? rust-lang/rustdoc
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions