Skip to content

lint creating a &str (or String) from invalid UTF-8 bytes #629

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

Closed
llogiq opened this issue Feb 6, 2016 · 4 comments · Fixed by #9105
Closed

lint creating a &str (or String) from invalid UTF-8 bytes #629

llogiq opened this issue Feb 6, 2016 · 4 comments · Fixed by #9105
Assignees
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group T-middle Type: Probably requires verifiying types

Comments

@llogiq
Copy link
Contributor

llogiq commented Feb 6, 2016

This is also undefined behavior (according to the rust book), calling std::str::from_utf8_unchecked(..) on something which is not UTF-8.

@Manishearth
Copy link
Member

I don't see why someone would ever use from_unchecked on a literal?

@llogiq
Copy link
Contributor Author

llogiq commented Feb 6, 2016

Perhaps within a macro?

@John-Steidley
Copy link

Perhaps because of a refactor. Perhaps because they passed the literal into a function.

@oli-obk oli-obk added L-correctness Lint: Belongs in the correctness lint group good-first-issue These issues are a good way to get started with Clippy A-lint Area: New lints T-middle Type: Probably requires verifiying types labels May 10, 2017
@Serial-ATA
Copy link
Contributor

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lint Area: New lints good-first-issue These issues are a good way to get started with Clippy L-correctness Lint: Belongs in the correctness lint group T-middle Type: Probably requires verifiying types
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants