Skip to content

Commit

Permalink
char fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bend-n committed Jan 26, 2025
1 parent 722d284 commit 9666623
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions library/core/src/char/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub(super) const fn from_u32(i: u32) -> Option<char> {
/// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`].
#[inline]
#[must_use]
#[cfg_attr(not(bootstrap), allow(redundant_transmutation))]
pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
// SAFETY: the caller must guarantee that `i` is a valid char value.
unsafe {
Expand Down Expand Up @@ -229,6 +230,7 @@ impl FromStr for char {
}

#[inline]
#[cfg_attr(not(bootstrap), allow(redundant_transmutation))]
const fn char_try_from_u32(i: u32) -> Result<char, CharTryFromError> {
// This is an optimized version of the check
// (i > MAX as u32) || (i >= 0xD800 && i <= 0xDFFF),
Expand Down

0 comments on commit 9666623

Please sign in to comment.