verus-lang / verus

Verified Rust for low-level systems code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Associated trait bounds bug in lifetime-generate

utaal-b opened this issue · comments

From https://verus-lang.zulipchat.com/#narrow/stream/399078-help/topic/Confusing.20errors.20when.20using.20bounded.20associated.20types/near/411091311

Minimized repro thanks to @marshtompsxd:

pub trait A {
    type Input: View;
    type Output: View;
}

pub trait B {
    type MyA: A;

    fn foo(input: <Self::MyA as A>::Input) -> <Self::MyA as A>::Output;
}

fails with:

the trait bound `<A51_Self as T87_B>::A86_MyA: T85_A` is not satisfied

@tjhance diagnosed this to be due to lifetime-generate not adding bounds in this case, despite being still relied upon by the signature of foo.

trait T26_A {
    type A24_Input;
    type A25_Output;
}

trait T29_B {
    type A28_MyA;
}