-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Show a constant's virtual memory on validation errors #53325
Comments
cc @oli-obk |
This seems legit! Your |
Ah.. that makes sense. Making the Using the default |
Reopening to track the improvement of the diagnostic to show the bit pattern and which bytes were undefined. |
The work-around where an untagged union is used to crate uninitialized memory in a const fn also seems to be affected by this issue.
This code does no longer compile since the see also discussion in rust-lang/rfcs#411 and #50150 and rust-lang/rfcs#1892 |
Yes, you should be returning a Additionally, your code is not affected. Only if you use the function to produce a |
@oli-obk I would like to take this up. |
So... Before we start out on this, we should bikeshed what the output should look like. cc @rust-lang/wg-diagnostics I'm wondering if it would make sense to render the memory of a constant similar to how hex editors render memory. Then we could dump the rendered version in a virtual file that diagnostics can get spans into. For the given example above (where only half of a
and thus a diagnostic pointing into it would look like
|
Hopefully we can bypass needing an actual Also keep in mind IDEs can't really show your "virtual hex dump" files, as we don't have a way to export them from the compiler (other than saving them in a temp dir), so it'd be nicer to make the long-form "rendered" message itself contain the hex dump. Minor bikeshed: Alternatives (press to expand)
|
I like that one, it's very clear on a glance |
Underscores are also the format I used for undefined bytes in the original Miri report and slide deck, so +1 from me. :) |
Add allocation information to undefined behaviour errors. So far I'm looking on information on whether the error messages are suitable. Fixes rust-lang#53325.
Add allocation information to undefined behaviour errors. So far I'm looking on information on whether the error messages are suitable. Fixes rust-lang#53325.
Add allocation information to undefined behaviour errors. So far I'm looking on information on whether the error messages are suitable. Fixes rust-lang#53325.
Add allocation information to undefined behaviour errors. So far I'm looking on information on whether the error messages are suitable. Fixes rust-lang#53325.
The following code worked up until
nightly-2018-07-30-x86_64-unknown-linux-gnu
:The text was updated successfully, but these errors were encountered: