Uh oh!
There was an error while loading. Please reload this page.
Update vec.rs - #38874
Conversation
Add a warning not to convert char* from c to Vec<u8> (I thought you could until I asked on irc)
rust-highfive
commented
Jan 6, 2017
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @brson (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
steveklabnik
left a comment
There was a problem hiding this comment.
one tiny nit. Thank you!
| /// Violating these may cause problems like corrupting the allocator's | ||
| /// internal datastructures. | ||
| /// internal datastructures. For example it is **not** safe | ||
| /// to build a `Vec<u8>` from a C pointer to a char array and a `size_t`. |
There was a problem hiding this comment.
could you put graves on the char as well, please?
Changed language to stress char is the C meaning (u8) not unicode.
steveklabnik
commented
Jan 6, 2017
@bors: r+ rollup thank you! |
bors
commented
Jan 6, 2017
📌 Commit 0a85d5f has been approved by |
Update vec.rs Add a warning not to convert char* from c to Vec<u8> (I thought you could until I asked on irc). Reasoning is that it will help people avoid an error that could cause crashes and undefined behaviour. Only drawback is that it could confuse someone not familiar with C, but beginners are unlikely to be using this function anyway.
Add a warning not to convert char* from c to Vec (I thought you could until I asked on irc).
Reasoning is that it will help people avoid an error that could cause crashes and undefined behaviour. Only drawback is that it could confuse someone not familiar with C, but beginners are unlikely to be using this function anyway.