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 unsafe_unwrap (or stdlib equivalent) for NonNull #149

Open
joshlf opened this issue Feb 16, 2018 · 0 comments
Open

Use unsafe_unwrap (or stdlib equivalent) for NonNull #149

joshlf opened this issue Feb 16, 2018 · 0 comments

Comments

@joshlf
Copy link
Collaborator

joshlf commented Feb 16, 2018

Now that we're using NonNull instead of *mut, we're sometimes using Option<NonNull<T>> where we would otherwise use a *mut T that could be null. Where we previously would have dereferenced if we already knew that the pointer was non-null, we now have to do ptr.unwrap(), which incurs runtime overhead.

Instead, we should use unsafe_unwrap or a stdlib equivalent if one is ever added (see rust-lang/rust#48278).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant