What qualitifies as a dyn upcasting coercion
The condition comes from the existing infrastructure within the compiler.
Currently the unsizing coercion on a trait object type allows it to:
-
Removing one or more auto traits. (i.e.
dyn Foo + Send: Unsize<dyn Foo>
) -
Changing lifetime bounds according to subtyping rules. (
dyn Bar<'static>: Unsize<dyn Bar<'a>>
) -
Changing the principal trait to one of its supertraits. (
dyn Goo: Unsize<dyn Foo>
whereGoo
istrait Goo: Foo {}
)
When the third rule is involved, this unsizing coercion is a dyn upcasting coercion.