-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
infinite recursion with TAIT and replace_opaque_types_with_inference_vars in project #109268
Copy link
Copy link
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcF-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.E-needs-bisectionCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcCall for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustcF-type_alias_impl_trait`#[feature(type_alias_impl_trait)]``#[feature(type_alias_impl_trait)]`S-bug-has-testStatus: This bug is tracked inside the repo by a `known-bug` test.Status: This bug is tracked inside the repo by a `known-bug` test.T-typesRelevant to the types team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
Status
Can do after stabilization
this causes rustc to freeze. This is similar to
rust/tests/ui/type-alias-impl-trait/issue-53398-cyclic-types.rs
Lines 1 to 10 in c50c62d
The only reason that this test does not hang is the following hack in fulfillment
rust/compiler/rustc_trait_selection/src/traits/fulfill.rs
Lines 711 to 733 in c50c62d
because of this hack we only try to prove
<Foo as FnOnce<()>>::Output == Foousingevaluate_obligationwhich usesDefiningAnchor::Bubbleinstead of theDefiningAnchor::Bindused by typeck and fulfill directly.The reason this breaks when using
DefiningAnchor::Bindis the following:we call
project_and_unify_typefor<Foo as FnOnce<()>>::Output == Foowhich normalizes<Foo as FnOnce<()>>::OutputtoFoo.The issue is that we then replace
Foowith a new inference variable (if we useDefiningAnchor::Bind)?nand add the item bounds ofFooas obligations on that new inference variable:rust/compiler/rustc_trait_selection/src/traits/project.rs
Lines 280 to 286 in c50c62d
This adds a new obligation
<?n as FnOnce<()>>::Output == Footo the fulfillment context, even though?nwas already constrained toFooagain. The easiest fix is to resolve inference variables in obligations before adding them to the fulfillment context.