When trying to return a trait object from a default implementation within a trait, such as
trait Foo {
fn foo(self: Box<Self>) -> Box<dyn Foo> {
self
}
}
the Rust compiler complains that
error[E0277]: the size for values of type `Self` cannot be known at compilation time
note: required for the cast to the object type `dyn Foo`
The type cast should be from Box<Self> to Box<dyn Foo>, why would this require Self to be sized?