rust/compiler/rustc_errors/src
bors dc1feabef2 Auto merge of #147207 - Muscraft:anstyle-anstream, r=davidtwco
refactor: Move to anstream + anstyle for styling

`rustc` uses [`termcolor`](https://crates.io/crates/termcolor) for styling and writing, while `annotate-snippets` uses [`anstyle`](https://crates.io/crates/anstyle) for styling and currently writes directly to a `String`. When rendering directly to a terminal, there isn't/shouldn't be any differences. Still, there are differences in the escape sequences, which leads to slightly different output in JSON and SVG tests. As part of my work to have `rustc` use `annotate-snippets`, and to reduce the test differences between the two, I switched `rustc` to use `anstlye` and [`anstream`](https://crates.io/crates/anstream) for styling and writing.

The first commit migrates to `anstyle` and `anstream` and notably does not change the output. This is because it includes extra formatting to ensure that `anstyle` + `anstream` match the current output exactly. Most of this code is unnecessary, as it adds redundant resets or uses 256-color (8-bit) when it could be using 4-bit color. The subsequent commits remove this extra formatting while maintaining the correct output when rendered.

[Zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/147480-t-compiler.2Fdiagnostics/topic/annotate-snippets.20hurdles)
2025-10-22 16:22:51 +00:00
..
json Extract Translator struct 2025-06-19 13:02:04 -05:00
markdown chore: Remove unneeded ansi escape resets from output 2025-10-20 12:13:26 -06:00
annotate_snippet_emitter_writer.rs Extract Translator struct 2025-06-19 13:02:04 -05:00
codes.rs Move IntoDiagArg earlier in the dependency chains 2025-08-20 15:01:13 -07:00
decorate_diag.rs Refactor lint buffering to avoid requiring a giant enum 2025-08-22 01:59:56 -07:00
diagnostic.rs chore: Remove redundant disjoint spans assert 2025-09-04 17:42:13 -06:00
diagnostic_impls.rs Move IntoDiagArg earlier in the dependency chains 2025-08-20 15:01:13 -07:00
emitter.rs Auto merge of #147207 - Muscraft:anstyle-anstream, r=davidtwco 2025-10-22 16:22:51 +00:00
error.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
json.rs refactor: Move to anstream + anstyle for styling 2025-10-20 12:13:25 -06:00
lib.rs Auto merge of #147207 - Muscraft:anstyle-anstream, r=davidtwco 2025-10-22 16:22:51 +00:00
lock.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
registry.rs Reformat use declarations. 2024-07-29 08:26:52 +10:00
snippet.rs Use abs_diff where applicable 2025-03-27 18:29:06 +00:00
styled_buffer.rs use let chains in ast, borrowck, codegen, const_eval 2025-07-28 06:08:48 +05:00
tests.rs Extract Translator struct 2025-06-19 13:02:04 -05:00
timings.rs Add codegen timing section 2025-06-23 08:50:17 +02:00
translation.rs Extract Translator struct 2025-06-19 13:02:04 -05:00