rust/compiler/rustc_builtin_macros/src
bors f242d6c26c Auto merge of #127516 - nnethercote:simplify-LazyAttrTokenStream, r=petrochenkov
Simplify `LazyAttrTokenStream`

`LazyAttrTokenStream` is an unpleasant type: `Lrc<Box<dyn ToAttrTokenStream>>`. Why does it look like that?
- There are two `ToAttrTokenStream` impls, one for the lazy case, and one for the case where we already have an `AttrTokenStream`.
- The lazy case (`LazyAttrTokenStreamImpl`) is implemented in `rustc_parse`, but `LazyAttrTokenStream` is defined in `rustc_ast`, which does not depend on `rustc_parse`. The use of the trait lets `rustc_ast` implicitly depend on `rustc_parse`. This explains the `dyn`.
- `LazyAttrTokenStream` must have a `size_of` as small as possible, because it's used in many AST nodes. This explains the `Lrc<Box<_>>`, which keeps it to one word. (It's required `Lrc<dyn _>` would be a fat pointer.)

This PR moves `LazyAttrTokenStreamImpl` (and a few other token stream things) from `rustc_parse` to `rustc_ast`. This lets us replace the `ToAttrTokenStream` trait with a two-variant enum and also remove the `Box`, changing `LazyAttrTokenStream` to `Lrc<LazyAttrTokenStreamInner>`. Plus it does a few cleanups.

r? `@petrochenkov`
2025-04-30 00:09:21 +00:00
..
assert Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
deriving Replace infallible name_or_empty methods with fallible name methods. 2025-04-17 09:50:52 +10:00
format_foreign Rustfmt 2025-02-08 22:12:13 +00:00
alloc_error_handler.rs Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
asm.rs Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
assert.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
autodiff.rs Rollup merge of #140104 - Shourya742:2025-04-21-auto-diff-fails-on-impl-block, r=ZuseZ4 2025-04-22 15:24:07 +00:00
cfg.rs Speed up Parser::expected_token_types. 2024-12-19 16:05:41 +11:00
cfg_accessible.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
cfg_eval.rs Remove TokenStream::flattened and InvisibleOrigin::FlattenToken. 2025-04-02 16:16:51 +11:00
cmdline_attrs.rs Improve -Z crate-attr diagnostics 2025-04-13 16:46:02 -04:00
compile_error.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
concat.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
concat_bytes.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
concat_idents.rs Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino 2024-12-18 22:56:53 +08:00
contracts.rs Fix imports, remove attrs for unused_* 2025-02-10 20:15:30 +00:00
define_opaque.rs Test define opaques in extern items 2025-03-25 16:44:59 +00:00
derive.rs Use Ident::dummy() in dummy_annotatable. 2025-03-25 16:14:27 +11:00
edition_panic.rs use slice::contains where applicable 2025-03-28 12:21:21 +00:00
env.rs Rustfmt 2025-02-08 22:12:13 +00:00
errors.rs Move eager translation to a method on Diag 2025-04-16 21:38:59 -04:00
format.rs Simplify printf and shell format suggestions 2025-03-06 13:55:05 -08:00
format_foreign.rs Simplify printf and shell format suggestions 2025-03-06 13:55:05 -08:00
global_allocator.rs Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
lib.rs Simplify LazyAttrTokenStream. 2025-04-30 07:10:56 +10:00
log_syntax.rs Adjust some pubs. 2024-04-26 13:29:20 +10:00
pattern_type.rs Add or-patterns to pattern types 2025-04-28 07:50:18 +00:00
proc_macro_harness.rs Rename some name variables as ident. 2025-04-10 09:30:55 +10:00
source_util.rs tree-wide: parallel: Fully removed all Lrc, replaced with Arc 2025-02-03 13:25:57 +03:00
standard_library_imports.rs Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
test.rs Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
test_harness.rs Move ast::Item::ident into ast::ItemKind. 2025-04-01 14:08:57 +11:00
trace_macros.rs Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino 2024-12-18 22:56:53 +08:00
util.rs Account for format_args in HiddenUnicodeCodepoints lint 2024-12-31 05:03:22 +00:00