Skip to content

Commit b899dbc

Browse files
committed
Fix compiler panic with a large number of threads
1 parent 16422db commit b899dbc

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler/rustc_session/src/options.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,13 @@ mod parse {
663663
true
664664
}
665665
Some(i) => {
666-
*slot = i;
666+
// We want to cap the number of threads here to avoid large numbers like 999999 and compiler panics.
667+
// This solution was suggested here https://github.com/rust-lang/rust/issues/117638#issuecomment-1800925067
668+
if i <= 256 {
669+
*slot = i;
670+
} else {
671+
*slot = 256;
672+
}
667673
true
668674
}
669675
None => false,

0 commit comments

Comments
 (0)