mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +00:00
Merge #8776
8776: fix: fix unnecessary recomputations due to macros r=jonas-schievink a=jonas-schievink This computes a macro's fragment kind eagerly (when the calling file is still available in parsed form) and stores it in the `MacroCallLoc`. This means that during expansion we no longer have to reparse the file containing the macro call, avoiding the unnecessary salsa dependencies (https://github.com/rust-analyzer/rust-analyzer/pull/8746#issuecomment-834776349). Marking as draft until I manage to find a test for this problem, since for some reason `typing_inside_a_function_should_not_invalidate_expansions` does not catch this (which might indicate that I misunderstand the problem). I've manually confirmed that this fixes the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/8746#issuecomment-834776349: ``` 7ms - parse_query @ FileId(179) 12ms - SourceBinder::to_module_def 12ms - crate_def_map:wait 5ms - item_tree_query (1 calls) 7ms - ??? ``` Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
This commit is contained in:
commit
0900beeaa2
10 changed files with 119 additions and 74 deletions
|
@ -578,6 +578,7 @@ mod tests {
|
|||
krate,
|
||||
kind: MacroCallKind::FnLike {
|
||||
ast_id: AstId::new(file_id.into(), ast_id_map.ast_id(¯o_call)),
|
||||
fragment: FragmentKind::Expr,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue