The below code shouldn't compile, since i64 does not implement Bound, so I shouldn't be allowed to write Output<i64>. However, it compiles without errors.
I'm guessing that rustc sees <.... as Super>::Assoc and immediately concludes that the type must be i32 without further checking.
trait Super {
type Assoc;
}
trait Sub: Super<Assoc = i32> {}
// no impl for Bound anywhere
trait Bound {}
trait Apply {
// Bound requirement here
type Output<T: Bound>: Sub;
}
trait Trait {
type What;
}
impl<A: Apply> Trait for A {
// i64 doesn't implement Bound
type What = <<A as Apply>::Output<i64> as Super>::Assoc;
}
cc @lcnr
Meta
Reproducible on the playground with version 1.96.0-nightly (2026-03-12 3102493c71626b5912d1)
The below code shouldn't compile, since
i64does not implementBound, so I shouldn't be allowed to writeOutput<i64>. However, it compiles without errors.I'm guessing that rustc sees
<.... as Super>::Assocand immediately concludes that the type must bei32without further checking.cc @lcnr
Meta
Reproducible on the playground with version
1.96.0-nightly (2026-03-12 3102493c71626b5912d1)