Type inference fails for collection of trait objects

I imagine there's a tradeoff here, as we don't want this to stop compiling due to the compiler never being sure if it should coerce or not:

fn foo() {
    let mut v = Vec::new();
    v.push(Box::new(D1));
    println!("{v:?}");
}

...but I'm not familiar enough with the compiler to do more than speculate.

By the way, signaling that things may not be what they seem (i.e. where a coercion is required) also results in a successful compilation.

3 Likes