You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
= note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
19
19
20
-
error[E0038]: the trait `Trait` cannot be made into an object
21
-
--> $DIR/issue-34373.rs:7:24
22
-
|
23
-
LL | pub struct Foo<T = Box<Trait<DefaultFoo>>>;
24
-
| ^^^^^^^^^^^^^^^^^ `Trait` cannot be made into an object
25
-
|
26
-
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>
27
-
--> $DIR/issue-34373.rs:4:8
28
-
|
29
-
LL | trait Trait<T> {
30
-
| ----- this trait cannot be made into an object...
31
-
LL | fn foo(_: T) {}
32
-
| ^^^ ...because associated function `foo` has no `self` parameter
33
-
help: consider turning `foo` into a method by giving it a `&self` argument
34
-
|
35
-
LL | fn foo(&self, _: T) {}
36
-
| ++++++
37
-
help: alternatively, consider constraining `foo` so it does not apply to trait objects
0 commit comments