Skip to content

Commit c2310a0

Browse files
committed
Auto merge of rust-lang#13001 - Veykril:scoped, r=Veykril
Replace crossbeam with std's scoped threads Probably best to wait a week or two so we don't immediately give linux packagers problems again
2 parents dea1639 + f9d1b26 commit c2310a0

File tree

3 files changed

+6
-37
lines changed

3 files changed

+6
-37
lines changed

Cargo.lock

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/proc-macro-srv/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ tt = { path = "../tt", version = "0.0.0" }
2424
mbe = { path = "../mbe", version = "0.0.0" }
2525
paths = { path = "../paths", version = "0.0.0" }
2626
proc-macro-api = { path = "../proc-macro-api", version = "0.0.0" }
27-
crossbeam = "0.8.1"
2827

2928
[dev-dependencies]
3029
expect-test = "1.4.0"

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

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ use std::{
2626
ffi::OsString,
2727
fs,
2828
path::{Path, PathBuf},
29+
thread,
2930
time::SystemTime,
3031
};
3132

@@ -65,18 +66,16 @@ impl ProcMacroSrv {
6566

6667
let macro_body = task.macro_body.to_subtree();
6768
let attributes = task.attributes.map(|it| it.to_subtree());
68-
// FIXME: replace this with std's scoped threads once they stabilize
69-
// (then remove dependency on crossbeam)
70-
let result = crossbeam::scope(|s| {
71-
let res = match s
72-
.builder()
69+
let result = thread::scope(|s| {
70+
let thread = thread::Builder::new()
7371
.stack_size(EXPANDER_STACK_SIZE)
7472
.name(task.macro_name.clone())
75-
.spawn(|_| {
73+
.spawn_scoped(s, || {
7674
expander
7775
.expand(&task.macro_name, &macro_body, attributes.as_ref())
7876
.map(|it| FlatTree::new(&it))
79-
}) {
77+
});
78+
let res = match thread {
8079
Ok(handle) => handle.join(),
8180
Err(e) => std::panic::resume_unwind(Box::new(e)),
8281
};
@@ -86,10 +85,6 @@ impl ProcMacroSrv {
8685
Err(e) => std::panic::resume_unwind(e),
8786
}
8887
});
89-
let result = match result {
90-
Ok(result) => result,
91-
Err(e) => std::panic::resume_unwind(e),
92-
};
9388

9489
prev_env.rollback();
9590

0 commit comments

Comments
 (0)