about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-11-02 02:22:30 +0300
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>2018-11-02 02:22:30 +0300
commit29d2ceae7c03fb4a4d99e4e766cf212fb9582ffa (patch)
tree889e40eb304ad091e669608fdad73e62a0e101d0
parent89cf577c73b70e66157d9a4ff6560e738d039ab1 (diff)
downloadrust-29d2ceae7c03fb4a4d99e4e766cf212fb9582ffa.tar.gz
rust-29d2ceae7c03fb4a4d99e4e766cf212fb9582ffa.zip
Remove deprecated unstable `#[panic_implementation]`
It was superseded by `#[panic_handler]`
-rw-r--r--src/librustc/middle/dead.rs6
-rw-r--r--src/librustc/middle/lang_items.rs4
-rw-r--r--src/librustc_mir/monomorphize/partitioning.rs2
-rw-r--r--src/librustc_typeck/check/mod.rs2
-rw-r--r--src/libsyntax/feature_gate.rs15
-rw-r--r--src/test/run-make/wasm-symbols-not-imported/foo.rs4
-rw-r--r--src/test/ui/feature-gates/feature-gate-panic-implementation.rs21
-rw-r--r--src/test/ui/feature-gates/feature-gate-panic-implementation.stderr11
-rw-r--r--src/test/ui/panic-implementation/panic-implementation-deprecated.rs24
-rw-r--r--src/test/ui/panic-implementation/panic-implementation-deprecated.stderr14
10 files changed, 8 insertions, 95 deletions
diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs
index dc5f7361725..c5bcfd48cf3 100644
--- a/src/librustc/middle/dead.rs
+++ b/src/librustc/middle/dead.rs
@@ -291,10 +291,8 @@ fn has_allow_dead_code_or_lang_attr(tcx: TyCtxt<'_, '_, '_>,
         return true;
     }
 
-    // (To be) stable attribute for #[lang = "panic_impl"]
-    if attr::contains_name(attrs, "panic_implementation") ||
-        attr::contains_name(attrs, "panic_handler")
-    {
+    // Stable attribute for #[lang = "panic_impl"]
+    if attr::contains_name(attrs, "panic_handler") {
         return true;
     }
 
diff --git a/src/librustc/middle/lang_items.rs b/src/librustc/middle/lang_items.rs
index 45de958e72e..931f466e422 100644
--- a/src/librustc/middle/lang_items.rs
+++ b/src/librustc/middle/lang_items.rs
@@ -204,9 +204,7 @@ pub fn extract(attrs: &[ast::Attribute]) -> Option<(Symbol, Span)> {
             if let Some(value) = attribute.value_str() {
                 return Some((value, attribute.span));
             }
-        } else if attribute.check_name("panic_implementation") ||
-            attribute.check_name("panic_handler")
-        {
+        } else if attribute.check_name("panic_handler") {
             return Some((Symbol::intern("panic_impl"), attribute.span))
         } else if attribute.check_name("alloc_error_handler") {
             return Some((Symbol::intern("oom"), attribute.span))
diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs
index f0a35ca7adb..fd63bf79da9 100644
--- a/src/librustc_mir/monomorphize/partitioning.rs
+++ b/src/librustc_mir/monomorphize/partitioning.rs
@@ -505,7 +505,7 @@ fn mono_item_visibility(
         //
         // * First is weak lang items. These are basically mechanisms for
         //   libcore to forward-reference symbols defined later in crates like
-        //   the standard library or `#[panic_implementation]` definitions. The
+        //   the standard library or `#[panic_handler]` definitions. The
         //   definition of these weak lang items needs to be referenceable by
         //   libcore, so we're no longer a candidate for internalization.
         //   Removal of these functions can't be done by LLVM but rather must be
diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs
index 17784a4681d..694cd0c2718 100644
--- a/src/librustc_typeck/check/mod.rs
+++ b/src/librustc_typeck/check/mod.rs
@@ -1167,7 +1167,7 @@ fn check_fn<'a, 'gcx, 'tcx>(inherited: &'a Inherited<'a, 'gcx, 'tcx>,
         }
     }
 
-    // Check that a function marked as `#[panic_implementation]` has signature `fn(&PanicInfo) -> !`
+    // Check that a function marked as `#[panic_handler]` has signature `fn(&PanicInfo) -> !`
     if let Some(panic_impl_did) = fcx.tcx.lang_items().panic_impl() {
         if panic_impl_did == fcx.tcx.hir.local_def_id(fn_id) {
             if let Some(panic_info_did) = fcx.tcx.lang_items().panic_info() {
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs
index 0ddeedfb50d..dd5eacb86eb 100644
--- a/src/libsyntax/feature_gate.rs
+++ b/src/libsyntax/feature_gate.rs
@@ -448,9 +448,6 @@ declare_features! (
     // Integer match exhaustiveness checking
     (active, exhaustive_integer_patterns, "1.30.0", Some(50907), None),
 
-    // RFC 2070: #[panic_implementation] / #[panic_handler]
-    (active, panic_implementation, "1.28.0", Some(44489), None),
-
     // #[doc(keyword = "...")]
     (active, doc_keyword, "1.28.0", Some(51315), None),
 
@@ -541,6 +538,8 @@ declare_features! (
      Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
     (removed, proc_macro_gen, "1.27.0", Some(54727), None,
      Some("subsumed by `#![feature(proc_macro_hygiene)]`")),
+    (removed, panic_implementation, "1.28.0", Some(44489), None,
+     Some("subsumed by `#[panic_handler]`")),
 );
 
 declare_features! (
@@ -1160,16 +1159,6 @@ 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",
-                                 Some("replace this attribute with `#[panic_handler]`")),
-           "panic_implementation",
-           "this attribute was renamed to `panic_handler`",
-           cfg_fn!(panic_implementation))),
-
     // RFC 2070
     ("panic_handler", Normal, Ungated),
 
diff --git a/src/test/run-make/wasm-symbols-not-imported/foo.rs b/src/test/run-make/wasm-symbols-not-imported/foo.rs
index 156db486a47..dcc2f4f5223 100644
--- a/src/test/run-make/wasm-symbols-not-imported/foo.rs
+++ b/src/test/run-make/wasm-symbols-not-imported/foo.rs
@@ -9,8 +9,6 @@
 // except according to those terms.
 
 #![crate_type = "cdylib"]
-
-#![feature(panic_implementation)]
 #![no_std]
 
 use core::panic::PanicInfo;
@@ -20,7 +18,7 @@ pub extern fn foo() {
     panic!()
 }
 
-#[panic_implementation]
+#[panic_handler]
 fn panic(_info: &PanicInfo) -> ! {
     loop {}
 }
diff --git a/src/test/ui/feature-gates/feature-gate-panic-implementation.rs b/src/test/ui/feature-gates/feature-gate-panic-implementation.rs
deleted file mode 100644
index ca51154884f..00000000000
--- a/src/test/ui/feature-gates/feature-gate-panic-implementation.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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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
deleted file mode 100644
index a54780468c4..00000000000
--- a/src/test/ui/feature-gates/feature-gate-panic-implementation.stderr
+++ /dev/null
@@ -1,11 +0,0 @@
-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`.
diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.rs b/src/test/ui/panic-implementation/panic-implementation-deprecated.rs
deleted file mode 100644
index c4bec01f6af..00000000000
--- a/src/test/ui/panic-implementation/panic-implementation-deprecated.rs
+++ /dev/null
@@ -1,24 +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 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
-// compile-flags:-C panic=abort
-
-#![deny(deprecated)]
-#![feature(panic_implementation)]
-#![no_std]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(info: &PanicInfo) -> ! {
-    loop {}
-}
-
-fn main() {}
diff --git a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr b/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr
deleted file mode 100644
index fabfba94878..00000000000
--- a/src/test/ui/panic-implementation/panic-implementation-deprecated.stderr
+++ /dev/null
@@ -1,14 +0,0 @@
-error: use of deprecated attribute `panic_implementation`: this attribute was renamed to `panic_handler`. See https://github.com/rust-lang/rust/issues/44489#issuecomment-415140224
-  --> $DIR/panic-implementation-deprecated.rs:19:1
-   |
-LL | #[panic_implementation]
-   | ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this attribute with `#[panic_handler]`
-   |
-note: lint level defined here
-  --> $DIR/panic-implementation-deprecated.rs:13:9
-   |
-LL | #![deny(deprecated)]
-   |         ^^^^^^^^^^
-
-error: aborting due to previous error
-