evaluate: projection obligations are accepted in otherwise coinductive cycles #106040
Labels
A-trait-system
Area: Trait system
C-bug
Category: This is a bug.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
WG-trait-system-refactor
The Rustc Trait System Refactor Initiative (-Znext-solver)
The following compiles but should not
proving
LocalTy: Unpin
results in the following cycle:LocalTy: Unpin
LocalTy: OtherTrait
(trivially true)<LocalTy as OtherTrait>::Assoc = LocalTy
LocalTy: Unpin
(cycle!)While it's sound for this cycle to be coinductive, with our current rules it should not be. The new solver will also start out with this being inductive. Fulfill correctly detects this as an inductive cycle. Evaluate does not.
Note that using that is incredibly fragile as it depends on the following performance optimization to avoid fulfill:
rust/compiler/rustc_trait_selection/src/traits/fulfill.rs
Lines 604 to 614 in cce9e72
So the following code does result in the expected error 😁
The text was updated successfully, but these errors were encountered: