struct Inv<T>(Option<*mut T>);
trait Trait<T, U, V> {}
impl Trait<u32, u32, u32> for () {}
impl Trait<u32, i32, i32> for () {}
fn is_trait<T, U, V>(x: Inv<T>, y: Inv<U>) -> V
where
(): Trait<T, U, V>,
{
todo!()
}
fn main() {
let x = Inv(None);
let mut y = Inv(None);
let res = is_trait(x, y);
y = x;
res.bit_width();
}
https://rust.godbolt.org/z/r811s4Wra
equating ?t and ?u should get us to reprove (): Trait<?t, ?u, ?v> at which point the second impl is no longer applicable
cc @jdonszelmann
https://rust.godbolt.org/z/r811s4Wra
equating
?tand?ushould get us to reprove(): Trait<?t, ?u, ?v>at which point the second impl is no longer applicablecc @jdonszelmann