-
Notifications
You must be signed in to change notification settings - Fork 30
Conversation
Currently not all tests finish. I still need to figure out why. It may be in regards to the `fn defer_destroy` at list.rs:340
This looks pretty good! :) Regarding block allocation and deallocation, it seems we always turn a impl<T> Block<T> {
fn new<'a>(start_index: usize, msg_count: usize) -> Shared<'a, Block<T>>;
unsafe fn destroy(ptr: Shared<Block<T>>);
} The constructor doesn't really need to be Regarding the Travis failure, let's bump the minimum required Rust version to 1.28. (bump it in Some bikeshedding:
Regarding We could shave off a few bytes from |
@stjepang Thank you for the explanations! Good catch on the method signatures; I'll change those. |
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.
Just a few nits. Other than that, we can merge once Travis is happy.
src/flavors/list.rs
Outdated
let offset = head_index.wrapping_sub(head.start_index); | ||
|
||
let slot = head.slots.get_unchecked(offset); | ||
drop((*slot.msg.get()).take()); | ||
ManuallyDrop::drop(&mut (*slot).msg.get().read()); |
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.
We probably don't need to do .read()
here. This should work as well:
ManuallyDrop::drop(&mut *(*slot).msg.get());
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.
Perfect, thank you! :)
Closes #81
This builds off #100, and reverts back to the use of
UnsafeCell
withinSlot<T>
.There are a few things I would like to discuss in this PR:
slots
tomsgs
. I don't have a strong preference on naming, but found myself thinking of that field as messages anyways so I did it for clarity.msgs
needs to be typeUnsafeCell<Slot<T>>; 0]
. The type[Slot<T>; 0]
still passes, and allows a fewget()
s to be removed. I see the importance ofmsg
inSlot<T>
beingUnsafeCell
, but it's not as clear in this situation.msg_count
field inBlock<T>
. Do we want to consider embeddingmsg_count
instart_index
and just do some bitwise operations to retrieve the respective values? It would decrease the memory size of aBlock<T>
but also limits the size thatstart_index
can be (which will still be large).Any other feedback is welcome!