about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDavid Wood <david@davidtw.co>2019-09-25 13:58:41 +0100
committerDavid Wood <david@davidtw.co>2019-09-30 23:41:20 +0100
commit04fa9b1b3f947fa66bb3e92702e134c72af9486f (patch)
tree36337f318c51ae0809a55bb34d122ffed380a45a /src/libstd
parentd046ffddc4bd50e04ffc3ff9f766e2ac71f74d50 (diff)
downloadrust-04fa9b1b3f947fa66bb3e92702e134c72af9486f.tar.gz
rust-04fa9b1b3f947fa66bb3e92702e134c72af9486f.zip
async/await: improve obligation errors
This commit improves obligation errors for async/await:

```
note: future does not implement `std::marker::Send` because this value is used across an
      await
  --> $DIR/issue-64130-non-send-future-diags.rs:15:5
   |
LL |     let g = x.lock().unwrap();
   |         - has type `std::sync::MutexGuard<'_, u32>`
LL |     baz().await;
   |     ^^^^^^^^^^^ await occurs here, with `g` maybe used later
LL | }
   | - `g` is later dropped here
```

Signed-off-by: David Wood <david@davidtw.co>
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/future.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index 0406549ff07..c65f71fb1a4 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -26,6 +26,7 @@ pub fn from_generator<T: Generator<Yield = ()>>(x: T) -> impl Future<Output = T:
 #[doc(hidden)]
 #[unstable(feature = "gen_future", issue = "50547")]
 #[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
+#[cfg_attr(not(test), rustc_diagnostic_item = "gen_future")]
 struct GenFuture<T: Generator<Yield = ()>>(T);
 
 // We rely on the fact that async/await futures are immovable in order to create