-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Miri exception improvements #69297
Comments
The obvious solution is to go through the engine (we could still use the Didn't we also discuss checking the current query name somewhere? |
@oli-obk I take you you are talking about the first point? As I wrote above, I think @wesleywiser's proposed scheme of using a session var is a good next step there -- certainly better than what we do now. |
I found some more cases of exceptions being caught:
The first one occurs quite a bit in Miri because we validate all the time (CTFE validates less often so this should be less of an issue, but still). I am not sure how best to fix it, short of implementing rust-lang/miri#841. |
@wesleywiser do you still plan to submit this approach as a PR or would you like someone else to take over? |
…to_session_var, r=RalfJung [Miri] Use a session variable instead of checking for an env var always In CTFE heavy code, checking the env var everytime is inefficient. We can do a lot better by using a `Session` variable instead. r? @RalfJung Part of rust-lang#69297
avoid catching InterpError Avoid raising and then capturing `InterpError` for the definedness check. Cc rust-lang#69297 r? @oli-obk
avoid catching InterpError Avoid raising and then capturing `InterpError` for the definedness check. Cc rust-lang#69297 r? @oli-obk
Status: last time I looked into this, I found some more cases where exceptions are being caught, that are related to handling of pointer provenance and ptr-int casts. I consider this problem blocked on rust-lang/miri#841. |
I am also seeing many exceptions being raised and caught in ConstProp -- so, Sadly this also masks any exceptions being raised elsewhere, making it really hard to figure out if there are non-constprop instances of this problem left. |
I'm not sure const prop can do better other than duplicating all the checks that would lead to the exceptions being raised. We can do some half measures to eliminate obvious cases. We could add a |
We could also do something awful and have some thread-local storage so this code
knows it is inside ConstProp and always treats this as |
and then re-enable (in a scoped manner) when inside the CTFE query. Seems hacky and annyoing and actually manageable. I think it's fine, it's just for the backtrace printing, nothing that actually affects anyone that is not already debugging CTFE |
I think I'll just use a locally patched rustc that does not do const-prop.^^ But we should maybe make a note that Regarding the issue at hand, the following are the only Miri test cases that have any exceptions caught and discarded. :)
|
Ah, and those are expected, since they are using So I think this issue is solved. :-) We don't have a strategy in place to detect when it arises again in the future, but still I think we can close this one now. |
The Miri engine uses "exceptions" (
InterpResult
) to report misbehaving executions and propagate this information outwards to the machine (const-eval/const-prop/miri-the-tool). When an error is raised, we optionally capture a backtrace to ease debugging.There are two problems with this:
RUSTC_CTFE_BACKTRACE
much less by generating fewer errors #69290 brought some nice speed-up by removing just one case of catching an interpreter error! I think we should never catch these errors. Is there something we can do to prevent accidental catching?Cc @oli-obk
The text was updated successfully, but these errors were encountered: