-
Notifications
You must be signed in to change notification settings - Fork 58
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
Validity of strings #78
Comments
I think they should just be byte-slices, EDIT: That statement was incorrect |
Note that the Nomicon calls non-UTF-8 |
I think that in this case the Nomicon simply isn't quite correct. The Validity Invariant of a type, if any, is known to the compiler. In the case of |
I don't think the current rustc-LLVM compilation pipeline exploits knowledge of That said, I don't think there's anything useful the compiler can do with |
I opened a PR against the reference to decide that strings do not have UTF-8 in their validity invariant: rust-lang/reference#792. |
I saw this comment above:
Is that true? It seems in opposition to the following statement from rust-lang/rust#71033 (comment)
Trying out matching on So I don't think that "analogously [...] independent from unicode" is good justification here. (Which isn't a statement that removing the invariant would bad, just that I'd like to strike that particular piece of evidence.) |
I agree I was incorrect. |
The lang team and libs team decided in rust-lang/rust#71033 to change this from a validity invariant to a safety invariant. The FCP is complete, and the reference and nomicon have been updated. I believe this issue can be closed now. |
Ah good point, discussion here is done. Moving to state "writeup needed". |
Discussing the validity invariant of strings: Do they just have to be like byte slices, or do we require in the validity invariant that they be valid UTF-8?
Certainly, their safety invariant requires UTF-8, but that is not what we are discussing here.
The text was updated successfully, but these errors were encountered: