Skip to content

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

Merged
bors[bot] merged 1 commit intomatklad:masterfrom
Enselic:explain-get-safety
Jan 2, 2023
Merged

Explain safety of unsync::OnceCell::get(&self) in more detail#214
bors[bot] merged 1 commit intomatklad:masterfrom
Enselic:explain-get-safety

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.

2 participants