mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Run proc macro expansion in a separate thread (for the thread-local interner)
This commit is contained in:
parent
05d8f5fee7
commit
32ee097580
3 changed files with 36 additions and 3 deletions
|
@ -63,9 +63,16 @@ impl ProcMacroSrv {
|
|||
|
||||
let macro_body = task.macro_body.to_subtree();
|
||||
let attributes = task.attributes.map(|it| it.to_subtree());
|
||||
let result = expander
|
||||
.expand(&task.macro_name, ¯o_body, attributes.as_ref())
|
||||
.map(|it| FlatTree::new(&it));
|
||||
let result = crossbeam::scope(|s| {
|
||||
s.spawn(|_| {
|
||||
expander
|
||||
.expand(&task.macro_name, ¯o_body, attributes.as_ref())
|
||||
.map(|it| FlatTree::new(&it))
|
||||
})
|
||||
.join()
|
||||
.unwrap()
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
prev_env.rollback();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue