File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,20 @@ pub use crate::panicking::{set_hook, take_hook};
23
23
#[ stable( feature = "panic_hooks" , since = "1.10.0" ) ]
24
24
pub use core:: panic:: { Location , PanicInfo } ;
25
25
26
+ /// Panic the current thread, with the given payload as the panic message.
27
+ ///
28
+ /// This supports an arbitrary panic payload, instead of just (formatted) strings.
29
+ ///
30
+ /// The message is attached as a `Box<'static + Any + Send>`, which can be
31
+ /// accessed using [`PanicInfo::payload`].
32
+ ///
33
+ /// See the [`panic!`] macro for more information about panicking.
34
+ #[ unstable( feature = "panic_box" , issue = "none" ) ]
35
+ #[ inline]
36
+ pub fn panic_box < M : Any + Send > ( msg : M ) -> ! {
37
+ crate :: panicking:: begin_panic ( msg) ;
38
+ }
39
+
26
40
/// A marker trait which represents "panic safe" types in Rust.
27
41
///
28
42
/// This trait is implemented by default for many types and behaves similarly in
You can’t perform that action at this time.
0 commit comments