Skip to content

Do we actually need the fallible handling of forced_ambiguity? #105

Open
@compiler-errors

Description

@compiler-errors

Analyze why this requires rust-lang/rust#123477. Make sure it's not an unsoundness in cycle/overflow.

Thanks @lqd.

pub struct UInt<U, B> {
    _msb: U,
    _lsb: B,
}
pub struct B1;
pub trait Sub<Rhs> {
    type Output;
}
impl<U, B> Sub<B1> for UInt<UInt<U, B>, B1> {
    type Output = ();
}
impl<U> Sub<B1> for UInt<U, ()>
where
    U: Sub<B1>,
    U::Output: Send,
{
    type Output = ();
}

pub trait Op<N, R, I> {
    fn op(&self) {
        unimplemented!()
    }
}
trait OpIf<N, R, I> {}

impl<N, Ur, Br, I> Op<N, UInt<Ur, Br>, I> for ()
where
    N: Sub<I>,
    (): OpIf<N, UInt<UInt<Ur, Br>, N::Output>, I>,
{
}
impl<N, R, Ui, Bi> OpIf<N, R, UInt<Ui, Bi>> for ()
where
    UInt<Ui, Bi>: Sub<B1>,
    (): Op<N, R, <UInt<Ui, Bi> as Sub<B1>>::Output>,
{
}
impl<N, R> OpIf<N, R, ()> for () where R: Sub<N> {}

pub trait Compute {
    type Output;
}

pub fn repro<Ul, Bl>()
where
    UInt<Ul, Bl>: Compute,
    <UInt<Ul, Bl> as Compute>::Output: Sub<B1>,
    (): Op<UInt<(), Bl>, (), ()>,
{
    ().op();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    unknown

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions