The following code
trait Foo {
fn call_mut(&mut self);
fn call_once(mut self) {
self.call_mut();
}
}
produces the following error:
test37.rs:4:18: 4:26 error: the trait bound `Self: std::marker::Sized` is not satisfied [E0277]
test37.rs:4 fn call_once(mut self) {
^~~~~~~~
test37.rs:4:18: 4:26 help: run `rustc --explain E0277` to see a detailed explanation
test37.rs:4:18: 4:26 help: consider adding a `where Self: std::marker::Sized` bound
test37.rs:4:18: 4:26 note: all local variables must have a statically known size
error: aborting due to previous error
Why? As I understand it, Rust monomorphizes trait except when using trait objects, so for each concrete T, it provides a separate "fn call_once(mut self: T)" implementation, where it must know the size of T.
Thanks.