diff options
| author | Simon Sapin <simon.sapin@exyr.org> | 2018-04-05 15:45:33 +0200 |
|---|---|---|
| committer | Simon Sapin <simon.sapin@exyr.org> | 2018-04-12 00:13:43 +0200 |
| commit | ae6adf335c88cad4e4a1805a805ac49dd1350174 (patch) | |
| tree | de76138105b635d9001fcc22767f96b9662b8d9d /src | |
| parent | ad610bed83f43158892222a71336bdcaa167909a (diff) | |
| download | rust-ae6adf335c88cad4e4a1805a805ac49dd1350174.tar.gz rust-ae6adf335c88cad4e4a1805a805ac49dd1350174.zip | |
Move char::REPLACEMENT_CHARACTER to libcore
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/char.rs | 8 | ||||
| -rw-r--r-- | src/libstd_unicode/char.rs | 10 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 718c6b893ed..b5554a59db5 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -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` (�) 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 diff --git a/src/libstd_unicode/char.rs b/src/libstd_unicode/char.rs index 33e47ade8cb..460f83d875a 100644 --- a/src/libstd_unicode/char.rs +++ b/src/libstd_unicode/char.rs @@ -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` (�) 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}'; |
