Add more robust handling of nested query cycles#154389
Add more robust handling of nested query cycles#154389Zoxc wants to merge 2 commits intorust-lang:mainfrom
Conversation
|
The nested query cycles are currently printed as errors as I don't think we have the mechanism to resume after emitting a bug. This means we have 2 tests that are failing which were previously "undetected". |
|
This is now a blocker for the delegation work (like #154368) where you get compiler hangs instead of query cycle errors quite often due to this issue. |
There was a problem hiding this comment.
We shouldn't be testing for ICEs, but fixing them instead.
|
This is currently racy as we can resume multiple query cycles at once, so the global counter doesn't work. I have a branch which changes that, but I was waiting for #154146 to land first. |
| 0 => false, | ||
| 1 => true, | ||
| _ => { | ||
| // Don't print further nested errors to avoid cases of infinite recursion | ||
| tcx.dcx().delayed_bug("doubly nested cycle error").raise_fatal() | ||
| } |
There was a problem hiding this comment.
We call handle_cycle function in wait_for_query after breaking and resuming from one or multiple query cycles. As such this might race with other handle_cycle calls which wouldn't be a "nested" query cycles.
This adds more robust handling of query cycle that occur while we are already printing a query cycle error. Such nested query cycle are compiler bugs and this adds special handling so that both the nested query cycle and the outer query cycle are printed. Doubly nested query cycle errors are ignored to prevent infinite recursion.
This is based on #153999