Skip to content

Commit 39db9cd

Browse files
Use std::panic::resume_unwind
1 parent 48bcc22 commit 39db9cd

File tree

1 file changed

+17
-9
lines changed
  • crates/proc-macro-srv/src

1 file changed

+17
-9
lines changed

crates/proc-macro-srv/src/lib.rs

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,23 @@ impl ProcMacroSrv {
6464
let macro_body = task.macro_body.to_subtree();
6565
let attributes = task.attributes.map(|it| it.to_subtree());
6666
let result = crossbeam::scope(|s| {
67-
s.spawn(|_| {
68-
expander
69-
.expand(&task.macro_name, &macro_body, attributes.as_ref())
70-
.map(|it| FlatTree::new(&it))
71-
})
72-
.join()
73-
.unwrap()
74-
})
75-
.unwrap();
67+
let res = s
68+
.spawn(|_| {
69+
expander
70+
.expand(&task.macro_name, &macro_body, attributes.as_ref())
71+
.map(|it| FlatTree::new(&it))
72+
})
73+
.join();
74+
75+
match res {
76+
Ok(res) => res,
77+
Err(e) => std::panic::resume_unwind(e),
78+
}
79+
});
80+
let result = match result {
81+
Ok(result) => result,
82+
Err(e) => std::panic::resume_unwind(e),
83+
};
7684

7785
prev_env.rollback();
7886

0 commit comments

Comments
 (0)