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 NonNull in place of *const (v2) #334

Merged
merged 2 commits into from
Jan 15, 2024
Merged

Conversation

matzemathics
Copy link
Contributor

Port of #171. While it (at least currently) does not improve the size of objects in any case I could come up with, it still feels a lot more appropriate to use, because it cleanly communicates the requirements it already had: it is covariant and never null.

Copy link
Collaborator

@mbrubeck mbrubeck left a comment

Choose a reason for hiding this comment

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

Thanks again! Added one minor request.

src/lib.rs Outdated
drop(DropDealloc {
ptr: NonNull::new_unchecked(ptr as *mut u8),
ptr: NonNull::new_unchecked(ptr.as_ptr() as *mut u8),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this can use NonNull::cast.

@mbrubeck mbrubeck added this pull request to the merge queue Jan 15, 2024
Merged via the queue into servo:v2 with commit 43e678e Jan 15, 2024
6 checks passed
@matzemathics matzemathics deleted the use-non-null-v2 branch January 15, 2024 23:44
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