diff options
| author | Tyler Mandry <tmandry@gmail.com> | 2020-04-01 19:04:55 -0700 |
|---|---|---|
| committer | Tyler Mandry <tmandry@gmail.com> | 2020-04-13 18:58:17 -0700 |
| commit | e340375ef8eb551bae29f36bf562aab1162939db (patch) | |
| tree | 9d14e69b985472969ead92a3f3a29c676e939f55 /src/test | |
| parent | aed7c30e4f794bc285aeca36dd9e2cc02cef2754 (diff) | |
| download | rust-e340375ef8eb551bae29f36bf562aab1162939db.tar.gz rust-e340375ef8eb551bae29f36bf562aab1162939db.zip | |
Don't double-annotate the same Span
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/ui/async-await/issue-68112.rs | 9 | ||||
| -rw-r--r-- | src/test/ui/async-await/issue-68112.stderr | 28 |
2 files changed, 31 insertions, 6 deletions
diff --git a/src/test/ui/async-await/issue-68112.rs b/src/test/ui/async-await/issue-68112.rs index 0d269b1801b..604cc51921e 100644 --- a/src/test/ui/async-await/issue-68112.rs +++ b/src/test/ui/async-await/issue-68112.rs @@ -35,6 +35,15 @@ fn test1() { //~^ ERROR future cannot be sent between threads } +fn test1_no_let() { + let send_fut = async { + let _ = make_non_send_future1().await; + ready(0).await; + }; + require_send(send_fut); + //~^ ERROR future cannot be sent between threads +} + async fn ready2<T>(t: T) -> T { t } fn make_non_send_future2() -> impl Future<Output = Arc<RefCell<i32>>> { ready2(Arc::new(RefCell::new(0))) diff --git a/src/test/ui/async-await/issue-68112.stderr b/src/test/ui/async-await/issue-68112.stderr index f79908110c4..c0659bf944b 100644 --- a/src/test/ui/async-await/issue-68112.stderr +++ b/src/test/ui/async-await/issue-68112.stderr @@ -16,8 +16,24 @@ LL | let non_send_fut = make_non_send_future1(); LL | let _ = non_send_fut.await; | ^^^^^^^^^^^^ await occurs here +error: future cannot be sent between threads safely + --> $DIR/issue-68112.rs:43:5 + | +LL | fn require_send(_: impl Send) {} + | ------------ ---- required by this bound in `require_send` +... +LL | require_send(send_fut); + | ^^^^^^^^^^^^ future created by async block is not `Send` + | + = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell<i32>` +note: future is not `Send` as this value is used in an await + --> $DIR/issue-68112.rs:40:17 + | +LL | let _ = make_non_send_future1().await; + | ^^^^^^^^^^^^^^^^^^^^^^^ await occurs here + error[E0277]: `std::cell::RefCell<i32>` cannot be shared between threads safely - --> $DIR/issue-68112.rs:49:5 + --> $DIR/issue-68112.rs:58:5 | LL | fn require_send(_: impl Send) {} | ------------ ---- required by this bound in `require_send` @@ -27,16 +43,16 @@ LL | require_send(send_fut); | = help: the trait `std::marker::Sync` is not implemented for `std::cell::RefCell<i32>` = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<std::cell::RefCell<i32>>` - = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:38:31: 38:36 t:std::sync::Arc<std::cell::RefCell<i32>> {}]` - = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:38:31: 38:36 t:std::sync::Arc<std::cell::RefCell<i32>> {}]>` + = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:47:31: 47:36 t:std::sync::Arc<std::cell::RefCell<i32>> {}]` + = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:47:31: 47:36 t:std::sync::Arc<std::cell::RefCell<i32>> {}]>` = note: required because it appears within the type `impl std::future::Future` = note: required because it appears within the type `impl std::future::Future` = note: required because it appears within the type `impl std::future::Future` = note: required because it appears within the type `{std::future::ResumeTy, impl std::future::Future, (), i32, Ready<i32>}` - = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:44:26: 48:6 {std::future::ResumeTy, impl std::future::Future, (), i32, Ready<i32>}]` - = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:44:26: 48:6 {std::future::ResumeTy, impl std::future::Future, (), i32, Ready<i32>}]>` + = note: required because it appears within the type `[static generator@$DIR/issue-68112.rs:53:26: 57:6 {std::future::ResumeTy, impl std::future::Future, (), i32, Ready<i32>}]` + = note: required because it appears within the type `std::future::from_generator::GenFuture<[static generator@$DIR/issue-68112.rs:53:26: 57:6 {std::future::ResumeTy, impl std::future::Future, (), i32, Ready<i32>}]>` = note: required because it appears within the type `impl std::future::Future` -error: aborting due to 2 previous errors +error: aborting due to 3 previous errors For more information about this error, try `rustc --explain E0277`. |
