diff options
| author | Jonas Schievink <jonasschievink@gmail.com> | 2021-06-27 03:54:06 +0200 |
|---|---|---|
| committer | Jonas Schievink <jonasschievink@gmail.com> | 2021-06-27 03:54:06 +0200 |
| commit | b3fbfe474b40b5747161668d830e7589af71be92 (patch) | |
| tree | b4d7d260823f9b76afc40e8802e78208f68d14aa | |
| parent | a1411de9de38e0fed728874580218338160eb185 (diff) | |
| download | rust-b3fbfe474b40b5747161668d830e7589af71be92.tar.gz rust-b3fbfe474b40b5747161668d830e7589af71be92.zip | |
Make `fmt::Arguments::as_str` unstably const
| -rw-r--r-- | library/core/src/fmt/mod.rs | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 409a84367a7..9ed49c1e302 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), |
