id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | .build()
.unwrap();
// This makes sure that `enter_runtime()` from worker thread is called before the one from main thread,
// ensuring that the RNG state is consistent. See also https://github.com/tokio-rs/tokio/pull/7495.
rx.recv().unwrap();
let rt2_values = rt2.block_on(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/macros_select.rs:19 | std::future::ready(())
}
}
tokio::select! {
() = NotAFuture => {},
}
}
// regression test for https://github.com/tokio-rs/tokio/issues/6721
#[tokio::test]
async fn temporary_lifetime_extension() {
tokio::select! {
() = &mut std::future::ready(()) => {},
}
}
#[tokio::test]
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/macros_select.rs | 721 | 760 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | _ = async {} => (),
else => (),
}
}
// https://github.com/tokio-rs/tokio/issues/4182
#[maybe_tokio_test]
async fn mut_ref_patterns() {
tokio::select! {
Some(mut foo) = async { Some("1".to_string()) } => {
assert_eq!(foo, "1");
foo = "2".to_string();
assert_eq... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0284d1b5c8ea5aff5b30c254200fb0a46c21d67c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0284d1b5c8ea5aff5b30c254200fb0a46c21d67c/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .build()
.unwrap();
let rt1_values = rt1.block_on(async { (select_0_to_9().await, select_0_to_9().await) });
let rt2 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt2_values = rt2.bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0284d1b5c8ea5aff5b30c254200fb0a46c21d67c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0284d1b5c8ea5aff5b30c254200fb0a46c21d67c/tokio/tests/macros_select.rs | 641 | 700 |
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
x = async { 6 } => x,
x = async { 7 } => x,
x = async { 8 } => x,
x = async { 9 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0284d1b5c8ea5aff5b30c254200fb0a46c21d67c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0284d1b5c8ea5aff5b30c254200fb0a46c21d67c/tokio/tests/macros_select.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/macros_select.rs:19 | async fn select_is_budget_aware() {
const BUDGET: usize = 128;
let task = || {
Box::pin(async move {
tokio::select! {
biased;
() = tokio::task::coop::consume_budget() => {},
() = std::future::ready(()) => {}
}
})
};
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0284d1b5c8ea5aff5b30c254200fb0a46c21d67c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0284d1b5c8ea5aff5b30c254200fb0a46c21d67c/tokio/tests/macros_select.rs | 721 | 742 |
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
x = async { 6 } => x,
x = async { 7 } => x,
x = async { 8 } => x,
x = async { 9 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7f09959b0a13cbea2b0e5c20ec1b7ac3f208dbad/tokio/tests/macros_select.rs | 681 | 718 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![allow(unknown_lints, unexpected_cfgs)]
#![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))]
use tokio::test as mayb... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:2 | assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn nested_one() {
let foo = tokio::select! {
foo = async { 1 } => tokio::select! {
bar = async { foo } => bar,
},
};
assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn sync_one_lit_expr_no_comma() {
let foo = tokio::select! {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_select.rs:3 | }
#[maybe_tokio_test]
async fn sync_one_ident() {
let one = one();
let foo = tokio::select! {
foo = one => foo,
};
assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn sync_two() {
use std::cell::Cell;
let cnt = Cell::new(0);
let res = tokio::select! {
foo = async {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_select.rs:4 | let v = one().await;
drop(s);
v
} => foo
};
assert_eq!(res, 1);
}
#[maybe_tokio_test]
#[cfg(feature = "full")]
async fn one_ready() {
let (tx1, rx1) = oneshot::channel::<i32>();
let (_tx2, rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
let v = tokio::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | tokio::task::yield_now().await;
assert_ok!(tx2.send(3));
tokio::task::yield_now().await;
drop((tx1, tx2));
});
let mut rem = true;
let mut msgs = vec![];
while rem {
tokio::select! {
Some(x) = rx1.recv() => {
msgs.push(x);
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | res = &mut rx1 => {
assert_eq!(1, assert_ok!(res));
assert_eq!(2, assert_ok!(rx2.await));
ran = true;
},
res = &mut rx2 => {
assert_eq!(2, assert_ok!(res));
assert_eq!(1, assert_ok!(rx1.await));
ran = true;
},
}
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | _ = ready => {},
}
};
assert_eq!(mem::size_of_val(&fut), 32);
}
#[maybe_tokio_test]
async fn struct_size_2() {
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::select! {
_ =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | #[maybe_tokio_test]
async fn mutable_borrowing_future_with_same_borrow_in_block() {
let mut value = 234;
tokio::select! {
_ = require_mutable(&mut value) => { },
_ = async_noop() => {
value += 5;
},
}
assert!(value >= 234);
}
#[maybe_tokio_test]
async fn mutable_bo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | assert!(!polled);
polled = true;
Ready(None::<()>)
});
let mut f = task::spawn(async {
tokio::select! {
Some(_) = f => unreachable!(),
ret = rx => ret.unwrap(),
}
});
assert_pending!(f.poll());
assert_pending!(f.poll());
assert_ok!(tx.se... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | assert_ready!(f.poll());
}
#[maybe_tokio_test]
async fn join_with_select() {
use tokio_test::task;
let (tx1, mut rx1) = oneshot::channel();
let (tx2, mut rx2) = oneshot::channel();
let mut f = task::spawn(async {
let mut a = None;
let mut b = None;
while a.is_none() || b.is_n... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | async fn use_future_in_if_condition() {
use tokio::time::{self, Duration};
tokio::select! {
_ = time::sleep(Duration::from_millis(10)), if false => {
panic!("if condition ignored")
}
_ = async { 1u32 } => {
}
}
}
#[tokio::test]
#[cfg(feature = "full")]
async fn ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | #[maybe_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);
}
#[maybe_tokio_test... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | #[maybe_tokio_test]
#[cfg(feature = "full")]
async fn biased_eventually_ready() {
use tokio::task::yield_now;
let one = async {};
let two = async { yield_now().await };
let three = async { yield_now().await };
let mut count = 0u8;
tokio::pin!(one, two, three);
loop {
tokio::selec... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | tokio::select! {
_ = async {} => (),
else => (),
}
}
// https://github.com/tokio-rs/tokio/issues/4182
#[maybe_tokio_test]
async fn mut_ref_patterns() {
tokio::select! {
Some(mut foo) = async { Some("1".to_string()) } => {
assert_eq!(foo, "1");
foo = "2".to_string... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt1_values = rt1.block_on(async { (select_0_to_9().await, select_0_to_9().await) });
let rt2 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 641 | 700 |
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | tokio::select!(
x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
x = async { 6 } => x,
x = async { 7 } => x,
x = async { 8 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 12b2567b959ec754e6f58fb76b88a1a38f805771 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/tests/macros_select.rs | 681 | 719 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![allow(unknown_lints, unexpected_cfgs)]
#![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))]
use tokio::test as mayb... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 438def79579a7e285beb5f0d93b1eb6a9f8062b3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/438def79579a7e285beb5f0d93b1eb6a9f8062b3/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | tokio::select!(
x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
x = async { 6 } => x,
x = async { 7 } => x,
x = async { 8 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | dd1d37167d1f4008ca5d3df500e86826112a8cad | github | async-runtime | https://github.com/tokio-rs/tokio/blob/dd1d37167d1f4008ca5d3df500e86826112a8cad/tokio/tests/macros_select.rs | 681 | 711 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt1_values = rt1.block_on(async { (select_0_to_9().await, select_0_to_9().await) });
let rt2 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2a0df5fb05ae1a624fe2f6db756190f41812214b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/macros_select.rs | 641 | 694 |
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | tokio::select!(
x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
x = async { 6 } => x,
x = async { 7 } => x,
x = async { 8 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2a0df5fb05ae1a624fe2f6db756190f41812214b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/macros_select.rs | 681 | 694 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2ce1cee0f9386bc808a32010339464ebbbd38e2d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ce1cee0f9386bc808a32010339464ebbbd38e2d/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .build()
.unwrap();
let rt1_values = rt1.block_on(async { (select_0_to_9().await, select_0_to_9().await) });
let rt2 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt2_values = rt2.bloc... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2ce1cee0f9386bc808a32010339464ebbbd38e2d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ce1cee0f9386bc808a32010339464ebbbd38e2d/tokio/tests/macros_select.rs | 641 | 693 |
tokio-rs/tokio:tokio/tests/macros_select.rs:18 | x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
x = async { 6 } => x,
x = async { 7 } => x,
x = async { 8 } => x,
x = async { 9 ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2ce1cee0f9386bc808a32010339464ebbbd38e2d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ce1cee0f9386bc808a32010339464ebbbd38e2d/tokio/tests/macros_select.rs | 681 | 693 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:2 | assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn sync_one_lit_expr_block() {
let foo = tokio::select! {
foo = async { 1 } => { foo }
};
assert_eq!(foo, 1);
}
#[maybe_tokio_test]
async fn sync_one_await() {
let foo = tokio::select! {
foo = one() => foo,
};
assert_eq!(foo, 1)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_select.rs:3 | foo = async {
cnt.set(cnt.get() + 1);
1
} => foo,
bar = async {
cnt.set(cnt.get() + 1);
2
} => bar,
};
assert_eq!(1, cnt.get());
assert!(res == 1 || res == 2);
}
#[maybe_tokio_test]
async fn drop_in_fut() {
let s = "hello".to_stri... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_select.rs:4 | },
_ = rx2 => unreachable!(),
};
assert_eq!(1, v);
}
#[maybe_tokio_test]
#[cfg(feature = "full")]
async fn select_streams() {
use tokio::sync::mpsc;
let (tx1, mut rx1) = mpsc::unbounded_channel::<i32>();
let (tx2, mut rx2) = mpsc::unbounded_channel::<i32>();
tokio::spawn(async move {... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | rem = false;
}
}
}
msgs.sort_unstable();
assert_eq!(&msgs[..], &[1, 2, 3]);
}
#[maybe_tokio_test]
async fn move_uncompleted_futures() {
let (tx1, mut rx1) = oneshot::channel::<i32>();
let (tx2, mut rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
tx2.send(2).unw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | y = async { 2 } => x + y,
}
}
};
assert_eq!(res, 3);
}
#[cfg(target_pointer_width = "64")]
mod pointer_64_tests {
use super::maybe_tokio_test;
use futures::future;
use std::mem;
#[maybe_tokio_test]
async fn struct_size_1() {
let fut = async {
let re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | }
#[maybe_tokio_test]
async fn struct_size_3() {
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
let ready3 = future::ready(0i32);
tokio::select! {
_ = ready1 => {},
_ = ready2 => {},
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | _ = async_noop() => {
value += 5;
},
else => {
value += 27;
},
}
assert!(value >= 234);
}
#[maybe_tokio_test]
async fn future_panics_after_poll() {
use tokio_test::task;
let (tx, rx) = oneshot::channel();
let mut polled = false;
let f = poll_f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | #[maybe_tokio_test]
async fn disable_with_if() {
use tokio_test::task;
let f = poll_fn(|_| panic!());
let (tx, rx) = oneshot::channel();
let mut f = task::spawn(async {
tokio::select! {
_ = f, if false => unreachable!(),
_ = rx => (),
}
});
assert_pendi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | (a.unwrap(), b.unwrap())
});
assert_pending!(f.poll());
assert_ok!(tx1.send(123));
assert!(f.is_woken());
assert_pending!(f.poll());
assert_ok!(tx2.send(456));
assert!(f.is_woken());
let (a, b) = assert_ready!(f.poll());
assert_eq!(a, 123);
assert_eq!(b, 456);
}
#[tokio::tes... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | panic!("if condition ignored")
}
_ = async { 1u32 } => {
}
}
}
#[maybe_tokio_test]
async fn many_branches() {
let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | async fn never_branch_no_warnings() {
let t = tokio::select! {
_ = async_never() => 0,
one_async_ready = one() => one_async_ready,
};
assert_eq!(t, 1);
}
async fn one() -> usize {
1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_never() -> ! {
f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | let (tx3, rx3) = oneshot::channel::<i32>();
tx2.send(2).unwrap();
tx3.send(3).unwrap();
let v = tokio::select! {
biased;
_ = rx1 => unreachable!(),
res = rx2 => {
assert_ok!(res)
},
_ = rx3 => {
panic!("This branch should never be activated ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | }
_ = &mut three, if count < 3 => {
count += 1;
assert_eq!(count, 3);
}
_ = &mut one, if count < 1 => {
count += 1;
assert_eq!(count, 1);
}
else => break,
}
}
assert_eq!(count, 3)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | },
};
tokio::select! {
Some(ref mut foo) = async { Some("1".to_string()) } => {
assert_eq!(*foo, "1");
*foo = "2".to_string();
assert_eq!(*foo, "2");
},
};
}
#[cfg(tokio_unstable)]
mod unstable {
use tokio::runtime::RngSeed;
#[test]
fn deter... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt1_values = rt1.block_on(async {
let _ = tokio::spawn(async { (select_0_to_9().await, select_0_to_9().await) }).await;
});
let rt2 = tokio::runtime::Builder::new_multi_thread()
.worker_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/macros_select.rs | 641 | 674 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::disallowed_names)]
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(tokio_wasm_not_wasi))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
use tokio_test::{assert_ok, assert_pending, assert_ready};
use fut... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0c8e8248f8de281f22ad6f30b967053f44fff66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | },
};
tokio::select! {
Some(ref mut foo) = async { Some("1".to_string()) } => {
assert_eq!(*foo, "1");
*foo = "2".to_string();
assert_eq!(*foo, "2");
},
};
}
#[cfg(tokio_unstable)]
mod unstable {
use tokio::runtime::RngSeed;
#[test]
fn deter... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0c8e8248f8de281f22ad6f30b967053f44fff66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0c8e8248f8de281f22ad6f30b967053f44fff66e/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | rem = false;
}
}
}
msgs.sort_unstable();
assert_eq!(&msgs[..], &[1, 2, 3]);
}
#[maybe_tokio_test]
async fn move_uncompleted_futures() {
let (tx1, mut rx1) = oneshot::channel::<i32>();
let (tx2, mut rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
tx2.send(2).unw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | y = async { 2 } => x + y,
}
}
};
assert_eq!(res, 3);
}
#[maybe_tokio_test]
#[cfg(target_pointer_width = "64")]
async fn struct_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(0i32);
tokio::select! {
_ = ready... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | tokio::select! {
_ = ready1 => {},
_ = ready2 => {},
_ = ready3 => {},
}
};
assert_eq!(mem::size_of_val(&fut), 56);
}
#[maybe_tokio_test]
async fn mutable_borrowing_future_with_same_borrow_in_block() {
let mut value = 234;
tokio::select! {
_ = requi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | }
#[maybe_tokio_test]
async fn future_panics_after_poll() {
use tokio_test::task;
let (tx, rx) = oneshot::channel();
let mut polled = false;
let f = poll_fn(|_| {
assert!(!polled);
polled = true;
Ready(None::<()>)
});
let mut f = task::spawn(async {
tokio::se... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | tokio::select! {
_ = f, if false => unreachable!(),
_ = rx => (),
}
});
assert_pending!(f.poll());
assert_ok!(tx.send(()));
assert!(f.is_woken());
assert_ready!(f.poll());
}
#[maybe_tokio_test]
async fn join_with_select() {
use tokio_test::task;
let (tx1,... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | assert_ok!(tx2.send(456));
assert!(f.is_woken());
let (a, b) = assert_ready!(f.poll());
assert_eq!(a, 123);
assert_eq!(b, 456);
}
#[tokio::test]
#[cfg(feature = "full")]
async fn use_future_in_if_condition() {
use tokio::time::{self, Duration};
tokio::select! {
_ = time::sleep(Duratio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | let num = tokio::select! {
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 }... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | 1
}
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_never() -> ! {
futures::future::pending().await
}
// From https://github.com/tokio-rs/tokio/issues/2857
#[maybe_tokio_test]
async fn mut_on_left_hand_side() {
let v = async move {
let ok = async { 1 };
tokio:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | res = rx2 => {
assert_ok!(res)
},
_ = rx3 => {
panic!("This branch should never be activated because `rx2` should be polled before `rx3` due to `biased;`.")
}
};
assert_eq!(2, v);
}
#[maybe_tokio_test]
#[cfg(feature = "full")]
async fn biased_eventually_ready() ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | else => break,
}
}
assert_eq!(count, 3);
}
// https://github.com/tokio-rs/tokio/issues/3830
// https://github.com/rust-lang/rust-clippy/issues/7304
#[warn(clippy::default_numeric_fallback)]
pub async fn default_numeric_fallback() {
tokio::select! {
_ = async {} => (),
else => (),
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | };
}
#[cfg(tokio_unstable)]
mod unstable {
use tokio::runtime::RngSeed;
#[test]
fn deterministic_select_current_thread() {
let seed = b"bytes used to generate seed";
let rt1 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .rng_seed(RngSeed::from_bytes(seed))
.build()
.unwrap();
let rt2_values = rt2.block_on(async {
let _ = tokio::spawn(async { (select_0_to_9().await, select_0_to_9().await) }).await;
});
assert_eq!(rt1_values, rt2_values);
}
async fn select_0_to_9() ->... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 22cff80048c62ed0fa20065888667d00d5aedd14 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22cff80048c62ed0fa20065888667d00d5aedd14/tokio/tests/macros_select.rs | 641 | 665 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
#[cfg(tokio_wasm_not_wasi)]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(tokio_wasm_not_wasi))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
use tokio_test::{assert_ok, assert_pending, assert_ready};
use fut... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 6929decf2cdb391e26f0e5c8d742f7aef51743b9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6929decf2cdb391e26f0e5c8d742f7aef51743b9/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | rem = false;
}
}
}
msgs.sort_unstable();
assert_eq!(&msgs[..], &[1, 2, 3]);
}
#[maybe_tokio_test]
async fn move_uncompleted_futures() {
let (tx1, mut rx1) = oneshot::channel::<i32>();
let (tx2, mut rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
tx2.send(2).unw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | y = async { 2 } => x + y,
}
}
};
assert_eq!(res, 3);
}
#[maybe_tokio_test]
async fn struct_size() {
use futures::future;
use std::mem;
let fut = async {
let ready = future::ready(0i32);
tokio::select! {
_ = ready => {},
}
};
assert... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | tokio::select! {
_ = ready1 => {},
_ = ready2 => {},
_ = ready3 => {},
}
};
assert!(mem::size_of_val(&fut) <= 48);
}
#[maybe_tokio_test]
async fn mutable_borrowing_future_with_same_borrow_in_block() {
let mut value = 234;
tokio::select! {
_ = requir... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | #[maybe_tokio_test]
async fn future_panics_after_poll() {
use tokio_test::task;
let (tx, rx) = oneshot::channel();
let mut polled = false;
let f = poll_fn(|_| {
assert!(!polled);
polled = true;
Ready(None::<()>)
});
let mut f = task::spawn(async {
tokio::selec... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | _ = f, if false => unreachable!(),
_ = rx => (),
}
});
assert_pending!(f.poll());
assert_ok!(tx.send(()));
assert!(f.is_woken());
assert_ready!(f.poll());
}
#[maybe_tokio_test]
async fn join_with_select() {
use tokio_test::task;
let (tx1, mut rx1) = oneshot::channel(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | assert_ok!(tx2.send(456));
assert!(f.is_woken());
let (a, b) = assert_ready!(f.poll());
assert_eq!(a, 123);
assert_eq!(b, 456);
}
#[tokio::test]
#[cfg(feature = "full")]
async fn use_future_in_if_condition() {
use tokio::time::{self, Duration};
tokio::select! {
_ = time::sleep(Duratio... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | }
async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_never() -> ! {
futures::future::pending().await
}
// From https://github.com/tokio-rs/tokio/issues/2857
#[maybe_tokio_test]
async fn mut_on_left_hand_side() {
let v = async move {
let ok = async { 1 };
tokio::p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | assert_ok!(res)
},
_ = rx3 => {
panic!("This branch should never be activated because `rx2` should be polled before `rx3` due to `biased;`.")
}
};
assert_eq!(2, v);
}
#[maybe_tokio_test]
#[cfg(feature = "full")]
async fn biased_eventually_ready() {
use tokio::task::yiel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | }
}
assert_eq!(count, 3);
}
// https://github.com/tokio-rs/tokio/issues/3830
// https://github.com/rust-lang/rust-clippy/issues/7304
#[warn(clippy::default_numeric_fallback)]
pub async fn default_numeric_fallback() {
tokio::select! {
_ = async {} => (),
else => (),
}
}
// https://gith... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | }
#[cfg(tokio_unstable)]
mod unstable {
use tokio::runtime::RngSeed;
#[test]
fn deterministic_select_current_thread() {
let seed = b"bytes used to generate seed";
let rt1 = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | .build()
.unwrap();
let rt2_values = rt2.block_on(async {
let _ = tokio::spawn(async { (select_0_to_9().await, select_0_to_9().await) }).await;
});
assert_eq!(rt1_values, rt2_values);
}
async fn select_0_to_9() -> u32 {
tokio::select!(
x = as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 9b486357ed1aa008afa09e95965eb6c94a8753a1 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9b486357ed1aa008afa09e95965eb6c94a8753a1/tokio/tests/macros_select.rs | 641 | 664 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | }
}
assert_eq!(count, 3);
}
// https://github.com/tokio-rs/tokio/issues/3830
// https://github.com/rust-lang/rust-clippy/issues/7304
#[warn(clippy::default_numeric_fallback)]
pub async fn default_numeric_fallback() {
tokio::select! {
_ = async {} => (),
else => (),
}
}
// https://gith... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b5709baa917494043e21589adb10347c57361f1f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/macros_select.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/macros_select.rs:16 | }
#[cfg(tokio_unstable)]
mod unstable {
use tokio::runtime::RngSeed;
#[test]
fn deterministic_select_current_thread() {
let seed = b"bytes used to generate seed";
let rt = tokio::runtime::Builder::new_current_thread()
.rng_seed(RngSeed::from_bytes(seed))
.build()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b5709baa917494043e21589adb10347c57361f1f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/macros_select.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:17 | })
.await;
});
}
async fn select_0_to_9() -> u32 {
tokio::select!(
x = async { 0 } => x,
x = async { 1 } => x,
x = async { 2 } => x,
x = async { 3 } => x,
x = async { 4 } => x,
x = async { 5 } => x,
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b5709baa917494043e21589adb10347c57361f1f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b5709baa917494043e21589adb10347c57361f1f/tokio/tests/macros_select.rs | 641 | 660 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | }
}
assert_eq!(count, 3);
}
// https://github.com/tokio-rs/tokio/issues/3830
// https://github.com/rust-lang/rust-clippy/issues/7304
#[warn(clippy::default_numeric_fallback)]
pub async fn default_numeric_fallback() {
tokio::select! {
_ = async {} => (),
else => (),
}
}
// https://gith... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/macros_select.rs | 561 | 601 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
#[cfg(all(target_family = "wasm", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_family = "wasm", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0dc62da21b0bffe113e2efa23f6da6ef4e36bf4f/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![cfg(feature = "macros")]
#![allow(clippy::blacklisted_name)]
#[cfg(target_arch = "wasm32")]
use wasm_bindgen_test::wasm_bindgen_test as maybe_tokio_test;
#[cfg(not(target_arch = "wasm32"))]
use tokio::test as maybe_tokio_test;
use tokio::sync::oneshot;
use tokio_test::{assert_ok, assert_pending, assert_ready};
u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | e8f19e771f501408427f7f9ee6ba4f54b2d4094c | github | async-runtime | https://github.com/tokio-rs/tokio/blob/e8f19e771f501408427f7f9ee6ba4f54b2d4094c/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:12 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_select.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/macros_select.rs:13 | async fn require_mutable(_: &mut i32) {}
async fn async_noop() {}
async fn async_never() -> ! {
futures::future::pending().await
}
// From https://github.com/tokio-rs/tokio/issues/2857
#[maybe_tokio_test]
async fn mut_on_left_hand_side() {
let v = async move {
let ok = async { 1 };
tokio::pin!... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_select.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/macros_select.rs:14 | },
_ = rx3 => {
panic!("This branch should never be activated because `rx2` should be polled before `rx3` due to `biased;`.")
}
};
assert_eq!(2, v);
}
#[maybe_tokio_test]
#[cfg(feature = "full")]
async fn biased_eventually_ready() {
use tokio::task::yield_now;
let one = as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_select.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/macros_select.rs:15 | }
assert_eq!(count, 3);
}
// https://github.com/tokio-rs/tokio/issues/3830
// https://github.com/rust-lang/rust-clippy/issues/7304
#[warn(clippy::default_numeric_fallback)]
pub async fn default_numeric_fallback() {
tokio::select! {
_ = async {} => (),
else => (),
}
}
// https://github.com... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 2747043f6f7e0870cc5aa72c146dfae9543c5ba8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2747043f6f7e0870cc5aa72c146dfae9543c5ba8/tokio/tests/macros_select.rs | 561 | 600 |
tokio-rs/tokio:tokio/tests/macros_select.rs:1 | #![allow(clippy::blacklisted_name)]
use tokio::sync::{mpsc, oneshot};
use tokio::task;
use tokio_test::{assert_ok, assert_pending, assert_ready};
use futures::future::poll_fn;
use std::task::Poll::Ready;
#[tokio::test]
async fn sync_one_lit_expr_comma() {
let foo = tokio::select! {
foo = async { 1 } => fo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/macros_select.rs:2 | foo = async { 1 } => { foo }
};
assert_eq!(foo, 1);
}
#[tokio::test]
async fn sync_one_await() {
let foo = tokio::select! {
foo = one() => foo,
};
assert_eq!(foo, 1);
}
#[tokio::test]
async fn sync_one_ident() {
let one = one();
let foo = tokio::select! {
foo = one => fo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/macros_select.rs:3 | } => bar,
};
assert_eq!(1, cnt.get());
assert!(res == 1 || res == 2);
}
#[tokio::test]
async fn drop_in_fut() {
let s = "hello".to_string();
let res = tokio::select! {
foo = async {
let v = one().await;
drop(s);
v
} => foo
};
assert_eq!... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/macros_select.rs:4 | async fn select_streams() {
let (tx1, mut rx1) = mpsc::unbounded_channel::<i32>();
let (tx2, mut rx2) = mpsc::unbounded_channel::<i32>();
tokio::spawn(async move {
assert_ok!(tx2.send(1));
task::yield_now().await;
assert_ok!(tx1.send(2));
task::yield_now().await;
a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/macros_select.rs:5 | let (tx1, mut rx1) = oneshot::channel::<i32>();
let (tx2, mut rx2) = oneshot::channel::<i32>();
tx1.send(1).unwrap();
tx2.send(2).unwrap();
let ran;
tokio::select! {
res = &mut rx1 => {
assert_eq!(1, assert_ok!(res));
assert_eq!(2, assert_ok!(rx2.await));
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/macros_select.rs:6 | use std::mem;
let fut = async {
let ready = future::ready(0i32);
tokio::select! {
_ = ready => {},
}
};
assert!(mem::size_of_val(&fut) <= 32);
let fut = async {
let ready1 = future::ready(0i32);
let ready2 = future::ready(0i32);
tokio::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/macros_select.rs:7 | async fn mutable_borrowing_future_with_same_borrow_in_block() {
let mut value = 234;
tokio::select! {
_ = require_mutable(&mut value) => { },
_ = async_noop() => {
value += 5;
},
}
assert!(value >= 234);
}
#[tokio::test]
async fn mutable_borrowing_future_with_same_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/macros_select.rs:8 | polled = true;
Ready(None::<()>)
});
let mut f = task::spawn(async {
tokio::select! {
Some(_) = f => unreachable!(),
ret = rx => ret.unwrap(),
}
});
assert_pending!(f.poll());
assert_pending!(f.poll());
assert_ok!(tx.send(1));
let res = ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/macros_select.rs:9 | }
#[tokio::test]
async fn join_with_select() {
use tokio_test::task;
let (tx1, mut rx1) = oneshot::channel();
let (tx2, mut rx2) = oneshot::channel();
let mut f = task::spawn(async {
let mut a = None;
let mut b = None;
while a.is_none() || b.is_none() {
tokio::sel... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/macros_select.rs:10 | tokio::select! {
_ = time::sleep(Duration::from_millis(10)), if false => {
panic!("if condition ignored")
}
_ = async { 1u32 } => {
}
}
}
#[tokio::test]
async fn use_future_in_if_condition_biased() {
use tokio::time::{self, Duration};
tokio::select! {
bi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/macros_select.rs:11 | x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x,
x = async { 1 } => x... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/macros_select.rs | MIT | 94ee305741eb21a46fce832ff3683f886da76fec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/94ee305741eb21a46fce832ff3683f886da76fec/tokio/tests/macros_select.rs | 401 | 460 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.