1175 Commits
Author SHA1 Message Date
Scott Schafer 1c8bd26240 fix(rustdoc): Color doctest errors
(cherry picked from commit c523b65245)
2025-12-02 15:51:07 -08:00
Rémy Rakic a2b48332ba Revert "Auto merge of #146121 - Muscraft:filter-suggestion-parts, r=petrochenkov"
This reverts commit 99317ef14d, reversing
changes made to 9cd272dc85.
2025-10-23 18:18:35 +00:00
Scott Schafer c7f014ddc6 fix: Don't add diff symbol to unchanged lines 2025-10-22 15:30:57 -06:00
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
Scott Schafer 5aedef17f9 chore: Remove unneeded ansi escape resets from output 2025-10-20 12:13:26 -06:00
Scott Schafer a484119046 refactor: Use plain ansi colors for output 2025-10-20 12:13:26 -06:00
Scott Schafer 926d4535cd refactor: Move to anstream + anstyle for styling 2025-10-20 12:13:25 -06:00
relaxcn ad67c9d581 fix: Use untrimmed line numbers for trimmed suggestions 2025-10-19 23:58:04 +08:00
Matthias Krüger f64703ce7a Rollup merge of #147354 - chenyukang:yukang-fix-147070-wrong-highlight-span, r=estebank
Fix wrong span for hightlight for duplicated diff lines

Fixes rust-lang/rust#147070

From comments: https://github.com/rust-lang/rust/issues/147070#issuecomment-3368593144
The lightlight row for diff must at least 2.

r? `@estebank`
2025-10-07 07:04:17 +02:00
yukang 231c39545e Fix wrong span for hightlight for duplicated diff lines 2025-10-07 02:45:11 +00:00
Scott Schafer 9c6897bd07 test: Subtract code_offset from width for ui_testing 2025-10-02 05:45:16 -06:00
Scott Schafer b307a1146b fix: Filter suggestion parts that match existing code 2025-09-04 17:42:13 -06:00
Scott Schafer f196f50d66 chore: Remove redundant disjoint spans assert 2025-09-04 17:42:13 -06:00
Scott Schafer 81557349be refactor: Move assert for disjoint substitution spans 2025-09-04 17:42:13 -06:00
Stuart Cook 584832843d Rollup merge of #146120 - smoelius:patch-3, r=lqd
Correct typo in `rustc_errors` comment
2025-09-04 10:01:59 +10:00
Samuel Moelius 5e9b655e70 Correct typo in rustc_errors comment 2025-09-02 08:43:34 -04:00
Nicholas Nethercote 301655eafe Revert introduction of [workspace.dependencies].
This was done in #145740 and #145947. It is causing problems for people
using r-a on anything that uses the rustc-dev rustup package, e.g. Miri,
clippy.

This repository has lots of submodules and subtrees and various
different projects are carved out of pieces of it. It seems like
`[workspace.dependencies]` will just be more trouble than it's worth.
2025-09-02 19:12:54 +10:00
Stuart Cook 2246dda682 Rollup merge of #145947 - nnethercote:workspace-members-2, r=Kobzol
Add more to the `[workspace.dependencies]` section in the top-level `Cargo.toml`

Following on from rust-lang/rust#145740.

r? `@Kobzol`
2025-08-29 12:54:12 +10:00
Stuart Cook 2fae59ac96 Rollup merge of #144864 - Muscraft:no-source-fixes, r=jieyouxu
No source fixes

This PR started as a fix for a rendering bug that [got noticed in #143661](https://github.com/rust-lang/rust/pull/143661#discussion_r2199109530), but turned into a fix for any rendering bugs related to files with no source.
- Don't add an end column separator after a file with no source
- Add column separator before secondary messages with no source
- Render continuation between no source labels

Before
```
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
   ╰╴
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ╰ note: private field
   │
   ╰ note: private field
```

After
```
error[E0423]: expected function, tuple struct or tuple variant, found struct `std::collections::HashMap`
   ╭▸ $DIR/multi-suggestion.rs:17:13
   │
LL │     let _ = std::collections::HashMap();
   │             ━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ╰╴
   ╭▸ $SRC_DIR/std/src/collections/hash/map.rs:LL:COL
   │
   ╰ note: `std::collections::HashMap` defined here
note: constructor is not visible here due to private fields
   ╭▸ $SRC_DIR/alloc/src/boxed.rs:LL:COL
   │
   ├ note: private field
   │
   ╰ note: private field
```

Note: This PR also makes it so `rustc` and `annotate-snippets` match in these cases
2025-08-28 23:10:34 +10:00
Nicholas Nethercote daf6fe2c1b Add serde_json to [workspace.dependencies]. 2025-08-28 20:10:54 +10:00
Nicholas Nethercote c50d2cc807 Add tracing to [workspace.dependencies]. 2025-08-27 14:21:19 +10:00
Scott Schafer 2bd47d2646 fix: Render continuation between no source labels 2025-08-26 15:15:17 -06:00
Scott Schafer 93d16c5100 fix: Add col separator before secondary messages with no source 2025-08-26 15:15:17 -06:00
Scott Schafer 8835ea854e fix: Don't add an end column separator after a file with no source 2025-08-26 15:15:17 -06:00
Jana Dönszelmann 4b35cde904 Support lints in early attribute parsing 2025-08-24 09:14:49 +02:00