Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4471500

Browse files
committedFeb 7, 2025·
Skip scanning for surrogates when known invalid
1 parent 91552a5 commit 4471500

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

0 commit comments

Comments
 (0)
Please sign in to comment.