@@ -131,6 +131,8 @@ cfg_if! {
131
131
#[ macro_export]
132
132
macro_rules! parallel {
133
133
( $( $blocks: tt) , * ) => {
134
+ // We catch panics here ensuring that all the blocks execute.
135
+ // This makes behavior consistent with the parallel compiler.
134
136
let mut panic = None ;
135
137
$(
136
138
if let Err ( p) = :: std:: panic:: catch_unwind(
@@ -158,6 +160,8 @@ cfg_if! {
158
160
for_each:
159
161
impl Fn ( <<T as IntoIterator >:: IntoIter as Iterator >:: Item ) + Sync + Send
160
162
) {
163
+ // We catch panics here ensuring that all the loop iterations execute.
164
+ // This makes behavior consistent with the parallel compiler.
161
165
let mut panic = None ;
162
166
t. into_iter( ) . for_each( |i| {
163
167
if let Err ( p) = catch_unwind( AssertUnwindSafe ( || for_each( i) ) ) {
@@ -309,6 +313,8 @@ cfg_if! {
309
313
use std:: thread;
310
314
pub use rayon:: { join, scope} ;
311
315
316
+ /// Runs a list of blocks in parallel. The first block is executed immediately on
317
+ /// the current thread. Use that for the longest running block.
312
318
#[ macro_export]
313
319
macro_rules! parallel {
314
320
( impl $fblock: tt [ $( $c: tt, ) * ] [ $block: tt $( , $rest: tt) * ] ) => {
@@ -323,7 +329,7 @@ cfg_if! {
323
329
} )
324
330
} ;
325
331
( $fblock: tt, $( $blocks: tt) , * ) => {
326
- // Reverse the order of the blocks since Rayon executes them in reverse order
332
+ // Reverse the order of the later blocks since Rayon executes them in reverse order
327
333
// when using a single thread. This ensures the execution order matches that
328
334
// of a single threaded rustc
329
335
parallel!( impl $fblock [ ] [ $( $blocks) , * ] ) ;
0 commit comments