Skip to content

Commit eb14652

Browse files
committed
Skip scanning for surrogates when not known valid
1 parent 0842f2c commit eb14652

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
@@ -388,7 +388,7 @@ impl Wtf8Buf {
388388
_ => {
389389
// If we'll be pushing a string containing a surrogate, we may
390390
// no longer have UTF-8.
391-
if other.next_surrogate(0).is_some() {
391+
if self.is_known_utf8 && other.next_surrogate(0).is_some() {
392392
self.is_known_utf8 = false;
393393
}
394394

0 commit comments

Comments
 (0)