@@ -267,7 +267,7 @@ extern "C" {
267
267
#[ allow( missing_debug_implementations) ]
268
268
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
269
269
#[ doc( hidden) ]
270
- pub struct ArgumentV1 < ' a > {
270
+ pub struct Argument < ' a > {
271
271
value : & ' a Opaque ,
272
272
formatter : fn ( & Opaque , & mut Formatter < ' _ > ) -> Result ,
273
273
}
@@ -321,18 +321,18 @@ macro_rules! arg_new {
321
321
#[ doc( hidden) ]
322
322
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
323
323
#[ inline]
324
- pub fn $f<' b, T : $t>( x: & ' b T ) -> ArgumentV1 <' _> {
324
+ pub fn $f<' b, T : $t>( x: & ' b T ) -> Argument <' _> {
325
325
Self :: new( x, $t:: fmt)
326
326
}
327
327
} ;
328
328
}
329
329
330
- #[ rustc_diagnostic_item = "ArgumentV1Methods " ]
331
- impl < ' a > ArgumentV1 < ' a > {
330
+ #[ rustc_diagnostic_item = "ArgumentMethods " ]
331
+ impl < ' a > Argument < ' a > {
332
332
#[ doc( hidden) ]
333
333
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
334
334
#[ inline]
335
- pub fn new < ' b , T > ( x : & ' b T , f : fn ( & T , & mut Formatter < ' _ > ) -> Result ) -> ArgumentV1 < ' b > {
335
+ pub fn new < ' b , T > ( x : & ' b T , f : fn ( & T , & mut Formatter < ' _ > ) -> Result ) -> Argument < ' b > {
336
336
// SAFETY: `mem::transmute(x)` is safe because
337
337
// 1. `&'b T` keeps the lifetime it originated with `'b`
338
338
// (so as to not have an unbounded lifetime)
@@ -341,7 +341,7 @@ impl<'a> ArgumentV1<'a> {
341
341
// `mem::transmute(f)` is safe since `fn(&T, &mut Formatter<'_>) -> Result`
342
342
// and `fn(&Opaque, &mut Formatter<'_>) -> Result` have the same ABI
343
343
// (as long as `T` is `Sized`)
344
- unsafe { ArgumentV1 { formatter : mem:: transmute ( f) , value : mem:: transmute ( x) } }
344
+ unsafe { Argument { formatter : mem:: transmute ( f) , value : mem:: transmute ( x) } }
345
345
}
346
346
347
347
arg_new ! ( new_display, Display ) ;
@@ -356,8 +356,8 @@ impl<'a> ArgumentV1<'a> {
356
356
357
357
#[ doc( hidden) ]
358
358
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
359
- pub fn from_usize ( x : & usize ) -> ArgumentV1 < ' _ > {
360
- ArgumentV1 :: new ( x, USIZE_MARKER )
359
+ pub fn from_usize ( x : & usize ) -> Argument < ' _ > {
360
+ Argument :: new ( x, USIZE_MARKER )
361
361
}
362
362
363
363
fn as_usize ( & self ) -> Option < usize > {
@@ -377,7 +377,7 @@ impl<'a> ArgumentV1<'a> {
377
377
378
378
// flags available in the v1 format of format_args
379
379
#[ derive( Copy , Clone ) ]
380
- enum FlagV1 {
380
+ enum Flag {
381
381
SignPlus ,
382
382
SignMinus ,
383
383
Alternate ,
@@ -404,7 +404,7 @@ impl<'a> Arguments<'a> {
404
404
#[ doc( hidden) ]
405
405
#[ inline]
406
406
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
407
- pub fn new_v1 ( pieces : & ' a [ & ' static str ] , args : & ' a [ ArgumentV1 < ' a > ] ) -> Arguments < ' a > {
407
+ pub fn new_v1 ( pieces : & ' a [ & ' static str ] , args : & ' a [ Argument < ' a > ] ) -> Arguments < ' a > {
408
408
if pieces. len ( ) < args. len ( ) || pieces. len ( ) > args. len ( ) + 1 {
409
409
panic ! ( "invalid args" ) ;
410
410
}
@@ -416,7 +416,7 @@ impl<'a> Arguments<'a> {
416
416
#[ inline]
417
417
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
418
418
#[ rustc_const_unstable( feature = "const_fmt_arguments_new" , issue = "none" ) ]
419
- pub const fn new_v1 ( pieces : & ' a [ & ' static str ] , args : & ' a [ ArgumentV1 < ' a > ] ) -> Arguments < ' a > {
419
+ pub const fn new_v1 ( pieces : & ' a [ & ' static str ] , args : & ' a [ Argument < ' a > ] ) -> Arguments < ' a > {
420
420
if pieces. len ( ) < args. len ( ) || pieces. len ( ) > args. len ( ) + 1 {
421
421
panic ! ( "invalid args" ) ;
422
422
}
@@ -435,7 +435,7 @@ impl<'a> Arguments<'a> {
435
435
#[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
436
436
pub fn new_v1_formatted (
437
437
pieces : & ' a [ & ' static str ] ,
438
- args : & ' a [ ArgumentV1 < ' a > ] ,
438
+ args : & ' a [ Argument < ' a > ] ,
439
439
fmt : & ' a [ rt:: Placeholder ] ,
440
440
_unsafe_arg : UnsafeArg ,
441
441
) -> Arguments < ' a > {
@@ -502,7 +502,7 @@ pub struct Arguments<'a> {
502
502
503
503
// Dynamic arguments for interpolation, to be interleaved with string
504
504
// pieces. (Every argument is preceded by a string piece.)
505
- args : & ' a [ ArgumentV1 < ' a > ] ,
505
+ args : & ' a [ Argument < ' a > ] ,
506
506
}
507
507
508
508
impl < ' a > Arguments < ' a > {
@@ -1274,7 +1274,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
1274
1274
Ok ( ( ) )
1275
1275
}
1276
1276
1277
- unsafe fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: Placeholder , args : & [ ArgumentV1 < ' _ > ] ) -> Result {
1277
+ unsafe fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: Placeholder , args : & [ Argument < ' _ > ] ) -> Result {
1278
1278
fmt. fill = arg. fill ;
1279
1279
fmt. align = arg. align ;
1280
1280
fmt. flags = arg. flags ;
@@ -1295,7 +1295,7 @@ unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::Placeholder, args: &[ArgumentV1
1295
1295
( value. formatter ) ( value. value , fmt)
1296
1296
}
1297
1297
1298
- unsafe fn getcount ( args : & [ ArgumentV1 < ' _ > ] , cnt : & rt:: Count ) -> Option < usize > {
1298
+ unsafe fn getcount ( args : & [ Argument < ' _ > ] , cnt : & rt:: Count ) -> Option < usize > {
1299
1299
match * cnt {
1300
1300
rt:: Count :: Is ( n) => Some ( n) ,
1301
1301
rt:: Count :: Implied => None ,
@@ -1878,7 +1878,7 @@ impl<'a> Formatter<'a> {
1878
1878
#[ must_use]
1879
1879
#[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1880
1880
pub fn sign_plus ( & self ) -> bool {
1881
- self . flags & ( 1 << FlagV1 :: SignPlus as u32 ) != 0
1881
+ self . flags & ( 1 << Flag :: SignPlus as u32 ) != 0
1882
1882
}
1883
1883
1884
1884
/// Determines if the `-` flag was specified.
@@ -1907,7 +1907,7 @@ impl<'a> Formatter<'a> {
1907
1907
#[ must_use]
1908
1908
#[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1909
1909
pub fn sign_minus ( & self ) -> bool {
1910
- self . flags & ( 1 << FlagV1 :: SignMinus as u32 ) != 0
1910
+ self . flags & ( 1 << Flag :: SignMinus as u32 ) != 0
1911
1911
}
1912
1912
1913
1913
/// Determines if the `#` flag was specified.
@@ -1935,7 +1935,7 @@ impl<'a> Formatter<'a> {
1935
1935
#[ must_use]
1936
1936
#[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1937
1937
pub fn alternate ( & self ) -> bool {
1938
- self . flags & ( 1 << FlagV1 :: Alternate as u32 ) != 0
1938
+ self . flags & ( 1 << Flag :: Alternate as u32 ) != 0
1939
1939
}
1940
1940
1941
1941
/// Determines if the `0` flag was specified.
@@ -1961,17 +1961,17 @@ impl<'a> Formatter<'a> {
1961
1961
#[ must_use]
1962
1962
#[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1963
1963
pub fn sign_aware_zero_pad ( & self ) -> bool {
1964
- self . flags & ( 1 << FlagV1 :: SignAwareZeroPad as u32 ) != 0
1964
+ self . flags & ( 1 << Flag :: SignAwareZeroPad as u32 ) != 0
1965
1965
}
1966
1966
1967
1967
// FIXME: Decide what public API we want for these two flags.
1968
1968
// https://github.com/rust-lang/rust/issues/48584
1969
1969
fn debug_lower_hex ( & self ) -> bool {
1970
- self . flags & ( 1 << FlagV1 :: DebugLowerHex as u32 ) != 0
1970
+ self . flags & ( 1 << Flag :: DebugLowerHex as u32 ) != 0
1971
1971
}
1972
1972
1973
1973
fn debug_upper_hex ( & self ) -> bool {
1974
- self . flags & ( 1 << FlagV1 :: DebugUpperHex as u32 ) != 0
1974
+ self . flags & ( 1 << Flag :: DebugUpperHex as u32 ) != 0
1975
1975
}
1976
1976
1977
1977
/// Creates a [`DebugStruct`] builder designed to assist with creation of
@@ -2531,13 +2531,13 @@ pub(crate) fn pointer_fmt_inner(ptr_addr: usize, f: &mut Formatter<'_>) -> Resul
2531
2531
// or not to zero extend, and then unconditionally set it to get the
2532
2532
// prefix.
2533
2533
if f. alternate ( ) {
2534
- f. flags |= 1 << ( FlagV1 :: SignAwareZeroPad as u32 ) ;
2534
+ f. flags |= 1 << ( Flag :: SignAwareZeroPad as u32 ) ;
2535
2535
2536
2536
if f. width . is_none ( ) {
2537
2537
f. width = Some ( ( usize:: BITS / 4 ) as usize + 2 ) ;
2538
2538
}
2539
2539
}
2540
- f. flags |= 1 << ( FlagV1 :: Alternate as u32 ) ;
2540
+ f. flags |= 1 << ( Flag :: Alternate as u32 ) ;
2541
2541
2542
2542
let ret = LowerHex :: fmt ( & ptr_addr, f) ;
2543
2543
0 commit comments