Fix avoid cycle for self referential return type notation - #159958
Conversation
037d040 to
6e1755a
Compare
|
This PR changes a file inside |
|
r? @jieyouxu rustbot has assigned @jieyouxu. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
r? types (bandwidth) |
| //@ dont-check-compiler-stderr | ||
| //@ dont-require-annotations: ERROR | ||
|
|
||
| struct Wrapper<'a>(); |
There was a problem hiding this comment.
why was this unrelated type ever part of the logic that caused the ICE?
There was a problem hiding this comment.
one thing to try is to add more lifetime params here until they are more than the anonymous ones on the function, maybe then the ICE reoccurs?
There was a problem hiding this comment.
Wrapper is only there to force error recovery. it is a separate HIR owner and is not the source of the bound variable list used for IntFactory::stream
I increased it to four unrelated lifetime parameters as you suggested. on the this patch base commit the compiler still panics with
Not enough bound vars: ... IntFactory::stream ... not found in []
and exits with status 101
With the patch applied the exact same test only reports the four expected E0392 diagnostics. this shows that the fix is addressing the underlying problem
There was a problem hiding this comment.
Ok I see now. the query cycle happens during fn_sig, which, when part of a cycle returns a dummy value instead of causing a fatal error. Thus the entire output of resolve_bound_vars query is now bogus, as invoking it again will not cause a cycle now, but use the dummy value from the cached failed fn_sig query. This produces an empty list of bound vars.
Your fix avoids the cycle entirely and everything is good.
|
Reminder, once the PR becomes ready for a review, use |
|
@rustbot ready |
|
@bors squash avoid cycle for self referential return type notation |
|
Unknown argument "avoid". Did you mean to use |
|
@bors squash msg="avoid cycle for self referential return type notation" |
This comment has been minimized.
This comment has been minimized.
|
🔨 2 commits were squashed into af64640. |
f4caf4f to
af64640
Compare
|
@bors r+ rollup |
…uwer Rollup of 25 pull requests Successful merges: - #160204 (Sync from portable simd 2026 07 30) - #138230 (Add `raw_borrows_via_references` lint) - #158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`) - #160015 (refactor(mir-transform): Merge `can_be_overridden`, `is_required` and `is_enabled` into one) - #160031 (std: make positioned I/O unsupported on VxWorks) - #160125 (Fix typing mode handling in transmute checks and rustc_dump_layout) - #160152 (Create on-demand CI job for testing EC2 instances) - #160232 (rustdoc: fix ICE when a grapheme cluster joins a Prepend-class character to `_` or `:`) - #159214 (std: improve the documentation of the random feature) - #159818 (Resolve vars before calling `unnormalized_obligations`) - #159955 (Stop using higher-order macros to declare arenas) - #159958 (Fix avoid cycle for self referential return type notation) - #160040 (Split function parsing out of `item.rs` to a new module.) - #160044 (Add regression tests for fixed dead-code issues) - #160144 (renovate: group lockfiles PRs) - #160149 (Fix Windows on Arm PAC default) - #160164 (Derive `GenericTypeVisitable` for `RegionConstraint`) - #160175 (Try to recover less from incorrectly parsed const arg) - #160177 (A few more "predicate"-to-"clause" renamings) - #160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`) - #160192 (Fix ICE for parsing issue with a closing brace) - #160209 (bootstrap: Remove method `Subcommand::kind`) - #160221 (Remove `Copy` supertrait from `VaList`) - #160223 (interpret: rename validate_operand → validate_place) - #160234 (Always use short ty path for call with missing arguments suggestion)
…uwer Rollup of 25 pull requests Successful merges: - #160204 (Sync from portable simd 2026 07 30) - #138230 (Add `raw_borrows_via_references` lint) - #158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`) - #160015 (refactor(mir-transform): Merge `can_be_overridden`, `is_required` and `is_enabled` into one) - #160031 (std: make positioned I/O unsupported on VxWorks) - #160125 (Fix typing mode handling in transmute checks and rustc_dump_layout) - #160152 (Create on-demand CI job for testing EC2 instances) - #160232 (rustdoc: fix ICE when a grapheme cluster joins a Prepend-class character to `_` or `:`) - #159214 (std: improve the documentation of the random feature) - #159818 (Resolve vars before calling `unnormalized_obligations`) - #159955 (Stop using higher-order macros to declare arenas) - #159958 (Fix avoid cycle for self referential return type notation) - #160040 (Split function parsing out of `item.rs` to a new module.) - #160044 (Add regression tests for fixed dead-code issues) - #160144 (renovate: group lockfiles PRs) - #160149 (Fix Windows on Arm PAC default) - #160164 (Derive `GenericTypeVisitable` for `RegionConstraint`) - #160175 (Try to recover less from incorrectly parsed const arg) - #160177 (A few more "predicate"-to-"clause" renamings) - #160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`) - #160192 (Fix ICE for parsing issue with a closing brace) - #160209 (bootstrap: Remove method `Subcommand::kind`) - #160221 (Remove `Copy` supertrait from `VaList`) - #160223 (interpret: rename validate_operand → validate_place) - #160234 (Always use short ty path for call with missing arguments suggestion)
Rollup merge of #159958 - amirHdev:fix-rtn-cycle, r=oli-obk Fix avoid cycle for self referential return type notation Fixes #159892 and #133613 we had to preserve and restore shadowed parameters in the impl trait overcapture lint and convert the resolved crash regression into a normal UI test which is applied to this patch
…uwer Rollup of 25 pull requests Successful merges: - rust-lang/rust#160204 (Sync from portable simd 2026 07 30) - rust-lang/rust#138230 (Add `raw_borrows_via_references` lint) - rust-lang/rust#158057 (Don't escape U+FF9E and U+FF9F in `escape_debug_ext`) - rust-lang/rust#160015 (refactor(mir-transform): Merge `can_be_overridden`, `is_required` and `is_enabled` into one) - rust-lang/rust#160031 (std: make positioned I/O unsupported on VxWorks) - rust-lang/rust#160125 (Fix typing mode handling in transmute checks and rustc_dump_layout) - rust-lang/rust#160152 (Create on-demand CI job for testing EC2 instances) - rust-lang/rust#160232 (rustdoc: fix ICE when a grapheme cluster joins a Prepend-class character to `_` or `:`) - rust-lang/rust#159214 (std: improve the documentation of the random feature) - rust-lang/rust#159818 (Resolve vars before calling `unnormalized_obligations`) - rust-lang/rust#159955 (Stop using higher-order macros to declare arenas) - rust-lang/rust#159958 (Fix avoid cycle for self referential return type notation) - rust-lang/rust#160040 (Split function parsing out of `item.rs` to a new module.) - rust-lang/rust#160044 (Add regression tests for fixed dead-code issues) - rust-lang/rust#160144 (renovate: group lockfiles PRs) - rust-lang/rust#160149 (Fix Windows on Arm PAC default) - rust-lang/rust#160164 (Derive `GenericTypeVisitable` for `RegionConstraint`) - rust-lang/rust#160175 (Try to recover less from incorrectly parsed const arg) - rust-lang/rust#160177 (A few more "predicate"-to-"clause" renamings) - rust-lang/rust#160181 (Mark `Tuple` and `FnPtr` traits `#[fundamental]`) - rust-lang/rust#160192 (Fix ICE for parsing issue with a closing brace) - rust-lang/rust#160209 (bootstrap: Remove method `Subcommand::kind`) - rust-lang/rust#160221 (Remove `Copy` supertrait from `VaList`) - rust-lang/rust#160223 (interpret: rename validate_operand → validate_place) - rust-lang/rust#160234 (Always use short ty path for call with missing arguments suggestion)
View all comments
Fixes #159892 and #133613
we had to preserve and restore shadowed parameters in the impl trait overcapture lint and convert the resolved crash regression into a normal UI test which is applied to this patch