rust-analyzer/crates
bors[bot] e1ea2500fc Merge #1238
1238: Macro queries r=edwin0cheng a=matklad

In https://github.com/rust-analyzer/rust-analyzer/pull/1231, I've added aggressive clean up of `ast_id_to_node` query. 

The result of this query is a `SyntaxTree`, and we don't want to retain syntax trees in memory unless absolutely necessary.

Moreover, `SyntaxTree` has identity equality semantics, meaning that we'll get a diffferent syntax tree for a file after every reparse. That means that `ast_id_to_node` query should not genereally be used in HIR, unless it is behind some kind of salsa firewall, like the `raw` module of name resoulution.

However, that PR resulted in the abysmal performance: turns out we were using  ast_id_to_node quite heavily in hir when expanding macros! 

So this PR  installs the more incremental-friendly query structure:

* converting source to token tree is now a query; changing source without affecting token-trees will now preserve macro expansions
* expand macro (tt -> tt) is now a query as well, so we cache macro expansions *before* parsing them into item lists or expressions, which is nice: we can cache expansion without knowing the calling context!

r? @edwin0cheng 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-05-04 15:54:04 +00:00
..
gen_lsp_server switch to official extend selection API 2019-04-21 12:13:48 +03:00
ra_arena Add is_empty to Arena 2019-04-26 11:42:10 -04:00
ra_assists add complex match case and documentation 2019-05-02 01:41:02 +09:00
ra_batch migrate to salsas interning 2019-04-09 22:51:22 +03:00
ra_cli Merge #1068 2019-04-03 09:09:11 +00:00
ra_db drop old interning infra 2019-04-09 22:52:06 +03:00
ra_fmt replace usages of algo::generate with iter::successors from std 2019-04-13 16:43:49 +02:00
ra_hir make macro expansion into a proper query 2019-05-04 18:01:43 +03:00
ra_ide_api revert eagarly clean astd maps 2019-05-04 15:29:35 +03:00
ra_lsp_server Basic resolution for ADT 2019-04-23 14:32:47 -04:00
ra_mbe Add test 2019-05-04 22:32:48 +08:00
ra_parser Skip Dollars when bump raw token 2019-05-01 22:39:47 +08:00
ra_prof Simplify 2019-04-26 11:42:56 -04:00
ra_project_model Sends cwd info for runnables and code lenses 2019-04-14 10:04:38 +02:00
ra_syntax Revert "eagarly clean astd maps" 2019-05-04 16:04:34 +03:00
ra_text_edit Disable fork feature for proptest 2019-03-23 08:57:07 +01:00
ra_tt Use map, sum in Subtree::coount instead of fold 2019-04-22 17:37:27 +08:00
test_utils fix error on wrong path 2019-03-17 12:53:22 +03:00
thread_worker automatically wait for worker threads 2019-02-14 21:11:07 +03:00
tools Use EXE extension for pre-commit hook on Window 2019-03-27 07:52:59 +01:00