From a774c81f9855f75a1a86f71a851b373d2178d9e9 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 23 Aug 2018 00:40:32 +0200 Subject: add #[panic_handler]; deprecate #[panic_implementation] --- src/libsyntax/feature_gate.rs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 1ffb6e55f06..04066f687fc 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -472,8 +472,9 @@ declare_features! ( // Integer match exhaustiveness checking (active, exhaustive_integer_patterns, "1.30.0", Some(50907), None), - // #[panic_implementation] + // 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), @@ -1104,11 +1105,18 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG "infer 'static lifetime requirements", cfg_fn!(infer_static_outlives_requirements))), + // RFC 2070 (deprecated attribute name) + ("panic_implementation", + Normal, Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224"), + "panic_implementation", + "This attribute was renamed to `panic_handler`", + cfg_fn!(panic_implementation))), + // RFC 2070 - ("panic_implementation", Normal, Gated(Stability::Unstable, - "panic_implementation", - "#[panic_implementation] is an unstable feature", - cfg_fn!(panic_implementation))), + ("panic_handler", Normal, Gated(Stability::Unstable, + "panic_handler", + "#[panic_handler] is an unstable feature", + cfg_fn!(panic_handler))), ("alloc_error_handler", Normal, Gated(Stability::Unstable, "alloc_error_handler", -- cgit 1.4.1-3-g733a5 From ca03f86aadbcd79129fce8d29bf7dff68c778a81 Mon Sep 17 00:00:00 2001 From: Jorge Aparicio Date: Thu, 23 Aug 2018 13:52:43 +0200 Subject: fix tidy --- src/libsyntax/feature_gate.rs | 10 ++++++---- .../feature-gate-panic-implementation.rs | 21 +++++++++++++++++++++ .../feature-gate-panic-implementation.stderr | 11 +++++++++++ 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 src/test/ui/feature-gates/feature-gate-panic-implementation.rs create mode 100644 src/test/ui/feature-gates/feature-gate-panic-implementation.stderr (limited to 'src/libsyntax') diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 04066f687fc..db4bd29c4b7 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1107,10 +1107,12 @@ pub const BUILTIN_ATTRIBUTES: &'static [(&'static str, AttributeType, AttributeG // RFC 2070 (deprecated attribute name) ("panic_implementation", - Normal, Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224"), - "panic_implementation", - "This attribute was renamed to `panic_handler`", - cfg_fn!(panic_implementation))), + Normal, + Gated(Stability::Deprecated("https://github.com/rust-lang/rust/issues/44489\ + #issuecomment-415140224"), + "panic_implementation", + "This attribute was renamed to `panic_handler`", + cfg_fn!(panic_implementation))), // RFC 2070 ("panic_handler", Normal, Gated(Stability::Unstable, diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs new file mode 100644 index 00000000000..84e5f302c16 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs @@ -0,0 +1,21 @@ +// 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_implementation] //~ ERROR This attribute was renamed to `panic_handler` (see issue #44489) +fn panic(info: &PanicInfo) -> ! { + loop {} +} diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr new file mode 100644 index 00000000000..926a49ae831 --- /dev/null +++ b/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr @@ -0,0 +1,11 @@ +error[E0658]: This attribute was renamed to `panic_handler` (see issue #44489) + --> $DIR/feature-gate-panic-implementation.rs:18:1 + | +LL | #[panic_implementation] //~ ERROR This attribute was renamed to `panic_handler` (see issue #44489) + | ^^^^^^^^^^^^^^^^^^^^^^^ + | + = help: add #![feature(panic_implementation)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. -- cgit 1.4.1-3-g733a5