From 12c15a2bfe9f4144003366bc72e10387fbef9aab Mon Sep 17 00:00:00 2001 From: est31 Date: Thu, 29 Sep 2022 14:23:47 +0200 Subject: [PATCH] Split out from_u32_unchecked from const_char_convert It relies on the Option::unwrap function which is not const-stable (yet). --- library/core/src/char/convert.rs | 1 - library/core/src/char/methods.rs | 2 +- library/core/src/char/mod.rs | 2 +- library/core/src/lib.rs | 1 + 4 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/core/src/char/convert.rs b/library/core/src/char/convert.rs index 7c5f82f5ea4..f1a51a550f5 100644 --- a/library/core/src/char/convert.rs +++ b/library/core/src/char/convert.rs @@ -18,7 +18,6 @@ pub(super) const fn from_u32(i: u32) -> Option { } /// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`]. -#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] #[inline] #[must_use] pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char { diff --git a/library/core/src/char/methods.rs b/library/core/src/char/methods.rs index b7a63b7c675..4416602c0bd 100644 --- a/library/core/src/char/methods.rs +++ b/library/core/src/char/methods.rs @@ -183,7 +183,7 @@ pub const fn from_u32(i: u32) -> Option { /// assert_eq!('❤', c); /// ``` #[stable(feature = "assoc_char_funcs", since = "1.52.0")] - #[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] + #[rustc_const_unstable(feature = "const_char_from_u32_unchecked", issue = "89259")] #[must_use] #[inline] pub const unsafe fn from_u32_unchecked(i: u32) -> char { diff --git a/library/core/src/char/mod.rs b/library/core/src/char/mod.rs index b34a7121631..bb3a96a19fb 100644 --- a/library/core/src/char/mod.rs +++ b/library/core/src/char/mod.rs @@ -120,7 +120,7 @@ pub const fn from_u32(i: u32) -> Option { /// Converts a `u32` to a `char`, ignoring validity. Use [`char::from_u32_unchecked`]. /// instead. #[stable(feature = "char_from_unchecked", since = "1.5.0")] -#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")] +#[rustc_const_unstable(feature = "const_char_from_u32_unchecked", issue = "89259")] #[must_use] #[inline] pub const unsafe fn from_u32_unchecked(i: u32) -> char { diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index c3df0d4f9b9..f98ea6985b0 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -105,6 +105,7 @@ #![feature(const_caller_location)] #![feature(const_cell_into_inner)] #![feature(const_char_convert)] +#![feature(const_char_from_u32_unchecked)] #![feature(const_clone)] #![feature(const_cmp)] #![feature(const_discriminant)]