@@ -384,13 +384,14 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
384384 if self . cx . current_expansion . depth > self . cx . ecfg . recursion_limit {
385385 let info = self . cx . current_expansion . mark . expn_info ( ) . unwrap ( ) ;
386386 let suggested_limit = self . cx . ecfg . recursion_limit * 2 ;
387- let mut err = self . cx . struct_span_fatal ( info. call_site ,
387+ let mut err = self . cx . struct_span_err ( info. call_site ,
388388 & format ! ( "recursion limit reached while expanding the macro `{}`" ,
389389 info. callee. name( ) ) ) ;
390390 err. help ( & format ! (
391391 "consider adding a `#![recursion_limit=\" {}\" ]` attribute to your crate" ,
392392 suggested_limit) ) ;
393393 err. emit ( ) ;
394+ self . cx . trace_macros_diag ( ) ;
394395 panic ! ( FatalError ) ;
395396 }
396397
@@ -439,11 +440,13 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
439440 }
440441 ProcMacroDerive ( ..) | BuiltinDerive ( ..) => {
441442 self . cx . span_err ( attr. span , & format ! ( "`{}` is a derive mode" , attr. path) ) ;
443+ self . cx . trace_macros_diag ( ) ;
442444 kind. dummy ( attr. span )
443445 }
444446 _ => {
445447 let msg = & format ! ( "macro `{}` may not be used in attributes" , attr. path) ;
446448 self . cx . span_err ( attr. span , msg) ;
449+ self . cx . trace_macros_diag ( ) ;
447450 kind. dummy ( attr. span )
448451 }
449452 }
@@ -482,6 +485,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
482485 if let Err ( msg) = validate_and_set_expn_info ( def_span. map ( |( _, s) | s) ,
483486 false , false ) {
484487 self . cx . span_err ( path. span , & msg) ;
488+ self . cx . trace_macros_diag ( ) ;
485489 return kind. dummy ( span) ;
486490 }
487491 kind. make_from ( expand. expand ( self . cx , span, mac. node . stream ( ) ) )
@@ -497,6 +501,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
497501 allow_internal_unstable,
498502 allow_internal_unsafe) {
499503 self . cx . span_err ( path. span , & msg) ;
504+ self . cx . trace_macros_diag ( ) ;
500505 return kind. dummy ( span) ;
501506 }
502507 kind. make_from ( expander. expand ( self . cx , span, mac. node . stream ( ) ) )
@@ -506,6 +511,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
506511 if ident. name == keywords:: Invalid . name ( ) {
507512 self . cx . span_err ( path. span ,
508513 & format ! ( "macro {}! expects an ident argument" , path) ) ;
514+ self . cx . trace_macros_diag ( ) ;
509515 return kind. dummy ( span) ;
510516 } ;
511517
@@ -526,11 +532,13 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
526532 MultiDecorator ( ..) | MultiModifier ( ..) | AttrProcMacro ( ..) => {
527533 self . cx . span_err ( path. span ,
528534 & format ! ( "`{}` can only be used in attributes" , path) ) ;
535+ self . cx . trace_macros_diag ( ) ;
529536 return kind. dummy ( span) ;
530537 }
531538
532539 ProcMacroDerive ( ..) | BuiltinDerive ( ..) => {
533540 self . cx . span_err ( path. span , & format ! ( "`{}` is a derive mode" , path) ) ;
541+ self . cx . trace_macros_diag ( ) ;
534542 return kind. dummy ( span) ;
535543 }
536544
@@ -539,6 +547,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
539547 let msg =
540548 format ! ( "macro {}! expects no ident argument, given '{}'" , path, ident) ;
541549 self . cx . span_err ( path. span , & msg) ;
550+ self . cx . trace_macros_diag ( ) ;
542551 return kind. dummy ( span) ;
543552 }
544553
@@ -564,6 +573,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
564573 let msg = format!( "non-{kind} macro in {kind} position: {name}" ,
565574 name = path. segments[ 0 ] . identifier. name, kind = kind. name( ) ) ;
566575 self . cx. span_err( path. span, & msg) ;
576+ self . cx. trace_macros_diag( ) ;
567577 kind. dummy( span)
568578 } )
569579 }
@@ -617,6 +627,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
617627 _ => {
618628 let msg = & format ! ( "macro `{}` may not be used for derive attributes" , attr. path) ;
619629 self . cx . span_err ( span, msg) ;
630+ self . cx . trace_macros_diag ( ) ;
620631 kind. dummy ( span)
621632 }
622633 }
@@ -629,6 +640,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> {
629640 Ok ( expansion) => expansion,
630641 Err ( mut err) => {
631642 err. emit ( ) ;
643+ self . cx . trace_macros_diag ( ) ;
632644 return kind. dummy ( span) ;
633645 }
634646 } ;
@@ -739,6 +751,7 @@ impl<'a, 'b> InvocationCollector<'a, 'b> {
739751 if !traits. is_empty ( ) &&
740752 ( kind == ExpansionKind :: TraitItems || kind == ExpansionKind :: ImplItems ) {
741753 self . cx . span_err ( traits[ 0 ] . span , "`derive` can be only be applied to items" ) ;
754+ self . cx . trace_macros_diag ( ) ;
742755 return kind. expect_from_annotatables ( :: std:: iter:: once ( item) ) ;
743756 }
744757 self . collect ( kind, InvocationKind :: Attr { attr : attr, traits : traits, item : item } )
0 commit comments