@@ -1375,29 +1375,32 @@ impl Build {
1375
1375
1376
1376
cell_update ( & pendings, |mut pendings| {
1377
1377
// Try waiting on them.
1378
- retain_unordered_mut ( & mut pendings, |( cmd, program, child, _token) | {
1379
- match try_wait_on_child ( cmd, program, & mut child. 0 , & mut stdout) {
1380
- Ok ( Some ( ( ) ) ) => {
1381
- // Task done, remove the entry
1382
- has_made_progress. set ( true ) ;
1383
- false
1384
- }
1385
- Ok ( None ) => true , // Task still not finished, keep the entry
1386
- Err ( err) => {
1387
- // Task fail, remove the entry.
1388
- // Since we can only return one error, log the error to make
1389
- // sure users always see all the compilation failures.
1390
- has_made_progress. set ( true ) ;
1391
-
1392
- if self . cargo_output . warnings {
1393
- let _ = writeln ! ( stdout, "cargo:warning={}" , err) ;
1378
+ parallel:: retain_unordered_mut (
1379
+ & mut pendings,
1380
+ |( cmd, program, child, _token) | {
1381
+ match try_wait_on_child ( cmd, program, & mut child. 0 , & mut stdout) {
1382
+ Ok ( Some ( ( ) ) ) => {
1383
+ // Task done, remove the entry
1384
+ has_made_progress. set ( true ) ;
1385
+ false
1386
+ }
1387
+ Ok ( None ) => true , // Task still not finished, keep the entry
1388
+ Err ( err) => {
1389
+ // Task fail, remove the entry.
1390
+ // Since we can only return one error, log the error to make
1391
+ // sure users always see all the compilation failures.
1392
+ has_made_progress. set ( true ) ;
1393
+
1394
+ if self . cargo_output . warnings {
1395
+ let _ = writeln ! ( stdout, "cargo:warning={}" , err) ;
1396
+ }
1397
+ error = Some ( err) ;
1398
+
1399
+ false
1394
1400
}
1395
- error = Some ( err) ;
1396
-
1397
- false
1398
1401
}
1399
- }
1400
- } ) ;
1402
+ } ,
1403
+ ) ;
1401
1404
pendings_is_empty = pendings. is_empty ( ) ;
1402
1405
pendings
1403
1406
} ) ;
@@ -4344,21 +4347,3 @@ impl Drop for PrintThread {
4344
4347
self . handle . take ( ) . unwrap ( ) . join ( ) . unwrap ( ) ;
4345
4348
}
4346
4349
}
4347
-
4348
- /// Remove all element in `vec` which `f(element)` returns `false`.
4349
- ///
4350
- /// TODO: Remove this once the MSRV is bumped to v1.61
4351
- #[ cfg( feature = "parallel" ) ]
4352
- fn retain_unordered_mut < T , F > ( vec : & mut Vec < T > , mut f : F )
4353
- where
4354
- F : FnMut ( & mut T ) -> bool ,
4355
- {
4356
- let mut i = 0 ;
4357
- while i < vec. len ( ) {
4358
- if f ( & mut vec[ i] ) {
4359
- i += 1 ;
4360
- } else {
4361
- vec. swap_remove ( i) ;
4362
- }
4363
- }
4364
- }
0 commit comments