Remove deprecated unstable #[panic_implementation]
It was superseded by `#[panic_handler]`
This commit is contained in:
parent
89cf577c73
commit
29d2ceae7c
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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
|
||||
|
@ -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() {
|
||||
|
@ -448,9 +448,6 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
|
||||
// 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 @@ pub fn walk_feature_fields<F>(&self, mut f: F)
|
||||
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 fn is_builtin_attr(attr: &ast::Attribute) -> bool {
|
||||
"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),
|
||||
|
||||
|
@ -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 @@
|
||||
panic!()
|
||||
}
|
||||
|
||||
#[panic_implementation]
|
||||
#[panic_handler]
|
||||
fn panic(_info: &PanicInfo) -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
@ -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 {}
|
||||
}
|
@ -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`.
|
@ -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() {}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user