I just looked at some code I wrote almost two years ago, and my IDE gave me this warning for fn bar().
pub trait Foo: Sized {
fn bar(&self, s: &str) -> Self;
fn qux(&self, s: &str) -> Self { self.bar(s) }
}
If I change that to
pub trait Foo: Sized {
fn bar(&self, s: &str) -> dyn Self;
fn qux(&self, s: &str) -> Self { self.bar(s) }
}
I get "The trait bound Foo: std::marker::Sized is not satisfied" on fn bar(). Replacing Self with Foo doesn't help. If I change Foo: Sized to Foo, I get an error on fn qux() saying that Self isn't sized.
I can leave things as I found them, but I don't want to be accused of being old fashioned