Skip to content

Commit 3a60212

Browse files
committed
access String's inner vec before taking pointer to make miri happy
1 parent 0918568 commit 3a60212

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/alloc/src/string.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,7 @@ impl String {
14231423

14241424
// SAFETY: Just reserved capacity for at least the length needed to encode `ch`.
14251425
unsafe {
1426-
core::char::encode_utf8_raw_unchecked(ch as u32, self.as_mut_ptr().add(self.len()));
1426+
core::char::encode_utf8_raw_unchecked(ch as u32, self.vec.as_mut_ptr().add(self.len()));
14271427
self.vec.set_len(len + ch_len);
14281428
}
14291429
}

0 commit comments

Comments
 (0)