| error[E0038]: the trait `Foo` cannot be made into an object |
| --> $DIR/object-safety-no-static.rs:22:27 |
| | |
| LL | trait Foo { |
| | --- this trait cannot be made into an object... |
| LL | fn foo() {} |
| | --- ...because associated function `foo` has no `self` parameter |
| ... |
| LL | let b: Box<dyn Foo> = Box::new(Bar); |
| | ^^^^^^^^^^^^^ the trait `Foo` cannot be made into an object |
| | |
| = note: required because of the requirements on the impl of `CoerceUnsized<Box<dyn Foo>>` for `Box<Bar>` |
| = note: required by cast to type `Box<dyn Foo>` |
| help: consider turning `foo` into a method by giving it a `&self` argument or constraining it so it does not apply to trait objects |
| | |
| LL | fn foo() where Self: Sized {} |
| | ^^^^^^^^^^^^^^^^^ |
| |
| error: aborting due to previous error |
| |
| For more information about this error, try `rustc --explain E0038`. |