Skip to content

Commit c5b3cb5

Browse files
committed
Skip scanning for surrogates when not known valid
1 parent 1de1739 commit c5b3cb5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/std/src/sys_common/wtf8.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl Wtf8Buf {
383383
_ => {
384384
// If we'll be pushing a string containing a surrogate, we may
385385
// no longer have UTF-8.
386-
if other.next_surrogate(0).is_some() {
386+
if self.is_known_utf8 && other.next_surrogate(0).is_some() {
387387
self.is_known_utf8 = false;
388388
}
389389

0 commit comments

Comments
 (0)