diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2024-03-21 14:16:07 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2024-03-21 14:49:02 -0700 |
| commit | 542533865aa2d828665d96047ed575267eed7ac6 (patch) | |
| tree | 8a5487ee348b15557cee1eeb8c34286d62a02140 /compiler/rustc_driver_impl/src | |
| parent | 60891cab33c99c0be933ddd54008513af7e49cd9 (diff) | |
| download | rust-542533865aa2d828665d96047ed575267eed7ac6.tar.gz rust-542533865aa2d828665d96047ed575267eed7ac6.zip | |
Suggest using RUST_MIN_STACK if rustc overflowed
Diffstat (limited to 'compiler/rustc_driver_impl/src')
| -rw-r--r-- | compiler/rustc_driver_impl/src/signal_handler.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/compiler/rustc_driver_impl/src/signal_handler.rs b/compiler/rustc_driver_impl/src/signal_handler.rs index deca1082221..441219eec90 100644 --- a/compiler/rustc_driver_impl/src/signal_handler.rs +++ b/compiler/rustc_driver_impl/src/signal_handler.rs @@ -1,6 +1,7 @@ //! Signal handler for rustc //! Primarily used to extract a backtrace from stack overflow +use rustc_interface::util::{DEFAULT_STACK_SIZE, STACK_SIZE}; use std::alloc::{alloc, Layout}; use std::{fmt, mem, ptr}; @@ -100,7 +101,10 @@ extern "C" fn print_stack_trace(_: libc::c_int) { written += 1; } raw_errln!("note: we would appreciate a report at https://github.com/rust-lang/rust"); - written += 1; + // get the current stack size WITHOUT blocking and double it + let new_size = STACK_SIZE.get().copied().unwrap_or(DEFAULT_STACK_SIZE) * 2; + raw_errln!("help: you can increase rustc's stack size by setting RUST_MIN_STACK={new_size}"); + written += 2; if written > 24 { // We probably just scrolled the earlier "we got SIGSEGV" message off the terminal raw_errln!("note: backtrace dumped due to SIGSEGV! resuming signal"); |
