@@ -1468,7 +1468,6 @@ impl HumanEmitter {
1468
1468
level : & Level ,
1469
1469
max_line_num_len : usize ,
1470
1470
is_secondary : bool ,
1471
- emitted_at : Option < & DiagLocation > ,
1472
1471
is_cont : bool ,
1473
1472
) -> io:: Result < ( ) > {
1474
1473
let mut buffer = StyledBuffer :: new ( ) ;
@@ -1960,12 +1959,6 @@ impl HumanEmitter {
1960
1959
trace ! ( "buffer: {:#?}" , buffer. render( ) ) ;
1961
1960
}
1962
1961
1963
- if let Some ( tracked) = emitted_at {
1964
- let track = format ! ( "-Ztrack-diagnostics: created at {tracked}" ) ;
1965
- let len = buffer. num_lines ( ) ;
1966
- buffer. append ( len, & track, Style :: NoStyle ) ;
1967
- }
1968
-
1969
1962
// final step: take our styled buffer, render it, then output it
1970
1963
emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
1971
1964
@@ -2477,34 +2470,46 @@ impl HumanEmitter {
2477
2470
level,
2478
2471
max_line_num_len,
2479
2472
false ,
2480
- emitted_at,
2481
2473
!children. is_empty ( )
2482
2474
|| suggestions. iter ( ) . any ( |s| s. style != SuggestionStyle :: CompletelyHidden ) ,
2483
2475
) {
2484
2476
Ok ( ( ) ) => {
2477
+ let mut buffer = StyledBuffer :: new ( ) ;
2478
+ let primary_span = span. primary_span ( ) . unwrap_or_default ( ) ;
2479
+ if let ( Some ( tracked) , false ) = ( emitted_at, primary_span. is_dummy ( ) ) {
2480
+ if !self . short_message {
2481
+ let track = format ! ( "-Ztrack-diagnostics: created at {tracked}" ) ;
2482
+ buffer. append ( 0 , & track, Style :: NoStyle ) ;
2483
+ }
2484
+ }
2485
2485
if !children. is_empty ( )
2486
2486
|| suggestions. iter ( ) . any ( |s| s. style != SuggestionStyle :: CompletelyHidden )
2487
2487
{
2488
- let mut buffer = StyledBuffer :: new ( ) ;
2488
+ let line_offest = buffer . num_lines ( ) ;
2489
2489
if !self . short_message {
2490
2490
if let Some ( child) = children. iter ( ) . next ( )
2491
2491
&& child. span . primary_spans ( ) . is_empty ( )
2492
2492
{
2493
2493
// We'll continue the vertical bar to point into the next note.
2494
- self . draw_col_separator_no_space ( & mut buffer, 0 , max_line_num_len + 1 ) ;
2494
+ self . draw_col_separator_no_space (
2495
+ & mut buffer,
2496
+ line_offest,
2497
+ max_line_num_len + 1 ,
2498
+ ) ;
2495
2499
} else {
2496
2500
// We'll close the vertical bar to visually end the code window.
2497
- self . draw_col_separator_end ( & mut buffer, 0 , max_line_num_len + 1 ) ;
2501
+ self . draw_col_separator_end (
2502
+ & mut buffer,
2503
+ line_offest,
2504
+ max_line_num_len + 1 ,
2505
+ ) ;
2498
2506
}
2499
2507
}
2500
- if let Err ( e) = emit_to_destination (
2501
- & buffer. render ( ) ,
2502
- level,
2503
- & mut self . dst ,
2504
- self . short_message ,
2505
- ) {
2506
- panic ! ( "failed to emit error: {e}" )
2507
- }
2508
+ }
2509
+ if let Err ( e) =
2510
+ emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message )
2511
+ {
2512
+ panic ! ( "failed to emit error: {e}" )
2508
2513
}
2509
2514
if !self . short_message {
2510
2515
for ( i, child) in children. iter ( ) . enumerate ( ) {
@@ -2523,7 +2528,6 @@ impl HumanEmitter {
2523
2528
& child. level ,
2524
2529
max_line_num_len,
2525
2530
true ,
2526
- None ,
2527
2531
!should_close,
2528
2532
) {
2529
2533
panic ! ( "failed to emit error: {err}" ) ;
@@ -2543,7 +2547,6 @@ impl HumanEmitter {
2543
2547
& Level :: Help ,
2544
2548
max_line_num_len,
2545
2549
true ,
2546
- None ,
2547
2550
// FIXME: this needs to account for the suggestion type,
2548
2551
// some don't take any space.
2549
2552
i + 1 != suggestions. len ( ) ,
0 commit comments