Move char::REPLACEMENT_CHARACTER to libcore

This commit is contained in:
Simon Sapin 2018-04-05 15:45:33 +02:00
parent ad610bed83
commit ae6adf335c
2 changed files with 10 additions and 8 deletions

View File

@ -77,6 +77,14 @@ const MAX_THREE_B: u32 = 0x10000;
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: char = '\u{10ffff}';
/// `U+FFFD REPLACEMENT CHARACTER` (<28>) is used in Unicode to represent a
/// decoding error.
///
/// It can occur, for example, when giving ill-formed UTF-8 bytes to
/// [`String::from_utf8_lossy`](../../std/string/struct.String.html#method.from_utf8_lossy).
#[stable(feature = "decode_utf16", since = "1.9.0")]
pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}';
/// Converts a `u32` to a `char`.
///
/// Note that all [`char`]s are valid [`u32`]s, and can be cast to one with

View File

@ -38,6 +38,8 @@ use tables::{conversions, derived_property, general_category, property};
pub use core::char::{MAX, from_digit, from_u32, from_u32_unchecked};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::char::{EscapeDebug, EscapeDefault, EscapeUnicode};
#[stable(feature = "decode_utf16", since = "1.9.0")]
pub use core::char::REPLACEMENT_CHARACTER;
#[stable(feature = "char_from_str", since = "1.20.0")]
pub use core::char::ParseCharError;
@ -1581,11 +1583,3 @@ impl fmt::Display for DecodeUtf16Error {
write!(f, "unpaired surrogate found: {:x}", self.code)
}
}
/// `U+FFFD REPLACEMENT CHARACTER` (<28>) is used in Unicode to represent a
/// decoding error.
///
/// It can occur, for example, when giving ill-formed UTF-8 bytes to
/// [`String::from_utf8_lossy`](../../std/string/struct.String.html#method.from_utf8_lossy).
#[stable(feature = "decode_utf16", since = "1.9.0")]
pub const REPLACEMENT_CHARACTER: char = '\u{FFFD}';