Auto merge of #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
This commit is contained in:
commit
c2310a0af6
25
Cargo.lock
generated
25
Cargo.lock
generated
@ -247,20 +247,6 @@ dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam"
|
||||
version = "0.8.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-channel",
|
||||
"crossbeam-deque",
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-queue",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-channel"
|
||||
version = "0.5.6"
|
||||
@ -296,16 +282,6 @@ dependencies = [
|
||||
"scopeguard",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-queue"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1cd42583b04998a5363558e5f9291ee5a5ff6b49944332103f251e7479a82aa7"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.11"
|
||||
@ -1178,7 +1154,6 @@ dependencies = [
|
||||
name = "proc-macro-srv"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"crossbeam",
|
||||
"expect-test",
|
||||
"libloading",
|
||||
"mbe",
|
||||
|
@ -24,7 +24,6 @@ tt = { path = "../tt", version = "0.0.0" }
|
||||
mbe = { path = "../mbe", version = "0.0.0" }
|
||||
paths = { path = "../paths", version = "0.0.0" }
|
||||
proc-macro-api = { path = "../proc-macro-api", version = "0.0.0" }
|
||||
crossbeam = "0.8.1"
|
||||
|
||||
[dev-dependencies]
|
||||
expect-test = "1.4.0"
|
||||
|
@ -26,6 +26,7 @@
|
||||
ffi::OsString,
|
||||
fs,
|
||||
path::{Path, PathBuf},
|
||||
thread,
|
||||
time::SystemTime,
|
||||
};
|
||||
|
||||
@ -65,18 +66,16 @@ pub fn expand(&mut self, task: ExpandMacro) -> Result<FlatTree, PanicMessage> {
|
||||
|
||||
let macro_body = task.macro_body.to_subtree();
|
||||
let attributes = task.attributes.map(|it| it.to_subtree());
|
||||
// FIXME: replace this with std's scoped threads once they stabilize
|
||||
// (then remove dependency on crossbeam)
|
||||
let result = crossbeam::scope(|s| {
|
||||
let res = match s
|
||||
.builder()
|
||||
let result = thread::scope(|s| {
|
||||
let thread = thread::Builder::new()
|
||||
.stack_size(EXPANDER_STACK_SIZE)
|
||||
.name(task.macro_name.clone())
|
||||
.spawn(|_| {
|
||||
.spawn_scoped(s, || {
|
||||
expander
|
||||
.expand(&task.macro_name, ¯o_body, attributes.as_ref())
|
||||
.map(|it| FlatTree::new(&it))
|
||||
}) {
|
||||
});
|
||||
let res = match thread {
|
||||
Ok(handle) => handle.join(),
|
||||
Err(e) => std::panic::resume_unwind(Box::new(e)),
|
||||
};
|
||||
@ -86,10 +85,6 @@ pub fn expand(&mut self, task: ExpandMacro) -> Result<FlatTree, PanicMessage> {
|
||||
Err(e) => std::panic::resume_unwind(e),
|
||||
}
|
||||
});
|
||||
let result = match result {
|
||||
Ok(result) => result,
|
||||
Err(e) => std::panic::resume_unwind(e),
|
||||
};
|
||||
|
||||
prev_env.rollback();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user