Skip to content

futures-util: make Mutex::new() const - #2956

Merged
taiki-e merged 1 commit into
rust-lang:masterfrom
jstarks:const_mutex
Jul 19, 2025
Merged

taiki-e merged 1 commit into
rust-lang:masterfrom
jstarks:const_mutex

Conversation

@jstarks

@jstarks jstarks commented May 31, 2025

Copy link
Copy Markdown
Contributor

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 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 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 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.

Thanks.

@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
taiki-e merged commit de9274e into rust-lang:master Jul 19, 2025
taiki-e pushed a commit that referenced this pull request Feb 15, 2026
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 taiki-e mentioned this pull request Feb 15, 2026
@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 Feb 15, 2026
taiki-e pushed a commit that referenced this pull request Feb 15, 2026
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()`.
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.

3 participants