@@ -201,27 +201,16 @@ pub unsafe trait PanicPayload: crate::fmt::Display {
201
201
#[ unstable( feature = "panic_internals" , issue = "none" ) ]
202
202
#[ doc( hidden) ]
203
203
pub macro const_panic {
204
- ( $const_msg: literal, $runtime_msg: literal, $( $arg: ident : $ty: ty = $val: expr) , * $( , ) ?) => { {
205
- // Wrap call to `const_eval_select` in a function so that we can
206
- // add the `rustc_allow_const_fn_unstable`. This is okay to do
207
- // because both variants will panic, just with different messages.
208
- #[ rustc_allow_const_fn_unstable( const_eval_select) ]
209
- #[ inline( always) ]
210
- #[ track_caller]
211
- #[ cfg_attr( bootstrap, rustc_const_stable( feature = "const_panic" , since = "CURRENT_RUSTC_VERSION" ) ) ]
212
- const fn do_panic ( $( $arg: $ty) , * ) -> ! {
213
- $crate:: intrinsics:: const_eval_select!(
214
- @capture { $( $arg: $ty) , * } -> !:
215
- if const #[ track_caller] {
216
- $crate :: panic!( $const_msg)
217
- } else #[ track_caller] {
218
- $crate :: panic!( $runtime_msg)
219
- }
220
- )
221
- }
222
-
223
- do_panic ( $( $val) , * )
224
- } } ,
204
+ ( $const_msg: literal, $runtime_msg: literal, $( $arg: ident : $ty: ty = $val: expr) , * $( , ) ?) => {
205
+ $crate:: intrinsics:: const_eval_select!(
206
+ @capture { $( $arg: $ty = $val) , * } -> !:
207
+ if const #[ track_caller] {
208
+ $crate :: panic!( $const_msg)
209
+ } else #[ track_caller] {
210
+ $crate :: panic!( $runtime_msg)
211
+ }
212
+ )
213
+ } ,
225
214
// We support leaving away the `val` expressions for *all* arguments
226
215
// (but not for *some* arguments, that's too tricky).
227
216
( $const_msg: literal, $runtime_msg: literal, $( $arg: ident : $ty: ty) , * $( , ) ?) => {
0 commit comments