-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples. #38839
Conversation
/// | ||
/// unsafe { | ||
/// let bytes = b"foo\xc3".to_vec(); | ||
/// let string = String::from_utf8_unchecked(bytes); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this Undefined Behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it still UB if it doesn't get represented as a string?
Please no :( |
In retrospect, I agree. I overlooked that what I am doing is UB. |
Let me know if the latest changes look better. |
Much nicer :) |
Squashed. |
📌 Commit 4794f95 has been approved by |
…omez Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples. None
No description provided.