rust/compiler/rustc_ast/src
bors c9cf9c6507 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
2022-01-01 02:03:23 +00:00
..
ast mv compiler to compiler/ 2020-08-30 18:45:07 +03:00
attr Add Attribute::meta_kind 2021-12-26 16:56:34 +01:00
expand Make allocator_kind a query. 2021-06-20 11:52:51 +02:00
util Remove unnecessary sigils around Symbol::as_str() calls. 2021-12-15 17:32:14 +11:00
ast.rs remove feature gate and cleanup code 2021-12-10 19:20:31 +00:00
ast_like.rs expand: Turn ast::Crate into a first class expansion target 2021-11-28 15:48:55 +08:00
entry.rs Fix ICE when main is declared in an extern block 2021-06-09 23:14:02 -04:00
lib.rs Stabilize iter::zip. 2021-12-14 18:50:31 -04:00
mut_visit.rs Rollup merge of #91519 - petrochenkov:cratexp2, r=Aaron1011 2021-12-30 13:12:33 +01:00
node_id.rs Use LocalExpnId where possible. 2021-07-17 19:41:02 +02:00
ptr.rs Remove box syntax from rustc_ast 2021-08-18 09:25:26 +02:00
token.rs Use TokenKind::similar_tokens() 2021-10-04 22:13:00 +02:00
tokenstream.rs fix: inner attribute followed by outer attribute causing ICE 2021-10-25 17:31:27 +02:00
visit.rs expand: Turn ast::Crate into a first class expansion target 2021-11-28 15:48:55 +08:00