@@ -341,7 +341,7 @@ impl<'a> Arguments<'a> {
341341 #[ doc( hidden) ] #[ inline]
342342 #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" ,
343343 issue = "0" ) ]
344- pub fn new_v1 ( pieces : & ' a [ & ' a str ] ,
344+ pub const fn new_v1 ( pieces : & ' a [ & ' a str ] ,
345345 args : & ' a [ ArgumentV1 < ' a > ] ) -> Arguments < ' a > {
346346 Arguments {
347347 pieces,
@@ -359,7 +359,7 @@ impl<'a> Arguments<'a> {
359359 #[ doc( hidden) ] #[ inline]
360360 #[ unstable( feature = "fmt_internals" , reason = "internal to format_args!" ,
361361 issue = "0" ) ]
362- pub fn new_v1_formatted ( pieces : & ' a [ & ' a str ] ,
362+ pub const fn new_v1_formatted ( pieces : & ' a [ & ' a str ] ,
363363 args : & ' a [ ArgumentV1 < ' a > ] ,
364364 fmt : & ' a [ rt:: v1:: Argument ] ) -> Arguments < ' a > {
365365 Arguments {
@@ -1492,7 +1492,7 @@ impl<'a> Formatter<'a> {
14921492 /// assert_eq!(&format!("{:t>6}", Foo), "tttttt");
14931493 /// ```
14941494 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1495- pub fn fill ( & self ) -> char { self . fill }
1495+ pub const fn fill ( & self ) -> char { self . fill }
14961496
14971497 /// Flag indicating what form of alignment was requested.
14981498 ///
@@ -1562,7 +1562,7 @@ impl<'a> Formatter<'a> {
15621562 /// assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
15631563 /// ```
15641564 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1565- pub fn width ( & self ) -> Option < usize > { self . width }
1565+ pub const fn width ( & self ) -> Option < usize > { self . width }
15661566
15671567 /// Optionally specified precision for numeric types.
15681568 ///
@@ -1589,7 +1589,7 @@ impl<'a> Formatter<'a> {
15891589 /// assert_eq!(&format!("{}", Foo(23.2)), "Foo(23.20)");
15901590 /// ```
15911591 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1592- pub fn precision ( & self ) -> Option < usize > { self . precision }
1592+ pub const fn precision ( & self ) -> Option < usize > { self . precision }
15931593
15941594 /// Determines if the `+` flag was specified.
15951595 ///
@@ -1617,7 +1617,9 @@ impl<'a> Formatter<'a> {
16171617 /// assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
16181618 /// ```
16191619 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1620- pub fn sign_plus ( & self ) -> bool { self . flags & ( 1 << FlagV1 :: SignPlus as u32 ) != 0 }
1620+ pub const fn sign_plus ( & self ) -> bool {
1621+ self . flags & ( 1 << FlagV1 :: SignPlus as u32 ) != 0
1622+ }
16211623
16221624 /// Determines if the `-` flag was specified.
16231625 ///
@@ -1643,7 +1645,9 @@ impl<'a> Formatter<'a> {
16431645 /// assert_eq!(&format!("{}", Foo(23)), "Foo(23)");
16441646 /// ```
16451647 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1646- pub fn sign_minus ( & self ) -> bool { self . flags & ( 1 << FlagV1 :: SignMinus as u32 ) != 0 }
1648+ pub const fn sign_minus ( & self ) -> bool {
1649+ self . flags & ( 1 << FlagV1 :: SignMinus as u32 ) != 0
1650+ }
16471651
16481652 /// Determines if the `#` flag was specified.
16491653 ///
@@ -1668,7 +1672,9 @@ impl<'a> Formatter<'a> {
16681672 /// assert_eq!(&format!("{}", Foo(23)), "23");
16691673 /// ```
16701674 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1671- pub fn alternate ( & self ) -> bool { self . flags & ( 1 << FlagV1 :: Alternate as u32 ) != 0 }
1675+ pub const fn alternate ( & self ) -> bool {
1676+ self . flags & ( 1 << FlagV1 :: Alternate as u32 ) != 0
1677+ }
16721678
16731679 /// Determines if the `0` flag was specified.
16741680 ///
@@ -1691,15 +1697,19 @@ impl<'a> Formatter<'a> {
16911697 /// assert_eq!(&format!("{:04}", Foo(23)), "23");
16921698 /// ```
16931699 #[ stable( feature = "fmt_flags" , since = "1.5.0" ) ]
1694- pub fn sign_aware_zero_pad ( & self ) -> bool {
1700+ pub const fn sign_aware_zero_pad ( & self ) -> bool {
16951701 self . flags & ( 1 << FlagV1 :: SignAwareZeroPad as u32 ) != 0
16961702 }
16971703
16981704 // FIXME: Decide what public API we want for these two flags.
16991705 // https://github.com/rust-lang/rust/issues/48584
1700- fn debug_lower_hex ( & self ) -> bool { self . flags & ( 1 << FlagV1 :: DebugLowerHex as u32 ) != 0 }
1706+ const fn debug_lower_hex ( & self ) -> bool {
1707+ self . flags & ( 1 << FlagV1 :: DebugLowerHex as u32 ) != 0
1708+ }
17011709
1702- fn debug_upper_hex ( & self ) -> bool { self . flags & ( 1 << FlagV1 :: DebugUpperHex as u32 ) != 0 }
1710+ const fn debug_upper_hex ( & self ) -> bool {
1711+ self . flags & ( 1 << FlagV1 :: DebugUpperHex as u32 ) != 0
1712+ }
17031713
17041714 /// Creates a [`DebugStruct`] builder designed to assist with creation of
17051715 /// [`fmt::Debug`] implementations for structs.
0 commit comments