@@ -24,6 +24,7 @@ use ptr::P;
24
24
use symbol:: Symbol ;
25
25
use util:: small_vector:: SmallVector ;
26
26
27
+ use std:: collections:: HashMap ;
27
28
use std:: path:: PathBuf ;
28
29
use std:: rc:: Rc ;
29
30
use std:: default:: Default ;
@@ -643,6 +644,7 @@ pub struct ExtCtxt<'a> {
643
644
pub resolver : & ' a mut Resolver ,
644
645
pub resolve_err_count : usize ,
645
646
pub current_expansion : ExpansionData ,
647
+ pub expansions : HashMap < Span , Vec < String > > ,
646
648
}
647
649
648
650
impl < ' a > ExtCtxt < ' a > {
@@ -662,6 +664,7 @@ impl<'a> ExtCtxt<'a> {
662
664
module : Rc :: new ( ModuleData { mod_path : Vec :: new ( ) , directory : PathBuf :: new ( ) } ) ,
663
665
directory_ownership : DirectoryOwnership :: Owned ,
664
666
} ,
667
+ expansions : HashMap :: new ( ) ,
665
668
}
666
669
}
667
670
@@ -765,8 +768,14 @@ impl<'a> ExtCtxt<'a> {
765
768
pub fn span_bug ( & self , sp : Span , msg : & str ) -> ! {
766
769
self . parse_sess . span_diagnostic . span_bug ( sp, msg) ;
767
770
}
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
+ }
770
779
}
771
780
pub fn bug ( & self , msg : & str ) -> ! {
772
781
self . parse_sess . span_diagnostic . bug ( msg) ;
0 commit comments