@@ -55,11 +55,11 @@ use std::fmt::Write as _;
55
55
use std:: io;
56
56
use std:: marker;
57
57
use std:: sync:: Arc ;
58
+ use std:: thread:: { self , Scope } ;
58
59
use std:: time:: Duration ;
59
60
60
61
use anyhow:: { format_err, Context as _} ;
61
62
use cargo_util:: ProcessBuilder ;
62
- use crossbeam_utils:: thread:: Scope ;
63
63
use jobserver:: { Acquired , Client , HelperThread } ;
64
64
use log:: { debug, trace} ;
65
65
use semver:: Version ;
@@ -556,22 +556,21 @@ impl<'cfg> JobQueue<'cfg> {
556
556
. take ( )
557
557
. map ( move |srv| srv. start ( move |msg| messages. push ( Message :: FixDiagnostic ( msg) ) ) ) ;
558
558
559
- crossbeam_utils :: thread:: scope ( move |scope| {
560
- match state. drain_the_queue ( cx, plan, scope, & helper) {
559
+ thread:: scope (
560
+ move |scope| match state. drain_the_queue ( cx, plan, scope, & helper) {
561
561
Some ( err) => Err ( err) ,
562
562
None => Ok ( ( ) ) ,
563
- }
564
- } )
565
- . expect ( "child threads shouldn't panic" )
563
+ } ,
564
+ )
566
565
}
567
566
}
568
567
569
568
impl < ' cfg > DrainState < ' cfg > {
570
- fn spawn_work_if_possible (
569
+ fn spawn_work_if_possible < ' s > (
571
570
& mut self ,
572
571
cx : & mut Context < ' _ , ' _ > ,
573
572
jobserver_helper : & HelperThread ,
574
- scope : & Scope < ' _ > ,
573
+ scope : & ' s Scope < ' s , ' _ > ,
575
574
) -> CargoResult < ( ) > {
576
575
// Dequeue as much work as we can, learning about everything
577
576
// possible that can run. Note that this is also the point where we
@@ -807,11 +806,11 @@ impl<'cfg> DrainState<'cfg> {
807
806
///
808
807
/// This returns an Option to prevent the use of `?` on `Result` types
809
808
/// because it is important for the loop to carefully handle errors.
810
- fn drain_the_queue (
809
+ fn drain_the_queue < ' s > (
811
810
mut self ,
812
811
cx : & mut Context < ' _ , ' _ > ,
813
812
plan : & mut BuildPlan ,
814
- scope : & Scope < ' _ > ,
813
+ scope : & ' s Scope < ' s , ' _ > ,
815
814
jobserver_helper : & HelperThread ,
816
815
) -> Option < anyhow:: Error > {
817
816
trace ! ( "queue: {:#?}" , self . queue) ;
@@ -997,7 +996,7 @@ impl<'cfg> DrainState<'cfg> {
997
996
///
998
997
/// Fresh jobs block until finished (which should be very fast!), Dirty
999
998
/// jobs will spawn a thread in the background and return immediately.
1000
- fn run ( & mut self , unit : & Unit , job : Job , cx : & Context < ' _ , ' _ > , scope : & Scope < ' _ > ) {
999
+ fn run < ' s > ( & mut self , unit : & Unit , job : Job , cx : & Context < ' _ , ' _ > , scope : & ' s Scope < ' s , ' _ > ) {
1001
1000
let id = JobId ( self . next_id ) ;
1002
1001
self . next_id = self . next_id . checked_add ( 1 ) . unwrap ( ) ;
1003
1002
@@ -1072,7 +1071,7 @@ impl<'cfg> DrainState<'cfg> {
1072
1071
}
1073
1072
Freshness :: Dirty => {
1074
1073
self . timings . add_dirty ( ) ;
1075
- scope. spawn ( move |_ | {
1074
+ scope. spawn ( move || {
1076
1075
doit ( JobState {
1077
1076
id,
1078
1077
messages : messages. clone ( ) ,
0 commit comments