Rollup merge of #88860 - nbdd0121:panic, r=m-ou-se
Deduplicate panic_fmt std's begin_panic_fmt and core's panic_fmt are duplicates. Merge them to declutter code and remove a lang item.
This commit is contained in:
commit
f7024998c7
12 changed files with 15 additions and 38 deletions
|
@ -121,7 +121,7 @@ impl<'a> PanicInfo<'a> {
|
|||
#[stable(feature = "panic_hooks", since = "1.10.0")]
|
||||
pub fn location(&self) -> Option<&Location<'_>> {
|
||||
// NOTE: If this is changed to sometimes return None,
|
||||
// deal with that case in std::panicking::default_hook and std::panicking::begin_panic_fmt.
|
||||
// deal with that case in std::panicking::default_hook and core::panicking::panic_fmt.
|
||||
Some(&self.location)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,8 +76,15 @@ fn panic_bounds_check(index: usize, len: usize) -> ! {
|
|||
panic!("index out of bounds: the len is {} but the index is {}", len, index)
|
||||
}
|
||||
|
||||
/// The underlying implementation of libcore's `panic!` macro when formatting is used.
|
||||
/// The entry point for panicking with a formatted message.
|
||||
///
|
||||
/// This is designed to reduce the amount of code required at the call
|
||||
/// site as much as possible (so that `panic!()` has as low an impact
|
||||
/// on (e.g.) the inlining of other functions as possible), by moving
|
||||
/// the actual formatting into this shared place.
|
||||
#[cold]
|
||||
// If panic_immediate_abort, inline the abort call,
|
||||
// otherwise avoid inlining because of it is cold path.
|
||||
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never))]
|
||||
#[cfg_attr(feature = "panic_immediate_abort", inline)]
|
||||
#[track_caller]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue