Skip to content
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

Merged
merged 1 commit into from
Jan 10, 2017

Conversation

frewsxcv
Copy link
Member

@frewsxcv frewsxcv commented Jan 5, 2017

No description provided.

///
/// unsafe {
/// let bytes = b"foo\xc3".to_vec();
/// let string = String::from_utf8_unchecked(bytes);
Copy link
Member

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?

Copy link
Member Author

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?

@strega-nil
Copy link
Contributor

Please no :(

@frewsxcv
Copy link
Member Author

frewsxcv commented Jan 5, 2017

Please no :(

In retrospect, I agree. I overlooked that what I am doing is UB.

@frewsxcv
Copy link
Member Author

frewsxcv commented Jan 5, 2017

Let me know if the latest changes look better.

@strega-nil
Copy link
Contributor

Much nicer :)

@frewsxcv
Copy link
Member Author

frewsxcv commented Jan 5, 2017

Squashed.

@GuillaumeGomez
Copy link
Member

Good for me as well. Thanks for the review @ubsan! ;)

@bors: r+ rollup

@bors
Copy link
Contributor

bors commented Jan 5, 2017

📌 Commit 4794f95 has been approved by GuillaumeGomez

sanxiyn added a commit to sanxiyn/rust that referenced this pull request Jan 10, 2017
…omez

Expand {Path,OsStr}::{to_str,to_string_lossy} doc examples.

None
bors added a commit that referenced this pull request Jan 10, 2017
Rollup of 11 pull requests

- Successful merges: #38606, #38607, #38623, #38664, #38799, #38816, #38836, #38839, #38841, #38849, #38874
- Failed merges: #38845
@bors bors merged commit 4794f95 into rust-lang:master Jan 10, 2017
@frewsxcv frewsxcv deleted the osstr-to-str branch June 19, 2017 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants