diff options
| author | nyanpasu64 <nyanpasu64@tuta.io> | 2021-10-25 18:42:22 -0700 |
|---|---|---|
| committer | nyanpasu64 <nyanpasu64@tuta.io> | 2021-10-25 23:22:57 -0700 |
| commit | 6b90c0f1b40966ff33bdbb8385357a958532fb8a (patch) | |
| tree | fbed1f6ca8441cedcbb6903b1b997aaa0f863288 /library/alloc | |
| parent | 17e13b549f5f83cd9ffca9a540090754eb95115c (diff) | |
| download | rust-6b90c0f1b40966ff33bdbb8385357a958532fb8a.tar.gz rust-6b90c0f1b40966ff33bdbb8385357a958532fb8a.zip | |
Fix copy-paste error in String::as_mut_vec() docs
Diffstat (limited to 'library/alloc')
| -rw-r--r-- | library/alloc/src/string.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/library/alloc/src/string.rs b/library/alloc/src/string.rs index f479bf231b3..85ee7ea9438 100644 --- a/library/alloc/src/string.rs +++ b/library/alloc/src/string.rs @@ -1500,10 +1500,11 @@ impl String { /// /// # Safety /// - /// This function is unsafe because it does not check that the bytes passed - /// to it are valid UTF-8. If this constraint is violated, it may cause - /// memory unsafety issues with future users of the `String`, as the rest of - /// the standard library assumes that `String`s are valid UTF-8. + /// This function is unsafe because the returned `&mut Vec` allows writing + /// bytes which are not valid UTF-8. If this constraint is violated, using + /// the original `String` after dropping the `&mut Vec` may violate memory + /// safety, as the rest of the standard library assumes that `String`s are + /// valid UTF-8. /// /// # Examples /// |
