about summary refs log tree commit diff
path: root/library/core/src/future
diff options
context:
space:
mode:
authorEric Holk <ericholk@microsoft.com>2021-12-02 11:36:48 -0800
committerEric Holk <ericholk@microsoft.com>2021-12-02 11:36:56 -0800
commit0cb769347d64b52187a593aca941879d990f61b2 (patch)
tree73413decb7fe4604b537f3eb146173a5b1ca85c7 /library/core/src/future
parentdb80c0759067028edc71939b24c35d8234835096 (diff)
downloadrust-0cb769347d64b52187a593aca941879d990f61b2.tar.gz
rust-0cb769347d64b52187a593aca941879d990f61b2.zip
Code review feedback
Add a note about `IntoFuture` in error messages where T is not a future.

Change await-into-future.rs to be a run-pass test.
Diffstat (limited to 'library/core/src/future')
-rw-r--r--library/core/src/future/future.rs6
1 files changed, 5 insertions, 1 deletions
diff --git a/library/core/src/future/future.rs b/library/core/src/future/future.rs
index 09d8a2aac26..6b62236b32f 100644
--- a/library/core/src/future/future.rs
+++ b/library/core/src/future/future.rs
@@ -28,7 +28,11 @@ use crate::task::{Context, Poll};
 #[must_use = "futures do nothing unless you `.await` or poll them"]
 #[stable(feature = "futures_api", since = "1.36.0")]
 #[lang = "future_trait"]
-#[rustc_on_unimplemented(label = "`{Self}` is not a future", message = "`{Self}` is not a future")]
+#[rustc_on_unimplemented(
+    label = "`{Self}` is not a future",
+    message = "`{Self}` is not a future",
+    note = "{Self} must be a future or must implement `IntoFuture` to be awaited"
+)]
 pub trait Future {
     /// The type of value produced on completion.
     #[stable(feature = "futures_api", since = "1.36.0")]