@@ -2818,22 +2818,34 @@ impl<'a, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'tcx> {
28182818 kind : SpirvValueKind :: Def ( b_id) ,
28192819 ..
28202820 } ,
2821- // NOTE(fee1-dead): the standard `panic` takes in a `Location` due to `track_caller`.
2822- // but for `panic_nounwind` it does not, therefore we only look at the first two arguments.
2823- ] = args[ ..2 ]
2821+ ref other_args @ ..,
2822+ ] = args[ ..]
28242823 {
2825- if let Some ( const_msg) = const_str_as_utf8 ( & [ a_id, b_id] ) {
2826- decoded_format_args. const_pieces = Some ( [ const_msg] . into_iter ( ) . collect ( ) ) ;
2827- return Ok ( decoded_format_args) ;
2824+ // Optional `&'static panic::Location<'static>`.
2825+ if other_args. len ( ) <= 1 {
2826+ if let Some ( const_msg) = const_str_as_utf8 ( & [ a_id, b_id] ) {
2827+ decoded_format_args. const_pieces =
2828+ Some ( [ const_msg] . into_iter ( ) . collect ( ) ) ;
2829+ return Ok ( decoded_format_args) ;
2830+ }
28282831 }
28292832 }
28302833
2831- let format_args_id = match args {
2832- & [
2834+ let format_args_id = match * args {
2835+ // HACK(eddyb) `panic_nounwind_fmt` takes an extra argument.
2836+ [
2837+ SpirvValue {
2838+ kind : SpirvValueKind :: Def ( format_args_id) ,
2839+ ..
2840+ } ,
2841+ _, // `&'static panic::Location<'static>`
2842+ ]
2843+ | [
28332844 SpirvValue {
28342845 kind : SpirvValueKind :: Def ( format_args_id) ,
28352846 ..
28362847 } ,
2848+ _, // `force_no_backtrace: bool`
28372849 _, // `&'static panic::Location<'static>`
28382850 ] => format_args_id,
28392851
0 commit comments