rust/compiler/rustc_ast/src
Nicholas Nethercote ba1751a201 Avoid more MetaItem-to-Attribute conversions.
There is code for converting `Attribute` (syntactic) to `MetaItem`
(semantic). There is also code for the reverse direction. The reverse
direction isn't really necessary; it's currently only used when
generating attributes, e.g. in `derive` code.

This commit adds some new functions for creating `Attributes`s directly,
without involving `MetaItem`s: `mk_attr_word`, `mk_attr_name_value_str`,
`mk_attr_nested_word`, and
`ExtCtxt::attr_{word,name_value_str,nested_word}`.

These new methods replace the old functions for creating `Attribute`s:
`mk_attr_inner`, `mk_attr_outer`, and `ExtCtxt::attribute`. Those
functions took `MetaItem`s as input, and relied on many other functions
that created `MetaItems`, which are also removed: `mk_name_value_item`,
`mk_list_item`, `mk_word_item`, `mk_nested_word_item`,
`{MetaItem,MetaItemKind,NestedMetaItem}::token_trees`,
`MetaItemKind::attr_args`, `MetaItemLit::{from_lit_kind,to_token}`,
`ExtCtxt::meta_word`.

Overall this cuts more than 100 lines of code and makes thing simpler.
2022-11-29 18:43:53 +11:00
..
attr Avoid more MetaItem-to-Attribute conversions. 2022-11-29 18:43:53 +11:00
expand Make allocator_kind a query. 2021-06-20 11:52:51 +02:00
util Avoid more MetaItem-to-Attribute conversions. 2022-11-29 18:43:53 +11:00
ast_traits.rs Rename {Create,Lazy}TokenStream as {To,Lazy}AttrTokenStream. 2022-09-09 17:25:38 +10:00
ast.rs Reorder some types. 2022-11-29 12:10:34 +11:00
entry.rs Fixup missing renames from #[main] to #[rustc_main] 2022-06-22 18:24:09 +02:00
lib.rs Replace some bool params with an enum 2022-10-01 10:13:02 +00:00
mut_visit.rs Rename NestedMetaItem::[Ll]iteral as NestedMetaItem::[Ll]it. 2022-11-28 15:18:53 +11:00
node_id.rs rustc_error, rustc_private, rustc_ast: Switch to stable hash containers 2022-09-10 11:49:12 +02:00
ptr.rs Use delayed error handling for Encodable and Encoder infallible. 2022-06-08 07:01:26 +10:00
token.rs Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
tokenstream.rs Prefer doc comments over //-comments in compiler 2022-11-27 11:19:04 +00:00
visit.rs Suggest .clone() or ref binding on E0382 2022-11-23 12:17:47 -08:00