From 358fc5b62126f997a1c38ba4c8be60ae16e4a2c4 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Fri, 7 Sep 2018 12:43:39 +0200 Subject: [PATCH] stabilize `#[panic_handler]` --- src/libstd/lib.rs | 1 - src/libsyntax/feature_gate.rs | 7 ++----- .../compile-fail/auxiliary/some-panic-impl.rs | 1 - src/test/compile-fail/panic-handler-twice.rs | 1 - src/test/run-make-fulldeps/issue-51671/app.rs | 1 - .../panic-impl-provider.rs | 1 - .../const-eval/const_panic_libcore_main.rs | 1 - .../const_panic_libcore_main.stderr | 12 +++++------ .../feature-gate-panic-handler.rs | 21 ------------------- .../feature-gate-panic-handler.stderr | 11 ---------- .../auxiliary/some-panic-impl.rs | 1 - .../panic-handler-bad-signature-1.rs | 1 - .../panic-handler-bad-signature-1.stderr | 4 ++-- .../panic-handler-bad-signature-2.rs | 1 - .../panic-handler-bad-signature-2.stderr | 2 +- .../panic-handler-bad-signature-3.rs | 1 - .../panic-handler-bad-signature-3.stderr | 2 +- .../panic-handler-bad-signature-4.rs | 1 - .../panic-handler-bad-signature-4.stderr | 2 +- .../panic-handler/panic-handler-duplicate.rs | 1 - .../panic-handler-duplicate.stderr | 4 ++-- .../panic-handler-requires-panic-info.rs | 1 - .../ui/panic-handler/panic-handler-std.rs | 1 - .../ui/panic-handler/panic-handler-std.stderr | 4 ++-- src/test/ui/panic_implementation-closures.rs | 1 - 25 files changed, 17 insertions(+), 67 deletions(-) delete mode 100644 src/test/ui/feature-gates/feature-gate-panic-handler.rs delete mode 100644 src/test/ui/feature-gates/feature-gate-panic-handler.stderr diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index e7195b3e21ee3..4278926b042f3 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -312,7 +312,6 @@ #![feature(doc_keyword)] #![feature(panic_info_message)] #![cfg_attr(stage0, feature(panic_implementation))] -#![cfg_attr(not(stage0), feature(panic_handler))] #![feature(non_exhaustive)] #![default_lib_allocator] diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index e3ea3563d853b..0270e36db1177 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -487,7 +487,6 @@ declare_features! ( // RFC 2070: #[panic_implementation] / #[panic_handler] (active, panic_implementation, "1.28.0", Some(44489), None), - (active, panic_handler, "1.30.0", Some(44489), None), // #[doc(keyword = "...")] (active, doc_keyword, "1.28.0", Some(51315), None), @@ -674,6 +673,7 @@ declare_features! ( (accepted, proc_macro_path_invoc, "1.30.0", Some(38356), None), // Allows all literals in attribute lists and values of key-value pairs. (accepted, attr_literals, "1.30.0", Some(34981), None), + (accepted, panic_handler, "1.30.0", Some(44489), None), ); // 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 cfg_fn!(panic_implementation))), // RFC 2070 - ("panic_handler", Normal, Gated(Stability::Unstable, - "panic_handler", - "#[panic_handler] is an unstable feature", - cfg_fn!(panic_handler))), + ("panic_handler", Normal, Ungated), ("alloc_error_handler", Normal, Gated(Stability::Unstable, "alloc_error_handler", diff --git a/src/test/compile-fail/auxiliary/some-panic-impl.rs b/src/test/compile-fail/auxiliary/some-panic-impl.rs index e3b4fba176e3c..090123198d175 100644 --- a/src/test/compile-fail/auxiliary/some-panic-impl.rs +++ b/src/test/compile-fail/auxiliary/some-panic-impl.rs @@ -11,7 +11,6 @@ // no-prefer-dynamic #![crate_type = "rlib"] -#![feature(panic_handler)] #![no_std] use core::panic::PanicInfo; diff --git a/src/test/compile-fail/panic-handler-twice.rs b/src/test/compile-fail/panic-handler-twice.rs index 6c9515ca90994..10e0453cf5ed4 100644 --- a/src/test/compile-fail/panic-handler-twice.rs +++ b/src/test/compile-fail/panic-handler-twice.rs @@ -10,7 +10,6 @@ // aux-build:some-panic-impl.rs -#![feature(panic_handler)] #![feature(lang_items)] #![no_std] #![no_main] diff --git a/src/test/run-make-fulldeps/issue-51671/app.rs b/src/test/run-make-fulldeps/issue-51671/app.rs index e980b12039e96..4066214f4b47e 100644 --- a/src/test/run-make-fulldeps/issue-51671/app.rs +++ b/src/test/run-make-fulldeps/issue-51671/app.rs @@ -10,7 +10,6 @@ #![crate_type = "bin"] #![feature(lang_items)] -#![feature(panic_handler)] #![no_main] #![no_std] diff --git a/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs b/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs index 065b2b6bf18fa..77aae7ee2c06b 100644 --- a/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs +++ b/src/test/run-make-fulldeps/panic-impl-transitive/panic-impl-provider.rs @@ -9,7 +9,6 @@ // except according to those terms. #![crate_type = "rlib"] -#![feature(panic_handler)] #![no_std] use core::panic::PanicInfo; diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_main.rs b/src/test/ui/consts/const-eval/const_panic_libcore_main.rs index f5e5f9778faed..0364123994dff 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_main.rs +++ b/src/test/ui/consts/const-eval/const_panic_libcore_main.rs @@ -10,7 +10,6 @@ #![crate_type = "bin"] #![feature(lang_items)] -#![feature(panic_handler)] #![feature(const_panic)] #![no_main] #![no_std] diff --git a/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr b/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr index 7cb9f51c427a7..44b30c08cdea2 100644 --- a/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr +++ b/src/test/ui/consts/const-eval/const_panic_libcore_main.stderr @@ -1,31 +1,31 @@ error: this constant cannot be used - --> $DIR/const_panic_libcore_main.rs:20:1 + --> $DIR/const_panic_libcore_main.rs:19:1 | LL | const Z: () = panic!("cheese"); | ^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:20:15 + | the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_main.rs:19:15 | = note: #[deny(const_err)] on by default = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this constant cannot be used - --> $DIR/const_panic_libcore_main.rs:23:1 + --> $DIR/const_panic_libcore_main.rs:22:1 | LL | const Y: () = unreachable!(); | ^^^^^^^^^^^^^^--------------^ | | - | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:23:15 + | the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_main.rs:22:15 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) error: this constant cannot be used - --> $DIR/const_panic_libcore_main.rs:26:1 + --> $DIR/const_panic_libcore_main.rs:25:1 | LL | const X: () = unimplemented!(); | ^^^^^^^^^^^^^^----------------^ | | - | the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:26:15 + | the evaluated program panicked at 'not yet implemented', $DIR/const_panic_libcore_main.rs:25:15 | = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/feature-gates/feature-gate-panic-handler.rs b/src/test/ui/feature-gates/feature-gate-panic-handler.rs deleted file mode 100644 index fd16268ef8b4e..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-panic-handler.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags:-C panic=abort - -#![no_std] -#![no_main] - -use core::panic::PanicInfo; - -#[panic_handler] //~ ERROR #[panic_handler] is an unstable feature (see issue #44489) -fn panic(info: &PanicInfo) -> ! { - loop {} -} diff --git a/src/test/ui/feature-gates/feature-gate-panic-handler.stderr b/src/test/ui/feature-gates/feature-gate-panic-handler.stderr deleted file mode 100644 index 9680a240a9925..0000000000000 --- a/src/test/ui/feature-gates/feature-gate-panic-handler.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: #[panic_handler] is an unstable feature (see issue #44489) - --> $DIR/feature-gate-panic-handler.rs:18:1 - | -LL | #[panic_handler] //~ ERROR #[panic_handler] is an unstable feature (see issue #44489) - | ^^^^^^^^^^^^^^^^ - | - = help: add #![feature(panic_handler)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs b/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs index e3b4fba176e3c..090123198d175 100644 --- a/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs +++ b/src/test/ui/panic-handler/auxiliary/some-panic-impl.rs @@ -11,7 +11,6 @@ // no-prefer-dynamic #![crate_type = "rlib"] -#![feature(panic_handler)] #![no_std] use core::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs index cc7e337fc9e65..8d53c66adbd93 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-1.rs @@ -10,7 +10,6 @@ // compile-flags:-C panic=abort -#![feature(panic_handler)] #![no_std] #![no_main] diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr index 5771f4277b46d..72b85da028f1f 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-1.stderr @@ -1,11 +1,11 @@ error: return type should be `!` - --> $DIR/panic-handler-bad-signature-1.rs:22:6 + --> $DIR/panic-handler-bad-signature-1.rs:21:6 | LL | ) -> () //~ ERROR return type should be `!` | ^^ error: argument should be `&PanicInfo` - --> $DIR/panic-handler-bad-signature-1.rs:21:11 + --> $DIR/panic-handler-bad-signature-1.rs:20:11 | LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo` | ^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs index ec698903c846e..0e8b3d5e855cb 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-2.rs @@ -10,7 +10,6 @@ // compile-flags:-C panic=abort -#![feature(panic_handler)] #![no_std] #![no_main] diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr index 4823f8a2781b0..f2bcb6b680952 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-2.stderr @@ -1,5 +1,5 @@ error: argument should be `&PanicInfo` - --> $DIR/panic-handler-bad-signature-2.rs:21:11 + --> $DIR/panic-handler-bad-signature-2.rs:20:11 | LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo` | ^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs index 585716c7c7569..ac1b19105b62e 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.rs @@ -10,7 +10,6 @@ // compile-flags:-C panic=abort -#![feature(panic_handler)] #![no_std] #![no_main] diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr index 5d0395e17f54d..77227e0d5a61c 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-3.stderr @@ -1,5 +1,5 @@ error: function should have one argument - --> $DIR/panic-handler-bad-signature-3.rs:20:1 + --> $DIR/panic-handler-bad-signature-3.rs:19:1 | LL | fn panic() -> ! { //~ ERROR function should have one argument | ^^^^^^^^^^^^^^^ diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs b/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs index 9cda37f27b332..f4728408a1afa 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-4.rs @@ -10,7 +10,6 @@ // compile-flags:-C panic=abort -#![feature(panic_handler)] #![no_std] #![no_main] diff --git a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr index a61b9b3743c7d..0dd47cafd7553 100644 --- a/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr +++ b/src/test/ui/panic-handler/panic-handler-bad-signature-4.stderr @@ -1,5 +1,5 @@ error: should have no type parameters - --> $DIR/panic-handler-bad-signature-4.rs:20:1 + --> $DIR/panic-handler-bad-signature-4.rs:19:1 | LL | / fn panic(pi: &PanicInfo) -> ! { LL | | //~^ ERROR should have no type parameters diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.rs b/src/test/ui/panic-handler/panic-handler-duplicate.rs index 7d7fe251869f1..c4fb4903e0031 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.rs +++ b/src/test/ui/panic-handler/panic-handler-duplicate.rs @@ -11,7 +11,6 @@ // compile-flags:-C panic=abort #![feature(lang_items)] -#![feature(panic_handler)] #![no_std] #![no_main] diff --git a/src/test/ui/panic-handler/panic-handler-duplicate.stderr b/src/test/ui/panic-handler/panic-handler-duplicate.stderr index d8afaa27e2662..e243d9079d851 100644 --- a/src/test/ui/panic-handler/panic-handler-duplicate.stderr +++ b/src/test/ui/panic-handler/panic-handler-duplicate.stderr @@ -1,5 +1,5 @@ error[E0152]: duplicate lang item found: `panic_impl`. - --> $DIR/panic-handler-duplicate.rs:26:1 + --> $DIR/panic-handler-duplicate.rs:25:1 | LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`. LL | | loop {} @@ -7,7 +7,7 @@ LL | | } | |_^ | note: first defined here. - --> $DIR/panic-handler-duplicate.rs:21:1 + --> $DIR/panic-handler-duplicate.rs:20:1 | LL | / fn panic(info: &PanicInfo) -> ! { LL | | loop {} diff --git a/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs b/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs index ec68a414f54d5..133d6c0557ab6 100644 --- a/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs +++ b/src/test/ui/panic-handler/panic-handler-requires-panic-info.rs @@ -13,7 +13,6 @@ #![feature(lang_items)] #![feature(no_core)] -#![feature(panic_handler)] #![no_core] #![no_main] diff --git a/src/test/ui/panic-handler/panic-handler-std.rs b/src/test/ui/panic-handler/panic-handler-std.rs index 7cbe0a35baed8..ff5995237cf21 100644 --- a/src/test/ui/panic-handler/panic-handler-std.rs +++ b/src/test/ui/panic-handler/panic-handler-std.rs @@ -10,7 +10,6 @@ // error-pattern: duplicate lang item found: `panic_impl`. -#![feature(panic_handler)] use std::panic::PanicInfo; diff --git a/src/test/ui/panic-handler/panic-handler-std.stderr b/src/test/ui/panic-handler/panic-handler-std.stderr index b141a2171646c..4ec1c6df35522 100644 --- a/src/test/ui/panic-handler/panic-handler-std.stderr +++ b/src/test/ui/panic-handler/panic-handler-std.stderr @@ -1,5 +1,5 @@ error[E0152]: duplicate lang item found: `panic_impl`. - --> $DIR/panic-handler-std.rs:18:1 + --> $DIR/panic-handler-std.rs:17:1 | LL | / fn panic(info: PanicInfo) -> ! { LL | | loop {} @@ -9,7 +9,7 @@ LL | | } = note: first defined in crate `std`. error: argument should be `&PanicInfo` - --> $DIR/panic-handler-std.rs:18:16 + --> $DIR/panic-handler-std.rs:17:16 | LL | fn panic(info: PanicInfo) -> ! { | ^^^^^^^^^ diff --git a/src/test/ui/panic_implementation-closures.rs b/src/test/ui/panic_implementation-closures.rs index 6642db6ee76bf..5902a1ae1b023 100644 --- a/src/test/ui/panic_implementation-closures.rs +++ b/src/test/ui/panic_implementation-closures.rs @@ -12,7 +12,6 @@ #![crate_type = "rlib"] #![no_std] -#![feature(panic_handler)] #[panic_handler] pub fn panic_fmt(_: &::core::panic::PanicInfo) -> ! {