From be156e733da2fd317b61160abdd6cfe45006632a Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Thu, 20 Feb 2020 16:59:10 -0500 Subject: [PATCH] ready-cache: restore assert for dropped cancel tx When ready-cache was upgraded from futures 0.1 to `std::future` in e2f1a49cf3bb29ec7a72feee2f31d9b8ab39d32a, this `expect` was removed, and the code instead silently ignores the error. That's probably not what we want, so this patch restores that assertion. --- tower-ready-cache/src/cache.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tower-ready-cache/src/cache.rs b/tower-ready-cache/src/cache.rs index 169aa5f..578f446 100644 --- a/tower-ready-cache/src/cache.rs +++ b/tower-ready-cache/src/cache.rs @@ -363,7 +363,8 @@ where fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { let mut fut = self.cancel.as_mut().expect("polled after complete"); - if let Poll::Ready(Ok(_)) = Pin::new(&mut fut).poll(cx) { + if let Poll::Ready(r) = Pin::new(&mut fut).poll(cx) { + assert!(r.is_ok(), "cancel sender lost"); let key = self.key.take().expect("polled after complete"); return Err(PendingError::Canceled(key)).into(); }