Fix unsound `Send` impl for `IterPinRef` and `Iter` by paolobarbolini · Pull Request #3003 · rust-lang/futures-rs · GitHub
Skip to content

Fix unsound Send impl for IterPinRef and Iter - #3003

Merged
taiki-e merged 1 commit into
rust-lang:masterfrom
paolobarbolini:fix-iter-pin-ref-send
Apr 12, 2026
Merged

taiki-e merged 1 commit into
rust-lang:masterfrom
paolobarbolini:fix-iter-pin-ref-send

Conversation

@paolobarbolini

Copy link
Copy Markdown
Contributor

Fixes #3002

`IterPinRef` yields `Pin<&Fut>` (shared references), so sending it
across threads requires `Fut: Sync`, not `Fut: Send`. The previous
bound allowed a data race when a `Send + !Sync` type (e.g. `Cell`)
was shared via iterators on two threads simultaneously.
@rustbot rustbot added A-stream Area: futures::stream S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 11, 2026

@taiki-e taiki-e left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taiki-e
taiki-e merged commit d883643 into rust-lang:master Apr 12, 2026
25 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 12, 2026
@taiki-e taiki-e added the 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. label Apr 12, 2026
@taiki-e taiki-e mentioned this pull request Jul 18, 2026
taiki-e pushed a commit that referenced this pull request Jul 18, 2026
`IterPinRef` yields `Pin<&Fut>` (shared references), so sending it
across threads requires `Fut: Sync`, not `Fut: Send`. The previous
bound allowed a data race when a `Send + !Sync` type (e.g. `Cell`)
was shared via iterators on two threads simultaneously.
@taiki-e

taiki-e commented Jul 18, 2026

Copy link
Copy Markdown
Member

@taiki-e taiki-e added 0.3-backport: completed and removed 0.3-backport: pending The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet. labels Aug 11, 2026
markharding pushed a commit to futo-org/Harbor that referenced this pull request Oct 13, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [futures](https://rust-lang.github.io/futures-rs) ([source](https://github.com/rust-lang/futures-rs)) | dependencies | patch | `0.3.32` → `0.3.34` |

---

### Release Notes

<details>
<summary>rust-lang/futures-rs (futures)</summary>

### [`v0.3.34`](https://github.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#0334---2026-08-11)

[Compare Source](rust-lang/futures-rs@0.3.33...0.3.34)

- Preserve cloned waker identity. ([#&#8203;3032](rust-lang/futures-rs#3032))
- Updato `syn` to 3. ([#&#8203;3028](rust-lang/futures-rs#3028))

### [`v0.3.33`](https://github.com/rust-lang/futures-rs/blob/HEAD/CHANGELOG.md#0333---2026-07-18)

[Compare Source](rust-lang/futures-rs@0.3.32...0.3.33)

- Fix `ReadLine`'s soundness issue regarding to exception safety. ([#&#8203;3020](rust-lang/futures-rs#3020))
- Fix unsound `Send` impl for `IterPinRef` and `Iter`. ([#&#8203;3003](rust-lang/futures-rs#3003))
- Fix stacked borrows violation in `compat01as03` implementation. ([#&#8203;3012](rust-lang/futures-rs#3012))
- Fix memory leak in `FuturesUnordered::IntoIter`. ([#&#8203;3005](rust-lang/futures-rs#3005))
- Add `portable-atomic-alloc` feature and use it in `FuturesUnordered`. ([#&#8203;3007](rust-lang/futures-rs#3007))
- Re-export `alloc::task::Wake`. ([#&#8203;3010](rust-lang/futures-rs#3010))
- Update `spin` to 0.12. ([#&#8203;3014](rust-lang/futures-rs#3014))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "before 9am on tuesday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjEzMy4wIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->

Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1791
Reviewed-by: Thomas de Zeeuw <thomas@futo.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IterPinRef and Iter unsoundly implement Send when Fut: Send instead of Fut: Sync

3 participants