Skip to content

Commit eff8664

Browse files
authored
Rollup merge of rust-lang#94818 - yoshuawuyts:into-future-associated-type, r=joshtriplett
Rename `IntoFuture::Future` to `IntoFuture::IntoFuture` Ref: rust-lang#67644 (comment) This renames `IntoFuture::Future` to `IntoFuture::IntoFuture`. This adds the `Into*` prefix to the associated type, similar to the [`IntoIterator::IntoIter`](https://doc.rust-lang.org/std/iter/trait.IntoIterator.html#associatedtype.IntoIter) associated type. It's my mistake we didn't do so in the first place. This fixes that and brings the two closer together. Thanks! ### References __`IntoIterator` trait def__ ```rust pub trait IntoIterator { type Item; type IntoIter: Iterator<Item = Self::Item>; fn into_iter(self) -> Self::IntoIter; } ``` __`IntoFuture` trait def__ ```rust pub trait IntoFuture { type Output; type IntoFuture: Future<Output = Self::Output>; // Prior to this PR: `type Future:` fn into_future(self) -> Self::IntoFuture; } ``` cc/ `@eholk` `@rust-lang/wg-async`
2 parents 0dbb5d8 + 32e8b11 commit eff8664

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/future/into_future.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ pub trait IntoFuture {
99

1010
/// Which kind of future are we turning this into?
1111
#[unstable(feature = "into_future", issue = "67644")]
12-
type Future: Future<Output = Self::Output>;
12+
type IntoFuture: Future<Output = Self::Output>;
1313

1414
/// Creates a future from a value.
1515
#[unstable(feature = "into_future", issue = "67644")]
1616
#[lang = "into_future"]
17-
fn into_future(self) -> Self::Future;
17+
fn into_future(self) -> Self::IntoFuture;
1818
}
1919

2020
#[unstable(feature = "into_future", issue = "67644")]
2121
impl<F: Future> IntoFuture for F {
2222
type Output = F::Output;
23-
type Future = F;
23+
type IntoFuture = F;
2424

25-
fn into_future(self) -> Self::Future {
25+
fn into_future(self) -> Self::IntoFuture {
2626
self
2727
}
2828
}

0 commit comments

Comments
 (0)