Skip to content

ArrayString: Reducing reliance on unsafe blocks + adding some safety comments #288

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

anforowicz
Copy link

PTAL? Please see the individual commit descriptions for more details.

Before the changes in `fn new`, the type of `MaybeUninit::uninit()`
would be inferred to be `MaybeUninit<[MaybeUninit<...>; CAP]>` which
seems somewhat unexpected.  This commit rewrites this expression so that
no `unsafe` is needed.

Similarily, before the changes in `fn zero_filled`, the type of
`MaybeUninit::zeroed()` would be inferred to be
`MaybeUninit<[MaybeUninit<...>; CAP]>`.  This commit also rewrites this
expression so that no `unsafe` is needed.
The safe code results in the same, fast assembly code.
The safe code should result in the same, fast assembly code.
This also opportunistically reduces the amount of `unsafe` in
`ArrayString::remove`.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant