}
// (To be) stable attribute for #[lang = "panic_impl"]
- if attr::contains_name(attrs, "panic_implementation") {
+ if attr::contains_name(attrs, "panic_implementation") ||
+ attr::contains_name(attrs, "panic_handler")
+ {
return true;
}
if let Some(value) = attribute.value_str() {
return Some((value, attribute.span));
}
- } else if attribute.check_name("panic_implementation") {
+ } else if attribute.check_name("panic_implementation") ||
+ 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))
!whitelisted(tcx, lang_items::$item) &&
items.$name().is_none() {
if lang_items::$item == lang_items::PanicImplLangItem {
- tcx.sess.err(&format!("`#[panic_implementation]` function required, \
+ tcx.sess.err(&format!("`#[panic_handler]` function required, \
but not found"));
} else if lang_items::$item == lang_items::OomLangItem {
tcx.sess.err(&format!("`#[alloc_error_handler]` function required, \
if !generics.params.is_empty() {
fcx.tcx.sess.span_err(
span,
- "`#[panic_implementation]` function should have no type \
- parameters",
+ "should have no type parameters",
);
}
}
#![feature(doc_alias)]
#![feature(doc_keyword)]
#![feature(panic_info_message)]
-#![feature(panic_implementation)]
+#![cfg_attr(stage0, feature(panic_implementation))]
+#![cfg_attr(not(stage0), feature(panic_handler))]
#![feature(non_exhaustive)]
#![default_lib_allocator]
/// Entry point of panic from the libcore crate.
#[cfg(not(test))]
-#[panic_implementation]
+#[cfg_attr(stage0, panic_implementation)]
+#[cfg_attr(not(stage0), panic_handler)]
#[unwind(allowed)]
pub fn rust_begin_panic(info: &PanicInfo) -> ! {
continue_panic_fmt(&info)
// 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),
"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",
// no-prefer-dynamic
#![crate_type = "rlib"]
-#![feature(panic_implementation)]
+#![feature(panic_handler)]
#![no_std]
use core::panic::PanicInfo;
-#[panic_implementation]
+#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
loop {}
}
--- /dev/null
+// 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.
+
+// error-pattern: `#[panic_handler]` function required, but not found
+
+#![feature(lang_items)]
+#![no_main]
+#![no_std]
+
+#[lang = "eh_personality"]
+fn eh() {}
--- /dev/null
+// 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.
+
+// aux-build:some-panic-impl.rs
+
+#![feature(panic_handler)]
+#![feature(lang_items)]
+#![no_std]
+#![no_main]
+
+extern crate some_panic_impl;
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: &PanicInfo) -> ! {
+ //~^ error duplicate lang item found: `panic_impl`
+ loop {}
+}
+
+#[lang = "eh_personality"]
+fn eh() {}
+++ /dev/null
-// 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.
-
-// error-pattern: `#[panic_implementation]` function required, but not found
-
-#![feature(lang_items)]
-#![no_main]
-#![no_std]
-
-#[lang = "eh_personality"]
-fn eh() {}
+++ /dev/null
-// 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.
-
-// aux-build:some-panic-impl.rs
-
-#![feature(panic_implementation)]
-#![feature(lang_items)]
-#![no_std]
-#![no_main]
-
-extern crate some_panic_impl;
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(info: &PanicInfo) -> ! {
- //~^ error duplicate lang item found: `panic_impl`
- loop {}
-}
-
-#[lang = "eh_personality"]
-fn eh() {}
// except according to those terms.
// aux-build:weak-lang-items.rs
-// error-pattern: `#[panic_implementation]` function required, but not found
+// error-pattern: `#[panic_handler]` function required, but not found
// error-pattern: language item required, but not found: `eh_personality`
// ignore-wasm32-bare compiled with panic=abort, personality not required
#![crate_type = "bin"]
#![feature(lang_items)]
-#![feature(panic_implementation)]
+#![feature(panic_handler)]
#![no_main]
#![no_std]
use core::alloc::Layout;
use core::panic::PanicInfo;
-#[panic_implementation]
+#[panic_handler]
fn panic(_: &PanicInfo) -> ! {
loop {}
}
// except according to those terms.
#![crate_type = "rlib"]
-#![feature(panic_implementation)]
+#![feature(panic_handler)]
#![no_std]
use core::panic::PanicInfo;
-#[panic_implementation]
+#[panic_handler]
fn panic(info: &PanicInfo) -> ! {
loop {}
}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-#![feature(panic_implementation, alloc_error_handler)]
+#![feature(panic_handler, alloc_error_handler)]
#![crate_type = "cdylib"]
#![no_std]
loop {}
}
-#[panic_implementation]
+#[panic_handler]
fn b(_: &core::panic::PanicInfo) -> ! {
loop {}
}
// compile-flags:-C panic=abort
-#![feature(alloc_error_handler, panic_implementation)]
+#![feature(alloc_error_handler, panic_handler)]
#![no_std]
#![no_main]
loop {}
}
-#[panic_implementation]
+#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }
// compile-flags:-C panic=abort
-#![feature(alloc_error_handler, panic_implementation)]
+#![feature(alloc_error_handler, panic_handler)]
#![no_std]
#![no_main]
loop {}
}
-#[panic_implementation]
+#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }
// compile-flags:-C panic=abort
-#![feature(alloc_error_handler, panic_implementation)]
+#![feature(alloc_error_handler, panic_handler)]
#![no_std]
#![no_main]
loop {}
}
-#[panic_implementation]
+#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }
--- /dev/null
+// 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_handler] //~ ERROR #[panic_handler] is an unstable feature (see issue #44489)
+fn panic(info: &PanicInfo) -> ! {
+ loop {}
+}
--- /dev/null
+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`.
+++ /dev/null
-// 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 #[panic_implementation] is an unstable feature (see issue #44489)
-fn panic(info: &PanicInfo) -> ! {
- loop {}
-}
+++ /dev/null
-error[E0658]: #[panic_implementation] is an unstable feature (see issue #44489)
- --> $DIR/feature-gate-panic-implementation.rs:18:1
- |
-LL | #[panic_implementation] //~ ERROR #[panic_implementation] is an unstable feature (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`.
#![no_std]
#![crate_type = "staticlib"]
-#![feature(panic_implementation, alloc_error_handler, alloc)]
+#![feature(panic_handler, alloc_error_handler, alloc)]
-#[panic_implementation]
+#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {}
}
#![no_std]
#![crate_type = "staticlib"]
-#![feature(panic_implementation, alloc_error_handler, alloc)]
+#![feature(panic_handler, alloc_error_handler, alloc)]
-#[panic_implementation]
+#[panic_handler]
fn panic(_: &core::panic::PanicInfo) -> ! {
loop {}
}
--- /dev/null
+// 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.
+
+// no-prefer-dynamic
+
+#![crate_type = "rlib"]
+#![feature(panic_handler)]
+#![no_std]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: &PanicInfo) -> ! {
+ loop {}
+}
--- /dev/null
+// 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
+
+#![feature(panic_handler)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(
+ info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
+) -> () //~ ERROR return type should be `!`
+{
+}
--- /dev/null
+error: return type should be `!`
+ --> $DIR/panic-handler-bad-signature-1.rs:22:6
+ |
+LL | ) -> () //~ ERROR return type should be `!`
+ | ^^
+
+error: argument should be `&PanicInfo`
+ --> $DIR/panic-handler-bad-signature-1.rs:21:11
+ |
+LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
+ | ^^^^^^^^^
+
+error: aborting due to 2 previous errors
+
--- /dev/null
+// 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
+
+#![feature(panic_handler)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(
+ info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
+) -> !
+{
+ loop {}
+}
--- /dev/null
+error: argument should be `&PanicInfo`
+ --> $DIR/panic-handler-bad-signature-2.rs:21:11
+ |
+LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
+ | ^^^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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
+
+#![feature(panic_handler)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic() -> ! { //~ ERROR function should have one argument
+ loop {}
+}
--- /dev/null
+error: function should have one argument
+ --> $DIR/panic-handler-bad-signature-3.rs:20:1
+ |
+LL | / fn panic() -> ! { //~ ERROR function should have one argument
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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
+
+#![feature(panic_handler)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic<T>(pi: &PanicInfo) -> ! {
+ //~^ ERROR should have no type parameters
+ loop {}
+}
--- /dev/null
+error: should have no type parameters
+ --> $DIR/panic-handler-bad-signature-4.rs:20:1
+ |
+LL | / fn panic<T>(pi: &PanicInfo) -> ! {
+LL | | //~^ ERROR should have no type parameters
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
--- /dev/null
+// 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
+
+#![feature(lang_items)]
+#![feature(panic_handler)]
+#![no_std]
+#![no_main]
+
+use core::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: &PanicInfo) -> ! {
+ loop {}
+}
+
+#[lang = "panic_impl"]
+fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`.
+ loop {}
+}
--- /dev/null
+error[E0152]: duplicate lang item found: `panic_impl`.
+ --> $DIR/panic-handler-duplicate.rs:26:1
+ |
+LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`.
+LL | | loop {}
+LL | | }
+ | |_^
+ |
+note: first defined here.
+ --> $DIR/panic-handler-duplicate.rs:21:1
+ |
+LL | / fn panic(info: &PanicInfo) -> ! {
+LL | | loop {}
+LL | | }
+ | |_^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0152`.
--- /dev/null
+// 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
+// error-pattern: language item required, but not found: `panic_info`
+
+#![feature(lang_items)]
+#![feature(no_core)]
+#![feature(panic_handler)]
+#![no_core]
+#![no_main]
+
+#[panic_handler]
+fn panic() -> ! {
+ loop {}
+}
+
+#[lang = "sized"]
+trait Sized {}
--- /dev/null
+error: language item required, but not found: `panic_info`
+
+error: aborting due to previous error
+
--- /dev/null
+// 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.
+
+// error-pattern: duplicate lang item found: `panic_impl`.
+
+#![feature(panic_handler)]
+
+use std::panic::PanicInfo;
+
+#[panic_handler]
+fn panic(info: PanicInfo) -> ! {
+ loop {}
+}
+
+fn main() {}
--- /dev/null
+error[E0152]: duplicate lang item found: `panic_impl`.
+ --> $DIR/panic-handler-std.rs:18:1
+ |
+LL | / fn panic(info: PanicInfo) -> ! {
+LL | | loop {}
+LL | | }
+ | |_^
+ |
+ = note: first defined in crate `std`.
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0152`.
+++ /dev/null
-// 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.
-
-// no-prefer-dynamic
-
-#![crate_type = "rlib"]
-#![feature(panic_implementation)]
-#![no_std]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(info: &PanicInfo) -> ! {
- loop {}
-}
+++ /dev/null
-// 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
-
-#![feature(panic_implementation)]
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(
- info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> () //~ ERROR return type should be `!`
-{
-}
+++ /dev/null
-error: return type should be `!`
- --> $DIR/panic-implementation-bad-signature-1.rs:22:6
- |
-LL | ) -> () //~ ERROR return type should be `!`
- | ^^
-
-error: argument should be `&PanicInfo`
- --> $DIR/panic-implementation-bad-signature-1.rs:21:11
- |
-LL | info: PanicInfo, //~ ERROR argument should be `&PanicInfo`
- | ^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
+++ /dev/null
-// 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
-
-#![feature(panic_implementation)]
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(
- info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
-) -> !
-{
- loop {}
-}
+++ /dev/null
-error: argument should be `&PanicInfo`
- --> $DIR/panic-implementation-bad-signature-2.rs:21:11
- |
-LL | info: &'static PanicInfo, //~ ERROR argument should be `&PanicInfo`
- | ^^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
+++ /dev/null
-// 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
-
-#![feature(panic_implementation)]
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic() -> ! { //~ ERROR function should have one argument
- loop {}
-}
+++ /dev/null
-error: function should have one argument
- --> $DIR/panic-implementation-bad-signature-3.rs:20:1
- |
-LL | / fn panic() -> ! { //~ ERROR function should have one argument
-LL | | loop {}
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
+++ /dev/null
-// 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
-
-#![feature(panic_implementation)]
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic<T>(pi: &PanicInfo) -> ! {
- //~^ ERROR `#[panic_implementation]` function should have no type parameters
- loop {}
-}
+++ /dev/null
-error: `#[panic_implementation]` function should have no type parameters
- --> $DIR/panic-implementation-bad-signature-4.rs:20:1
- |
-LL | / fn panic<T>(pi: &PanicInfo) -> ! {
-LL | | //~^ ERROR `#[panic_implementation]` function should have no type parameters
-LL | | loop {}
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
--- /dev/null
+// 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() {}
--- /dev/null
+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: remove this attribute
+ |
+note: lint level defined here
+ --> $DIR/panic-implementation-deprecated.rs:13:9
+ |
+LL | #![deny(deprecated)]
+ | ^^^^^^^^^^
+
+error: aborting due to previous error
+
+++ /dev/null
-// 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
-
-#![feature(lang_items)]
-#![feature(panic_implementation)]
-#![no_std]
-#![no_main]
-
-use core::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(info: &PanicInfo) -> ! {
- loop {}
-}
-
-#[lang = "panic_impl"]
-fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`.
- loop {}
-}
+++ /dev/null
-error[E0152]: duplicate lang item found: `panic_impl`.
- --> $DIR/panic-implementation-duplicate.rs:26:1
- |
-LL | / fn panic2(info: &PanicInfo) -> ! { //~ ERROR duplicate lang item found: `panic_impl`.
-LL | | loop {}
-LL | | }
- | |_^
- |
-note: first defined here.
- --> $DIR/panic-implementation-duplicate.rs:21:1
- |
-LL | / fn panic(info: &PanicInfo) -> ! {
-LL | | loop {}
-LL | | }
- | |_^
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0152`.
+++ /dev/null
-// 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
-// error-pattern: language item required, but not found: `panic_info`
-
-#![feature(lang_items)]
-#![feature(no_core)]
-#![feature(panic_implementation)]
-#![no_core]
-#![no_main]
-
-#[panic_implementation]
-fn panic() -> ! {
- loop {}
-}
-
-#[lang = "sized"]
-trait Sized {}
+++ /dev/null
-error: language item required, but not found: `panic_info`
-
-error: aborting due to previous error
-
+++ /dev/null
-// 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.
-
-// error-pattern: duplicate lang item found: `panic_impl`.
-
-#![feature(panic_implementation)]
-
-use std::panic::PanicInfo;
-
-#[panic_implementation]
-fn panic(info: PanicInfo) -> ! {
- loop {}
-}
-
-fn main() {}
+++ /dev/null
-error[E0152]: duplicate lang item found: `panic_impl`.
- --> $DIR/panic-implementation-std.rs:18:1
- |
-LL | / fn panic(info: PanicInfo) -> ! {
-LL | | loop {}
-LL | | }
- | |_^
- |
- = note: first defined in crate `std`.
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0152`.
#![crate_type = "rlib"]
#![no_std]
-#![feature(panic_implementation)]
+#![feature(panic_handler)]
-#[panic_implementation]
+#[panic_handler]
pub fn panic_fmt(_: &::core::panic::PanicInfo) -> ! {
|x: u8| x;
loop {}