mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-14 14:13:58 +00:00
Merge #6652
6652: Add/Fix macro expansion profiling r=jonas-schievink a=jonas-schievink
bors r+ 🤖
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
b6dd2c6cbd
1 changed files with 4 additions and 2 deletions
|
@ -189,6 +189,7 @@ fn macro_expand_with_arg(
|
||||||
id: MacroCallId,
|
id: MacroCallId,
|
||||||
arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>,
|
arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>,
|
||||||
) -> ExpandResult<Option<Arc<tt::Subtree>>> {
|
) -> ExpandResult<Option<Arc<tt::Subtree>>> {
|
||||||
|
let _p = profile::span("macro_expand");
|
||||||
let lazy_id = match id {
|
let lazy_id = match id {
|
||||||
MacroCallId::LazyMacro(id) => id,
|
MacroCallId::LazyMacro(id) => id,
|
||||||
MacroCallId::EagerMacro(id) => {
|
MacroCallId::EagerMacro(id) => {
|
||||||
|
@ -276,14 +277,15 @@ fn parse_macro_with_arg(
|
||||||
macro_file: MacroFile,
|
macro_file: MacroFile,
|
||||||
arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>,
|
arg: Option<Arc<(tt::Subtree, mbe::TokenMap)>>,
|
||||||
) -> ExpandResult<Option<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)>> {
|
) -> ExpandResult<Option<(Parse<SyntaxNode>, Arc<mbe::TokenMap>)>> {
|
||||||
let _p = profile::span("parse_macro_query");
|
|
||||||
|
|
||||||
let macro_call_id = macro_file.macro_call_id;
|
let macro_call_id = macro_file.macro_call_id;
|
||||||
let result = if let Some(arg) = arg {
|
let result = if let Some(arg) = arg {
|
||||||
macro_expand_with_arg(db, macro_call_id, Some(arg))
|
macro_expand_with_arg(db, macro_call_id, Some(arg))
|
||||||
} else {
|
} else {
|
||||||
db.macro_expand(macro_call_id)
|
db.macro_expand(macro_call_id)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let _p = profile::span("parse_macro_expansion");
|
||||||
|
|
||||||
if let Some(err) = &result.err {
|
if let Some(err) = &result.err {
|
||||||
// Note:
|
// Note:
|
||||||
// The final goal we would like to make all parse_macro success,
|
// The final goal we would like to make all parse_macro success,
|
||||||
|
|
Loading…
Reference in a new issue