Skip to content

Commit 0d3bf7f

Browse files
committed
char fix
1 parent 722d284 commit 0d3bf7f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

library/core/src/char/convert.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub(super) const fn from_u32(i: u32) -> Option<char> {
2121
/// Converts a `u32` to a `char`, ignoring validity. See [`char::from_u32_unchecked`].
2222
#[inline]
2323
#[must_use]
24+
#[cfg_attr(not(bootstrap), allow(redundant_transmutation))]
2425
pub(super) const unsafe fn from_u32_unchecked(i: u32) -> char {
2526
// SAFETY: the caller must guarantee that `i` is a valid char value.
2627
unsafe {
@@ -247,7 +248,7 @@ const fn char_try_from_u32(i: u32) -> Result<char, CharTryFromError> {
247248
Err(CharTryFromError(()))
248249
} else {
249250
// SAFETY: checked that it's a legal unicode value
250-
Ok(unsafe { transmute(i) })
251+
Ok(unsafe { char::from_u32_unchecked(i) })
251252
}
252253
}
253254

0 commit comments

Comments
 (0)