Skip to content

Commit 2502d8f

Browse files
authored
Rollup merge of #161320 - ChrisDenton:so, r=TaKO8Ki
Only suggest `RUST_MIN_STACK` if maybe stack overflow Alternatively we could make the wording of the help message note the uncertainty.
2 parents 23bc1ae + 7b7dffb commit 2502d8f

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎compiler/rustc_driver_impl/src/signal_handler.rs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ unsafe extern "C" fn print_stack_trace(signum: libc::c_int) {
115115
written += rem.len() + 1;
116116

117117
let random_depth = || 8 * 16; // chosen by random diceroll (2d20)
118-
if (cyclic || stack.len() > random_depth()) && signum == libc::SIGSEGV {
118+
let maybe_stack_overflow = (cyclic || stack.len() > random_depth()) && signum == libc::SIGSEGV;
119+
if maybe_stack_overflow {
119120
// technically speculation, but assert it with confidence anyway.
120121
// rustc only arrived in this signal handler because bad things happened
121122
// and this message is for explaining it's not the programmer's fault
@@ -128,7 +129,7 @@ unsafe extern "C" fn print_stack_trace(signum: libc::c_int) {
128129
}
129130
raw_errln!("note: we would appreciate a report at https://github.com/rust-lang/rust");
130131
written += 1;
131-
if signum == libc::SIGSEGV {
132+
if maybe_stack_overflow {
132133
// get the current stack size WITHOUT blocking and double it
133134
let new_size = STACK_SIZE.get().copied().unwrap_or(DEFAULT_STACK_SIZE) * 2;
134135
raw_errln!(

0 commit comments

Comments
 (0)