@@ -414,22 +414,24 @@ pub trait Emitter {
414414 }
415415
416416 // This does a small "fix" for multispans by looking to see if it can find any that
417- // point directly at <* macros> . Since these are often difficult to read, this
418- // will change the span to point at the use site.
417+ // point directly at external macros. Since these are often difficult to read,
418+ // this will change the span to point at the use site.
419419 fn fix_multispans_in_extern_macros (
420420 & self ,
421421 source_map : & Option < Lrc < SourceMap > > ,
422422 span : & mut MultiSpan ,
423423 children : & mut Vec < SubDiagnostic > ,
424424 ) {
425- for span in iter:: once ( span) . chain ( children. iter_mut ( ) . map ( |child| & mut child. span ) ) {
425+ debug ! ( "fix_multispans_in_extern_macros: before: span={:?} children={:?}" , span, children) ;
426+ for span in iter:: once ( & mut * span) . chain ( children. iter_mut ( ) . map ( |child| & mut child. span ) ) {
426427 self . fix_multispan_in_extern_macros ( source_map, span) ;
427428 }
429+ debug ! ( "fix_multispans_in_extern_macros: after: span={:?} children={:?}" , span, children) ;
428430 }
429431
430- // This "fixes" MultiSpans that contain Spans that are pointing to locations inside of
431- // <*macros>. Since these locations are often difficult to read, we move these Spans from
432- // <* macros> to their corresponding use site.
432+ // This "fixes" MultiSpans that contain `Span`s pointing to locations inside of external macros.
433+ // Since these locations are often difficult to read,
434+ // we move these spans from the external macros to their corresponding use site.
433435 fn fix_multispan_in_extern_macros (
434436 & self ,
435437 source_map : & Option < Lrc < SourceMap > > ,
@@ -440,14 +442,14 @@ pub trait Emitter {
440442 None => return ,
441443 } ;
442444
443- // First, find all the spans in <* macros> and point instead at their use site
445+ // First, find all the spans in external macros and point instead at their use site.
444446 let replacements: Vec < ( Span , Span ) > = span
445447 . primary_spans ( )
446448 . iter ( )
447449 . copied ( )
448450 . chain ( span. span_labels ( ) . iter ( ) . map ( |sp_label| sp_label. span ) )
449451 . filter_map ( |sp| {
450- if !sp. is_dummy ( ) && sm. span_to_filename ( sp) . is_macros ( ) {
452+ if !sp. is_dummy ( ) && sm. is_imported ( sp) {
451453 let maybe_callsite = sp. source_callsite ( ) ;
452454 if sp != maybe_callsite {
453455 return Some ( ( sp, maybe_callsite) ) ;
@@ -457,7 +459,7 @@ pub trait Emitter {
457459 } )
458460 . collect ( ) ;
459461
460- // After we have them, make sure we replace these 'bad' def sites with their use sites
462+ // After we have them, make sure we replace these 'bad' def sites with their use sites.
461463 for ( from, to) in replacements {
462464 span. replace ( from, to) ;
463465 }
@@ -472,6 +474,7 @@ impl Emitter for EmitterWriter {
472474 fn emit_diagnostic ( & mut self , diag : & Diagnostic ) {
473475 let mut children = diag. children . clone ( ) ;
474476 let ( mut primary_span, suggestions) = self . primary_span_formatted ( & diag) ;
477+ debug ! ( "emit_diagnostic: suggestions={:?}" , suggestions) ;
475478
476479 self . fix_multispans_in_extern_macros_and_render_macro_backtrace (
477480 & self . sm ,
@@ -1533,6 +1536,7 @@ impl EmitterWriter {
15331536
15341537 // Render the replacements for each suggestion
15351538 let suggestions = suggestion. splice_lines ( & * * sm) ;
1539+ debug ! ( "emit_suggestion_default: suggestions={:?}" , suggestions) ;
15361540
15371541 if suggestions. is_empty ( ) {
15381542 // Suggestions coming from macros can have malformed spans. This is a heavy handed
0 commit comments