rust/compiler/rustc_ast/src
Nicholas Nethercote 478f8287c0 Introduce ByteSymbol.
It's like `Symbol` but for byte strings. The interner is now used for
both `Symbol` and `ByteSymbol`. E.g. if you intern `"dog"` and `b"dog"`
you'll get a `Symbol` and a `ByteSymbol` with the same index and the
characters will only be stored once.

The motivation for this is to eliminate the `Arc`s in `ast::LitKind`, to
make `ast::LitKind` impl `Copy`, and to avoid the need to arena-allocate
`ast::LitKind` in HIR. The latter change reduces peak memory by a
non-trivial amount on literal-heavy benchmarks such as `deep-vector` and
`tuple-stress`.

`Encoder`, `Decoder`, `SpanEncoder`, and `SpanDecoder` all get some
changes so that they can handle normal strings and byte strings.

This change does slow down compilation of programs that use
`include_bytes!` on large files, because the contents of those files are
now interned (hashed). This makes `include_bytes!` more similar to
`include_str!`, though `include_bytes!` contents still aren't escaped,
and hashing is still much cheaper than escaping.
2025-06-30 20:42:27 +10:00
..
attr Remove style() from AttributeExt trait 2025-06-21 11:09:13 -07:00
expand Change __rust_no_alloc_shim_is_unstable to be a function 2025-06-16 10:54:07 -07:00
util Introduce ByteSymbol. 2025-06-30 20:42:27 +10:00
ast.rs Introduce ByteSymbol. 2025-06-30 20:42:27 +10:00
ast_traits.rs completely deduplicate Visitor and MutVisitor 2025-06-19 17:50:44 +08:00
entry.rs remove support for the #[start] attribute 2025-01-21 06:59:15 -07:00
format.rs Implement DesugaringKind::FormatLiteral 2025-06-22 10:58:25 +02:00
lib.rs Remove unused feature gates 2025-06-28 23:36:46 +00:00
mut_visit.rs completely deduplicate Visitor and MutVisitor 2025-06-19 17:50:44 +08:00
node_id.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
ptr.rs Reduce P<T> to a typedef of Box<T>. 2025-05-27 13:29:24 +10:00
token.rs Add Ident::is_non_reserved_ident 2025-06-26 18:11:14 +00:00
tokenstream.rs Add Ident::is_non_reserved_ident 2025-06-26 18:11:14 +00:00
visit.rs Auto merge of #142878 - GuillaumeGomez:rollup-53dohob, r=GuillaumeGomez 2025-06-22 17:10:28 +00:00