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 0d3bf7f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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 @@ -247,7 +248,7 @@ const fn char_try_from_u32(i: u32) -> Result<char, CharTryFromError> {
Err(CharTryFromError(()))
} else {
// SAFETY: checked that it's a legal unicode value
Ok(unsafe { transmute(i) })
Ok(unsafe { char::from_u32_unchecked(i) })
}
}

Expand Down

0 comments on commit 0d3bf7f

Please sign in to comment.