@@ -18,6 +18,7 @@ mod float;
1818#[ cfg( no_fp_fmt_parse) ]
1919mod nofloat;
2020mod num;
21+ mod rt;
2122
2223#[ stable( feature = "fmt_flags_align" , since = "1.28.0" ) ]
2324#[ cfg_attr( not( test) , rustc_diagnostic_item = "Alignment" ) ]
@@ -38,12 +39,6 @@ pub enum Alignment {
3839#[ stable( feature = "debug_builders" , since = "1.2.0" ) ]
3940pub use self :: builders:: { DebugList , DebugMap , DebugSet , DebugStruct , DebugTuple } ;
4041
41- #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
42- #[ doc( hidden) ]
43- pub mod rt {
44- pub mod v1;
45- }
46-
4742/// The type returned by formatter methods.
4843///
4944/// # Examples
@@ -227,7 +222,7 @@ impl<W: Write + ?Sized> Write for &mut W {
227222pub struct Formatter < ' a > {
228223 flags : u32 ,
229224 fill : char ,
230- align : rt:: v1 :: Alignment ,
225+ align : rt:: Alignment ,
231226 width : Option < usize > ,
232227 precision : Option < usize > ,
233228
@@ -248,7 +243,7 @@ impl<'a> Formatter<'a> {
248243 Formatter {
249244 flags : 0 ,
250245 fill : ' ' ,
251- align : rt:: v1 :: Alignment :: Unknown ,
246+ align : rt:: Alignment :: Unknown ,
252247 width : None ,
253248 precision : None ,
254249 buf,
@@ -433,17 +428,17 @@ impl<'a> Arguments<'a> {
433428 /// An `UnsafeArg` is required because the following invariants must be held
434429 /// in order for this function to be safe:
435430 /// 1. The `pieces` slice must be at least as long as `fmt`.
436- /// 2. Every [`rt::v1:: Argument::position`] value within `fmt` must be a
431+ /// 2. Every [`rt::Argument::position`] value within `fmt` must be a
437432 /// valid index of `args`.
438- /// 3. Every [`rt::v1:: Count::Param`] within `fmt` must contain a valid index of
433+ /// 3. Every [`rt::Count::Param`] within `fmt` must contain a valid index of
439434 /// `args`.
440435 #[ doc( hidden) ]
441436 #[ inline]
442437 #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" , issue = "none" ) ]
443438 pub fn new_v1_formatted (
444439 pieces : & ' a [ & ' static str ] ,
445440 args : & ' a [ ArgumentV1 < ' a > ] ,
446- fmt : & ' a [ rt:: v1 :: Argument ] ,
441+ fmt : & ' a [ rt:: Argument ] ,
447442 _unsafe_arg : UnsafeArg ,
448443 ) -> Arguments < ' a > {
449444 Arguments { pieces, fmt : Some ( fmt) , args }
@@ -505,7 +500,7 @@ pub struct Arguments<'a> {
505500 pieces : & ' a [ & ' static str ] ,
506501
507502 // Placeholder specs, or `None` if all specs are default (as in "{}{}").
508- fmt : Option < & ' a [ rt:: v1 :: Argument ] > ,
503+ fmt : Option < & ' a [ rt:: Argument ] > ,
509504
510505 // Dynamic arguments for interpolation, to be interleaved with string
511506 // pieces. (Every argument is preceded by a string piece.)
@@ -1281,7 +1276,7 @@ pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
12811276 Ok ( ( ) )
12821277}
12831278
1284- unsafe fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: v1 :: Argument , args : & [ ArgumentV1 < ' _ > ] ) -> Result {
1279+ unsafe fn run ( fmt : & mut Formatter < ' _ > , arg : & rt:: Argument , args : & [ ArgumentV1 < ' _ > ] ) -> Result {
12851280 fmt. fill = arg. format . fill ;
12861281 fmt. align = arg. format . align ;
12871282 fmt. flags = arg. format . flags ;
@@ -1302,11 +1297,11 @@ unsafe fn run(fmt: &mut Formatter<'_>, arg: &rt::v1::Argument, args: &[ArgumentV
13021297 ( value. formatter ) ( value. value , fmt)
13031298}
13041299
1305- unsafe fn getcount ( args : & [ ArgumentV1 < ' _ > ] , cnt : & rt:: v1 :: Count ) -> Option < usize > {
1300+ unsafe fn getcount ( args : & [ ArgumentV1 < ' _ > ] , cnt : & rt:: Count ) -> Option < usize > {
13061301 match * cnt {
1307- rt:: v1 :: Count :: Is ( n) => Some ( n) ,
1308- rt:: v1 :: Count :: Implied => None ,
1309- rt:: v1 :: Count :: Param ( i) => {
1302+ rt:: Count :: Is ( n) => Some ( n) ,
1303+ rt:: Count :: Implied => None ,
1304+ rt:: Count :: Param ( i) => {
13101305 debug_assert ! ( i < args. len( ) ) ;
13111306 // SAFETY: cnt and args come from the same Arguments,
13121307 // which guarantees this index is always within bounds.
@@ -1449,7 +1444,7 @@ impl<'a> Formatter<'a> {
14491444 // is zero
14501445 Some ( min) if self . sign_aware_zero_pad ( ) => {
14511446 let old_fill = crate :: mem:: replace ( & mut self . fill , '0' ) ;
1452- let old_align = crate :: mem:: replace ( & mut self . align , rt:: v1 :: Alignment :: Right ) ;
1447+ let old_align = crate :: mem:: replace ( & mut self . align , rt:: Alignment :: Right ) ;
14531448 write_prefix ( self , sign, prefix) ?;
14541449 let post_padding = self . padding ( min - width, Alignment :: Right ) ?;
14551450 self . buf . write_str ( buf) ?;
@@ -1553,10 +1548,10 @@ impl<'a> Formatter<'a> {
15531548 default : Alignment ,
15541549 ) -> result:: Result < PostPadding , Error > {
15551550 let align = match self . align {
1556- rt:: v1 :: Alignment :: Unknown => default,
1557- rt:: v1 :: Alignment :: Left => Alignment :: Left ,
1558- rt:: v1 :: Alignment :: Right => Alignment :: Right ,
1559- rt:: v1 :: Alignment :: Center => Alignment :: Center ,
1551+ rt:: Alignment :: Unknown => default,
1552+ rt:: Alignment :: Left => Alignment :: Left ,
1553+ rt:: Alignment :: Right => Alignment :: Right ,
1554+ rt:: Alignment :: Center => Alignment :: Center ,
15601555 } ;
15611556
15621557 let ( pre_pad, post_pad) = match align {
@@ -1788,10 +1783,10 @@ impl<'a> Formatter<'a> {
17881783 #[ stable( feature = "fmt_flags_align" , since = "1.28.0" ) ]
17891784 pub fn align ( & self ) -> Option < Alignment > {
17901785 match self . align {
1791- rt:: v1 :: Alignment :: Left => Some ( Alignment :: Left ) ,
1792- rt:: v1 :: Alignment :: Right => Some ( Alignment :: Right ) ,
1793- rt:: v1 :: Alignment :: Center => Some ( Alignment :: Center ) ,
1794- rt:: v1 :: Alignment :: Unknown => None ,
1786+ rt:: Alignment :: Left => Some ( Alignment :: Left ) ,
1787+ rt:: Alignment :: Right => Some ( Alignment :: Right ) ,
1788+ rt:: Alignment :: Center => Some ( Alignment :: Center ) ,
1789+ rt:: Alignment :: Unknown => None ,
17951790 }
17961791 }
17971792
0 commit comments