@@ -392,8 +392,31 @@ enum FlagV1 {
392
392
}
393
393
394
394
impl < ' a > Arguments < ' a > {
395
+ #[ doc( hidden) ]
396
+ #[ inline]
397
+ #[ unstable( feature = "fmt_internals" , issue = "none" ) ]
398
+ #[ rustc_const_unstable( feature = "const_fmt_arguments_new" , issue = "none" ) ]
399
+ pub const fn new_const ( pieces : & ' a [ & ' static str ] ) -> Self {
400
+ if pieces. len ( ) > 1 {
401
+ panic ! ( "invalid args" ) ;
402
+ }
403
+ Arguments { pieces, fmt : None , args : & [ ] }
404
+ }
405
+
395
406
/// When using the format_args!() macro, this function is used to generate the
396
407
/// Arguments structure.
408
+ #[ cfg( not( bootstrap) ) ]
409
+ #[ doc( hidden) ]
410
+ #[ inline]
411
+ #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
412
+ pub fn new_v1 ( pieces : & ' a [ & ' static str ] , args : & ' a [ ArgumentV1 < ' a > ] ) -> Arguments < ' a > {
413
+ if pieces. len ( ) < args. len ( ) || pieces. len ( ) > args. len ( ) + 1 {
414
+ panic ! ( "invalid args" ) ;
415
+ }
416
+ Arguments { pieces, fmt : None , args }
417
+ }
418
+
419
+ #[ cfg( bootstrap) ]
397
420
#[ doc( hidden) ]
398
421
#[ inline]
399
422
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
@@ -417,8 +440,7 @@ impl<'a> Arguments<'a> {
417
440
#[ doc( hidden) ]
418
441
#[ inline]
419
442
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
420
- #[ rustc_const_unstable( feature = "const_fmt_arguments_new" , issue = "none" ) ]
421
- pub const fn new_v1_formatted (
443
+ pub fn new_v1_formatted (
422
444
pieces : & ' a [ & ' static str ] ,
423
445
args : & ' a [ ArgumentV1 < ' a > ] ,
424
446
fmt : & ' a [ rt:: v1:: Argument ] ,
0 commit comments