// compile-flags: -Znext-solver // This currently hangs if we do not erase constraints from // overflow. // // We set the provisional result of `W` to `?0 := W<_>`. // The next iteration does not simply result in a `?0 := W` constraint as // one might expect, but instead each time we evaluate the nested `W` goal we // apply the previously returned constraints: the first fixpoint iteration goes // as follows: `W: Trait` constrains `?1` to `W`, we then evaluate // `W>: Trait` the next time we try to prove the nested goal. This results // inn `W>>` and so on. This goes on until we reach overflow in // `try_evaluate_added_goals`. This means the provisional result after the // second fixpoint iteration is already `W>>` with a size proportional // to the number of steps in `try_evaluate_added_goals`. The size then continues // to grow. The exponential blowup from having 2 nested goals per impl causes // the solver to hang without hitting the recursion limit. trait Trait {} struct W(*const T); impl Trait for W> where W: Trait, W: Trait, {} fn impls_trait() {} fn main() { impls_trait::>(); //~^ ERROR overflow evaluating the requirement }