@@ -501,9 +501,12 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
501
501
// This puts back the tokens that this rustc
502
502
// acquired into our primary token list.
503
503
//
504
- // FIXME: this represents a rustc bug: it did not
504
+ // This represents a rustc bug: it did not
505
505
// release all of its thread tokens but finished
506
- // completely.
506
+ // completely. But we want to make Cargo resilient
507
+ // to such rustc bugs, as they're generally not
508
+ // fatal in nature (i.e., Cargo can make progress
509
+ // still, and the build might not even fail).
507
510
self . tokens . extend ( rustc_tokens) ;
508
511
}
509
512
self . to_send_clients . remove ( & id) ;
@@ -552,6 +555,11 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
552
555
// Note that this pops off potentially a completely
553
556
// different token, but all tokens of the same job are
554
557
// conceptually the same so that's fine.
558
+ //
559
+ // self.tokens is a "pool" -- the order doesn't matter -- and
560
+ // this transfers ownership of the token into that pool. If we
561
+ // end up using it on the next go around, then this token will
562
+ // be truncated, same as tokens obtained through Message::Token.
555
563
let rustc_tokens = self
556
564
. rustc_tokens
557
565
. get_mut ( & id)
0 commit comments