From f9063ff15cfdd39d84cefd4c1bf1bb8077a976ad Mon Sep 17 00:00:00 2001 From: chansuke Date: Sun, 10 Nov 2024 22:03:42 +0900 Subject: [PATCH 1/4] Update the doc comment of `ASCII_CASE_MASK` --- core/src/num/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/num/mod.rs b/core/src/num/mod.rs index 5a69dc0c7242b..51abf65cee68e 100644 --- a/core/src/num/mod.rs +++ b/core/src/num/mod.rs @@ -528,7 +528,7 @@ impl isize { midpoint_impl! { isize, signed } } -/// If the 6th bit is set ascii is lower case. +/// If the bit selected by this mask is set, ascii is lower case. const ASCII_CASE_MASK: u8 = 0b0010_0000; impl u8 { From 7fafe990a8b0d76bb82d520ccbd6b1c0fde80bdc Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 12 Nov 2024 15:13:31 +0100 Subject: [PATCH 2/4] stabilize const_unicode_case_lookup --- core/src/char/methods.rs | 6 ++---- core/src/lib.rs | 1 - core/src/unicode/unicode_data.rs | 3 +++ 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/char/methods.rs b/core/src/char/methods.rs index 02cc0f9d77042..6e79e79c14398 100644 --- a/core/src/char/methods.rs +++ b/core/src/char/methods.rs @@ -775,13 +775,12 @@ impl char { /// In a const context: /// /// ``` - /// #![feature(const_unicode_case_lookup)] /// const CAPITAL_DELTA_IS_LOWERCASE: bool = 'Δ'.is_lowercase(); /// assert!(!CAPITAL_DELTA_IS_LOWERCASE); /// ``` #[must_use] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_unicode_case_lookup", issue = "101400")] + #[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")] #[inline] pub const fn is_lowercase(self) -> bool { match self { @@ -817,13 +816,12 @@ impl char { /// In a const context: /// /// ``` - /// #![feature(const_unicode_case_lookup)] /// const CAPITAL_DELTA_IS_UPPERCASE: bool = 'Δ'.is_uppercase(); /// assert!(CAPITAL_DELTA_IS_UPPERCASE); /// ``` #[must_use] #[stable(feature = "rust1", since = "1.0.0")] - #[rustc_const_unstable(feature = "const_unicode_case_lookup", issue = "101400")] + #[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")] #[inline] pub const fn is_uppercase(self) -> bool { match self { diff --git a/core/src/lib.rs b/core/src/lib.rs index 2f4f33dcc85de..1cc353befb81d 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -134,7 +134,6 @@ #![feature(const_type_name)] #![feature(const_typed_swap)] #![feature(const_ub_checks)] -#![feature(const_unicode_case_lookup)] #![feature(core_intrinsics)] #![feature(coverage_attribute)] #![feature(do_not_recommend)] diff --git a/core/src/unicode/unicode_data.rs b/core/src/unicode/unicode_data.rs index 4655d35e9c437..7f4826402eb53 100644 --- a/core/src/unicode/unicode_data.rs +++ b/core/src/unicode/unicode_data.rs @@ -1,6 +1,7 @@ ///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually! #[inline(always)] +#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))] const fn bitset_search< const N: usize, const CHUNK_SIZE: usize, @@ -423,6 +424,7 @@ pub mod lowercase { (5, 187), (6, 78), (7, 132), ]; + #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))] pub const fn lookup(c: char) -> bool { super::bitset_search( c as u32, @@ -547,6 +549,7 @@ pub mod uppercase { (2, 146), (2, 20), (3, 146), (3, 140), (3, 134), (4, 178), (4, 171), ]; + #[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))] pub const fn lookup(c: char) -> bool { super::bitset_search( c as u32, From 6ab50dd1c971a82a015ee154a5727786a07cf113 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 12 Nov 2024 21:42:15 +0100 Subject: [PATCH 3/4] stabilize const_option_ext --- core/src/lib.rs | 1 - core/src/option.rs | 8 ++++---- core/tests/lib.rs | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/core/src/lib.rs b/core/src/lib.rs index 2f4f33dcc85de..c20bb8d78762e 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -120,7 +120,6 @@ #![feature(const_float_methods)] #![feature(const_heap)] #![feature(const_nonnull_new)] -#![feature(const_option_ext)] #![feature(const_pin_2)] #![feature(const_ptr_is_null)] #![feature(const_ptr_sub_ptr)] diff --git a/core/src/option.rs b/core/src/option.rs index 461879386225a..29d1956af9559 100644 --- a/core/src/option.rs +++ b/core/src/option.rs @@ -738,7 +738,7 @@ impl Option { #[inline] #[must_use] #[stable(feature = "pin", since = "1.33.0")] - #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")] + #[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")] pub const fn as_pin_ref(self: Pin<&Self>) -> Option> { // FIXME(const-hack): use `map` once that is possible match Pin::get_ref(self).as_ref() { @@ -755,7 +755,7 @@ impl Option { #[inline] #[must_use] #[stable(feature = "pin", since = "1.33.0")] - #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")] + #[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")] pub const fn as_pin_mut(self: Pin<&mut Self>) -> Option> { // SAFETY: `get_unchecked_mut` is never used to move the `Option` inside `self`. // `x` is guaranteed to be pinned because it comes from `self` which is pinned. @@ -802,7 +802,7 @@ impl Option { #[inline] #[must_use] #[stable(feature = "option_as_slice", since = "1.75.0")] - #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")] + #[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")] pub const fn as_slice(&self) -> &[T] { // SAFETY: When the `Option` is `Some`, we're using the actual pointer // to the payload, with a length of 1, so this is equivalent to @@ -857,7 +857,7 @@ impl Option { #[inline] #[must_use] #[stable(feature = "option_as_slice", since = "1.75.0")] - #[rustc_const_unstable(feature = "const_option_ext", issue = "91930")] + #[rustc_const_stable(feature = "const_option_ext", since = "CURRENT_RUSTC_VERSION")] pub const fn as_mut_slice(&mut self) -> &mut [T] { // SAFETY: When the `Option` is `Some`, we're using the actual pointer // to the payload, with a length of 1, so this is equivalent to diff --git a/core/tests/lib.rs b/core/tests/lib.rs index b9706ea2a9e35..f515e9e41097e 100644 --- a/core/tests/lib.rs +++ b/core/tests/lib.rs @@ -21,7 +21,6 @@ #![feature(const_eval_select)] #![feature(const_heap)] #![feature(const_nonnull_new)] -#![feature(const_option_ext)] #![feature(const_pin_2)] #![feature(const_trait_impl)] #![feature(core_intrinsics)] From a0c0c40eafd3e44904cb50e7e8b542a532b815b8 Mon Sep 17 00:00:00 2001 From: Asger Hautop Drewsen Date: Tue, 12 Nov 2024 22:36:54 +0100 Subject: [PATCH 4/4] Add tracking issue number to unsigned_nonzero_div_ceil feature --- core/src/num/nonzero.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/num/nonzero.rs b/core/src/num/nonzero.rs index c7eb9d0f3fd2d..b883a0c2ec7f9 100644 --- a/core/src/num/nonzero.rs +++ b/core/src/num/nonzero.rs @@ -1233,7 +1233,7 @@ macro_rules! nonzero_integer_signedness_dependent_impls { #[doc = concat!("let three = NonZero::new(3", stringify!($Int), ").unwrap();")] /// assert_eq!(three.div_ceil(two), two); /// ``` - #[unstable(feature = "unsigned_nonzero_div_ceil", issue = "none")] + #[unstable(feature = "unsigned_nonzero_div_ceil", issue = "132968")] #[must_use = "this returns the result of the operation, \ without modifying the original"] #[inline]