summaryrefslogtreecommitdiffstats
path: root/tokio/tests
diff options
context:
space:
mode:
authorAlice Ryhl <alice@ryhl.io>2020-09-22 22:56:45 +0200
committerGitHub <noreply@github.com>2020-09-23 05:56:45 +0900
commite09b90ea32385337170ce17eb55ab372f9388af5 (patch)
tree9aeac2a40a50053e77346d5997a0d175f0b99a11 /tokio/tests
parentcb8f2ceb2eaab72800ecee60a89cbff73c6c79de (diff)
macros: add #[allow(unused_mut)] to select! (#2858)
Diffstat (limited to 'tokio/tests')
-rw-r--r--tokio/tests/macros_select.rs17
1 files changed, 17 insertions, 0 deletions
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);
+}