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

Make SmallBox covariant over T #40

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

PonasKovas
Copy link
Contributor

Hello again.

I modified the implementation of SmallBox<T> to make it covariant over T, by replacing the inner pointer from *mut to *const.

It's worth noting that we have to be careful with the *const pointer, to not do something like &mut T as *const T, which results in a non-writable pointer (basically expands to &mut T as &T as *const T instead of &mut T as *mut T as *const T), but I didn't see anything like that in the codebase, as we are using the alloc crate which gives *mut u8 directly.

@andylokandy andylokandy merged commit eb4dfc3 into andylokandy:master Dec 22, 2024
9 checks passed
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