Coherence with object types with overlapping supertrait projections is incomplete #133361
Open
Description
I tried this code:
trait Sup<T> {
type Assoc;
}
impl<T> Sup<T> for () {
type Assoc = T;
}
impl<T, U> Dyn<T, U> for () {}
trait Dyn<A, B>: Sup<A, Assoc = A> + Sup<B, Assoc = B> {}
trait Trait {
type Assoc;
}
impl Trait for dyn Dyn<(), ()> {
type Assoc = &'static str;
}
impl<A, B> Trait for dyn Dyn<A, B> {
type Assoc = usize;
}
fn call<A, B>(x: usize) -> <dyn Dyn<A, B> as Trait>::Assoc {
x
}
fn main() {
let x: &'static str = call::<(), ()>(0xDEADBEEF);
println!("{x}");
}
I expected to see this happen: It does not work.
Instead, this happened: Segfault
Meta
rustc --version --verbose
:
rustc 1.85.0-nightly (a47555110 2024-11-22)
Metadata
Assignees
Labels
Type
Projects
Status
unblocked
Activity