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
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
14
14
= help: consider moving `baz` to another trait
15
15
16
-
error[E0277]: the trait bound `dyn Foo: Foo` is not satisfied
16
+
error[E0038]: the trait `Foo` cannot be made into an object
17
17
--> $DIR/object-safety.rs:20:15
18
18
|
19
19
LL | let s = i.baz();
20
-
| ^^^ the trait `Foo` is not implemented for `dyn Foo`
20
+
| ^^^ `Foo` cannot be made into an object
21
21
|
22
-
= help: the trait `Foo` is implemented for `u32`
22
+
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>
23
+
--> $DIR/object-safety.rs:7:22
24
+
|
25
+
LL | trait Foo {
26
+
| --- this trait cannot be made into an object...
27
+
LL | fn baz(&self) -> impl Debug;
28
+
| ^^^^^^^^^^ ...because method `baz` references an `impl Trait` type in its return type
29
+
= help: consider moving `baz` to another trait
23
30
24
31
error[E0038]: the trait `Foo` cannot be made into an object
0 commit comments