Skip to content

Recommend using Once::new() instead of ONCE_INIT? #61746

Closed
@estebank

Description

@estebank

std::sync::ONCE_INIT is in effect just an alias to std::sync::Once::new(), anyone using the former can use the latter since v1.2.0. I guess we can't outright deprecate ONCE_INIT given our backwards compatibility policy, but I would like to lint on its usage and at the very least call it out in the documentation ("use Once::new() instead").

This also opens the conversation around the larger problem of what to do with the parts of the API that would get superseded by new features, like const generics, or in this case const fns.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsA-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.T-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