rust/compiler/rustc_ast/src/util
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
..
comments Add test for block doc comments horizontal trim 2022-02-07 17:07:53 +01:00
case.rs Replace some bool params with an enum 2022-10-01 10:13:02 +00:00
classify.rs Box ExprKind::{Closure,MethodCall}, and QSelf in expressions, types, and patterns. 2022-11-17 13:45:59 +11:00
comments.rs Shrink Token. 2022-08-01 08:53:04 +10:00
literal.rs Avoid more MetaItem-to-Attribute conversions. 2022-11-29 18:43:53 +11:00
parser.rs Remove ref patterns from rustc_ast 2022-11-21 09:18:59 +00:00
unicode.rs Use one match instead of a staggered match. 2021-11-05 00:39:34 +01:00