Split out from_u32_unchecked from const_char_convert
It relies on the Option::unwrap function which is not const-stable (yet).
This commit is contained in:
parent
8a497b7181
commit
12c15a2bfe
@ -18,7 +18,6 @@ pub(super) const fn from_u32(i: u32) -> Option<char> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`].
|
/// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`].
|
||||||
#[rustc_const_unstable(feature = "const_char_convert", issue = "89259")]
|
|
||||||
#[inline]
|
#[inline]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
|
pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
|
||||||
|
@ -183,7 +183,7 @@ pub const fn from_u32(i: u32) -> Option<char> {
|
|||||||
/// assert_eq!('❤', c);
|
/// assert_eq!('❤', c);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "assoc_char_funcs", since = "1.52.0")]
|
#[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]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn from_u32_unchecked(i: u32) -> char {
|
pub const unsafe fn from_u32_unchecked(i: u32) -> char {
|
||||||
|
@ -120,7 +120,7 @@ pub const fn from_u32(i: u32) -> Option<char> {
|
|||||||
/// Converts a `u32` to a `char`, ignoring validity. Use [`char::from_u32_unchecked`].
|
/// Converts a `u32` to a `char`, ignoring validity. Use [`char::from_u32_unchecked`].
|
||||||
/// instead.
|
/// instead.
|
||||||
#[stable(feature = "char_from_unchecked", since = "1.5.0")]
|
#[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]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const unsafe fn from_u32_unchecked(i: u32) -> char {
|
pub const unsafe fn from_u32_unchecked(i: u32) -> char {
|
||||||
|
@ -105,6 +105,7 @@
|
|||||||
#![feature(const_caller_location)]
|
#![feature(const_caller_location)]
|
||||||
#![feature(const_cell_into_inner)]
|
#![feature(const_cell_into_inner)]
|
||||||
#![feature(const_char_convert)]
|
#![feature(const_char_convert)]
|
||||||
|
#![feature(const_char_from_u32_unchecked)]
|
||||||
#![feature(const_clone)]
|
#![feature(const_clone)]
|
||||||
#![feature(const_cmp)]
|
#![feature(const_cmp)]
|
||||||
#![feature(const_discriminant)]
|
#![feature(const_discriminant)]
|
||||||
|
Loading…
Reference in New Issue
Block a user