1- error[E0277]: `U` cannot be sent between threads safely
1+ error: future cannot be sent between threads safely
22 --> $DIR/issue-70818.rs:4:38
33 |
44LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
5- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ `U` cannot be sent between threads safely
5+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
66LL |
77LL | async { (ty, ty1) }
88 | ------------------- this returned value is of type `impl Future`
9- |
10- ::: $SRC_DIR/core/src/future/mod.rs:LL:COL
119 |
12- LL | pub const fn from_generator<T>(gen: T) -> impl Future<Output = T::Return>
13- | ------------------------------- within this `impl Future`
10+ note: captured value is not `Send`
11+ --> $DIR/issue-70818.rs:6:18
1412 |
15- = note: required because it appears within the type `(T, U)`
16- = note: required because it appears within the type `[static generator@$DIR/issue-70818.rs:6:11: 6:24 _]`
17- = note: required because it appears within the type `from_generator::GenFuture<[static generator@$DIR/issue-70818.rs:6:11: 6:24 _]>`
18- = note: required because it appears within the type `impl Future`
13+ LL | async { (ty, ty1) }
14+ | ^^^ has type `U` which is not `Send`
1915 = note: the return type of a function must have a statically known size
2016help: consider restricting type parameter `U`
2117 |
@@ -24,4 +20,3 @@ LL | fn foo<T: Send, U: Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + S
2420
2521error: aborting due to previous error
2622
27- For more information about this error, try `rustc --explain E0277`.
0 commit comments