stabilize const_arguments_as_str

This commit is contained in:
Ralf Jung 2024-11-02 12:01:56 +01:00
parent 67395551d0
commit 234d3de8b4
3 changed files with 2 additions and 5 deletions

View File

@ -438,10 +438,9 @@ impl<'a> Arguments<'a> {
/// assert_eq!(format_args!("{:?}", std::env::current_dir()).as_str(), None); /// assert_eq!(format_args!("{:?}", std::env::current_dir()).as_str(), None);
/// ``` /// ```
#[stable(feature = "fmt_as_str", since = "1.52.0")] #[stable(feature = "fmt_as_str", since = "1.52.0")]
#[rustc_const_unstable(feature = "const_arguments_as_str", issue = "103900")] #[rustc_const_stable(feature = "const_arguments_as_str", since = "CURRENT_RUSTC_VERSION")]
#[must_use] #[must_use]
#[inline] #[inline]
#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
pub const fn as_str(&self) -> Option<&'static str> { pub const fn as_str(&self) -> Option<&'static str> {
match (self.pieces, self.args) { match (self.pieces, self.args) {
([], []) => Some(""), ([], []) => Some(""),

View File

@ -114,7 +114,6 @@
#![feature(const_align_of_val_raw)] #![feature(const_align_of_val_raw)]
#![feature(const_align_offset)] #![feature(const_align_offset)]
#![feature(const_alloc_layout)] #![feature(const_alloc_layout)]
#![feature(const_arguments_as_str)]
#![feature(const_black_box)] #![feature(const_black_box)]
#![feature(const_char_encode_utf16)] #![feature(const_char_encode_utf16)]
#![feature(const_eval_select)] #![feature(const_eval_select)]

View File

@ -165,10 +165,9 @@ impl<'a> PanicMessage<'a> {
/// ///
/// See [`fmt::Arguments::as_str`] for details. /// See [`fmt::Arguments::as_str`] for details.
#[stable(feature = "panic_info_message", since = "1.81.0")] #[stable(feature = "panic_info_message", since = "1.81.0")]
#[rustc_const_unstable(feature = "const_arguments_as_str", issue = "103900")] #[rustc_const_stable(feature = "const_arguments_as_str", since = "CURRENT_RUSTC_VERSION")]
#[must_use] #[must_use]
#[inline] #[inline]
#[cfg_attr(not(bootstrap), rustc_const_stable_indirect)]
pub const fn as_str(&self) -> Option<&'static str> { pub const fn as_str(&self) -> Option<&'static str> {
self.message.as_str() self.message.as_str()
} }