Skip to content

Add const Default impls for LazyCell and LazyLock#154929

Open
davidgauch wants to merge 1 commit intorust-lang:mainfrom
davidgauch:const-default-lazy
Open

Add const Default impls for LazyCell and LazyLock#154929
davidgauch wants to merge 1 commit intorust-lang:mainfrom
davidgauch:const-default-lazy

Conversation

@davidgauch
Copy link
Copy Markdown

Follow up to these commits by @estebank #134628 and #151190.
Tracking issue #143894.

cc @fmease @fee1-dead @oli-obk

This enables static L: LazyLock<D> = Default::default() for any type D: Default which is safe as D::default() is only evaluated at runtime.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 7, 2026
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Apr 7, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 7, 2026

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 8 candidates
  • Random selection from Mark-Simulacrum, jhpratt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants