bless issue-70818 test case
This commit is contained in:
parent
382a963c17
commit
d2e5a8e2e9
3 changed files with 35 additions and 13 deletions
|
|
@ -1,7 +1,9 @@
|
|||
// edition 2018
|
||||
// edition:2018
|
||||
|
||||
fn foo<T: Sized>(ty: T) -> impl std::future::Future<Output = T> + Send { //~ Error `T` cannot be sent between threads safely
|
||||
async { ty }
|
||||
use std::future::Future;
|
||||
fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
//~^ Error future cannot be sent between threads safely
|
||||
async { (ty, ty1) }
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
23
src/test/ui/async-await/issue-70818.stderr
Normal file
23
src/test/ui/async-await/issue-70818.stderr
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
error: future cannot be sent between threads safely
|
||||
--> $DIR/issue-70818.rs:4:38
|
||||
|
|
||||
LL | fn foo<T: Send, U>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ future created by async block is not `Send`
|
||||
LL |
|
||||
LL | async { (ty, ty1) }
|
||||
| ------------------- this returned value is of type `impl std::future::Future`
|
||||
|
|
||||
= help: within `impl std::future::Future`, the trait `std::marker::Send` is not implemented for `U`
|
||||
note: captured outer value is not `Send`
|
||||
--> $DIR/issue-70818.rs:6:18
|
||||
|
|
||||
LL | async { (ty, ty1) }
|
||||
| ^^^ has type `U` which is not `Send`
|
||||
= note: the return type of a function must have a statically known size
|
||||
help: consider restricting type parameter `U`
|
||||
|
|
||||
LL | fn foo<T: Send, U: std::marker::Send>(ty: T, ty1: U) -> impl Future<Output = (T, U)> + Send {
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue