Skip to content

Commit

Permalink
remove workaround
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <i@bugenzhao.com>
  • Loading branch information
BugenZhao committed Oct 25, 2022
1 parent 97e020f commit 702edef
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/storage/src/hummock/iterator/merge_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,15 +227,6 @@ trait MergeIteratorNext {
fn next_inner(&mut self) -> Self::HummockResultFuture<'_>;
}

// TODO(chi): workaround for Rust toolchain 2022-10-16, removed this later
fn unsafe_boxed_static_future<F, O>(f: F) -> BoxFuture<'static, O>
where
F: Future<Output = O> + Send,
{
let b = f.boxed();
unsafe { std::mem::transmute::<BoxFuture<'_, O>, BoxFuture<'static, O>>(b) }
}

impl<I: HummockIterator> OrderedMergeIteratorInner<I> {
async fn next_inner_inner(&mut self) -> HummockResult<()> {
let top_node = self.heap.pop().expect("no inner iter");
Expand All @@ -259,12 +250,8 @@ impl<I: HummockIterator> OrderedMergeIteratorInner<I> {

// Put the popped nodes back to the heap if valid or unused_iters if invalid.

// TODO(chi): workaround for Rust toolchain 2022-10-16, removed boxed() later

for mut node in popped_nodes {
let f = unsafe_boxed_static_future(node.iter.next());

match f.await {
match node.iter.next().await {
Ok(_) => {}
Err(e) => {
// If the iterator returns error, we should clear the heap, so that this
Expand Down Expand Up @@ -301,11 +288,7 @@ impl<I: HummockIterator> UnorderedMergeIteratorInner<I> {
// return. Once the iterator enters an invalid state, we should remove it from heap
// before returning.

// TODO(chi): workaround for Rust toolchain 2022-10-16, removed boxed() later

let f = unsafe_boxed_static_future(node.iter.next());

match f.await {
match node.iter.next().await {
Ok(_) => {}
Err(e) => {
// If the iterator returns error, we should clear the heap, so that this
Expand Down

0 comments on commit 702edef

Please sign in to comment.