@@ -338,23 +338,19 @@ pub struct Arguments<'a> {
338338impl < ' a >  Arguments < ' a >  { 
339339    #[ inline]  
340340    #[ rustc_const_unstable( feature = "const_fmt_arguments_new" ,  issue = "none" ) ]  
341-     pub  const  fn  new_const ( pieces :  & ' a  [ & ' static  str ] )  -> Self  { 
342-         if  pieces. len ( )  > 1  { 
343-             // Since panic!() expands to panic_fmt(format_args!()), using panic! here is both a 
344-             // bit silly and also significantly increases the amount of MIR generated by panics. 
345-             crate :: panicking:: panic_nounwind ( "invalid args" ) ; 
346-         } 
341+     pub  const  fn  new_const < const  N :  usize > ( pieces :  & ' a  [ & ' static  str ;  N ] )  -> Self  { 
342+         const  {  assert ! ( N  <= 1 )  } ; 
347343        Arguments  {  pieces,  fmt :  None ,  args :  & [ ]  } 
348344    } 
349345
350346    /// When using the format_args!() macro, this function is used to generate the 
351347     /// Arguments structure. 
352348     #[ inline]  
353-     pub  fn  new_v1 ( pieces :   & ' a   [ & ' static   str ] ,   args :   & ' a   [ rt :: Argument < ' a > ] )  ->  Arguments < ' a >   { 
354-         if   pieces. len ( )  < args . len ( )  || pieces . len ( )  > args . len ( )  +  1   { 
355-              // See Arguments::new_const for why we don't use panic!. 
356-              crate :: panicking :: panic_nounwind ( "invalid args" ) ; 
357-         } 
349+     pub  fn  new_v1 < const   P :   usize ,   const   A :   usize > ( 
350+         pieces :   & ' a   [ & ' static   str ;   P ] , 
351+         args :   & ' a   [ rt :: Argument < ' a > ;   A ] , 
352+     )  ->  Arguments < ' a >   { 
353+         const   {   assert ! ( P  >=  A  &&  P  <=  A  +  1 ,   "invalid args" )   } 
358354        Arguments  {  pieces,  fmt :  None ,  args } 
359355    } 
360356
0 commit comments