Open
Description
struct W<T: ?Sized>(*const T);
trait Foo {}
trait Bar {}
impl<T: Bar + NotImplemented> Foo for T {}
impl Foo for W<u32> {}
impl<T: Foo + AssertInferenceConstraintsApplied> Bar for T {}
trait AssertInferenceConstraintsApplied {}
trait GuideFromEnv {}
trait ErrOnGuidance {}
impl<T: GuideFromEnv + ErrOnGuidance> AssertInferenceConstraintsApplied for T {}
impl<T> GuideFromEnv for T {}
impl ErrOnGuidance for W<u32> {}
impl<T> Bar for T
where
W<T>: NotImplemented {}
trait NotImplemented {}
fn impls_foo<T: Foo>() {}
fn impls_bar<T: Bar>() {}
fn with_bound()
where
W<u64>: GuideFromEnv,
{
impls_foo::<W<_>>(); // commenting this line changes the next one to OK
impls_bar::<W<_>>(); // ERROR
}
fn main() {
with_bound();
}
cc @compiler-errors #123303 this should be broken even after #122791
THe idea is from #123303 (comment)
- GoalA
- CandA1
- GoalB
- CandB1
- GoalA (inductive cycle -> ambig)
- AssertInferenceConstraintsApplied (fails due to incompleteness if the inference constraints from
CandA2
have not yet been applied)- CandB2
- Impossible (necessary to evaluate nested goals of
CandB1
during selection)- CandA2
- guide inference ~> Ok, but inference constraints