-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop #138679
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
base: master
Are you sure you want to change the base?
Conversation
…report_error When constant evaluation fails, the error is propagated to other places if report_error uses tainted_by_errors. Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
Signed-off-by: Shunpoco <[email protected]>
This ty::Error was added in rust-lang#123428, but the root cause is the same as rust-lang#125323. After report_error is fixed, the arm isn't needed anymore. Signed-off-by: Shunpoco <[email protected]>
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Shunpoco <[email protected]>
This PR changes a file inside |
I don't believe this is the right solution, because using The real root cause of this issue is this: rust/compiler/rustc_interface/src/passes.rs Lines 991 to 995 in 75530e9
...which causes us to enter r? oli-obk |
Please ensure that after this PR is fully reworked that it's squashed into a single commit. |
Yea errs' analysis is spot on. Skipping the |
Thanks both! @oli-obk
Are you talking about ResultsVisitor in compiler/rustc_mir_dataflow/src/framework/visitor.rs? So far I don't understand how to record the error into the query result. It would be great if you give me a hint which code I should looking for |
Does this fix #138361 as well? Seems like a very closely related issue, at the very least. Ideally we'd make sure that the approach taken will take care of both of these. |
@meithecatte I think the root cause is the same. I tried your issue's failure case with 3cf7d22, and the ICE didn't happen, although as we discussed above I can't use this commit as the solution. @oli-obk @compiler-errors |
This PR fixes #125323
Context
According to the issue, the ICE happens since #121206.
In the PR, some error methods were reorganized. For example, has_errors() was renamed to has_errors_exclude_lint_errors(). However, some codes which used the original has_errors() were not switched to has_errors_exclude_lint_errors(). I finally found that report_error() in writeback.rs causes this ICE. Currently the method uses tainted_by_errors() to get guar (ErrorGuaranteed), but originally it used dcx().has_errors() but it wasn't changed to has_errors_exclude_lint_errors() when changes in #121206 were merged. I don't think I fully understand how an error is propagated, but I suppose that the error from long time constant evaluation is unexpectedly propagated other parts (in this ICE, for loop), then cause the non-ADT in struct pattern ICE.
Change
NOTE
The 4th commit aims to revert the fix in #123516 because I confirmed that the ICE solved by the PR doesn't happen if I modify report_error(). I think the root cause of that ICE is the same as #125323 . But I can discard this commit since we can fix #125323 without it.