1
Fork 0

track proc-macro expansions in the self-profiler

Use the proc-macro descr to track their individual expansions with
self-profiling events. This will help diagnose performance issues
with slow proc-macros.
This commit is contained in:
Rémy Rakic 2022-03-30 15:14:25 +02:00
parent f132bcf3bd
commit 9ac8d2fe4e
2 changed files with 24 additions and 10 deletions

View file

@ -1047,6 +1047,12 @@ impl<'a> ExtCtxt<'a> {
self.current_expansion.id.expn_data().call_site
}
/// Returns the current expansion kind's description.
pub(crate) fn expansion_descr(&self) -> String {
let expn_data = self.current_expansion.id.expn_data();
expn_data.kind.descr()
}
/// Equivalent of `Span::def_site` from the proc macro API,
/// except that the location is taken from the span passed as an argument.
pub fn with_def_site_ctxt(&self, span: Span) -> Span {