Skip to content

Commit 1fc546b

Browse files
committed
rename begin_panic
1 parent 7cd9505 commit 1fc546b

File tree

11 files changed

+17
-17
lines changed

11 files changed

+17
-17
lines changed

compiler/rustc_const_eval/src/check_consts/check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,11 +827,11 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
827827

828828
// At this point, we are calling a function, `callee`, whose `DefId` is known...
829829

830-
// `begin_panic` and `#[rustc_const_panic_str]` functions accept generic
830+
// `panic_with_payload` and `#[rustc_const_panic_str]` functions accept generic
831831
// types other than str. Check to enforce that only str can be used in
832832
// const-eval.
833833

834-
// const-eval of the `begin_panic` fn assumes the argument is `&str`
834+
// const-eval of the `panic_with_payload` fn assumes the argument is `&str`
835835
if tcx.is_lang_item(callee, LangItem::BeginPanic) {
836836
match args[0].node.ty(&self.ccx.body.local_decls, tcx).kind() {
837837
ty::Ref(_, ty, _) if ty.is_str() => {}

library/std/src/panic.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ impl fmt::Display for PanicHookInfo<'_> {
215215
#[rustc_macro_transparency = "semitransparent"]
216216
pub macro panic_2015 {
217217
() => ({
218-
$crate::rt::begin_panic("explicit panic")
218+
$crate::rt::panic_with_payload("explicit panic")
219219
}),
220220
($msg:expr $(,)?) => ({
221-
$crate::rt::begin_panic($msg);
221+
$crate::rt::panic_with_payload($msg);
222222
}),
223223
// Special-case the single-argument case for const_panic.
224224
("{}", $arg:expr $(,)?) => ({
@@ -257,7 +257,7 @@ pub use crate::panicking::{set_hook, take_hook};
257257
#[track_caller]
258258
#[cfg_attr(not(test), rustc_diagnostic_item = "panic_any")]
259259
pub fn panic_any<M: 'static + Any + Send>(msg: M) -> ! {
260-
crate::panicking::begin_panic(msg);
260+
crate::panicking::panic_with_payload(msg);
261261
}
262262

263263
#[stable(feature = "catch_unwind", since = "1.9.0")]

library/std/src/panicking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::{fmt, intrinsics, process, thread};
2929

3030
// This forces codegen of the function called by panic!() inside the std crate, rather than in
3131
// downstream crates. Primarily this is useful for rustc's codegen tests, which rely on noticing
32-
// complete removal of panic from generated IR. Since begin_panic is inline(never), it's only
32+
// complete removal of panic from generated IR. Since panic_with_payload is inline(never), it's only
3333
// codegen'd once per crate-graph so this pushes that to std rather than our codegen test crates.
3434
//
3535
// (See https://github.com/rust-lang/rust/pull/123244 for more info on why).
@@ -41,7 +41,7 @@ use crate::{fmt, intrinsics, process, thread};
4141
#[allow(dead_code)]
4242
#[used(compiler)]
4343
pub static EMPTY_PANIC: fn(&'static str) -> ! =
44-
begin_panic::<&'static str> as fn(&'static str) -> !;
44+
panic_with_payload::<&'static str> as fn(&'static str) -> !;
4545

4646
// Binary interface to the panic runtime that the standard library depends on.
4747
//
@@ -650,7 +650,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
650650
fn take_box(&mut self) -> *mut (dyn Any + Send) {
651651
// We do two allocations here, unfortunately. But (a) they're required with the current
652652
// scheme, and (b) we don't handle panic + OOM properly anyway (see comment in
653-
// begin_panic below).
653+
// panic_with_payload below).
654654
let contents = mem::take(self.fill());
655655
Box::into_raw(Box::new(contents))
656656
}
@@ -725,7 +725,7 @@ pub fn begin_panic_handler(info: &core::panic::PanicInfo<'_>) -> ! {
725725
#[cfg_attr(feature = "panic_immediate_abort", inline)]
726726
#[track_caller]
727727
#[rustc_do_not_const_check] // hooked by const-eval
728-
pub const fn begin_panic<M: Any + Send>(msg: M) -> ! {
728+
pub const fn panic_with_payload<M: Any + Send>(msg: M) -> ! {
729729
if cfg!(feature = "panic_immediate_abort") {
730730
intrinsics::abort()
731731
}

library/std/src/rt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#![allow(unused_macros)]
1818

1919
#[rustfmt::skip]
20-
pub use crate::panicking::{begin_panic, panic_count};
20+
pub use crate::panicking::{panic_with_payload, panic_count};
2121
pub use core::panicking::{panic_display, panic_fmt};
2222

2323
#[rustfmt::skip]

src/tools/clippy/clippy_lints/src/fallible_impl_from.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ fn lint_impl_body(cx: &LateContext<'_>, item_def_id: hir::OwnerId, impl_span: Sp
103103
{
104104
let impl_item_def_id = impl_item.def_id.expect_local();
105105

106-
// check the body for `begin_panic` or `unwrap`
106+
// check the body for `panic_with_payload` or `unwrap`
107107
let body = cx.tcx.hir_body_owned_by(impl_item_def_id);
108108
let mut fpu = FindPanicUnwrap {
109109
lcx: cx,

tests/ui/issues/issue-16966.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ LL | panic!(std::default::Default::default());
88
| required by a bound introduced by this call
99
|
1010
= note: cannot satisfy `_: Any`
11-
note: required by a bound in `begin_panic`
11+
note: required by a bound in `panic_with_payload`
1212
--> $SRC_DIR/std/src/panicking.rs:LL:COL
1313

1414
error: aborting due to 1 previous error

tests/ui/panics/issue-47429-short-backtraces.run.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
thread 'main' panicked at $DIR/issue-47429-short-backtraces.rs:24:5:
33
explicit panic
44
stack backtrace:
5-
0: std::panicking::begin_panic
5+
0: std::panicking::panic_with_payload
66
1: issue_47429_short_backtraces::main
77
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

tests/ui/panics/runtime-switch.run.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
thread 'main' panicked at $DIR/runtime-switch.rs:28:5:
33
explicit panic
44
stack backtrace:
5-
0: std::panicking::begin_panic
5+
0: std::panicking::panic_with_payload
66
1: runtime_switch::main
77
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

tests/ui/panics/short-ice-remove-middle-frames-2.run.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
thread 'main' panicked at $DIR/short-ice-remove-middle-frames-2.rs:62:5:
33
debug!!!
44
stack backtrace:
5-
0: std::panicking::begin_panic
5+
0: std::panicking::panic_with_payload
66
1: short_ice_remove_middle_frames_2::eight
77
2: short_ice_remove_middle_frames_2::seven::{{closure}}
88
[... omitted 3 frames ...]

tests/ui/panics/short-ice-remove-middle-frames.run.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
thread 'main' panicked at $DIR/short-ice-remove-middle-frames.rs:58:5:
33
debug!!!
44
stack backtrace:
5-
0: std::panicking::begin_panic
5+
0: std::panicking::panic_with_payload
66
1: short_ice_remove_middle_frames::seven
77
2: short_ice_remove_middle_frames::sixth
88
3: short_ice_remove_middle_frames::fifth::{{closure}}

0 commit comments

Comments
 (0)