stabilize const_unicode_case_lookup
This commit is contained in:
parent
9a9daddd0d
commit
eddab479fd
5 changed files with 10 additions and 5 deletions
|
@ -775,13 +775,12 @@ impl char {
|
||||||
/// In a const context:
|
/// In a const context:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(const_unicode_case_lookup)]
|
|
||||||
/// const CAPITAL_DELTA_IS_LOWERCASE: bool = 'Δ'.is_lowercase();
|
/// const CAPITAL_DELTA_IS_LOWERCASE: bool = 'Δ'.is_lowercase();
|
||||||
/// assert!(!CAPITAL_DELTA_IS_LOWERCASE);
|
/// assert!(!CAPITAL_DELTA_IS_LOWERCASE);
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn is_lowercase(self) -> bool {
|
pub const fn is_lowercase(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
|
@ -817,13 +816,12 @@ impl char {
|
||||||
/// In a const context:
|
/// In a const context:
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// #![feature(const_unicode_case_lookup)]
|
|
||||||
/// const CAPITAL_DELTA_IS_UPPERCASE: bool = 'Δ'.is_uppercase();
|
/// const CAPITAL_DELTA_IS_UPPERCASE: bool = 'Δ'.is_uppercase();
|
||||||
/// assert!(CAPITAL_DELTA_IS_UPPERCASE);
|
/// assert!(CAPITAL_DELTA_IS_UPPERCASE);
|
||||||
/// ```
|
/// ```
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[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]
|
#[inline]
|
||||||
pub const fn is_uppercase(self) -> bool {
|
pub const fn is_uppercase(self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
|
|
|
@ -134,7 +134,6 @@
|
||||||
#![feature(const_type_name)]
|
#![feature(const_type_name)]
|
||||||
#![feature(const_typed_swap)]
|
#![feature(const_typed_swap)]
|
||||||
#![feature(const_ub_checks)]
|
#![feature(const_ub_checks)]
|
||||||
#![feature(const_unicode_case_lookup)]
|
|
||||||
#![feature(core_intrinsics)]
|
#![feature(core_intrinsics)]
|
||||||
#![feature(coverage_attribute)]
|
#![feature(coverage_attribute)]
|
||||||
#![feature(do_not_recommend)]
|
#![feature(do_not_recommend)]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!
|
///! This file is generated by `./x run src/tools/unicode-table-generator`; do not edit manually!
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
|
||||||
const fn bitset_search<
|
const fn bitset_search<
|
||||||
const N: usize,
|
const N: usize,
|
||||||
const CHUNK_SIZE: usize,
|
const CHUNK_SIZE: usize,
|
||||||
|
@ -423,6 +424,7 @@ pub mod lowercase {
|
||||||
(5, 187), (6, 78), (7, 132),
|
(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 {
|
pub const fn lookup(c: char) -> bool {
|
||||||
super::bitset_search(
|
super::bitset_search(
|
||||||
c as u32,
|
c as u32,
|
||||||
|
@ -547,6 +549,7 @@ pub mod uppercase {
|
||||||
(2, 146), (2, 20), (3, 146), (3, 140), (3, 134), (4, 178), (4, 171),
|
(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 {
|
pub const fn lookup(c: char) -> bool {
|
||||||
super::bitset_search(
|
super::bitset_search(
|
||||||
c as u32,
|
c as u32,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]
|
||||||
const fn bitset_search<
|
const fn bitset_search<
|
||||||
const N: usize,
|
const N: usize,
|
||||||
const CHUNK_SIZE: usize,
|
const CHUNK_SIZE: usize,
|
||||||
|
|
|
@ -97,6 +97,10 @@ impl RawEmitter {
|
||||||
|
|
||||||
self.blank_line();
|
self.blank_line();
|
||||||
|
|
||||||
|
writeln!(
|
||||||
|
&mut self.file,
|
||||||
|
r#"#[cfg_attr(bootstrap, rustc_const_stable(feature = "const_unicode_case_lookup", since = "1.84.0"))]"#
|
||||||
|
).unwrap();
|
||||||
writeln!(&mut self.file, "pub const fn lookup(c: char) -> bool {{").unwrap();
|
writeln!(&mut self.file, "pub const fn lookup(c: char) -> bool {{").unwrap();
|
||||||
if first_code_point > 0x7f {
|
if first_code_point > 0x7f {
|
||||||
writeln!(&mut self.file, " (c as u32) >= {first_code_point:#04x} &&").unwrap();
|
writeln!(&mut self.file, " (c as u32) >= {first_code_point:#04x} &&").unwrap();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue