Skip to content

Commit 5616053

Browse files
committed
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.
1 parent c0781d8 commit 5616053

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

core/src/future/future.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ use crate::task::{Context, Poll};
2828
#[must_use = "futures do nothing unless you `.await` or poll them"]
2929
#[stable(feature = "futures_api", since = "1.36.0")]
3030
#[lang = "future_trait"]
31-
#[rustc_on_unimplemented(label = "`{Self}` is not a future", message = "`{Self}` is not a future")]
31+
#[rustc_on_unimplemented(
32+
label = "`{Self}` is not a future",
33+
message = "`{Self}` is not a future",
34+
note = "{Self} must be a future or must implement `IntoFuture` to be awaited"
35+
)]
3236
pub trait Future {
3337
/// The type of value produced on completion.
3438
#[stable(feature = "futures_api", since = "1.36.0")]

0 commit comments

Comments
 (0)