-
Notifications
You must be signed in to change notification settings - Fork 13.4k
ICE with non-utf8 const generic &str #75763
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
It looks like it's correctly complied on rustc 1.48.0-nightly: |
I dont think this should compile at all. After all, we cause UB, the value of the const generic does not comply with the rules of |
A str being valid utf-8 is not a language invariant, so this should not be UB to my knowledge. cc @RalfJung I do expect this to be the correct behavior, so marking as |
We do have to compare the |
@lcnr I think you are free to decide on your own invariant here -- assuming that two What is the plan for other library types? Like, imagine a user defined a newtype around |
👍 yeah, see #72396 for more details here I guess One concern is that we probably want to print |
Yeah, you could either use |
Printing invalid utf8 as bytes might be simpler there 🤔 I guess cc @eddyb about that |
Oh, this is not just pretty-printing but needs to be injective? Then I guess some |
Code
Meta
rustc --version --verbose
:Error output
Backtrace
The text was updated successfully, but these errors were encountered: