Skip to content

Commit ef30dab

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

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compiler/rustc_session/src/options.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,9 @@ 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+
*slot = i.min(256);
667669
true
668670
}
669671
None => false,

0 commit comments

Comments
 (0)