Skip to content

Typenum ambiguity #55

Closed
rust-lang/rust
#114934
@compiler-errors

Description

@compiler-errors
fn main() {
    let _: <typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0> as typenum::Pow<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>>>::Output;
}

The type above, which should be equivalent to U32 (since it's 0b10^0b101 = 2^5 = 32), but results in ambiguity (or overflow? can't tell):

error[E0282]: type annotations needed
 --> src/main.rs:2:12
  |
2 | ..._: <typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0> as typenum::Pow<typenum::UInt<typenum::UInt<typenum::UInt<typenum::UTerm, typenum::B1>, typenum::B0>, typenum::B1>>>::Outp...
  |       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type for associated type `<UInt<UInt<UTerm, B1>, B0> as Pow<UInt<UInt<UInt<UTerm, B1>, B0>, B1>>>::Output`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions