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

Use MaybeUninit while manipulating uninitialized data #40

Merged
merged 1 commit into from Nov 26, 2019
Merged

Use MaybeUninit while manipulating uninitialized data #40

merged 1 commit into from Nov 26, 2019

Conversation

vorner
Copy link
Contributor

@vorner vorner commented Nov 26, 2019

Because there's no way to manipulate unitialized data to some data types
just through references.

Adding Arena::reserve_extend to allow a somewhat safer pattern how to
initialize the memory without risk of causing UB by panicking before
full initialization, causing the arena to call destructors on bad data.

Closes #38.

If the documentation need improving or some more tests are need, just point them out please. I'm sometimes blind to these things.

Also, I hope I've been careful enough. I kind of assume that Vec already assumes the buffer might contain some uninitialized values so it's fine to cast them to MaybeUninit and hand out pointers to such things.

Because there's no way to manipulate unitialized data to some data types
just through references.

Adding Arena::reserve_extend to allow a somewhat safer pattern how to
initialize the memory without risk of causing UB by panicking before
full initialization, causing the arena to call destructors on bad data.

Closes #38.
Copy link
Collaborator

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great docs! Thanks!

@fitzgen fitzgen merged commit c96af29 into thomcc:master Nov 26, 2019
@fitzgen
Copy link
Collaborator

fitzgen commented Nov 26, 2019

Published 2.0.0-rc1 -- if we don't have any issues discovered or raised in the next week or so, then I'll publish 2.0.0 proper.

@vorner
Copy link
Contributor Author

vorner commented Nov 27, 2019

Thanks. I've noticed now that the docs are rendered on docs.rs that the links to methods don't work. I'll send a fix for that (I think I can make that one before the release).

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.

Should alloc_unitialized return MaybeUninit?
2 participants