Unverified Commit fc57e13c authored by Russell Cohen's avatar Russell Cohen Committed by GitHub
Browse files

Update changelog and use you task::spawn helper (#1915)

parent f92855f6
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -46,3 +46,9 @@ message = "`aws_smithy_http_server::routing::Router` is exported from the crate
references = ["smithy-rs#1910"]
meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "server" }
author = "david-perez"

[[smithy-rs]]
message = "Fix bug that can cause panics in paginators"
references = ["smithy-rs#1903", "smithy-rs#1902"]
meta = { "breaking" = false, "tada" = false, "bug" = true, "target" = "client"}
author = "rcoh"
+1 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ futures-util = "0.3.16"

[dev-dependencies]
tokio = { version = "1.8.4", features = ["rt", "macros", "test-util"] }
tokio-test = "0.4.2"

[package.metadata.docs.rs]
all-features = true
+5 −12
Original line number Diff line number Diff line
@@ -76,6 +76,8 @@ where
            Poll::Pending => {
                if let Some(generator) = me.generator.as_mut().as_pin_mut() {
                    if generator.poll(cx).is_ready() {
                        // if the generator returned ready we MUST NOT poll it again—doing so
                        // will cause a panic.
                        me.generator.set(None);
                    }
                }
@@ -144,10 +146,7 @@ where
#[cfg(test)]
mod test {
    use crate::future::fn_stream::{FnStream, TryFlatMap};
    use futures_util::task::noop_waker_ref;
    use std::future::Future;
    use std::sync::{Arc, Mutex};
    use std::task::Context;
    use std::time::Duration;
    use tokio_stream::StreamExt;

@@ -185,15 +184,9 @@ mod test {
            })
        });
        assert_eq!(stream.next().await, Some("blah"));
        let mut fut = Box::pin(stream.next());
        assert!(fut
            .as_mut()
            .poll(&mut Context::from_waker(noop_waker_ref()))
            .is_pending());
        assert!(fut
            .as_mut()
            .poll(&mut Context::from_waker(noop_waker_ref()))
            .is_pending());
        let mut test_stream = tokio_test::task::spawn(stream);
        assert!(test_stream.poll_next().is_pending());
        assert!(test_stream.poll_next().is_pending());
    }

    /// Tests that the generator will not advance until demand exists