Skip to content

Conversation

Muscraft
Copy link
Member

@Muscraft Muscraft commented Oct 1, 2025

rustc uses termcolor for styling and writing, while annotate-snippets uses 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 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

@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2025

The list of allowed third-party dependencies may have been modified! You must ensure that any new dependencies have compatible licenses before merging.

cc @davidtwco, @wesleywiser

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added A-tidy Area: The tidy tool S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Oct 1, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 1, 2025

r? @lcnr

rustbot has assigned @lcnr.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test parser::tokenstream::tests::test_to_from_bijection ... ok

failures:

---- parser::tests::different_note_1 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_1::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_1 stdout end ----
---- parser::tests::different_note_2 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_2 stdout end ----
---- parser::tests::different_note_3 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_3::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_3 stdout end ----
---- parser::tests::different_note_spanned_1 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_1::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_1 stdout end ----
---- parser::tests::different_note_spanned_10 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_10::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_10 stdout end ----
---- parser::tests::different_note_spanned_3 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_3::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_3 stdout end ----
---- parser::tests::different_note_spanned_5 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_5::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_5 stdout end ----
---- parser::tests::different_note_spanned_2 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_2 stdout end ----
---- parser::tests::different_note_spanned_6 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_6::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_6 stdout end ----
---- parser::tests::different_note_spanned_4 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_4::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_4 stdout end ----
---- parser::tests::different_note_spanned_8 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_8::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_8 stdout end ----
---- parser::tests::different_note_spanned_7 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_7::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_7 stdout end ----
---- parser::tests::different_note_spanned_9 stdout ----
span: Span { lo: BytePos(17), hi: BytePos(22), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_note_spanned_9::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_note_spanned_9 stdout end ----
---- parser::tests::different_overlap stdout ----
span: Span { lo: BytePos(17), hi: BytePos(38), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0\n  X1 Y1 Z1\n  X2")
span: Span { lo: BytePos(31), hi: BytePos(49), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Z1\n  X2 Y2 Z2\n  X3")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::different_overlap::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::different_overlap stdout end ----
---- parser::tests::ends_on_col2 stdout ----
span: Span { lo: BytePos(10), hi: BytePos(17), ctxt: #0 } label: "test"
text: Ok("{\n\n\n  }")
expected output:
------
error: foo
##[error] --> test.rs:2:10
  |
---
   6: <rustc_parse::parser::tests::ends_on_col2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::ends_on_col2 stdout end ----
---- parser::tests::long_snippet stdout ----
span: Span { lo: BytePos(17), hi: BytePos(27), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0\n  X1")
span: Span { lo: BytePos(31), hi: BytePos(76), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Z1\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n  X2 Y2 Z2\n  X3 Y3 Z3")
expected output:
------
error: foo
##[error]  --> test.rs:3:6
   |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::long_snippet::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::long_snippet stdout end ----
---- parser::tests::ends_on_col0 stdout ----
span: Span { lo: BytePos(10), hi: BytePos(13), ctxt: #0 } label: "test"
text: Ok("{\n}")
expected output:
------
error: foo
##[error] --> test.rs:2:10
  |
---
   6: <rustc_parse::parser::tests::ends_on_col0::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::ends_on_col0 stdout end ----
---- parser::tests::long_snippet_multiple_spans stdout ----
span: Span { lo: BytePos(17), hi: BytePos(73), ctxt: #0 } label: "`Y` is a good letter"
text: Ok("Y0 Z0\n1\n2\n3\n  X1 Y1 Z1\n4\n5\n6\n  X2 Y2 Z2\n7\n8\n9\n10\n  X3 Y3")
span: Span { lo: BytePos(37), hi: BytePos(56), ctxt: #0 } label: "`Z` is a good letter too"
text: Ok("Z1\n4\n5\n6\n  X2 Y2 Z2")
expected output:
------
error: foo
##[error]  --> test.rs:3:6
   |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::long_snippet_multiple_spans::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::long_snippet_multiple_spans stdout end ----
---- parser::tests::multiline_and_normal_overlap stdout ----
span: Span { lo: BytePos(17), hi: BytePos(38), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0\n  X1 Y1 Z1\n  X2")
span: Span { lo: BytePos(14), hi: BytePos(19), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("X0 Y0")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   6: <rustc_parse::parser::tests::multiline_and_normal_overlap::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiline_and_normal_overlap stdout end ----
---- parser::tests::minimum_depth stdout ----
span: Span { lo: BytePos(17), hi: BytePos(27), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0\n  X1")
span: Span { lo: BytePos(28), hi: BytePos(44), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Y1 Z1\n  X2 Y2 Z2")
span: Span { lo: BytePos(36), hi: BytePos(52), ctxt: #0 } label: "`Z`"
text: Ok("X2 Y2 Z2\n  X3 Y3")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
3 |      X0 Y0 Z0
  |  _______^
4 | |    X1 Y1 Z1
  | | ____^_-
  | ||____|
  |  |    `X` is a good letter
5 |  |   X2 Y2 Z2
  |  |___-______- `Y` is a good letter too
  |   ___|
  |  |
6 |  |   X3 Y3 Z3
  |  |_______- `Z`

------
---
  | | ____^_-
  | ||____|
  |  |    `X` is a good letter
5 |  |   X2 Y2 Z2
  |  |___-______- `Y` is a good letter too
  |   ___|
  |  |
6 |  |   X3 Y3 Z3
  |  |_______- `Z`

------
---
   6: <rustc_parse::parser::tests::minimum_depth::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::minimum_depth stdout end ----
---- parser::tests::multiline_notes stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`a` is a good letter"
text: Ok("a { b { c } d")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^^^^^^^^^^ `a` is a good letter
  |
  = note: foo
          bar
  = note: foo
          bar

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^^^^^^^^^^ `a` is a good letter
  |
  = note: foo
          bar
  = note: foo
          bar
---
   6: <rustc_parse::parser::tests::multiline_notes::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiline_notes stdout end ----
---- parser::tests::multiple_labels_primary_without_message stdout ----
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: ""
text: Ok("b { c }")
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`a` is a good letter"
text: Ok("a { b { c } d")
span: Span { lo: BytePos(22), hi: BytePos(23), ctxt: #0 } label: ""
text: Ok("c")
expected output:
------
error: foo
##[error] --> test.rs:3:7
  |
3 |   a { b { c } d }
  |   ----^^^^-^^-- `a` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:7
  |
3 |   a { b { c } d }
  |   ----^^^^-^^-- `a` is a good letter

------

thread 'parser::tests::multiple_labels_primary_without_message' (50958) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
assertion failed: expected_output == actual_output
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::multiple_labels_primary_without_message::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_primary_without_message stdout end ----
---- parser::tests::multiple_labels_primary_without_message_2 stdout ----
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: "`b` is a good letter"
text: Ok("b { c }")
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: ""
text: Ok("a { b { c } d")
span: Span { lo: BytePos(22), hi: BytePos(23), ctxt: #0 } label: ""
text: Ok("c")
expected output:
------
error: foo
##[error] --> test.rs:3:7
  |
3 |   a { b { c } d }
  |   ----^^^^-^^--
  |       |
  |       `b` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:7
  |
3 |   a { b { c } d }
  |   ----^^^^-^^--
  |       |
  |       `b` is a good letter

------

---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::multiple_labels_primary_without_message_2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_primary_without_message_2 stdout end ----
---- parser::tests::multiple_labels_secondary_without_message stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`a` is a good letter"
text: Ok("a { b { c } d")
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: ""
text: Ok("b { c }")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^ `a` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^ `a` is a good letter

------

thread 'parser::tests::multiple_labels_secondary_without_message' (50960) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
assertion failed: expected_output == actual_output
---
   6: <rustc_parse::parser::tests::multiple_labels_secondary_without_message::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_secondary_without_message stdout end ----
---- parser::tests::multiple_labels_with_message stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`a` is a good letter"
text: Ok("a { b { c } d")
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: "`b` is a good letter"
text: Ok("b { c }")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^
  |   |   |
  |   |   `b` is a good letter
  |   `a` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^
  |   |   |
  |   |   `b` is a good letter
  |   `a` is a good letter

---
   6: <rustc_parse::parser::tests::multiple_labels_with_message::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_with_message stdout end ----
---- parser::tests::multiple_labels_without_message stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: ""
text: Ok("a { b { c } d")
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: ""
text: Ok("b { c }")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^

------

thread 'parser::tests::multiple_labels_without_message' (50964) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::multiple_labels_without_message::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_without_message stdout end ----
---- parser::tests::multiple_labels_secondary_without_message_2 stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: ""
text: Ok("a { b { c } d")
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: "`b` is a good letter"
text: Ok("b { c }")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^
  |       |
  |       `b` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^-------^^
  |       |
  |       `b` is a good letter

------
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::multiple_labels_secondary_without_message_2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_secondary_without_message_2 stdout end ----
---- parser::tests::multiple_labels_secondary_without_message_3 stdout ----
span: Span { lo: BytePos(14), hi: BytePos(18), ctxt: #0 } label: "`a` is a good letter"
text: Ok("a  b")
span: Span { lo: BytePos(18), hi: BytePos(22), ctxt: #0 } label: ""
text: Ok("c  d")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::multiple_labels_secondary_without_message_3::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_secondary_without_message_3 stdout end ----
---- parser::tests::multiple_labels_without_message_2 stdout ----
span: Span { lo: BytePos(18), hi: BytePos(25), ctxt: #0 } label: ""
text: Ok("b { c }")
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: ""
text: Ok("a { b { c } d")
span: Span { lo: BytePos(22), hi: BytePos(23), ctxt: #0 } label: ""
text: Ok("c")
expected output:
------
error: foo
##[error] --> test.rs:3:7
  |
3 |   a { b { c } d }
  |   ----^^^^-^^--

------
actual output:
------
error: foo
 --> test.rs:3:7
  |
3 |   a { b { c } d }
  |   ----^^^^-^^--

------

thread 'parser::tests::multiple_labels_without_message_2' (50965) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
assertion failed: expected_output == actual_output
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::multiple_labels_without_message_2::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::multiple_labels_without_message_2 stdout end ----
---- parser::tests::nested stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`X` is a good letter"
text: Ok("X0 Y0\n  Y1 X1")
span: Span { lo: BytePos(17), hi: BytePos(24), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Y0\n  Y1")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |      X0 Y0
  |  ____^  -
  | | ______|
4 | ||   Y1 X1
  | ||____-__^ `X` is a good letter
  |  |____|
  |       `Y` is a good letter too

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |      X0 Y0
  |  ____^  -
  | | ______|
4 | ||   Y1 X1
  | ||____-__^ `X` is a good letter
  |  |____|
  |       `Y` is a good letter too

------

---
   6: <rustc_parse::parser::tests::nested::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::nested stdout end ----
---- parser::tests::non_nested stdout ----
span: Span { lo: BytePos(14), hi: BytePos(32), ctxt: #0 } label: "`X` is a good letter"
text: Ok("X0 Y0\n  X1 Y1\n  X2")
span: Span { lo: BytePos(17), hi: BytePos(35), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Y0\n  X1 Y1\n  X2 Y2")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |      X0 Y0
  |  ____^  -
  | | ______|
4 | ||   X1 Y1
5 | ||   X2 Y2
  | ||____^__- `Y` is a good letter too
  | |_____|
  |       `X` is a good letter

------
actual output:
---
  |  ____^  -
  | | ______|
4 | ||   X1 Y1
5 | ||   X2 Y2
  | ||____^__- `Y` is a good letter too
  | |_____|
  |       `X` is a good letter

------

---
   6: <rustc_parse::parser::tests::non_nested::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::non_nested stdout end ----
---- parser::tests::non_overlapping stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`X` is a good letter"
text: Ok("X0 Y0 Z0\n  X1")
span: Span { lo: BytePos(39), hi: BytePos(55), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Y2 Z2\n  X3 Y3 Z3")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
---
   6: <rustc_parse::parser::tests::non_overlapping::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::non_overlapping stdout end ----
---- parser::tests::overlapping_start_and_end stdout ----
span: Span { lo: BytePos(17), hi: BytePos(27), ctxt: #0 } label: "`X` is a good letter"
text: Ok("Y0 Z0\n  X1")
span: Span { lo: BytePos(31), hi: BytePos(55), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Z1\n  X2 Y2 Z2\n  X3 Y3 Z3")
expected output:
------
error: foo
##[error] --> test.rs:3:6
  |
---
   6: <rustc_parse::parser::tests::overlapping_start_and_end::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::overlapping_start_and_end stdout end ----
---- parser::tests::single_label_without_message stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: ""
text: Ok("a { b { c } d")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^^^^^^^^^^

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^^^^^^^^^^

------

thread 'parser::tests::single_label_without_message' (50977) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
---
   6: <rustc_parse::parser::tests::single_label_without_message::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::single_label_without_message stdout end ----
---- parser::tests::single_label_with_message stdout ----
span: Span { lo: BytePos(14), hi: BytePos(27), ctxt: #0 } label: "`a` is a good letter"
text: Ok("a { b { c } d")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^^^^^^^^^^ `a` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |   a { b { c } d }
  |   ^^^^^^^^^^^^^ `a` is a good letter

------

thread 'parser::tests::single_label_with_message' (50976) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
assertion failed: expected_output == actual_output
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::single_label_with_message::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::single_label_with_message stdout end ----
---- parser::tests::triple_exact_overlap stdout ----
span: Span { lo: BytePos(14), hi: BytePos(38), ctxt: #0 } label: "`X` is a good letter"
text: Ok("X0 Y0 Z0\n  X1 Y1 Z1\n  X2")
span: Span { lo: BytePos(14), hi: BytePos(38), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("X0 Y0 Z0\n  X1 Y1 Z1\n  X2")
span: Span { lo: BytePos(14), hi: BytePos(38), ctxt: #0 } label: "`Z` label"
text: Ok("X0 Y0 Z0\n  X1 Y1 Z1\n  X2")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
---
   4: rustc_span::create_session_globals_then::<(), rustc_parse::parser::tests::test_harness::{closure#0}>
   5: rustc_parse::parser::tests::test_harness
   6: <rustc_parse::parser::tests::triple_exact_overlap::{closure#0} as core::ops::function::FnOnce<()>>::call_once
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
---- parser::tests::triple_exact_overlap stdout end ----
---- parser::tests::triple_overlap stdout ----
span: Span { lo: BytePos(14), hi: BytePos(38), ctxt: #0 } label: "`X` is a good letter"
text: Ok("X0 Y0 Z0\n  X1 Y1 Z1\n  X2")
span: Span { lo: BytePos(17), hi: BytePos(41), ctxt: #0 } label: "`Y` is a good letter too"
text: Ok("Y0 Z0\n  X1 Y1 Z1\n  X2 Y2")
span: Span { lo: BytePos(20), hi: BytePos(44), ctxt: #0 } label: "`Z` label"
text: Ok("Z0\n  X1 Y1 Z1\n  X2 Y2 Z2")
expected output:
------
error: foo
##[error] --> test.rs:3:3
  |
3 |       X0 Y0 Z0
  |  _____^  -  -
  | | _______|  |
  | || _________|
4 | |||   X1 Y1 Z1
5 | |||   X2 Y2 Z2
  | |||____^__-__- `Z` label
  | ||_____|__|
  | |______|  `Y` is a good letter too
  |        `X` is a good letter

------
actual output:
------
error: foo
 --> test.rs:3:3
  |
3 |       X0 Y0 Z0
  |  _____^  -  -
  | | _______|  |
  | || _________|
4 | |||   X1 Y1 Z1
5 | |||   X2 Y2 Z2
  | |||____^__-__- `Z` label
  | ||_____|__|
  | |______|  `Y` is a good letter too
  |        `X` is a good letter

------

thread 'parser::tests::triple_overlap' (50982) panicked at compiler/rustc_parse/src/parser/tests.rs:226:13:
assertion failed: expected_output == actual_output

@Muscraft Muscraft marked this pull request as draft October 1, 2025 03:58
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-tidy Area: The tidy tool S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants