rust/compiler/rustc_span/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
..
analyze_source_file Be more accurate about calculating display_col from a BytePos 2024-07-18 20:08:38 +00:00
edit_distance update cfg(bootstrap) 2025-01-08 21:26:39 +01:00
source_map Take into-account -Zremap-path-scope when embedding filenames 2025-05-05 19:45:34 +02:00
symbol Introduce ByteSymbol. 2025-06-30 20:42:27 +10:00
analyze_source_file.rs handle cfg bootstrap on compiler and miri 2025-05-30 21:03:54 +03:00
caching_source_map_view.rs Do not clone Arc when hashing span. 2025-06-11 23:44:22 +00:00
def_id.rs Move hashes from rustc_data_structure to rustc_hashes so they can be shared with rust-analyzer 2025-02-16 16:18:30 -05:00
edit_distance.rs Use abs_diff where applicable 2025-03-27 18:29:06 +00:00
edition.rs Unify the format of rustc cli flags 2025-04-24 12:54:40 +08:00
fatal_error.rs Auto merge of #117557 - Zoxc:panic-prio, r=petrochenkov 2023-11-09 00:39:02 +00:00
hygiene.rs Implement DesugaringKind::FormatLiteral 2025-06-22 10:58:25 +02:00
lib.rs Introduce ByteSymbol. 2025-06-30 20:42:27 +10:00
profiling.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
source_map.rs Take into-account -Zremap-path-scope when embedding filenames 2025-05-05 19:45:34 +02:00
span_encoding.rs Optimize the codegen for Span::from_expansion 2025-04-30 11:38:09 -04:00
symbol.rs Introduce ByteSymbol. 2025-06-30 20:42:27 +10:00
tests.rs add unstable support for outputting file checksums for use in cargo 2024-10-01 21:23:20 -06:00