@@ -28,7 +28,6 @@ use rustc_span::{FileLines, FileName, SourceFile, Span, char_width, str_width};
28
28
use termcolor:: { Buffer , BufferWriter , Color , ColorChoice , ColorSpec , StandardStream , WriteColor } ;
29
29
use tracing:: { debug, instrument, trace, warn} ;
30
30
31
- use crate :: diagnostic:: DiagLocation ;
32
31
use crate :: registry:: Registry ;
33
32
use crate :: snippet:: {
34
33
Annotation , AnnotationColumn , AnnotationType , Line , MultilineAnnotation , Style , StyledString ,
@@ -505,6 +504,10 @@ impl Emitter for HumanEmitter {
505
504
fn emit_diagnostic ( & mut self , mut diag : DiagInner , _registry : & Registry ) {
506
505
let fluent_args = to_fluent_args ( diag. args . iter ( ) ) ;
507
506
507
+ if self . track_diagnostics && diag. span . has_primary_spans ( ) && !diag. span . is_dummy ( ) {
508
+ diag. children . insert ( 0 , diag. emitted_at_sub_diag ( ) ) ;
509
+ }
510
+
508
511
let mut suggestions = diag. suggestions . unwrap_tag ( ) ;
509
512
self . primary_span_formatted ( & mut diag. span , & mut suggestions, & fluent_args) ;
510
513
@@ -523,7 +526,6 @@ impl Emitter for HumanEmitter {
523
526
& diag. span ,
524
527
& diag. children ,
525
528
& suggestions,
526
- self . track_diagnostics . then_some ( & diag. emitted_at ) ,
527
529
) ;
528
530
}
529
531
@@ -1468,7 +1470,6 @@ impl HumanEmitter {
1468
1470
level : & Level ,
1469
1471
max_line_num_len : usize ,
1470
1472
is_secondary : bool ,
1471
- emitted_at : Option < & DiagLocation > ,
1472
1473
is_cont : bool ,
1473
1474
) -> io:: Result < ( ) > {
1474
1475
let mut buffer = StyledBuffer :: new ( ) ;
@@ -1978,12 +1979,6 @@ impl HumanEmitter {
1978
1979
trace ! ( "buffer: {:#?}" , buffer. render( ) ) ;
1979
1980
}
1980
1981
1981
- if let Some ( tracked) = emitted_at {
1982
- let track = format ! ( "-Ztrack-diagnostics: created at {tracked}" ) ;
1983
- let len = buffer. num_lines ( ) ;
1984
- buffer. append ( len, & track, Style :: NoStyle ) ;
1985
- }
1986
-
1987
1982
// final step: take our styled buffer, render it, then output it
1988
1983
emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
1989
1984
@@ -2478,7 +2473,6 @@ impl HumanEmitter {
2478
2473
span : & MultiSpan ,
2479
2474
children : & [ Subdiag ] ,
2480
2475
suggestions : & [ CodeSuggestion ] ,
2481
- emitted_at : Option < & DiagLocation > ,
2482
2476
) {
2483
2477
let max_line_num_len = if self . ui_testing {
2484
2478
ANONYMIZED_LINE_NUM . len ( )
@@ -2495,7 +2489,6 @@ impl HumanEmitter {
2495
2489
level,
2496
2490
max_line_num_len,
2497
2491
false ,
2498
- emitted_at,
2499
2492
!children. is_empty ( )
2500
2493
|| suggestions. iter ( ) . any ( |s| s. style != SuggestionStyle :: CompletelyHidden ) ,
2501
2494
) {
@@ -2541,7 +2534,6 @@ impl HumanEmitter {
2541
2534
& child. level ,
2542
2535
max_line_num_len,
2543
2536
true ,
2544
- None ,
2545
2537
!should_close,
2546
2538
) {
2547
2539
panic ! ( "failed to emit error: {err}" ) ;
@@ -2561,7 +2553,6 @@ impl HumanEmitter {
2561
2553
& Level :: Help ,
2562
2554
max_line_num_len,
2563
2555
true ,
2564
- None ,
2565
2556
// FIXME: this needs to account for the suggestion type,
2566
2557
// some don't take any space.
2567
2558
i + 1 != suggestions. len ( ) ,
0 commit comments