Skip to content

Commit 978f592

Browse files
authored
Rollup merge of #132948 - RalfJung:const_unicode_case_lookup, r=Noratrieb
stabilize const_unicode_case_lookup Fixes #101400 See there for t-libs-api FCP
2 parents 5419f41 + eddab47 commit 978f592

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

library/core/src/char/methods.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -775,13 +775,12 @@ impl char {
775775
/// In a const context:
776776
///
777777
/// ```
778-
/// #![feature(const_unicode_case_lookup)]
779778
/// const CAPITAL_DELTA_IS_LOWERCASE: bool = 'Δ'.is_lowercase();
780779
/// assert!(!CAPITAL_DELTA_IS_LOWERCASE);
781780
/// ```
782781
#[must_use]
783782
#[stable(feature = "rust1", since = "1.0.0")]
784-
#[rustc_const_unstable(feature = "const_unicode_case_lookup", issue = "101400")]
783+
#[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")]
785784
#[inline]
786785
pub const fn is_lowercase(self) -> bool {
787786
match self {
@@ -817,13 +816,12 @@ impl char {
817816
/// In a const context:
818817
///
819818
/// ```
820-
/// #![feature(const_unicode_case_lookup)]
821819
/// const CAPITAL_DELTA_IS_UPPERCASE: bool = 'Δ'.is_uppercase();
822820
/// assert!(CAPITAL_DELTA_IS_UPPERCASE);
823821
/// ```
824822
#[must_use]
825823
#[stable(feature = "rust1", since = "1.0.0")]
826-
#[rustc_const_unstable(feature = "const_unicode_case_lookup", issue = "101400")]
824+
#[rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0")]
827825
#[inline]
828826
pub const fn is_uppercase(self) -> bool {
829827
match self {

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
#![feature(const_type_name)]
135135
#![feature(const_typed_swap)]
136136
#![feature(const_ub_checks)]
137-
#![feature(const_unicode_case_lookup)]
138137
#![feature(core_intrinsics)]
139138
#![feature(coverage_attribute)]
140139
#![feature(do_not_recommend)]

library/core/src/unicode/unicode_data.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!
22
33
#[inline(always)]
4+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
45
const fn bitset_search<
56
const N: usize,
67
const CHUNK_SIZE: usize,
@@ -423,6 +424,7 @@ pub mod lowercase {
423424
(5, 187), (6, 78), (7, 132),
424425
];
425426

427+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
426428
pub const fn lookup(c: char) -> bool {
427429
super::bitset_search(
428430
c as u32,
@@ -547,6 +549,7 @@ pub mod uppercase {
547549
(2, 146), (2, 20), (3, 146), (3, 140), (3, 134), (4, 178), (4, 171),
548550
];
549551

552+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
550553
pub const fn lookup(c: char) -> bool {
551554
super::bitset_search(
552555
c as u32,

src/tools/unicode-table-generator/src/range_search.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#[inline(always)]
2+
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
23
const fn bitset_search<
34
const N: usize,
45
const CHUNK_SIZE: usize,

src/tools/unicode-table-generator/src/raw_emitter.rs

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ impl RawEmitter {
9797

9898
self.blank_line();
9999

100+
writeln!(
101+
&mut self.file,
102+
r#"#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]"#
103+
).unwrap();
100104
writeln!(&mut self.file, "pub const fn lookup(c: char) -> bool {{").unwrap();
101105
if first_code_point > 0x7f {
102106
writeln!(&mut self.file, " (c as u32) >= {first_code_point:#04x} &&").unwrap();

0 commit comments

Comments
 (0)