Skip to content

chore: replace all usage of pin_mut #2943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ jobs:
rust:
# This is the minimum Rust version supported by futures, futures-util, futures-task, futures-macro, futures-executor, futures-channel, futures-test.
# When updating this, the reminder to update the minimum required version in README.md and Cargo.toml.
- '1.63'
- '1.68'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Add this to your `Cargo.toml`:
futures = "0.3"
```

The current `futures` requires Rust 1.63 or later.
The current `futures` requires Rust 1.68 or later.

### Feature `std`

Expand Down
2 changes: 1 addition & 1 deletion futures-channel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures-channel"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
Expand Down
2 changes: 1 addition & 1 deletion futures-channel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add this to your `Cargo.toml`:
futures-channel = "0.3"
```

The current `futures-channel` requires Rust 1.63 or later.
The current `futures-channel` requires Rust 1.68 or later.

## License

Expand Down
2 changes: 1 addition & 1 deletion futures-executor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures-executor"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
Expand Down
2 changes: 1 addition & 1 deletion futures-executor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add this to your `Cargo.toml`:
futures-executor = "0.3"
```

The current `futures-executor` requires Rust 1.63 or later.
The current `futures-executor` requires Rust 1.68 or later.

## License

Expand Down
6 changes: 3 additions & 3 deletions futures-executor/src/local_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use futures_core::stream::Stream;
use futures_core::task::{Context, Poll};
use futures_task::{waker_ref, ArcWake};
use futures_task::{FutureObj, LocalFutureObj, LocalSpawn, Spawn, SpawnError};
use futures_util::pin_mut;
use futures_util::stream::FuturesUnordered;
use futures_util::stream::StreamExt;
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
use std::pin::pin;
use std::rc::{Rc, Weak};
use std::sync::{
atomic::{AtomicBool, Ordering},
Expand Down Expand Up @@ -155,7 +155,7 @@ impl LocalPool {
/// one of the pool's run or poll methods. While the function is running,
/// however, all tasks in the pool will try to make progress.
pub fn run_until<F: Future>(&mut self, future: F) -> F::Output {
pin_mut!(future);
let mut future = pin!(future);

run_executor(|cx| {
{
Expand Down Expand Up @@ -312,7 +312,7 @@ impl Default for LocalPool {
///
/// Use a [`LocalPool`] if you need finer-grained control over spawned tasks.
pub fn block_on<F: Future>(f: F) -> F::Output {
pin_mut!(f);
let mut f = pin!(f);
run_executor(|cx| f.as_mut().poll(cx))
}

Expand Down
2 changes: 1 addition & 1 deletion futures-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures-macro"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
Expand Down
2 changes: 1 addition & 1 deletion futures-task/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures-task"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
Expand Down
2 changes: 1 addition & 1 deletion futures-task/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add this to your `Cargo.toml`:
futures-task = "0.3"
```

The current `futures-task` requires Rust 1.63 or later.
The current `futures-task` requires Rust 1.68 or later.

## License

Expand Down
2 changes: 1 addition & 1 deletion futures-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures-test"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
Expand Down
2 changes: 1 addition & 1 deletion futures-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add this to your `Cargo.toml`:
futures-test = "0.3"
```

The current `futures-test` requires Rust 1.63 or later.
The current `futures-test` requires Rust 1.68 or later.

## License

Expand Down
2 changes: 1 addition & 1 deletion futures-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures-util"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
repository = "https://github.com/rust-lang/futures-rs"
homepage = "https://rust-lang.github.io/futures-rs"
Expand Down
2 changes: 1 addition & 1 deletion futures-util/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Add this to your `Cargo.toml`:
futures-util = "0.3"
```

The current `futures-util` requires Rust 1.63 or later.
The current `futures-util` requires Rust 1.68 or later.

## License

Expand Down
12 changes: 5 additions & 7 deletions futures-util/src/future/future/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
//! This module contains a number of functions for working with `Future`s,
//! including the `FutureExt` trait which adds methods to `Future` types.

use crate::fns::{inspect_fn, into_fn, ok_fn, InspectFn, IntoFn, OkFn};
use crate::future::{assert_future, Either};
use crate::stream::assert_stream;
#[cfg(feature = "alloc")]
use alloc::boxed::Box;
use core::convert::Infallible;
use core::pin::pin;
use core::pin::Pin;

use crate::fns::{inspect_fn, into_fn, ok_fn, InspectFn, IntoFn, OkFn};
use crate::future::{assert_future, Either};
use crate::pin_mut;
use crate::stream::assert_stream;
#[cfg(feature = "alloc")]
use futures_core::future::{BoxFuture, LocalBoxFuture};
use futures_core::{
Expand Down Expand Up @@ -592,8 +591,7 @@ pub trait FutureExt: Future {
let noop_waker = crate::task::noop_waker();
let mut cx = Context::from_waker(&noop_waker);

let this = self;
pin_mut!(this);
let this = pin!(self);
match this.poll(&mut cx) {
Poll::Ready(x) => Some(x),
_ => None,
Expand Down
2 changes: 1 addition & 1 deletion futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "futures"
version = "0.4.0-alpha.0"
edition = "2018"
rust-version = "1.63"
rust-version = "1.68"
license = "MIT OR Apache-2.0"
readme = "../README.md"
keywords = ["futures", "async", "future"]
Expand Down