more panicking comments
This commit is contained in:
parent
08f779cb4b
commit
3c48579551
2 changed files with 8 additions and 5 deletions
|
|
@ -11,13 +11,13 @@
|
|||
//! ```
|
||||
//!
|
||||
//! This definition allows for panicking with any general message, but it does not
|
||||
//! allow for failing with a `Box<Any>` value. The reason for this is that libcore
|
||||
//! is not allowed to allocate.
|
||||
//! allow for failing with a `Box<Any>` value. (`PanicInfo` just contains a `&(dyn Any + Send)`,
|
||||
//! for which we fill in a dummy value in `PanicInfo::internal_constructor`.)
|
||||
//! The reason for this is that libcore is not allowed to allocate.
|
||||
//!
|
||||
//! This module contains a few other panicking functions, but these are just the
|
||||
//! necessary lang items for the compiler. All panics are funneled through this
|
||||
//! one function. Currently, the actual symbol is declared in the standard
|
||||
//! library, but the location of this may change over time.
|
||||
//! one function. The actual symbol is declared through the `#[panic_handler]` attribute.
|
||||
|
||||
// ignore-tidy-undocumented-unsafe
|
||||
|
||||
|
|
@ -72,6 +72,7 @@ pub fn panic_fmt(fmt: fmt::Arguments<'_>, location: &Location<'_>) -> ! {
|
|||
}
|
||||
|
||||
// NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call
|
||||
// that gets resolved to the `#[panic_handler]` function.
|
||||
extern "Rust" {
|
||||
#[lang = "panic_impl"]
|
||||
fn panic_impl(pi: &PanicInfo<'_>) -> !;
|
||||
|
|
|
|||
|
|
@ -455,7 +455,9 @@ fn rust_panic_with_hook(payload: &mut dyn BoxMeUp,
|
|||
match HOOK {
|
||||
// Some platforms know that printing to stderr won't ever actually
|
||||
// print anything, and if that's the case we can skip the default
|
||||
// hook.
|
||||
// hook. Since string formatting happens lazily when calling `payload`
|
||||
// methods, this means that with libpanic_abort, we don't format
|
||||
// the string at all!
|
||||
Hook::Default if panic_output().is_none() => {}
|
||||
Hook::Default => {
|
||||
info.set_payload(payload.get());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue