Skip to content

Commit

Permalink
[Turbopack] fix unsafe pinning code (#75473)
Browse files Browse the repository at this point in the history
### What?

Not sure exactly why, but the previous code caused hanging on event listeners...
  • Loading branch information
sokra authored Jan 30, 2025
1 parent 9a6b0f5 commit c5441e3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions turbopack/crates/turbo-tasks/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use std::{
fmt::{Debug, Formatter},
future::Future,
mem::replace,
pin::Pin,
};

#[cfg(feature = "hanging_detection")]
Expand Down Expand Up @@ -144,7 +143,8 @@ impl Future for EventListener {
self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Self::Output> {
unsafe { Pin::new_unchecked(&mut self.get_unchecked_mut().listener) }.poll(cx)
let listener = unsafe { self.map_unchecked_mut(|s| &mut s.listener) };
listener.poll(cx)
}
}

Expand Down

0 comments on commit c5441e3

Please sign in to comment.