Skip to content

Replace once_cell with std::sync::OnceLock - #257

Merged
djc merged 1 commit into
rustls:mainfrom
FalkWoldmann:replace-once-cell
Oct 1, 2026
Merged

djc merged 1 commit into
rustls:mainfrom
FalkWoldmann:replace-once-cell

Conversation

@FalkWoldmann

Copy link
Copy Markdown
Contributor

OnceLock has been in std since Rust 1.70, below the MSRV of 1.85. zget_or_try_init zisn't stable on OnceLock yet, so the two places that used it now build the value first and store it with set/get_or_ini t

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

Nice, thanks!

@djc

djc commented Oct 1, 2026

Copy link
Copy Markdown
Member

I fixed the unrelated CI issues in

Can you rebase on top of current main?

OnceLock::get_or_try_init isn't stable yet, so values are built before being stored.
@FalkWoldmann

Copy link
Copy Markdown
Contributor Author

Rebased, thanks!

@complexspaces

Copy link
Copy Markdown
Collaborator

Re the SemVer job failing: It seems really unlikely anyone enabled the once_cell feature manually and the parent feature it is part of (docsrs) is explicitly marked as unstable. I think we should be OK to ignore the reported breakage.

@djc
djc merged commit 8becdc1 into rustls:main Oct 1, 2026
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants