@@ -9,6 +9,7 @@ use rustc_data_structures::sync::Lrc;
99use rustc_errors:: ErrorGuaranteed ;
1010use rustc_parse:: nt_to_tokenstream;
1111use rustc_parse:: parser:: ForceCollect ;
12+ use rustc_span:: profiling:: SpannedEventArgRecorder ;
1213use rustc_span:: { Span , DUMMY_SP } ;
1314
1415const EXEC_STRATEGY : pm:: bridge:: server:: SameThread = pm:: bridge:: server:: SameThread ;
@@ -25,7 +26,10 @@ impl base::ProcMacro for BangProcMacro {
2526 input : TokenStream ,
2627 ) -> Result < TokenStream , ErrorGuaranteed > {
2728 let _timer =
28- ecx. sess . prof . generic_activity_with_arg ( "expand_proc_macro" , ecx. expansion_descr ( ) ) ;
29+ ecx. sess . prof . generic_activity_with_arg_recorder ( "expand_proc_macro" , |recorder| {
30+ recorder. record_arg_with_span ( ecx. expansion_descr ( ) , span) ;
31+ } ) ;
32+
2933 let proc_macro_backtrace = ecx. ecfg . proc_macro_backtrace ;
3034 let server = proc_macro_server:: Rustc :: new ( ecx) ;
3135 self . client . run ( & EXEC_STRATEGY , server, input, proc_macro_backtrace) . map_err ( |e| {
@@ -51,7 +55,10 @@ impl base::AttrProcMacro for AttrProcMacro {
5155 annotated : TokenStream ,
5256 ) -> Result < TokenStream , ErrorGuaranteed > {
5357 let _timer =
54- ecx. sess . prof . generic_activity_with_arg ( "expand_proc_macro" , ecx. expansion_descr ( ) ) ;
58+ ecx. sess . prof . generic_activity_with_arg_recorder ( "expand_proc_macro" , |recorder| {
59+ recorder. record_arg_with_span ( ecx. expansion_descr ( ) , span) ;
60+ } ) ;
61+
5562 let proc_macro_backtrace = ecx. ecfg . proc_macro_backtrace ;
5663 let server = proc_macro_server:: Rustc :: new ( ecx) ;
5764 self . client
@@ -103,7 +110,9 @@ impl MultiItemModifier for ProcMacroDerive {
103110
104111 let stream = {
105112 let _timer =
106- ecx. sess . prof . generic_activity_with_arg ( "expand_proc_macro" , ecx. expansion_descr ( ) ) ;
113+ ecx. sess . prof . generic_activity_with_arg_recorder ( "expand_proc_macro" , |recorder| {
114+ recorder. record_arg_with_span ( ecx. expansion_descr ( ) , span) ;
115+ } ) ;
107116 let proc_macro_backtrace = ecx. ecfg . proc_macro_backtrace ;
108117 let server = proc_macro_server:: Rustc :: new ( ecx) ;
109118 match self . client . run ( & EXEC_STRATEGY , server, input, proc_macro_backtrace) {
0 commit comments