rust/tests/ui/object-lifetime/object-lifetime-default-dyn-binding-nonstatic3.stderr
2024-01-09 21:08:16 +00:00

24 lines
1006 B
Plaintext

error[E0228]: the lifetime bound for this object type cannot be deduced from context; please supply an explicit bound
--> $DIR/object-lifetime-default-dyn-binding-nonstatic3.rs:16:36
|
LL | fn bar(x: &str) -> &dyn Foo<Item = dyn Bar> { &() }
| ^^^^^^^
error[E0277]: the trait bound `(): Foo<'_>` is not satisfied
--> $DIR/object-lifetime-default-dyn-binding-nonstatic3.rs:16:47
|
LL | fn bar(x: &str) -> &dyn Foo<Item = dyn Bar> { &() }
| ^^^ the trait `Foo<'_>` is not implemented for `()`
|
help: this trait has no implementations, consider adding one
--> $DIR/object-lifetime-default-dyn-binding-nonstatic3.rs:4:1
|
LL | trait Foo<'a> {
| ^^^^^^^^^^^^^
= note: required for the cast from `&()` to `&dyn Foo<'_, Item = dyn Bar>`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0228, E0277.
For more information about an error, try `rustc --explain E0228`.