-
Notifications
You must be signed in to change notification settings - Fork 490
skiplist: switch to alloc API #268
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR! We just need to tweak a few things before merging.
@stjepang I think this is all set now. |
Hmm, not really sure why it thinks that |
It's because of these shenanigans we use to support no_std + alloc environments. You probably need |
Ahhhh, alright. Lemme whip up the fix. |
Signed-off-by: Toby Lawrence <[email protected]>
Looks like it's an unrelated |
That is an unrelated regression on nightly Rust: rust-lang/rust#56867 |
let ptr = v.as_mut_ptr() as *mut Self; | ||
mem::forget(v); | ||
let layout = Self::get_layout(height); | ||
let ptr = alloc(layout) as *mut Self; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to check for null and call handle_alloc_error(layout)
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, thanks for pointing this out! I'm used to Box::new()
always working so the possibility of a failure didn't even cross my mind.
@tobz Would you like to submit a fix for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this a bit of a footgun… eventually we’ll stabilize the Alloc
trait with Result
return types and deprecate these functions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll submit a fix, yeah.
This addresses #246 by removing the allocation hack that was in place before.
Signed-off-by: Toby Lawrence [email protected]