Skip to content

Commit

Permalink
Make fmt::Arguments::as_str unstably const
Browse files Browse the repository at this point in the history
  • Loading branch information
jonas-schievink committed Jun 27, 2021
1 parent a1411de commit b3fbfe4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion library/core/src/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit b3fbfe4

Please sign in to comment.