From b3fbfe474b40b5747161668d830e7589af71be92 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Sun, 27 Jun 2021 03:54:06 +0200 Subject: [PATCH] Make `fmt::Arguments::as_str` unstably const --- library/core/src/fmt/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 409a84367a7d8..9ed49c1e3024f 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -444,8 +444,9 @@ impl<'a> Arguments<'a> { /// assert_eq!(format_args!("{}", 1).as_str(), None); /// ``` #[stable(feature = "fmt_as_str", since = "1.52.0")] + #[rustc_const_unstable(feature = "const_arguments_as_str", issue = "none")] #[inline] - pub fn as_str(&self) -> Option<&'static str> { + pub const fn as_str(&self) -> Option<&'static str> { match (self.pieces, self.args) { ([], []) => Some(""), ([s], []) => Some(s),