diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2019-07-26 23:31:02 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2019-08-30 12:34:20 +0200 |
| commit | 3e2d4d28b1c1a96e7c7482ae3e82fbf81505e8a7 (patch) | |
| tree | c7057b839a95c0228a25b84926dc5084364b603b | |
| parent | 035333993d09df69dd82723881b05cda5f0cde07 (diff) | |
| download | rust-3e2d4d28b1c1a96e7c7482ae3e82fbf81505e8a7.tar.gz rust-3e2d4d28b1c1a96e7c7482ae3e82fbf81505e8a7.zip | |
Document the ICE hook and make it more flexible
| -rw-r--r-- | src/librustc_driver/lib.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 0fd00af0bd0..97542a0e84e 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -1161,12 +1161,18 @@ pub fn catch_fatal_errors<F: FnOnce() -> R, R>(f: F) -> Result<R, ErrorReported> lazy_static! { static ref DEFAULT_HOOK: Box<dyn Fn(&panic::PanicInfo<'_>) + Sync + Send + 'static> = { let hook = panic::take_hook(); - panic::set_hook(Box::new(report_ice)); + panic::set_hook(Box::new(|info| report_ice(info, BUG_REPORT_URL))); hook }; } -pub fn report_ice(info: &panic::PanicInfo<'_>) { +/// Prints the ICE message, including backtrace and query stack. +/// +/// The message will point the user at `bug_report_url` to report the ICE. +/// +/// When `install_ice_hook` is called, this function will be called as the panic +/// hook. +pub fn report_ice(info: &panic::PanicInfo<'_>, bug_report_url: &str) { // Invoke the default handler, which prints the actual panic message and optionally a backtrace (*DEFAULT_HOOK)(info); @@ -1192,7 +1198,7 @@ pub fn report_ice(info: &panic::PanicInfo<'_>) { let mut xs: Vec<Cow<'static, str>> = vec