rust/tests/ui/async-await/async-fn/dyn-pos.stderr

19 lines
976 B
Plaintext
Raw Normal View History

2024-01-26 17:00:34 +00:00
error[E0038]: the trait `AsyncFnMut` cannot be made into an object
2024-11-06 17:53:59 +00:00
--> $DIR/dyn-pos.rs:3:16
2024-01-26 17:00:34 +00:00
|
LL | fn foo(x: &dyn AsyncFn()) {}
| ^^^^^^^^^ `AsyncFnMut` cannot be made into an object
2024-01-26 17:00:34 +00:00
|
note: for a trait to be "dyn-compatible" 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>
2024-01-26 17:00:34 +00:00
--> $SRC_DIR/core/src/ops/async_function.rs:LL:COL
|
= note: the trait cannot be made into an object because it contains the generic associated type `CallRefFuture`
= help: the following types implement the trait, consider defining an enum where each variant holds one of these types, implementing `AsyncFnMut` for this new enum and using it instead:
&F
&mut F
std::boxed::Box<F, A>
2024-01-26 17:00:34 +00:00
error: aborting due to 1 previous error
2024-01-26 17:00:34 +00:00
For more information about this error, try `rustc --explain E0038`.