@@ -24,6 +24,7 @@ use ptr::P;
2424use symbol:: Symbol ;
2525use util:: small_vector:: SmallVector ;
2626
27+ use std:: collections:: HashMap ;
2728use std:: path:: PathBuf ;
2829use std:: rc:: Rc ;
2930use std:: default:: Default ;
@@ -643,6 +644,7 @@ pub struct ExtCtxt<'a> {
643644 pub resolver : & ' a mut Resolver ,
644645 pub resolve_err_count : usize ,
645646 pub current_expansion : ExpansionData ,
647+ pub expansions : HashMap < Span , Vec < String > > ,
646648}
647649
648650impl < ' a > ExtCtxt < ' a > {
@@ -662,6 +664,7 @@ impl<'a> ExtCtxt<'a> {
662664 module : Rc :: new ( ModuleData { mod_path : Vec :: new ( ) , directory : PathBuf :: new ( ) } ) ,
663665 directory_ownership : DirectoryOwnership :: Owned ,
664666 } ,
667+ expansions : HashMap :: new ( ) ,
665668 }
666669 }
667670
@@ -765,8 +768,14 @@ impl<'a> ExtCtxt<'a> {
765768 pub fn span_bug ( & self , sp : Span , msg : & str ) -> ! {
766769 self . parse_sess . span_diagnostic . span_bug ( sp, msg) ;
767770 }
768- pub fn span_label_without_error ( & self , sp : Span , msg : & str , label : & str ) {
769- self . parse_sess . span_diagnostic . span_label_without_error ( sp, msg, label) ;
771+ pub fn trace_macros_diag ( & self ) {
772+ for ( sp, notes) in self . expansions . iter ( ) {
773+ let mut db = self . parse_sess . span_diagnostic . span_note_diag ( * sp, & "trace_macro" ) ;
774+ for note in notes {
775+ db. note ( & note) ;
776+ }
777+ db. emit ( ) ;
778+ }
770779 }
771780 pub fn bug ( & self , msg : & str ) -> ! {
772781 self . parse_sess . span_diagnostic . bug ( msg) ;
0 commit comments