Skip to content

Commit d7aa35e

Browse files
committed
Use Grapheme_Extend instead of Mn
1 parent d3c257b commit d7aa35e

File tree

3 files changed

+137
-174
lines changed

3 files changed

+137
-174
lines changed

src/libcore/char/methods.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ impl char {
229229
'\r' => EscapeDefaultState::Backslash('r'),
230230
'\n' => EscapeDefaultState::Backslash('n'),
231231
'\\' | '\'' | '"' => EscapeDefaultState::Backslash(self),
232+
_ if self.is_grapheme_extended() => {
233+
EscapeDefaultState::Unicode(self.escape_unicode())
234+
}
232235
_ if is_printable(self) => EscapeDefaultState::Char(self),
233236
_ => EscapeDefaultState::Unicode(self.escape_unicode()),
234237
};
@@ -692,16 +695,13 @@ impl char {
692695
general_category::Cc(self)
693696
}
694697

695-
/// Returns true if this `char` is a nonspacing mark code point, and false otherwise.
698+
/// Returns true if this `char` is an extended grapheme character, and false otherwise.
696699
///
697-
/// 'Nonspacing mark code point' is defined in terms of the Unicode General
698-
/// Category `Mn`.
699-
#[unstable(feature = "rustc_private",
700-
reason = "mainly needed for compiler internals",
701-
issue = "27812")]
700+
/// 'Extended grapheme character' is defined in terms of the Unicode Shaping and Rendering
701+
/// Category `Grapheme_Extend`.
702702
#[inline]
703-
pub fn is_nonspacing_mark(self) -> bool {
704-
general_category::Mn(self)
703+
pub(crate) fn is_grapheme_extended(self) -> bool {
704+
derived_property::Grapheme_Extend(self)
705705
}
706706

707707
/// Returns true if this `char` is numeric, and false otherwise.

0 commit comments

Comments
 (0)