From 9ce80f687b207072099aa2a1a11927ef12be34f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20Thei=C3=9Fen?= <alex.theissen@me.com>
Date: Fri, 13 Dec 2024 10:01:09 +0100
Subject: [PATCH] Rename PanicInfo to PanicHookInfo (#6865)

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 <>
---
 prdoc/pr_6865.prdoc                           | 9 +++++++++
 substrate/primitives/panic-handler/src/lib.rs | 4 ++--
 2 files changed, 11 insertions(+), 2 deletions(-)
 create mode 100644 prdoc/pr_6865.prdoc

diff --git a/prdoc/pr_6865.prdoc b/prdoc/pr_6865.prdoc
new file mode 100644
index 00000000000..c0581f2af24
--- /dev/null
+++ b/prdoc/pr_6865.prdoc
@@ -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
diff --git a/substrate/primitives/panic-handler/src/lib.rs b/substrate/primitives/panic-handler/src/lib.rs
index c4a7eb8dc67..81ccaaee828 100644
--- a/substrate/primitives/panic-handler/src/lib.rs
+++ b/substrate/primitives/panic-handler/src/lib.rs
@@ -30,7 +30,7 @@ use std::{
 	cell::Cell,
 	io::{self, Write},
 	marker::PhantomData,
-	panic::{self, PanicInfo},
+	panic::{self, PanicHookInfo},
 	sync::LazyLock,
 	thread,
 };
@@ -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);
-- 
GitLab