Skip to content

Commit 1204a52

Browse files
Elaborate on some documentation
1 parent 25bf99b commit 1204a52

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/cargo/core/compiler/job_queue.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,12 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
501501
// This puts back the tokens that this rustc
502502
// acquired into our primary token list.
503503
//
504-
// FIXME: this represents a rustc bug: it did not
504+
// This represents a rustc bug: it did not
505505
// 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).
507510
self.tokens.extend(rustc_tokens);
508511
}
509512
self.to_send_clients.remove(&id);
@@ -552,6 +555,11 @@ impl<'a, 'cfg> DrainState<'a, 'cfg> {
552555
// Note that this pops off potentially a completely
553556
// different token, but all tokens of the same job are
554557
// 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.
555563
let rustc_tokens = self
556564
.rustc_tokens
557565
.get_mut(&id)

0 commit comments

Comments
 (0)