Skip to content

Commit 8d38e92

Browse files
committed
rename begin_panic
1 parent 7cd9505 commit 8d38e92

20 files changed

+26
-26
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/mir-opt/building/issue_101867.main.built.after.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() -> () {
3333
bb1: {
3434
StorageLive(_3);
3535
StorageLive(_4);
36-
_4 = begin_panic::<&str>(const "explicit panic") -> bb8;
36+
_4 = panic_with_payload::<&str>(const "explicit panic") -> bb8;
3737
}
3838

3939
bb2: {

tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
bb1: {
18-
_2 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
18+
_2 = panic_with_payload::<&str>(const "explicit panic") -> unwind unreachable;
1919
}
2020

2121
bb2: {

tests/mir-opt/const_prop/control_flow_simplification.hello.GVN.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
}
1616

1717
bb1: {
18-
_2 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
18+
_2 = panic_with_payload::<&str>(const "explicit panic") -> unwind continue;
1919
}
2020

2121
bb2: {

tests/mir-opt/gvn.wrap_unwrap.GVN.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
bb2: {
3434
StorageLive(_6);
35-
_6 = begin_panic::<&str>(const "explicit panic") -> unwind unreachable;
35+
_6 = panic_with_payload::<&str>(const "explicit panic") -> unwind unreachable;
3636
}
3737

3838
bb3: {

tests/mir-opt/gvn.wrap_unwrap.GVN.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
bb2: {
3434
StorageLive(_6);
35-
_6 = begin_panic::<&str>(const "explicit panic") -> unwind continue;
35+
_6 = panic_with_payload::<&str>(const "explicit panic") -> unwind continue;
3636
}
3737

3838
bb3: {

0 commit comments

Comments
 (0)