Skip to content

Tracking Issue for Mutex::new() as const fn #66806

Closed
@elichai

Description

@elichai

Hi,
I think being able to do
static mut GLOBAL_LOCK: Mutex<Type> = Mutex::new(Type::new())

Is a very important feature, right now you have to do weird jumps with Option/MaybeUninit and Once to then return a &'static Mutex<T>.
In practice, the missing pieces here are: https://github.com/rust-lang/rust/blob/master/src/libstd/sys/unix/mutex.rs#L24 and #57349

alexcrichton Pointed out here #66823 (comment) that this also requires Box. so that's another missing piece in cost fn for these to be usable in const fn's


I opened this Issue as part of: #57563

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions