mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-29 10:13:54 +00:00
Rollup merge of #130773 - bjoernager:master, r=thomcc
Update Unicode escapes in `/library/core/src/char/methods.rs` `char::MAX` is inconsistent on how Unicode escapes should be formatted. This PR resolves that.
This commit is contained in:
commit
a5820b47d1
@ -69,7 +69,7 @@ impl char {
|
|||||||
/// assert_eq!(char::from_u32(value_at_max + 1), None);
|
/// assert_eq!(char::from_u32(value_at_max + 1), None);
|
||||||
/// ```
|
/// ```
|
||||||
#[stable(feature = "assoc_char_consts", since = "1.52.0")]
|
#[stable(feature = "assoc_char_consts", since = "1.52.0")]
|
||||||
pub const MAX: char = '\u{10ffff}';
|
pub const MAX: char = '\u{10FFFF}';
|
||||||
|
|
||||||
/// `U+FFFD REPLACEMENT CHARACTER` (<28>) is used in Unicode to represent a
|
/// `U+FFFD REPLACEMENT CHARACTER` (<28>) is used in Unicode to represent a
|
||||||
/// decoding error.
|
/// decoding error.
|
||||||
@ -1841,7 +1841,6 @@ pub const fn encode_utf16_raw(mut code: u32, dst: &mut [u16]) -> &mut [u16] {
|
|||||||
}
|
}
|
||||||
(2, [a, b, ..]) => {
|
(2, [a, b, ..]) => {
|
||||||
code -= 0x1_0000;
|
code -= 0x1_0000;
|
||||||
|
|
||||||
*a = (code >> 10) as u16 | 0xD800;
|
*a = (code >> 10) as u16 | 0xD800;
|
||||||
*b = (code & 0x3FF) as u16 | 0xDC00;
|
*b = (code & 0x3FF) as u16 | 0xDC00;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user