-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Emit a hard error when a panic occurs during const-eval
Previous, a panic during const evaluation would go through the `const_err` lint. This PR ensures that such a panic always causes compilation to fail.
- Loading branch information
Showing
15 changed files
with
118 additions
and
182 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,123 +1,103 @@ | ||
error: any use of this value will cause an error | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:7:15 | ||
| | ||
LL | const Z: () = std::panic!("cheese"); | ||
| --------------^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15 | ||
| | ||
= note: `#[deny(const_err)]` on by default | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:11:16 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:10:16 | ||
| | ||
LL | const Z2: () = std::panic!(); | ||
| ---------------^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:11:16 | ||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:15:15 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:13:15 | ||
| | ||
LL | const Y: () = std::unreachable!(); | ||
| --------------^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:15:15 | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:19:15 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:16:15 | ||
| | ||
LL | const X: () = std::unimplemented!(); | ||
| --------------^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:19:15 | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:23:15 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:19:15 | ||
| | ||
LL | const W: () = std::panic!(MSG); | ||
| --------------^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:23:15 | ||
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:27:20 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:22:20 | ||
| | ||
LL | const Z_CORE: () = core::panic!("cheese"); | ||
| -------------------^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:27:20 | ||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:31:21 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:25:21 | ||
| | ||
LL | const Z2_CORE: () = core::panic!(); | ||
| --------------------^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:31:21 | ||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:35:20 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:28:20 | ||
| | ||
LL | const Y_CORE: () = core::unreachable!(); | ||
| -------------------^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:35:20 | ||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:39:20 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:31:20 | ||
| | ||
LL | const X_CORE: () = core::unimplemented!(); | ||
| -------------------^^^^^^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:39:20 | ||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:43:20 | ||
error[E0080]: any use of this value will cause an error | ||
--> $DIR/const_panic.rs:34:20 | ||
| | ||
LL | const W_CORE: () = core::panic!(MSG); | ||
| -------------------^^^^^^^^^^^^^^^^^- | ||
| | | ||
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:43:20 | ||
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20 | ||
| | ||
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | ||
= note: for more information, see issue #71800 <https://github.com/rust-lang/rust/issues/71800> | ||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 10 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0080`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.