Skip to content

Commit 6768e78

Browse files
committed
Auto merge of #90737 - eholk:intofuture, r=tmandry
Reintroduce `into_future` in `.await` desugaring This is a reintroduction of the remaining parts from rust-lang/rust#65244 that have not been relanded yet. This isn't quite ready to merge yet. The last attempt was reverting due to performance regressions, so we need to make sure this does not introduce those issues again. Issues #67644, #67982 /cc `@yoshuawuyts`
2 parents 9003e2d + 5616053 commit 6768e78

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-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")]

core/src/future/into_future.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub trait IntoFuture {
1313

1414
/// Creates a future from a value.
1515
#[unstable(feature = "into_future", issue = "67644")]
16+
#[cfg_attr(not(bootstrap), lang = "into_future")]
1617
fn into_future(self) -> Self::Future;
1718
}
1819

0 commit comments

Comments
 (0)