-
Notifications
You must be signed in to change notification settings - Fork 349
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
Reduce redundancy in our error messages #2200
Comments
What about the case where no source is available for the error origin? |
You are concerned about something like rust-lang/rust#97699? IMO it is a bug in the rustc diagnostic printing that it entirely omits information attached to spans where the source is missing. We might have to work around that somehow on our side. But Miri requires rust-src to be installed, so I am not sure if this can ever happen? |
If we have a "title" and "text" for errors, that could also help const-eval errors in rustc itself which currently don't even state things like "you caused UB". |
While at it we should probably also let errors have a "help" output for extra text to print after the main diagnostic (e.g. for things like #2074). |
Also this can be improved: miri/src/concurrency/data_race.rs Lines 1016 to 1023 in d2552d2
|
Now that we have translatable diagnostics, this is probably a lot more work... we can't just have a "title" function on Or for now we just have these not be translatable and we wait until the translatable diagnostics are less painful to use. |
Hm, maybe we don't actually have to do this. In rustc we already avoid this redundancy by simply just putting "evaluation of constant value failed" or "it is undefined behavior to use this value" in the error title, so Miri could do the same -- just say whether it is UB / Unsupported in the title, but the rest in the span. The main effort then is updating all our tests to add new annotations that check that the span shows what it should. (Not sure if ui_test supports that yet, #2483 is still open so I think the answer is no.) |
Our errors currently print the same message twice:
That is unnecessarily redundant redundant. So maybe we could avoid duplication, e.g. by changing the above output to
This will require
InterpError
type needs separate methods to compute the "title" and "text" of a messageERROR
annotations will probably fail if the error details no longer appear in the "error:" message. On a case-by-case basis, we should either change this to just match on what the error message still says (we do have ui tests after all, so if the details change in unexpected ways we will notice), or add a second pattern to also match some key part of the details.The text was updated successfully, but these errors were encountered: