Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explain safety of unsync::OnceCell::get(&self) in more detail #214

Merged
merged 1 commit into from
Jan 2, 2023

Conversation

Enselic
Copy link
Contributor

@Enselic Enselic commented Jan 2, 2023

Background: I'm working on improving my unsafe Rust skills, and figuring out how once_cell works is one way to do that. By more elaborately explaining why unsync::OnceCell::get(&self) is safely implemented, I hope to help others increase their understanding of unsafe Rust as well.

(It was not obvious to me at first why unsync::OnceCell::get(&self) was safe. But I think I figured it out now.)

@matklad
Copy link
Owner

matklad commented Jan 2, 2023

bors r+

Thanks!

@bors
Copy link
Contributor

bors bot commented Jan 2, 2023

Build succeeded!

And happy new year! 🎉

@bors bors bot merged commit d706539 into matklad:master Jan 2, 2023
@Enselic Enselic deleted the explain-get-safety branch January 2, 2023 18:13
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.

None yet

2 participants