Skip to content

Commit

Permalink
Remove deprecated unstable #[panic_implementation]
Browse files Browse the repository at this point in the history
It was superseded by `#[panic_handler]`
  • Loading branch information
petrochenkov committed Nov 1, 2018
1 parent 89cf577 commit 29d2cea
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 95 deletions.
6 changes: 2 additions & 4 deletions src/librustc/middle/dead.rs
Expand Up @@ -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;
}

Expand Down
4 changes: 1 addition & 3 deletions src/librustc/middle/lang_items.rs
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/monomorphize/partitioning.rs
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/mod.rs
Expand Up @@ -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() {
Expand Down
15 changes: 2 additions & 13 deletions src/libsyntax/feature_gate.rs
Expand Up @@ -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),

Expand Down Expand Up @@ -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! (
Expand Down Expand Up @@ -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),

Expand Down
4 changes: 1 addition & 3 deletions src/test/run-make/wasm-symbols-not-imported/foo.rs
Expand Up @@ -9,8 +9,6 @@
// except according to those terms.

#![crate_type = "cdylib"]

#![feature(panic_implementation)]
#![no_std]

use core::panic::PanicInfo;
Expand All @@ -20,7 +18,7 @@ pub extern fn foo() {
panic!()
}

#[panic_implementation]
#[panic_handler]
fn panic(_info: &PanicInfo) -> ! {
loop {}
}
21 changes: 0 additions & 21 deletions src/test/ui/feature-gates/feature-gate-panic-implementation.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/test/ui/feature-gates/feature-gate-panic-implementation.stderr

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 29d2cea

Please sign in to comment.