Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
compiler-errors opened this issue Apr 23, 2024 · 0 comments
Open

Comments

@compiler-errors
Copy link
Member

compiler-errors commented Apr 23, 2024

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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: unknown
Development

No branches or pull requests

1 participant