futures-util: make Mutex::new() const by jstarks · Pull Request #2956 · rust-lang/futures-rs (original) (raw)

@jstarks

This builds with the MSRV (1.68) and is convenient for creating static mutexes.

This does bind the implementation to never allocate in new in the future, but that seems like a desirable property anyway.

Note that this also requires updating slab to 0.4.7, which is the first version that supports const Slab::new().

@rustbot added A-lock

Area: futures::lock

S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

May 31, 2025

@taiki-e taiki-e added 0.3-backport: pending

The maintainer accepted to backport this to the 0.3 branch, but backport has not been done yet.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jun 5, 2025

taiki-e pushed a commit that referenced this pull request

Feb 15, 2026

@jstarks @taiki-e

This builds with the MSRV (1.68) and is convenient for creating static mutexes.

This does bind the implementation to never allocate in new in the future, but that seems like a desirable property anyway.

Note that this also requires updating slab to 0.4.7, which is the first version that supports const Slab::new().

taiki-e pushed a commit that referenced this pull request

Feb 15, 2026

@jstarks @taiki-e

This builds with the MSRV (1.68) and is convenient for creating static mutexes.

This does bind the implementation to never allocate in new in the future, but that seems like a desirable property anyway.

Note that this also requires updating slab to 0.4.7, which is the first version that supports const Slab::new().

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})