@@ -28,7 +28,6 @@ use rustc_span::{FileLines, FileName, SourceFile, Span, char_width, str_width};
2828use termcolor:: { Buffer , BufferWriter , Color , ColorChoice , ColorSpec , StandardStream , WriteColor } ;
2929use tracing:: { debug, instrument, trace, warn} ;
3030
31- use crate :: diagnostic:: DiagLocation ;
3231use crate :: registry:: Registry ;
3332use crate :: snippet:: {
3433 Annotation , AnnotationColumn , AnnotationType , Line , MultilineAnnotation , Style , StyledString ,
@@ -505,6 +504,10 @@ impl Emitter for HumanEmitter {
505504 fn emit_diagnostic ( & mut self , mut diag : DiagInner , _registry : & Registry ) {
506505 let fluent_args = to_fluent_args ( diag. args . iter ( ) ) ;
507506
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+
508511 let mut suggestions = diag. suggestions . unwrap_tag ( ) ;
509512 self . primary_span_formatted ( & mut diag. span , & mut suggestions, & fluent_args) ;
510513
@@ -523,7 +526,6 @@ impl Emitter for HumanEmitter {
523526 & diag. span ,
524527 & diag. children ,
525528 & suggestions,
526- self . track_diagnostics . then_some ( & diag. emitted_at ) ,
527529 ) ;
528530 }
529531
@@ -1468,7 +1470,6 @@ impl HumanEmitter {
14681470 level : & Level ,
14691471 max_line_num_len : usize ,
14701472 is_secondary : bool ,
1471- emitted_at : Option < & DiagLocation > ,
14721473 is_cont : bool ,
14731474 ) -> io:: Result < ( ) > {
14741475 let mut buffer = StyledBuffer :: new ( ) ;
@@ -1978,12 +1979,6 @@ impl HumanEmitter {
19781979 trace ! ( "buffer: {:#?}" , buffer. render( ) ) ;
19791980 }
19801981
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-
19871982 // final step: take our styled buffer, render it, then output it
19881983 emit_to_destination ( & buffer. render ( ) , level, & mut self . dst , self . short_message ) ?;
19891984
@@ -2478,7 +2473,6 @@ impl HumanEmitter {
24782473 span : & MultiSpan ,
24792474 children : & [ Subdiag ] ,
24802475 suggestions : & [ CodeSuggestion ] ,
2481- emitted_at : Option < & DiagLocation > ,
24822476 ) {
24832477 let max_line_num_len = if self . ui_testing {
24842478 ANONYMIZED_LINE_NUM . len ( )
@@ -2495,7 +2489,6 @@ impl HumanEmitter {
24952489 level,
24962490 max_line_num_len,
24972491 false ,
2498- emitted_at,
24992492 !children. is_empty ( )
25002493 || suggestions. iter ( ) . any ( |s| s. style != SuggestionStyle :: CompletelyHidden ) ,
25012494 ) {
@@ -2541,7 +2534,6 @@ impl HumanEmitter {
25412534 & child. level ,
25422535 max_line_num_len,
25432536 true ,
2544- None ,
25452537 !should_close,
25462538 ) {
25472539 panic ! ( "failed to emit error: {err}" ) ;
@@ -2561,7 +2553,6 @@ impl HumanEmitter {
25612553 & Level :: Help ,
25622554 max_line_num_len,
25632555 true ,
2564- None ,
25652556 // FIXME: this needs to account for the suggestion type,
25662557 // some don't take any space.
25672558 i + 1 != suggestions. len ( ) ,
0 commit comments