Skip to content

Commit

Permalink
Rename PanicInfo to PanicHookInfo (#6865)
Browse files Browse the repository at this point in the history
Starting with Rust 1.82 `PanicInfo` is deprecated and will throw
warnings when used. The new type is available since Rust 1.81 and should
be available on our CI.

---------

Co-authored-by: command-bot <>
  • Loading branch information
athei authored Dec 13, 2024
1 parent 5153e2b commit 9ce80f6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions prdoc/pr_6865.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
title: Rename PanicInfo to PanicHookInfo
doc:
- audience: Node Dev
description: Starting with Rust 1.82 `PanicInfo` is deprecated and will throw warnings
when used. The new type is available since Rust 1.81 and should be available on
our CI.
crates:
- name: sp-panic-handler
bump: patch
4 changes: 2 additions & 2 deletions substrate/primitives/panic-handler/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use std::{
cell::Cell,
io::{self, Write},
marker::PhantomData,
panic::{self, PanicInfo},
panic::{self, PanicHookInfo},
sync::LazyLock,
thread,
};
Expand Down Expand Up @@ -149,7 +149,7 @@ fn strip_control_codes(input: &str) -> std::borrow::Cow<str> {
}

/// Function being called when a panic happens.
fn panic_hook(info: &PanicInfo, report_url: &str, version: &str) {
fn panic_hook(info: &PanicHookInfo, report_url: &str, version: &str) {
let location = info.location();
let file = location.as_ref().map(|l| l.file()).unwrap_or("<unknown>");
let line = location.as_ref().map(|l| l.line()).unwrap_or(0);
Expand Down

0 comments on commit 9ce80f6

Please sign in to comment.