From e09b90ea32385337170ce17eb55ab372f9388af5 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 22 Sep 2020 22:56:45 +0200 Subject: macros: add #[allow(unused_mut)] to select! (#2858) --- tokio/tests/macros_select.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'tokio/tests') diff --git a/tokio/tests/macros_select.rs b/tokio/tests/macros_select.rs index 2ebc4efc..a6c8f8f5 100644 --- a/tokio/tests/macros_select.rs +++ b/tokio/tests/macros_select.rs @@ -462,3 +462,20 @@ async fn async_never() -> ! { tokio::time::delay_for(Duration::from_millis(10)).await; } } + +// From https://github.com/tokio-rs/tokio/issues/2857 +#[tokio::test] +async fn mut_on_left_hand_side() { + let v = async move { + let ok = async { 1 }; + tokio::pin!(ok); + tokio::select! { + mut a = &mut ok => { + a += 1; + a + } + } + } + .await; + assert_eq!(v, 2); +} -- cgit v1.2.3