Auto merge of #129589 - saethlin:improve-panic-immediate-abort, r=tgross35
Tweak some attributes to improve panic_immediate_abort This is similar to https://github.com/rust-lang/rust/pull/117332; I did the same approach as before where I build a really big project with `-Zbuild-std -Zbuild-std-features=panic_immediate_abort` and grep its symbols for things that look panic-related.
This commit is contained in:
commit
ac77e88f7a
@ -195,6 +195,7 @@ pub const fn internal_constructor(file: &'a str, line: u32, col: u32) -> Self {
|
|||||||
|
|
||||||
#[stable(feature = "panic_hook_display", since = "1.26.0")]
|
#[stable(feature = "panic_hook_display", since = "1.26.0")]
|
||||||
impl fmt::Display for Location<'_> {
|
impl fmt::Display for Location<'_> {
|
||||||
|
#[inline]
|
||||||
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
write!(formatter, "{}:{}:{}", self.file, self.line, self.col)
|
write!(formatter, "{}:{}:{}", self.file, self.line, self.col)
|
||||||
}
|
}
|
||||||
|
@ -3667,8 +3667,8 @@ pub fn copy_from_slice(&mut self, src: &[T])
|
|||||||
{
|
{
|
||||||
// The panic code path was put into a cold function to not bloat the
|
// The panic code path was put into a cold function to not bloat the
|
||||||
// call site.
|
// call site.
|
||||||
#[inline(never)]
|
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
|
||||||
#[cold]
|
#[cfg_attr(feature = "panic_immediate_abort", inline)]
|
||||||
#[track_caller]
|
#[track_caller]
|
||||||
fn len_mismatch_fail(dst_len: usize, src_len: usize) -> ! {
|
fn len_mismatch_fail(dst_len: usize, src_len: usize) -> ! {
|
||||||
panic!(
|
panic!(
|
||||||
|
@ -840,7 +840,8 @@ unsafe fn bidirectional_merge<T: FreezeMarker, F: FnMut(&T, &T) -> bool>(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(never)]
|
#[cfg_attr(not(feature = "panic_immediate_abort"), inline(never), cold)]
|
||||||
|
#[cfg_attr(feature = "panic_immediate_abort", inline)]
|
||||||
fn panic_on_ord_violation() -> ! {
|
fn panic_on_ord_violation() -> ! {
|
||||||
// This is indicative of a logic bug in the user-provided comparison function or Ord
|
// This is indicative of a logic bug in the user-provided comparison function or Ord
|
||||||
// implementation. They are expected to implement a total order as explained in the Ord
|
// implementation. They are expected to implement a total order as explained in the Ord
|
||||||
|
Loading…
Reference in New Issue
Block a user