Skip to content

Commit 57c20d9

Browse files
Merge pull request #1553 from rust-lang/remove-crossbeam
Log preparation errors
2 parents 77a0156 + 4735406 commit 57c20d9

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

Cargo.lock

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

collector/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ intern = { path = "../intern" }
2727
futures = "0.3.5"
2828
num_cpus = "1.13"
2929
jobserver = "0.1.21"
30-
crossbeam-utils = "0.8"
3130
snap = "1"
3231
filetime = "0.2.14"
3332
walkdir = "2"

collector/src/benchmark/mod.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,20 +248,31 @@ impl Benchmark {
248248
// to do this in Cargo today. We would also ideally build in the same
249249
// target directory, but that's also not possible, as Cargo takes a
250250
// target-directory global lock during compilation.
251-
crossbeam_utils::thread::scope::<_, anyhow::Result<()>>(|s| {
251+
std::thread::scope::<_, anyhow::Result<()>>(|s| {
252252
let server = jobserver::Client::new(num_cpus::get()).context("jobserver::new")?;
253+
let mut threads = Vec::with_capacity(profile_dirs.len());
253254
for (profile, prep_dir) in &profile_dirs {
254255
let server = server.clone();
255-
s.spawn::<_, anyhow::Result<()>>(move |_| {
256+
let thread = s.spawn::<_, anyhow::Result<()>>(move || {
256257
self.mk_cargo_process(compiler, prep_dir.path(), *profile)
257258
.jobserver(server)
258259
.run_rustc(false)?;
259260
Ok(())
260261
});
262+
threads.push(thread);
261263
}
264+
265+
// Propagate all potential errors and panics eagerly as an error to avoid panicking
266+
// the scope.
267+
for thread in threads {
268+
let result = thread
269+
.join()
270+
.map_err(|error| anyhow::anyhow!("Preparation panicked: {error:?}"))?;
271+
result?;
272+
}
273+
262274
Ok(())
263-
})
264-
.unwrap()?;
275+
})?;
265276

266277
for (profile, prep_dir) in profile_dirs {
267278
eprintln!("Running {}: {:?} + {:?}", self.name, profile, scenarios);

0 commit comments

Comments
 (0)