Stabilise 'const_make_ascii'

This commit is contained in:
Gabriel Bjørnager Jensen 2024-10-09 22:33:27 +02:00 committed by David Tolnay
parent 9322d183f4
commit 3c31729887
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82
5 changed files with 16 additions and 9 deletions

View File

@ -1282,8 +1282,9 @@ pub const fn eq_ignore_ascii_case(&self, other: &char) -> bool {
///
/// [`to_ascii_uppercase()`]: #method.to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_uppercase(&mut self) {
*self = self.to_ascii_uppercase();
}
@ -1308,8 +1309,9 @@ pub const fn make_ascii_uppercase(&mut self) {
///
/// [`to_ascii_lowercase()`]: #method.to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_lowercase(&mut self) {
*self = self.to_ascii_lowercase();
}

View File

@ -125,7 +125,6 @@
#![feature(const_heap)]
#![feature(const_index_range_slice_index)]
#![feature(const_likely)]
#![feature(const_make_ascii)]
#![feature(const_nonnull_new)]
#![feature(const_num_midpoint)]
#![feature(const_option_ext)]

View File

@ -624,8 +624,9 @@ pub const fn eq_ignore_ascii_case(&self, other: &u8) -> bool {
///
/// [`to_ascii_uppercase`]: Self::to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_uppercase(&mut self) {
*self = self.to_ascii_uppercase();
}
@ -650,8 +651,9 @@ pub const fn make_ascii_uppercase(&mut self) {
///
/// [`to_ascii_lowercase`]: Self::to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_lowercase(&mut self) {
*self = self.to_ascii_lowercase();
}

View File

@ -67,8 +67,9 @@ pub fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool {
///
/// [`to_ascii_uppercase`]: #method.to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_uppercase(&mut self) {
// FIXME(const-hack): We would like to simply iterate using `for` loops but this isn't currently allowed in constant expressions.
let mut i = 0;
@ -89,8 +90,9 @@ pub const fn make_ascii_uppercase(&mut self) {
///
/// [`to_ascii_lowercase`]: #method.to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_lowercase(&mut self) {
// FIXME(const-hack): We would like to simply iterate using `for` loops but this isn't currently allowed in constant expressions.
let mut i = 0;

View File

@ -2475,8 +2475,9 @@ pub fn eq_ignore_ascii_case(&self, other: &str) -> bool {
/// assert_eq!("GRüßE, JüRGEN ❤", s);
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_uppercase(&mut self) {
// SAFETY: changing ASCII letters only does not invalidate UTF-8.
let me = unsafe { self.as_bytes_mut() };
@ -2503,8 +2504,9 @@ pub const fn make_ascii_uppercase(&mut self) {
/// assert_eq!("grÜße, jÜrgen ❤", s);
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.23.0")]
#[rustc_const_unstable(feature = "const_make_ascii", issue = "130698")]
#[rustc_const_stable(feature = "const_make_ascii", since = "CURRENT_RUSTC_VERSION")]
#[inline]
#[cfg_attr(bootstrap, rustc_allow_const_fn_unstable(const_mut_refs))]
pub const fn make_ascii_lowercase(&mut self) {
// SAFETY: changing ASCII letters only does not invalidate UTF-8.
let me = unsafe { self.as_bytes_mut() };