Skip to content

Commit b3fbfe4

Browse files
Make fmt::Arguments::as_str unstably const
1 parent a1411de commit b3fbfe4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/fmt/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,9 @@ impl<'a> Arguments<'a> {
444444
/// assert_eq!(format_args!("{}", 1).as_str(), None);
445445
/// ```
446446
#[stable(feature = "fmt_as_str", since = "1.52.0")]
447+
#[rustc_const_unstable(feature = "const_arguments_as_str", issue = "none")]
447448
#[inline]
448-
pub fn as_str(&self) -> Option<&'static str> {
449+
pub const fn as_str(&self) -> Option<&'static str> {
449450
match (self.pieces, self.args) {
450451
([], []) => Some(""),
451452
([s], []) => Some(s),

0 commit comments

Comments
 (0)