1 error[E0038]: the trait `NotObjectSafe` cannot be made into an object
2 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:21:13
4 LL | fn car() -> dyn NotObjectSafe {
5 | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object
7 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
8 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8
10 LL | trait NotObjectSafe {
11 | ------------- this trait cannot be made into an object...
12 LL | fn foo() -> Self;
13 | ^^^ ...because associated function `foo` has no `self` parameter
14 help: consider turning `foo` into a method by giving it a `&self` argument
16 LL | fn foo(&self) -> Self;
18 help: alternatively, consider constraining `foo` so it does not apply to trait objects
20 LL | fn foo() -> Self where Self: Sized;
23 error[E0038]: the trait `NotObjectSafe` cannot be made into an object
24 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:28:17
26 LL | fn cat() -> Box<dyn NotObjectSafe> {
27 | ^^^^^^^^^^^^^^^^^ `NotObjectSafe` cannot be made into an object
29 note: for a trait to be "object safe" it needs to allow building a vtable to allow the call to be resolvable dynamically; for more information visit <https://doc.rust-lang.org/reference/items/traits.html#object-safety>
30 --> $DIR/object-unsafe-trait-in-return-position-dyn-trait.rs:3:8
32 LL | trait NotObjectSafe {
33 | ------------- this trait cannot be made into an object...
34 LL | fn foo() -> Self;
35 | ^^^ ...because associated function `foo` has no `self` parameter
36 help: consider turning `foo` into a method by giving it a `&self` argument
38 LL | fn foo(&self) -> Self;
40 help: alternatively, consider constraining `foo` so it does not apply to trait objects
42 LL | fn foo() -> Self where Self: Sized;
45 error: aborting due to 2 previous errors
47 For more information about this error, try `rustc --explain E0038`.