Add more robust handling of nested query cycles#154389
Add more robust handling of nested query cycles#154389rust-bors[bot] merged 1 commit 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.
There was a problem hiding this comment.
"internal compiler error" is just a part of the message, I'm not sure if it's actually a compiler bug, and whether it's possible to eliminate it in all cases, if query cycles in general are not avoidable.
|
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. |
This comment has been minimized.
This comment has been minimized.
|
Blocked on #154973 |
|
Reminder, once the PR becomes ready for a review, use |
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
(Please, mark with the label if/when this is ready.) |
|
I'd say this is good enough to help out with the OOM cases now. @rustbot ready |
|
@bors r+ |
Add more robust handling of 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.
…uwer Rollup of 19 pull requests Successful merges: - #155162 (relnotes for 1.95) - #140763 (Change codegen of LLVM intrinsics to be name-based, and add llvm linkage support for `bf16(xN)` and `i1xN`) - #153604 (Fix thread::available_parallelism on WASI targets with threads) - #154193 (Implement EII for statics) - #154389 (Add more robust handling of nested query cycles) - #154435 (resolve: Some import resolution cleanups) - #155236 (Normalize individual predicate of `InstantiatedPredicates` inside `predicates_for_generics`) - #155243 (cg_ssa: transmute between scalable vectors) - #153941 (tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable) - #154587 (Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests) - #154624 (Make `DerefPure` dyn-incompatible) - #154929 (Add `const Default` impls for `LazyCell` and `LazyLock`) - #154944 (Small refactor of `arena_cache` query values) - #155055 (UI automation) - #155062 (Move tests from `tests/ui/issues/` to appropriate directories) - #155131 (Stabilize feature `uint_bit_width`) - #155147 (Stabilize feature `int_lowest_highest_one`) - #155174 (Improve emission of `UnknownDiagnosticAttribute` lint) - #155194 (Fix manpage version replacement and use verbose version)
Rollup merge of #154389 - Zoxc:nested-cycles, r=petrochenkov Add more robust handling of 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.
…uwer Rollup of 19 pull requests Successful merges: - rust-lang/rust#155162 (relnotes for 1.95) - rust-lang/rust#140763 (Change codegen of LLVM intrinsics to be name-based, and add llvm linkage support for `bf16(xN)` and `i1xN`) - rust-lang/rust#153604 (Fix thread::available_parallelism on WASI targets with threads) - rust-lang/rust#154193 (Implement EII for statics) - rust-lang/rust#154389 (Add more robust handling of nested query cycles) - rust-lang/rust#154435 (resolve: Some import resolution cleanups) - rust-lang/rust#155236 (Normalize individual predicate of `InstantiatedPredicates` inside `predicates_for_generics`) - rust-lang/rust#155243 (cg_ssa: transmute between scalable vectors) - rust-lang/rust#153941 (tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable) - rust-lang/rust#154587 (Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests) - rust-lang/rust#154624 (Make `DerefPure` dyn-incompatible) - rust-lang/rust#154929 (Add `const Default` impls for `LazyCell` and `LazyLock`) - rust-lang/rust#154944 (Small refactor of `arena_cache` query values) - rust-lang/rust#155055 (UI automation) - rust-lang/rust#155062 (Move tests from `tests/ui/issues/` to appropriate directories) - rust-lang/rust#155131 (Stabilize feature `uint_bit_width`) - rust-lang/rust#155147 (Stabilize feature `int_lowest_highest_one`) - rust-lang/rust#155174 (Improve emission of `UnknownDiagnosticAttribute` lint) - rust-lang/rust#155194 (Fix manpage version replacement and use verbose version)
| } | ||
|
|
||
| #[derive(Diagnostic)] | ||
| #[diag("internal compiler error: query cycle when printing cycle detected")] |
There was a problem hiding this comment.
this is very confusing as there is neither a stacktrace nor a an according exit code, why not just make this a bug!() ?
There was a problem hiding this comment.
Because we need to continue execution to print the outermost query cycle. I'm not sure if it's overkill to add a new diagnostic mode for that.
There was a problem hiding this comment.
Overkill, IMO, I'd rather just remove "internal compiler error" from the message #154389 (comment).
There was a problem hiding this comment.
They're always internal compiler errors though, so that wouldn't be great.
…uwer Rollup of 19 pull requests Successful merges: - rust-lang/rust#155162 (relnotes for 1.95) - rust-lang/rust#140763 (Change codegen of LLVM intrinsics to be name-based, and add llvm linkage support for `bf16(xN)` and `i1xN`) - rust-lang/rust#153604 (Fix thread::available_parallelism on WASI targets with threads) - rust-lang/rust#154193 (Implement EII for statics) - rust-lang/rust#154389 (Add more robust handling of nested query cycles) - rust-lang/rust#154435 (resolve: Some import resolution cleanups) - rust-lang/rust#155236 (Normalize individual predicate of `InstantiatedPredicates` inside `predicates_for_generics`) - rust-lang/rust#155243 (cg_ssa: transmute between scalable vectors) - rust-lang/rust#153941 (tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable) - rust-lang/rust#154587 (Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests) - rust-lang/rust#154624 (Make `DerefPure` dyn-incompatible) - rust-lang/rust#154929 (Add `const Default` impls for `LazyCell` and `LazyLock`) - rust-lang/rust#154944 (Small refactor of `arena_cache` query values) - rust-lang/rust#155055 (UI automation) - rust-lang/rust#155062 (Move tests from `tests/ui/issues/` to appropriate directories) - rust-lang/rust#155131 (Stabilize feature `uint_bit_width`) - rust-lang/rust#155147 (Stabilize feature `int_lowest_highest_one`) - rust-lang/rust#155174 (Improve emission of `UnknownDiagnosticAttribute` lint) - rust-lang/rust#155194 (Fix manpage version replacement and use verbose version)
…uwer Rollup of 19 pull requests Successful merges: - rust-lang/rust#155162 (relnotes for 1.95) - rust-lang/rust#140763 (Change codegen of LLVM intrinsics to be name-based, and add llvm linkage support for `bf16(xN)` and `i1xN`) - rust-lang/rust#153604 (Fix thread::available_parallelism on WASI targets with threads) - rust-lang/rust#154193 (Implement EII for statics) - rust-lang/rust#154389 (Add more robust handling of nested query cycles) - rust-lang/rust#154435 (resolve: Some import resolution cleanups) - rust-lang/rust#155236 (Normalize individual predicate of `InstantiatedPredicates` inside `predicates_for_generics`) - rust-lang/rust#155243 (cg_ssa: transmute between scalable vectors) - rust-lang/rust#153941 (tests/debuginfo/basic-stepping.rs: Explain why all lines are not steppable) - rust-lang/rust#154587 (Add --verbose-run-make-subprocess-output flag to suppress verbose run-make output for passing tests) - rust-lang/rust#154624 (Make `DerefPure` dyn-incompatible) - rust-lang/rust#154929 (Add `const Default` impls for `LazyCell` and `LazyLock`) - rust-lang/rust#154944 (Small refactor of `arena_cache` query values) - rust-lang/rust#155055 (UI automation) - rust-lang/rust#155062 (Move tests from `tests/ui/issues/` to appropriate directories) - rust-lang/rust#155131 (Stabilize feature `uint_bit_width`) - rust-lang/rust#155147 (Stabilize feature `int_lowest_highest_one`) - rust-lang/rust#155174 (Improve emission of `UnknownDiagnosticAttribute` lint) - rust-lang/rust#155194 (Fix manpage version replacement and use verbose version)
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.