Skip to content

Commit ff59ab1

Browse files
committed
Auto merge of rust-lang#51366 - japaric:stable-panic-impl, r=Mark-Simulacrum
stabilize #[panic_handler] closes rust-lang#44489 ### Update(2018-09-07) This was proposed for stabilization in rust-lang#44489 (comment) and its FCP with disposition to merge / accept is nearly over. The summary of what's being stabilized can be found in rust-lang#44489 (comment) Documentation PRs: - Reference. rust-lang/reference#362 - Nomicon. rust-lang/nomicon#75 --- `#[panic_implementation]` was implemented recently in rust-lang#50338. `#[panic_implementation]` is basically the old `panic_fmt` language item but in a less error prone (\*) shape. There are still some issues and questions to sort out around this feature (cf. rust-lang#44489) but this PR is meant to start a discussion about those issues / questions with the language team. (\*) `panic_fmt` was not type checked; changes in its function signature caused serious, silent binary size regressions like the one observed in rust-lang#43054 Some unresolved questions from rust-lang#44489: > Should the Display of PanicInfo format the panic information as "panicked at 'reason', > src/main.rs:27:4", as "'reason', src/main.rs:27:4", or simply as "reason". The current implementation formats `PanicInfo` as the first alternative, which is how panic messages are formatted by the `std` panic handler. The `Display` implementation is more than a convenience: `PanicInfo.message` is unstable so it's not possible to replicate the `Display` implementation on stable. > Is this design compatible, or can it be extended to work, with unwinding implementations for > no-std environments? I believe @whitequark made more progress with unwinding in no-std since their last comment in rust-lang#44489. Perhaps they can give us an update? --- Another unresolved question is where this feature should be documented. The feature currently doesn't have any documentation. cc @rust-lang/lang cc @jackpot51 @alevy @phil-opp
2 parents 06da917 + 358fc5b commit ff59ab1

25 files changed

+17
-67
lines changed

src/libstd/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@
312312
#![feature(doc_keyword)]
313313
#![feature(panic_info_message)]
314314
#![cfg_attr(stage0, feature(panic_implementation))]
315-
#![cfg_attr(not(stage0), feature(panic_handler))]
316315
#![feature(non_exhaustive)]
317316

318317
#![default_lib_allocator]

src/libsyntax/feature_gate.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,6 @@ declare_features! (
487487

488488
// RFC 2070: #[panic_implementation] / #[panic_handler]
489489
(active, panic_implementation, "1.28.0", Some(44489), None),
490-
(active, panic_handler, "1.30.0", Some(44489), None),
491490

492491
// #[doc(keyword = "...")]
493492
(active, doc_keyword, "1.28.0", Some(51315), None),
@@ -674,6 +673,7 @@ declare_features! (
674673
(accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None),
675674
// Allows all literals in attribute lists and values of key-value pairs.
676675
(accepted, attr_literals, "1.30.0", Some(34981), None),
676+
(accepted, panic_handler, "1.30.0", Some(44489), None),
677677
);
678678

679679
// If you change this, please modify src/doc/unstable-book as well. You must
@@ -1143,10 +1143,7 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG
11431143
cfg_fn!(panic_implementation))),
11441144

11451145
// RFC 2070
1146-
("panic_handler", Normal, Gated(Stability::Unstable,
1147-
"panic_handler",
1148-
"#[panic_handler] is an unstable feature",
1149-
cfg_fn!(panic_handler))),
1146+
("panic_handler", Normal, Ungated),
11501147

11511148
("alloc_error_handler", Normal, Gated(Stability::Unstable,
11521149
"alloc_error_handler",

src/test/compile-fail/auxiliary/some-panic-impl.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
// no-prefer-dynamic
1212

1313
#![crate_type = "rlib"]
14-
#![feature(panic_handler)]
1514
#![no_std]
1615

1716
use core::panic::PanicInfo;

src/test/compile-fail/panic-handler-twice.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// aux-build:some-panic-impl.rs
1212

13-
#![feature(panic_handler)]
1413
#![feature(lang_items)]
1514
#![no_std]
1615
#![no_main]

src/test/run-make-fulldeps/issue-51671/app.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![crate_type = "bin"]
1212
#![feature(lang_items)]
13-
#![feature(panic_handler)]
1413
#![no_main]
1514
#![no_std]
1615

src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// except according to those terms.
1010

1111
#![crate_type = "rlib"]
12-
#![feature(panic_handler)]
1312
#![no_std]
1413

1514
use core::panic::PanicInfo;

src/test/ui/consts/const-eval/const_panic_libcore_main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#![crate_type = "bin"]
1212
#![feature(lang_items)]
13-
#![feature(panic_handler)]
1413
#![feature(const_panic)]
1514
#![no_main]
1615
#![no_std]

src/test/ui/consts/const-eval/const_panic_libcore_main.stderr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: this constant cannot be used
2-
--> $DIR/const_panic_libcore_main.rs:20:1
2+
--> $DIR/const_panic_libcore_main.rs:19:1
33
|
44
LL | const Z: () = panic!("cheese");
55
| ^^^^^^^^^^^^^^----------------^
66
| |
7-
| the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:20:15
7+
| the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:19:15
88
|
99
= note: #[deny(const_err)] on by default
1010
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
1111

1212
error: this constant cannot be used
13-
--> $DIR/const_panic_libcore_main.rs:23:1
13+
--> $DIR/const_panic_libcore_main.rs:22:1
1414
|
1515
LL | const Y: () = unreachable!();
1616
| ^^^^^^^^^^^^^^--------------^
1717
| |
18-
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:23:15
18+
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:22:15
1919
|
2020
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
2121

2222
error: this constant cannot be used
23-
--> $DIR/const_panic_libcore_main.rs:26:1
23+
--> $DIR/const_panic_libcore_main.rs:25:1
2424
|
2525
LL | const X: () = unimplemented!();
2626
| ^^^^^^^^^^^^^^----------------^
2727
| |
28-
| the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:26:15
28+
| the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:25:15
2929
|
3030
= note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info)
3131

src/test/ui/feature-gates/feature-gate-panic-handler.rs

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/test/ui/feature-gates/feature-gate-panic-handler.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)