1
Fork 0

Auto merge of #80851 - m-ou-se:panic-2021, r=petrochenkov

Implement Rust 2021 panic

This implements the Rust 2021 versions of `panic!()`. See https://github.com/rust-lang/rust/issues/80162 and https://github.com/rust-lang/rfcs/pull/3007.

It does so by replacing `{std, core}::panic!()` by a bulitin macro that expands to either `$crate::panic::panic_2015!(..)` or `$crate::panic::panic_2021!(..)` depending on the edition of the caller.

This does not yet make std's panic an alias for core's panic on Rust 2021 as the RFC proposes. That will be a separate change: https://github.com/rust-lang/rust/pull/80879/commits/c5273bdfb266c35e8eab9413aa8d58d27fdbe114 That change is blocked on figuring out what to do with https://github.com/rust-lang/rust/issues/80846 first.
This commit is contained in:
bors 2021-02-01 10:25:31 +00:00
commit e0d9f79399
26 changed files with 596 additions and 429 deletions

View file

@ -398,6 +398,8 @@ symbols! {
copysignf64,
core,
core_intrinsics,
core_panic,
core_panic_2015_macro,
core_panic_macro,
cosf32,
cosf64,
@ -795,6 +797,8 @@ symbols! {
owned_box,
packed,
panic,
panic_2015,
panic_2021,
panic_abort,
panic_bounds_check,
panic_handler,
@ -1096,6 +1100,8 @@ symbols! {
staticlib,
std,
std_inject,
std_panic,
std_panic_2015_macro,
std_panic_macro,
stmt,
stmt_expr_attributes,