about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2019-11-26 08:18:57 +0100
committerRalf Jung <post@ralfj.de>2019-11-26 08:21:51 +0100
commit3a8e1b63cfc472a3c4884f6a31ab2236d7dd2fb7 (patch)
treebaab769f1f8d64f2c6f5bce0c21808040834a281
parent3c485795517d1f5a6ebfff6368dfae7a7cd85b85 (diff)
downloadrust-3a8e1b63cfc472a3c4884f6a31ab2236d7dd2fb7.tar.gz
rust-3a8e1b63cfc472a3c4884f6a31ab2236d7dd2fb7.zip
panic_handler -> begin_panic_handler (and more comments)
-rw-r--r--src/libstd/panicking.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs
index cb035f48d90..31dcbc6a7cb 100644
--- a/src/libstd/panicking.rs
+++ b/src/libstd/panicking.rs
@@ -316,16 +316,17 @@ pub fn begin_panic_fmt(msg: &fmt::Arguments<'_>,
         unsafe { intrinsics::abort() }
     }
 
+    // Just package everything into a `PanicInfo` and continue like libcore panics.
     let (file, line, col) = *file_line_col;
     let location = Location::internal_constructor(file, line, col);
     let info = PanicInfo::internal_constructor(Some(msg), &location);
-    panic_handler(&info)
+    begin_panic_handler(&info)
 }
 
-/// Entry point of panic from the libcore crate (`panic_impl` lang item).
+/// Entry point of panics from the libcore crate (`panic_impl` lang item).
 #[cfg_attr(not(test), panic_handler)]
 #[unwind(allowed)]
-fn panic_handler(info: &PanicInfo<'_>) -> ! {
+pub fn begin_panic_handler(info: &PanicInfo<'_>) -> ! {
     struct PanicPayload<'a> {
         inner: &'a fmt::Arguments<'a>,
         string: Option<String>,
@@ -374,7 +375,9 @@ fn panic_handler(info: &PanicInfo<'_>) -> ! {
         &file_line_col);
 }
 
-/// This is the entry point of panicking for panic!() and assert!().
+/// This is the entry point of panicking for the non-format-string variants of
+/// panic!() and assert!(). In particular, this is the only entry point that supports
+/// arbitrary payloads, not just format strings.
 #[unstable(feature = "libstd_sys_internals",
            reason = "used by the panic! macro",
            issue = "0")]