Skip to content

Commit 63f18e1

Browse files
committed
s/panic_fmt/panic_impl/g in docs
1 parent e44ad61 commit 63f18e1

File tree

4 files changed

+22
-21
lines changed

4 files changed

+22
-21
lines changed

src/doc/unstable-book/src/language-features/lang-items.md

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ sugar for dynamic allocations via `malloc` and `free`:
1919
#![feature(lang_items, box_syntax, start, libc, core_intrinsics)]
2020
#![no_std]
2121
use core::intrinsics;
22+
use core::panic::PanicInfo;
2223
2324
extern crate libc;
2425
@@ -50,7 +51,7 @@ fn main(_argc: isize, _argv: *const *const u8) -> isize {
5051
}
5152
5253
#[lang = "eh_personality"] extern fn rust_eh_personality() {}
53-
#[lang = "panic_fmt"] extern fn rust_begin_panic() -> ! { unsafe { intrinsics::abort() } }
54+
#[lang = "panic_impl"] extern fn rust_begin_panic(info: &PanicInfo) -> ! { unsafe { intrinsics::abort() } }
5455
#[lang = "eh_unwind_resume"] extern fn rust_eh_unwind_resume() {}
5556
#[no_mangle] pub extern fn rust_eh_register_frames () {}
5657
#[no_mangle] pub extern fn rust_eh_unregister_frames () {}
@@ -110,6 +111,7 @@ in the same format as C:
110111
#![feature(start)]
111112
#![no_std]
112113
use core::intrinsics;
114+
use core::panic::PanicInfo;
113115
114116
// Pull in the system libc library for what crt0.o likely requires.
115117
extern crate libc;
@@ -134,12 +136,9 @@ pub extern fn rust_eh_personality() {
134136
pub extern fn rust_eh_unwind_resume() {
135137
}
136138
137-
#[lang = "panic_fmt"]
139+
#[lang = "panic_impl"]
138140
#[no_mangle]
139-
pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
140-
_file: &'static str,
141-
_line: u32,
142-
_column: u32) -> ! {
141+
pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
143142
unsafe { intrinsics::abort() }
144143
}
145144
```
@@ -155,6 +154,7 @@ compiler's name mangling too:
155154
#![no_std]
156155
#![no_main]
157156
use core::intrinsics;
157+
use core::panic::PanicInfo;
158158
159159
// Pull in the system libc library for what crt0.o likely requires.
160160
extern crate libc;
@@ -179,12 +179,9 @@ pub extern fn rust_eh_personality() {
179179
pub extern fn rust_eh_unwind_resume() {
180180
}
181181
182-
#[lang = "panic_fmt"]
182+
#[lang = "panic_impl"]
183183
#[no_mangle]
184-
pub extern fn rust_begin_panic(_msg: core::fmt::Arguments,
185-
_file: &'static str,
186-
_line: u32,
187-
_column: u32) -> ! {
184+
pub extern fn rust_begin_panic(info: &PanicInfo) -> ! {
188185
unsafe { intrinsics::abort() }
189186
}
190187
```
@@ -215,7 +212,7 @@ called. The language item's name is `eh_personality`.
215212

216213
The second function, `rust_begin_panic`, is also used by the failure mechanisms of the
217214
compiler. When a panic happens, this controls the message that's displayed on
218-
the screen. While the language item's name is `panic_fmt`, the symbol name is
215+
the screen. While the language item's name is `panic_impl`, the symbol name is
219216
`rust_begin_panic`.
220217

221218
A third function, `rust_eh_unwind_resume`, is also needed if the `custom_unwind_resume`
@@ -259,8 +256,8 @@ the source code.
259256
- `msvc_try_filter`: `libpanic_unwind/seh.rs` (SEH)
260257
- `panic`: `libcore/panicking.rs`
261258
- `panic_bounds_check`: `libcore/panicking.rs`
262-
- `panic_fmt`: `libcore/panicking.rs`
263-
- `panic_fmt`: `libstd/panicking.rs`
259+
- `panic_impl`: `libcore/panicking.rs`
260+
- `panic_impl`: `libstd/panicking.rs`
264261
- Allocations
265262
- `owned_box`: `liballoc/boxed.rs`
266263
- `exchange_malloc`: `liballoc/heap.rs`

src/doc/unstable-book/src/language-features/used.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ This condition can be met using `#[used]` and `#[link_section]` plus a linker
8787
script.
8888

8989
``` rust,ignore
90-
#![feature(lang_items)]
90+
#![feature(panic_implementation)]
9191
#![feature(used)]
9292
#![no_main]
9393
#![no_std]
9494
95+
use core::panic::PanicInfo;
96+
9597
extern "C" fn reset_handler() -> ! {
9698
loop {}
9799
}
@@ -100,8 +102,10 @@ extern "C" fn reset_handler() -> ! {
100102
#[used]
101103
static RESET_HANDLER: extern "C" fn() -> ! = reset_handler;
102104
103-
#[lang = "panic_fmt"]
104-
fn panic_fmt() {}
105+
#[panic_implementation]
106+
fn panic_impl(info: &PanicInfo) -> ! {
107+
loop {}
108+
}
105109
```
106110

107111
``` text

src/libcore/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
//! dictate the panic message, the file at which panic was invoked, and the
4242
//! line and column inside the file. It is up to consumers of this core
4343
//! library to define this panic function; it is only required to never
44-
//! return. This requires a `lang` attribute named `panic_fmt`.
44+
//! return. This requires a `lang` attribute named `panic_impl`.
4545
//!
4646
//! * `rust_eh_personality` - is used by the failure mechanisms of the
4747
//! compiler. This is often mapped to GCC's personality function, but crates

src/librustc/diagnostics.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,8 +637,8 @@ Erroneous code example:
637637
```compile_fail,E0152
638638
#![feature(lang_items)]
639639
640-
#[lang = "panic_fmt"]
641-
struct Foo; // error: duplicate lang item found: `panic_fmt`
640+
#[lang = "panic_impl"]
641+
struct Foo; // error: duplicate lang item found: `panic_impl`
642642
```
643643
644644
Lang items are already implemented in the standard library. Unless you are
@@ -824,7 +824,7 @@ A list of available external lang items is available in
824824
#![feature(lang_items)]
825825
826826
extern "C" {
827-
#[lang = "panic_fmt"] // ok!
827+
#[lang = "panic_impl"] // ok!
828828
fn cake();
829829
}
830830
```

0 commit comments

Comments
 (0)