Skip to content

Commit 03f4a7a

Browse files
committed
refactor: Always add a col seperator before -Ztrack-diagnostics
1 parent 2233519 commit 03f4a7a

File tree

9 files changed

+14
-7
lines changed

9 files changed

+14
-7
lines changed

compiler/rustc_errors/src/emitter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,11 +2478,11 @@ impl HumanEmitter {
24782478
let primary_span = span.primary_span().unwrap_or_default();
24792479
if let (Some(tracked), false) = (emitted_at, primary_span.is_dummy()) {
24802480
if !self.short_message {
2481+
self.draw_col_separator_no_space(&mut buffer, 0, max_line_num_len + 1);
24812482
let track = format!("-Ztrack-diagnostics: created at {tracked}");
2482-
buffer.append(0, &track, Style::NoStyle);
2483+
buffer.append(1, &track, Style::NoStyle);
24832484
}
2484-
}
2485-
if !children.is_empty()
2485+
} else if !children.is_empty()
24862486
|| suggestions.iter().any(|s| s.style != SuggestionStyle::CompletelyHidden)
24872487
{
24882488
let line_offest = buffer.num_lines();

src/tools/clippy/tests/ui/track-diagnostics.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
33
|
44
LL | const S: A = B;
55
| ^ expected `A`, found `B`
6+
|
67
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:LL:CC
78

89
error: aborting due to 1 previous error

tests/rustdoc-ui/track-diagnostics.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error[E0308]: mismatched types
33
|
44
LL | pub const S: A = B;
55
| ^ expected `A`, found `B`
6+
|
67
-Ztrack-diagnostics: created at compiler/rustc_trait_selection/src/error_reporting/infer/mod.rs:LL:CC
78

89
error: aborting due to 1 previous error

tests/ui/track-diagnostics/track.stderr

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,24 @@ error[E0425]: cannot find value `rust` in this scope
33
|
44
LL | break rust
55
| ^^^^ not found in this scope
6+
|
67
-Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
78

89
error[E0268]: `break` outside of a loop or labeled block
910
--> $DIR/track.rs:LL:CC
1011
|
1112
LL | break rust
1213
| ^^^^^^^^^^ cannot `break` outside of a loop or labeled block
14+
|
1315
-Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/loops.rs:LL:CC
1416

1517
error: internal compiler error: It looks like you're trying to break rust; would you like some ICE?
1618
--> $DIR/track.rs:LL:CC
1719
|
1820
LL | break rust
1921
| ^^^^^^^^^^
20-
-Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/lib.rs:LL:CC
2122
|
23+
-Ztrack-diagnostics: created at compiler/rustc_hir_typeck/src/lib.rs:LL:CC
2224
= note: the compiler expectedly panicked. this is a feature.
2325
= note: we would appreciate a joke overview: https://github.com/rust-lang/rust/issues/43162#issuecomment-320764675
2426
= note: rustc $VERSION running on $TARGET

tests/ui/track-diagnostics/track2.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ LL | let _moved @ _from = String::from("foo");
66
| | |
77
| | value moved here
88
| value used here after move
9-
-Ztrack-diagnostics: created at compiler/rustc_borrowck/src/borrowck_errors.rs:LL:CC
109
|
10+
-Ztrack-diagnostics: created at compiler/rustc_borrowck/src/borrowck_errors.rs:LL:CC
1111
help: borrow this binding in the pattern to avoid moving the value
1212
|
1313
LL | let ref _moved @ ref _from = String::from("foo");

tests/ui/track-diagnostics/track3.stderr

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,15 @@ error[E0422]: cannot find struct, variant or union type `Blah` in this scope
33
|
44
LL | let _unimported = Blah { field: u8 };
55
| ^^^^ not found in this scope
6+
|
67
-Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
78

89
error[E0423]: expected value, found builtin type `u8`
910
--> $DIR/track3.rs:LL:CC
1011
|
1112
LL | let _unimported = Blah { field: u8 };
1213
| ^^ not a value
14+
|
1315
-Ztrack-diagnostics: created at compiler/rustc_resolve/src/late/diagnostics.rs:LL:CC
1416

1517
error: aborting due to 2 previous errors

tests/ui/track-diagnostics/track4.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ error: missing `enum` for enum definition
33
|
44
LL | pub onion {
55
| ^^^^^^^^^
6-
-Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/item.rs:LL:CC
76
|
7+
-Ztrack-diagnostics: created at compiler/rustc_parse/src/parser/item.rs:LL:CC
88
help: add `enum` here to parse `onion` as an enum
99
|
1010
LL | pub enum onion {

tests/ui/track-diagnostics/track5.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ error: unexpected closing delimiter: `}`
33
|
44
LL | }
55
| ^ unexpected closing delimiter
6+
|
67
-Ztrack-diagnostics: created at compiler/rustc_parse/src/lexer/tokentrees.rs:LL:CC
78

89
error: aborting due to 1 previous error

tests/ui/track-diagnostics/track6.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ error[E0658]: specialization is unstable
33
|
44
LL | default fn bar() {}
55
| ^^^^^^^^^^^^^^^^^^^
6-
-Ztrack-diagnostics: created at compiler/rustc_ast_passes/src/feature_gate.rs:LL:CC
76
|
7+
-Ztrack-diagnostics: created at compiler/rustc_ast_passes/src/feature_gate.rs:LL:CC
88
= note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information
99
= help: add `#![feature(specialization)]` to the crate attributes to enable
1010
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

0 commit comments

Comments
 (0)