Skip to content

Commit e2ec0eb

Browse files
committed
Handle panics with join
1 parent 93f7b24 commit e2ec0eb

File tree

1 file changed

+7
-3
lines changed
  • src/librustc_data_structures

1 file changed

+7
-3
lines changed

src/librustc_data_structures/sync.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ cfg_if! {
175175
where A: FnOnce() -> RA,
176176
B: FnOnce() -> RB
177177
{
178-
(oper_a(), oper_b())
178+
let panic = Lock::new(None);
179+
let a = catch(&panic, oper_a);
180+
let b = catch(&panic, oper_b);
181+
resume(panic);
182+
(a.unwrap(), b.unwrap())
179183
}
180184

181185
pub struct SerialScope;
@@ -204,8 +208,8 @@ cfg_if! {
204208
$crate::sync::catch(&panic, || $blocks);
205209
)*
206210
$crate::sync::resume(panic);
211+
}
207212
}
208-
}
209213

210214
use std::iter::{Iterator, IntoIterator, FromIterator};
211215

@@ -220,7 +224,7 @@ cfg_if! {
220224
catch(&panic, || for_each(i));
221225
});
222226
resume(panic);
223-
}
227+
}
224228

225229
pub fn par_map<T: IntoIterator, R, C: FromIterator<R>>(
226230
t: T,

0 commit comments

Comments
 (0)