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/sync_watch.rs:5
let mut t = spawn(tx.closed()); assert_pending!(t.poll()); drop(rx); assert!(t.is_woken()); assert_ready!(t.poll()); } assert!(tx.send("two").is_err()); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
2bc9a4815259c8ff4daa5e24f128ec826970d17f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bc9a4815259c8ff4daa5e24f128ec826970d17f/tokio/tests/sync_watch.rs
161
171
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; #[test] fn single_rx_recv() { let (tx, mut rx) = watch::channel("one"); { let mut t = spawn(rx.recv()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
} } #[test] fn multi_rx() { let (tx, mut rx1) = watch::channel("one"); let mut rx2 = rx1.clone(); { let mut t1 = spawn(rx1.recv()); let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t1.poll()); assert_eq!(res, "one"); let res = assert_ready!(t2.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
tx.send("three").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res, "three"); let res = assert_ready!(t2.poll()); assert_eq!(res, "three"); } drop(t2); { let mut t1 = spawn(rx1.recv()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
drop(t2); let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t2.poll()); assert_eq!(res, "four"); } } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::channel("one"); drop(tx); { let mut t1 = spawn(rx.recv()); let res =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
assert_pending!(t1.poll()); tx.send("three").unwrap(); drop(tx); assert!(t1.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res, "three"); } { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.poll()); assert_eq!(res, "three...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
{ let mut t = spawn(rx.next()); let v = assert_ready!(t.poll()).unwrap(); assert_eq!(v, "one"); } { let mut t = spawn(rx.next()); assert_pending!(t.poll()); tx.send("two").unwrap(); assert!(t.is_woken()); let v = assert_ready!(t.poll()).unwrap...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/5a1a6dc90c6d5a7eb5f31ae215f9ec383d6767aa/tokio/tests/sync_watch.rs
201
231
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![allow(clippy::cognitive_complexity)] #![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; #[test] fn single_rx_recv() { let (tx, mut rx) = watch::channel("one"); { let mut t = spawn(rx.recv()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
} } #[test] fn multi_rx() { let (tx, mut rx1) = watch::channel("one"); let mut rx2 = rx1.clone(); { let mut t1 = spawn(rx1.recv()); let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "one"); let res = assert_ready!(t2.poll...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
tx.broadcast("three").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); let res = assert_ready!(t2.poll()); assert_eq!(res.unwrap(), "three"); } drop(t2); { let mut t1 ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
drop(t2); let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t2.poll()); assert!(res.is_none()); } } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::channel("one"); drop(tx); { let mut t1 = spawn(rx.recv()); let res = ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
assert_pending!(t1.poll()); tx.broadcast("three").unwrap(); drop(tx); assert!(t1.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); } { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.poll()); assert!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
{ let mut t = spawn(rx.next()); let v = assert_ready!(t.poll()).unwrap(); assert_eq!(v, "one"); } { let mut t = spawn(rx.next()); assert_pending!(t.poll()); tx.broadcast("two").unwrap(); assert!(t.is_woken()); let v = assert_ready!(t.poll()).u...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
4c645866ef4ea5b0ef8c7852281a09b2f96d969b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/sync_watch.rs
201
231
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
assert_pending!(t1.poll()); tx.broadcast("three").unwrap(); drop(tx); assert!(t1.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); } { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.poll()); assert!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
d593c5b051f07bde5117122216a356632986b6dd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d593c5b051f07bde5117122216a356632986b6dd/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; #[test] fn single_rx_recv() { let (tx, mut rx) = watch::channel("one"); { let mut t = spawn(rx.recv()); let v = assert_ready!(t.poll()).unw...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
} #[test] fn multi_rx() { let (tx, mut rx1) = watch::channel("one"); let mut rx2 = rx1.clone(); { let mut t1 = spawn(rx1.recv()); let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "one"); let res = assert_ready!(t2.poll()...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
tx.broadcast("three").unwrap(); assert!(t1.is_woken()); assert!(t2.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); let res = assert_ready!(t2.poll()); assert_eq!(res.unwrap(), "three"); } drop(t2); { let mut t1 ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t2.poll()); assert!(res.is_none()); } } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::channel("one"); drop(tx); { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
tx.broadcast("three").unwrap(); drop(tx); assert!(t1.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); } { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.poll()); assert!(res.is_none()); } } #[test] fn p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
7b4c999341809588a427a9a80d310ee4aa1c1a21
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:1
#![warn(rust_2018_idioms)] use tokio::sync::watch; use tokio_test::task::spawn; use tokio_test::{assert_pending, assert_ready}; #[test] fn single_rx_recv() { let (tx, mut rx) = watch::channel("one"); { let mut t = spawn(rx.recv()); let v = assert_ready!(t.poll()).unwrap(); assert_eq!(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_watch.rs
1
60
tokio-rs/tokio:tokio/tests/sync_watch.rs:2
#[test] fn multi_rx() { let (tx, mut rx1) = watch::channel("one"); let mut rx2 = rx1.clone(); { let mut t1 = spawn(rx1.recv()); let mut t2 = spawn(rx2.recv()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "one"); let res = assert_ready!(t2.poll()); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_watch.rs
41
100
tokio-rs/tokio:tokio/tests/sync_watch.rs:3
assert!(t1.is_woken()); assert!(t2.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); let res = assert_ready!(t2.poll()); assert_eq!(res.unwrap(), "three"); } drop(t2); { let mut t1 = spawn(rx1.recv()); let mut t2 =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_watch.rs
81
140
tokio-rs/tokio:tokio/tests/sync_watch.rs:4
let res = assert_ready!(t2.poll()); assert!(res.is_none()); } } #[test] fn rx_observes_final_value() { // Initial value let (tx, mut rx) = watch::channel("one"); drop(tx); { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(),...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_watch.rs
121
180
tokio-rs/tokio:tokio/tests/sync_watch.rs:5
tx.broadcast("three").unwrap(); drop(tx); assert!(t1.is_woken()); let res = assert_ready!(t1.poll()); assert_eq!(res.unwrap(), "three"); } { let mut t1 = spawn(rx.recv()); let res = assert_ready!(t1.poll()); assert!(res.is_none()); } } #[test] fn p...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_watch.rs
161
220
tokio-rs/tokio:tokio/tests/sync_watch.rs:6
let mut t = spawn(rx.next()); let v = assert_ready!(t.poll()).unwrap(); assert_eq!(v, "one"); } { let mut t = spawn(rx.next()); assert_pending!(t.poll()); tx.broadcast("two").unwrap(); assert!(t.is_woken()); let v = assert_ready!(t.poll()).unwrap(); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/sync_watch.rs
MIT
8a7e57786a5dca139f5b4261685e22991ded0859
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/sync_watch.rs
201
229
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery use std::sync::Arc; use std::thread::sleep; use tokio::time::Duration; use tokio::runtime::Builder; #[cfg(panic = "unwind")] struct PanicOnDrop; #[cfg(panic = "unwind")] impl Drop for PanicOnDro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:2
/// Checks that a suspended task can be aborted inside of a current_thread /// executor without panicking as reported in issue #3662: /// <https://github.com/tokio-rs/tokio/issues/3662>. #[test] fn test_abort_without_panic_3662() { use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; struct D...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
41
100
tokio-rs/tokio:tokio/tests/task_abort.rs:3
.join() .unwrap(); let result = task.await; assert!(drop_flag.load(Ordering::SeqCst)); assert!(result.unwrap_err().is_cancelled()); // Note: We do the following to trigger a deferred task cleanup. // // The relevant piece of code you want to look at is in: ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
81
140
tokio-rs/tokio:tokio/tests/task_abort.rs:4
} impl Drop for DropCheck { fn drop(&mut self) { if std::thread::current().id() != self.created_on { panic!("non-Send value dropped in another thread!"); } } } let rt = Builder::new_current_thread().build().unwrap(); let local = tokio::task::Local...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
121
180
tokio-rs/tokio:tokio/tests/task_abort.rs:5
tokio::time::sleep(Duration::new(100, 0)).await }); // wait for task to sleep. tokio::time::sleep(Duration::from_millis(10)).await; handle.abort(); drop(handle); // wait for task to abort. tokio::time::sleep(Duration::from_millis(10)).await; // Check t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
161
220
tokio-rs/tokio:tokio/tests/task_abort.rs:6
} /// Checks that aborting a task whose destructor panics has the expected result. #[test] #[cfg(panic = "unwind")] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move { let handle = tokio::spawn(async move {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
201
260
tokio-rs/tokio:tokio/tests/task_abort.rs:7
// We can't assert the full output because the task ID can change. let join_err_str = join_err.to_string(); assert!( join_err_str.starts_with("task ") && join_err_str.ends_with(" panicked with message \"Format-args payload: 1234\""), "Unexpected join_err_str {joi...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
241
300
tokio-rs/tokio:tokio/tests/task_abort.rs:8
let rt = Builder::new_current_thread().build().unwrap(); rt.block_on(async move { // `String` payload let join_err = tokio::spawn(async move { let value = 1234; panic!("Format-args payload: {value}") }) .await .unwrap_err(); // We can't asser...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_abort.rs
281
326
tokio-rs/tokio:tokio/tests/task_abort.rs:6
} /// Checks that aborting a task whose destructor panics has the expected result. #[test] #[cfg(panic = "unwind")] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move { let handle = tokio::spawn(async move {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
0ecf5f0f03a3f98d8676f87c044b34d900137c7e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ecf5f0f03a3f98d8676f87c044b34d900137c7e/tokio/tests/task_abort.rs
201
260
tokio-rs/tokio:tokio/tests/task_abort.rs:7
// We can't assert the full output because the task ID can change. let join_err_str = join_err.to_string(); assert!( join_err_str.starts_with("task ") && join_err_str.ends_with(" panicked with message \"Format-args payload: 1234\""), "Unexpected join_err_str {:?}...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
0ecf5f0f03a3f98d8676f87c044b34d900137c7e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ecf5f0f03a3f98d8676f87c044b34d900137c7e/tokio/tests/task_abort.rs
241
300
tokio-rs/tokio:tokio/tests/task_abort.rs:8
#[test] #[cfg(panic = "unwind")] fn test_join_error_debug() { let rt = Builder::new_current_thread().build().unwrap(); rt.block_on(async move { // `String` payload let join_err = tokio::spawn(async move { let value = 1234; panic!("Format-args payload: {}", value) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
0ecf5f0f03a3f98d8676f87c044b34d900137c7e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ecf5f0f03a3f98d8676f87c044b34d900137c7e/tokio/tests/task_abort.rs
281
332
tokio-rs/tokio:tokio/tests/task_abort.rs:9
.await .unwrap_err(); let join_err_str = format!("{:?}", join_err); assert!( join_err_str.starts_with("JoinError::Panic(Id(") && join_err_str.ends_with("), ...)"), "Unexpected join_err_str {:?}", join_err_str ); }); }
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
0ecf5f0f03a3f98d8676f87c044b34d900137c7e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0ecf5f0f03a3f98d8676f87c044b34d900137c7e/tokio/tests/task_abort.rs
321
332
tokio-rs/tokio:tokio/tests/task_abort.rs:6
} /// Checks that aborting a task whose destructor panics has the expected result. #[test] #[cfg(panic = "unwind")] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move { let handle = tokio::spawn(async move {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
2a0df5fb05ae1a624fe2f6db756190f41812214b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2a0df5fb05ae1a624fe2f6db756190f41812214b/tokio/tests/task_abort.rs
201
222
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery use std::sync::Arc; use std::thread::sleep; use tokio::time::Duration; use tokio::runtime::Builder; struct PanicOnDrop; impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:2
/// <https://github.com/tokio-rs/tokio/issues/3662>. #[test] fn test_abort_without_panic_3662() { use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; struct DropCheck(Arc<AtomicBool>); impl Drop for DropCheck { fn drop(&mut self) { self.0.store(true, Ordering::SeqCst...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_abort.rs
41
100
tokio-rs/tokio:tokio/tests/task_abort.rs:3
let result = task.await; assert!(drop_flag.load(Ordering::SeqCst)); assert!(result.unwrap_err().is_cancelled()); // Note: We do the following to trigger a deferred task cleanup. // // The relevant piece of code you want to look at is in: // `Inner::block_on` of `schedule...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_abort.rs
81
140
tokio-rs/tokio:tokio/tests/task_abort.rs:4
fn drop(&mut self) { if std::thread::current().id() != self.created_on { panic!("non-Send value dropped in another thread!"); } } } let rt = Builder::new_current_thread().build().unwrap(); let local = tokio::task::LocalSet::new(); let check = DropCheck::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_abort.rs
121
180
tokio-rs/tokio:tokio/tests/task_abort.rs:5
// wait for task to sleep. tokio::time::sleep(Duration::from_millis(10)).await; handle.abort(); drop(handle); // wait for task to abort. tokio::time::sleep(Duration::from_millis(10)).await; // Check that the Arc has been dropped. assert!(weak_notify_dropped.upg...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_abort.rs
161
220
tokio-rs/tokio:tokio/tests/task_abort.rs:6
/// Checks that aborting a task whose destructor panics has the expected result. #[test] #[cfg(panic = "unwind")] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move { let handle = tokio::spawn(async move { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_abort.rs
201
220
tokio-rs/tokio:tokio/tests/task_abort.rs:4
fn drop(&mut self) { if std::thread::current().id() != self.created_on { panic!("non-Send value dropped in another thread!"); } } } let rt = Builder::new_current_thread().build().unwrap(); let local = tokio::task::LocalSet::new(); let check = DropCheck::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_abort.rs
121
180
tokio-rs/tokio:tokio/tests/task_abort.rs:5
// wait for task to sleep. tokio::time::sleep(Duration::from_millis(10)).await; handle.abort(); drop(handle); // wait for task to abort. tokio::time::sleep(Duration::from_millis(10)).await; // Check that the Arc has been dropped. assert!(weak_notify_dropped.upg...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_abort.rs
161
218
tokio-rs/tokio:tokio/tests/task_abort.rs:6
#[test] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move { let handle = tokio::spawn(async move { // Make sure the Arc is moved into the task let _panic_dropped = PanicOnDrop; ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_abort.rs
201
218
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support panic recovery use std::sync::Arc; use std::thread::sleep; use tokio::time::Duration; use tokio::runtime::Builder; struct PanicOnDrop; impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well what did...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
57e08e714754420f8b3d8ffe863549d8acf761d0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/57e08e714754420f8b3d8ffe863549d8acf761d0/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support panic recovery use std::sync::Arc; use std::thread::sleep; use tokio::time::Duration; use tokio::runtime::Builder; struct PanicOnDrop; impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well what did...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a3411a412c3424df7dcd151441fe0435c0a92c9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:2
/// Checks that a suspended task can be aborted inside of a current_thread /// executor without panicking as reported in issue #3662: /// <https://github.com/tokio-rs/tokio/issues/3662>. #[test] fn test_abort_without_panic_3662() { use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; struct D...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a3411a412c3424df7dcd151441fe0435c0a92c9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/tests/task_abort.rs
41
100
tokio-rs/tokio:tokio/tests/task_abort.rs:3
}) .join() .unwrap(); let result = task.await; assert!(drop_flag.load(Ordering::SeqCst)); assert!(result.unwrap_err().is_cancelled()); // Note: We do the following to trigger a deferred task cleanup. // // The relevant piece of code you want to look at i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a3411a412c3424df7dcd151441fe0435c0a92c9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/tests/task_abort.rs
81
140
tokio-rs/tokio:tokio/tests/task_abort.rs:4
} } impl Drop for DropCheck { fn drop(&mut self) { if std::thread::current().id() != self.created_on { panic!("non-Send value dropped in another thread!"); } } } let rt = Builder::new_current_thread().build().unwrap(); let local = tokio::task:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a3411a412c3424df7dcd151441fe0435c0a92c9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/tests/task_abort.rs
121
180
tokio-rs/tokio:tokio/tests/task_abort.rs:5
let _notify_dropped = notify_dropped; println!("task started"); tokio::time::sleep(Duration::new(100, 0)).await }); // wait for task to sleep. tokio::time::sleep(Duration::from_millis(10)).await; handle.abort(); drop(handle); // wait for task to...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a3411a412c3424df7dcd151441fe0435c0a92c9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/tests/task_abort.rs
161
220
tokio-rs/tokio:tokio/tests/task_abort.rs:6
tokio::time::sleep(Duration::from_millis(10)).await; }); } /// Checks that aborting a task whose destructor panics has the expected result. #[test] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move { le...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a3411a412c3424df7dcd151441fe0435c0a92c9c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a3411a412c3424df7dcd151441fe0435c0a92c9c/tokio/tests/task_abort.rs
201
224
tokio-rs/tokio:tokio/tests/task_abort.rs:2
/// Checks that a suspended task can be aborted inside of a current_thread /// executor without panicking as reported in issue #3662: /// <https://github.com/tokio-rs/tokio/issues/3662>. #[test] fn test_abort_without_panic_3662() { use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; struct D...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_abort.rs
41
100
tokio-rs/tokio:tokio/tests/task_abort.rs:3
}) .join() .unwrap(); let result = task.await; assert!(drop_flag.load(Ordering::SeqCst)); assert!(result.unwrap_err().is_cancelled()); // Note: We do the following to trigger a deferred task cleanup. // // The relevant piece of code you want to look at i...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
b2ada60e701d5c9e6644cf8fc42a100774f8e23f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/task_abort.rs
81
140
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support panic recovery use std::sync::Arc; use std::thread::sleep; use tokio::time::Duration; use tokio::runtime::Builder; struct PanicOnDrop; impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
6d3f92dddc510e9276191cfab1b0432ce8248589
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::sync::Arc; use std::thread::sleep; use tokio::time::Duration; use tokio::runtime::Builder; struct PanicOnDrop; impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well what did you expect would happen..."); } } /// Checks that a sus...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
0d9430b99cc699824cc8545afbb01e0a7c520428
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0d9430b99cc699824cc8545afbb01e0a7c520428/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::sync::Arc; use std::thread::sleep; use std::time::Duration; use tokio::runtime::Builder; struct PanicOnDrop; impl Drop for PanicOnDrop { fn drop(&mut self) { panic!("Well what did you expect would happen..."); } } /// Checks that a suspe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
ced7992f6555d884cac452d177b094eb44a58a29
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ced7992f6555d884cac452d177b094eb44a58a29/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:4
} } impl Drop for DropCheck { fn drop(&mut self) { if std::thread::current().id() != self.created_on { panic!("non-Send value dropped in another thread!"); } } } let rt = Builder::new_current_thread().build().unwrap(); let local = tokio::task:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
ced7992f6555d884cac452d177b094eb44a58a29
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ced7992f6555d884cac452d177b094eb44a58a29/tokio/tests/task_abort.rs
121
180
tokio-rs/tokio:tokio/tests/task_abort.rs:5
let _notify_dropped = notify_dropped; println!("task started"); tokio::time::sleep(std::time::Duration::new(100, 0)).await }); // wait for task to sleep. tokio::time::sleep(std::time::Duration::from_millis(10)).await; handle.abort(); drop(handle); ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
ced7992f6555d884cac452d177b094eb44a58a29
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ced7992f6555d884cac452d177b094eb44a58a29/tokio/tests/task_abort.rs
161
220
tokio-rs/tokio:tokio/tests/task_abort.rs:6
tokio::time::sleep(std::time::Duration::from_millis(10)).await; }); } /// Checks that aborting a task whose destructor panics has the expected result. #[test] fn test_abort_task_that_panics_on_drop_returned() { let rt = Builder::new_current_thread().enable_time().build().unwrap(); rt.block_on(async move {...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
ced7992f6555d884cac452d177b094eb44a58a29
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ced7992f6555d884cac452d177b094eb44a58a29/tokio/tests/task_abort.rs
201
224
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::sync::Arc; use std::thread::sleep; use std::time::Duration; /// Checks that a suspended task can be aborted without panicking as reported in /// issue #3157: <https://github.com/tokio-rs/tokio/issues/3157>. #[test] fn test_abort_without_panic_3157() { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
7c4183a45d3548840104df87d9c8b81c1b19c006
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c4183a45d3548840104df87d9c8b81c1b19c006/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:2
impl Drop for DropCheck { fn drop(&mut self) { self.0.store(true, Ordering::SeqCst); } } let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async move { let drop_flag = Arc::new(AtomicBool::new(false)); let dro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
7c4183a45d3548840104df87d9c8b81c1b19c006
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c4183a45d3548840104df87d9c8b81c1b19c006/tokio/tests/task_abort.rs
41
100
tokio-rs/tokio:tokio/tests/task_abort.rs:3
// Note: We do the following to trigger a deferred task cleanup. // // The relevant piece of code you want to look at is in: // `Inner::block_on` of `basic_scheduler.rs`. // // We cause the cleanup to happen by having a poll return Pending once // so that the scheduler ca...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
7c4183a45d3548840104df87d9c8b81c1b19c006
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c4183a45d3548840104df87d9c8b81c1b19c006/tokio/tests/task_abort.rs
81
140
tokio-rs/tokio:tokio/tests/task_abort.rs:4
} let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); let local = tokio::task::LocalSet::new(); let check = DropCheck::new(); let jh = local.spawn_local(async move { futures::future::pending::<()>().await; drop(check); }); let jh2 = std::...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
7c4183a45d3548840104df87d9c8b81c1b19c006
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c4183a45d3548840104df87d9c8b81c1b19c006/tokio/tests/task_abort.rs
121
180
tokio-rs/tokio:tokio/tests/task_abort.rs:5
}); // wait for task to sleep. tokio::time::sleep(std::time::Duration::from_millis(10)).await; handle.abort(); drop(handle); // wait for task to abort. tokio::time::sleep(std::time::Duration::from_millis(10)).await; // Check that the Arc has been dropped. ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
7c4183a45d3548840104df87d9c8b81c1b19c006
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c4183a45d3548840104df87d9c8b81c1b19c006/tokio/tests/task_abort.rs
161
220
tokio-rs/tokio:tokio/tests/task_abort.rs:6
// wait for task to sleep. tokio::time::sleep(std::time::Duration::from_millis(10)).await; handle.abort(); drop(handle); // wait for task to abort. tokio::time::sleep(std::time::Duration::from_millis(10)).await; }); } /// Checks that aborting a task whose destructor panics...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
7c4183a45d3548840104df87d9c8b81c1b19c006
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7c4183a45d3548840104df87d9c8b81c1b19c006/tokio/tests/task_abort.rs
201
235
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] use std::thread::sleep; use std::time::Duration; /// Checks that a suspended task can be aborted without panicking as reported in /// issue #3157: <https://github.com/tokio-rs/tokio/issues/3157>. #[test] fn test_abort_without_panic_3157() { let rt = tokio::runt...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
e3851089207f6617dfcc0c7a73013eb819a0bfe0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:2
impl Drop for DropCheck { fn drop(&mut self) { self.0.store(true, Ordering::SeqCst); } } let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async move { let drop_flag = Arc::new(AtomicBool::new(false)); let dro...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
e3851089207f6617dfcc0c7a73013eb819a0bfe0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/task_abort.rs
41
100
tokio-rs/tokio:tokio/tests/task_abort.rs:3
// // The relevant piece of code you want to look at is in: // `Inner::block_on` of `basic_scheduler.rs`. // // We cause the cleanup to happen by having a poll return Pending once // so that the scheduler can go into the "auxilliary tasks" mode, at // which point the task...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
e3851089207f6617dfcc0c7a73013eb819a0bfe0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/task_abort.rs
81
140
tokio-rs/tokio:tokio/tests/task_abort.rs:4
let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); let local = tokio::task::LocalSet::new(); let check = DropCheck::new(); let jh = local.spawn_local(async move { futures::future::pending::<()>().await; drop(check); }); let jh2 = std::thread:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
e3851089207f6617dfcc0c7a73013eb819a0bfe0
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e3851089207f6617dfcc0c7a73013eb819a0bfe0/tokio/tests/task_abort.rs
121
140
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] /// Checks that a suspended task can be aborted without panicking as reported in /// issue #3157: <https://github.com/tokio-rs/tokio/issues/3157>. #[test] fn test_abort_without_panic_3157() { let rt = tokio::runtime::Builder::new_multi_thread() .enable_t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
08ed41f339e345286f26bdbc6c67bf9f2975ed07
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08ed41f339e345286f26bdbc6c67bf9f2975ed07/tokio/tests/task_abort.rs
1
60
tokio-rs/tokio:tokio/tests/task_abort.rs:2
} } let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async move { let drop_flag = Arc::new(AtomicBool::new(false)); let drop_check = DropCheck(drop_flag.clone()); let j = tokio::spawn(async move { // NB: just grab t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
08ed41f339e345286f26bdbc6c67bf9f2975ed07
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08ed41f339e345286f26bdbc6c67bf9f2975ed07/tokio/tests/task_abort.rs
41
93
tokio-rs/tokio:tokio/tests/task_abort.rs:3
// The relevant piece of code you want to look at is in: // `Inner::block_on` of `basic_scheduler.rs`. // // We cause the cleanup to happen by having a poll return Pending once // so that the scheduler can go into the "auxiliary tasks" mode, at // which point the task is removed ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
08ed41f339e345286f26bdbc6c67bf9f2975ed07
github
async-runtime
https://github.com/tokio-rs/tokio/blob/08ed41f339e345286f26bdbc6c67bf9f2975ed07/tokio/tests/task_abort.rs
81
93
tokio-rs/tokio:tokio/tests/task_abort.rs:2
} } let rt = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); rt.block_on(async move { let drop_flag = Arc::new(AtomicBool::new(false)); let drop_check = DropCheck(drop_flag.clone()); let j = tokio::spawn(async move { // NB: just grab t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
1a72b28f538f812bec50d7d1921946c653282d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a72b28f538f812bec50d7d1921946c653282d31/tokio/tests/task_abort.rs
41
93
tokio-rs/tokio:tokio/tests/task_abort.rs:3
// The relevant piece of code you want to look at is in: // `Inner::block_on` of `basic_scheduler.rs`. // // We cause the cleanup to happen by having a poll return Pending once // so that the scheduler can go into the "auxilliary tasks" mode, at // which point the task is removed...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
1a72b28f538f812bec50d7d1921946c653282d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1a72b28f538f812bec50d7d1921946c653282d31/tokio/tests/task_abort.rs
81
93
tokio-rs/tokio:tokio/tests/task_abort.rs:1
#![warn(rust_2018_idioms)] #![cfg(feature = "full")] /// Checks that a suspended task can be aborted without panicking as reported in /// issue #3157: <https://github.com/tokio-rs/tokio/issues/3157>. #[test] fn test_abort_without_panic_3157() { let rt = tokio::runtime::Builder::new_multi_thread() .enable_t...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_abort.rs
MIT
a125ebd745f31098aa170cb1009ff0fe34508d37
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a125ebd745f31098aa170cb1009ff0fe34508d37/tokio/tests/task_abort.rs
1
26
tokio-rs/tokio:tokio/tests/task_blocking.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi"), not(miri)))] // Wasi doesn't support threads use tokio::{runtime, task, time}; use tokio_test::assert_ok; use std::thread; use std::time::Duration; mod support { pub(crate) mod mpsc_stream; } #[tokio::test] async fn basic_blocking(...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
1
60
tokio-rs/tokio:tokio/tests/task_blocking.rs:2
assert_ok!( task::spawn_blocking(|| { task::block_in_place(|| { thread::sleep(Duration::from_millis(5)); }); "hello" }) .await ) }) ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
41
100
tokio-rs/tokio:tokio/tests/task_blocking.rs:3
task::block_in_place(|| {}); } #[test] fn yes_block_in_threaded_block_on() { let rt = runtime::Runtime::new().unwrap(); rt.block_on(async { task::block_in_place(|| {}); }); } #[test] #[should_panic] fn no_block_in_current_thread_block_on() { let rt = runtime::Builder::new_current_thread().buil...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
81
140
tokio-rs/tokio:tokio/tests/task_blocking.rs:4
let outer = tokio::runtime::Runtime::new().unwrap(); let result = catch_unwind(AssertUnwindSafe(|| { outer.block_on(async { let _ = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); }); })); assert!(result.is_err()); let err =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
121
180
tokio-rs/tokio:tokio/tests/task_blocking.rs:5
rt.shutdown_background(); }); } #[test] fn coop_disabled_in_block_in_place() { let outer = tokio::runtime::Builder::new_multi_thread() .enable_time() .build() .unwrap(); let (tx, rx) = support::mpsc_stream::unbounded_channel_stream(); for i in 0..200 { tx.send(i).unwra...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
161
220
tokio-rs/tokio:tokio/tests/task_blocking.rs:6
let outer = tokio::runtime::Runtime::new().unwrap(); let (tx, rx) = support::mpsc_stream::unbounded_channel_stream(); for i in 0..200 { tx.send(i).unwrap(); } drop(tx); outer.block_on(async move { tokio::task::block_in_place(move || { fu...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
201
260
tokio-rs/tokio:tokio/tests/task_blocking.rs:7
.expect("blocking task should finish"); // Really: Do not auto-advance time, even if the timeout is short and the // blocking task runs for longer than that. It doesn't matter: Tokio time // is paused; system time is not. time::timeout( Duration::from_millis(1), task::spawn_blocking(|| ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
241
300
tokio-rs/tokio:tokio/tests/task_blocking.rs:8
}); crate::time::sleep(Duration::from_secs(15)).await; a.await.expect("blocking task should finish"); assert!( t0.elapsed() < Duration::from_secs(10), "completing a spawn_blocking should wake the scheduler if it's parked while time is paused" ); } #[cfg(panic = "unwind")] #[cfg(feature...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/task_blocking.rs
281
310
tokio-rs/tokio:tokio/tests/task_blocking.rs:3
task::block_in_place(|| {}); } #[test] fn yes_block_in_threaded_block_on() { let rt = runtime::Runtime::new().unwrap(); rt.block_on(async { task::block_in_place(|| {}); }); } #[test] #[should_panic] fn no_block_in_current_thread_block_on() { let rt = runtime::Builder::new_current_thread().buil...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/task_blocking.rs
81
140
tokio-rs/tokio:tokio/tests/task_blocking.rs:4
let outer = tokio::runtime::Runtime::new().unwrap(); let result = catch_unwind(AssertUnwindSafe(|| { outer.block_on(async { let _ = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); }); })); assert!(result.is_err()); let err =...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/task_blocking.rs
121
180
tokio-rs/tokio:tokio/tests/task_blocking.rs:5
.unwrap(); rt.shutdown_background(); }); } #[test] fn coop_disabled_in_block_in_place() { let outer = tokio::runtime::Builder::new_multi_thread() .enable_time() .build() .unwrap(); let (tx, rx) = support::mpsc_stream::unbounded_channel_stream(); for i in 0..200 { ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/task_blocking.rs
161
220
tokio-rs/tokio:tokio/tests/task_blocking.rs:6
thread::spawn(move || { let outer = tokio::runtime::Runtime::new().unwrap(); let (tx, rx) = support::mpsc_stream::unbounded_channel_stream(); for i in 0..200 { tx.send(i).unwrap(); } drop(tx); outer.block_on(async move { tokio::task::block_in_pl...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/task_blocking.rs
201
260
tokio-rs/tokio:tokio/tests/task_blocking.rs:7
.expect("timeout should not trigger") .expect("blocking task should finish"); // Really: Do not auto-advance time, even if the timeout is short and the // blocking task runs for longer than that. It doesn't matter: Tokio time // is paused; system time is not. time::timeout( Duration::from_m...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/task_blocking.rs
241
300
tokio-rs/tokio:tokio/tests/task_blocking.rs:8
thread::sleep(Duration::from_millis(1)); }); crate::time::sleep(Duration::from_secs(15)).await; a.await.expect("blocking task should finish"); assert!( t0.elapsed() < Duration::from_secs(10), "completing a spawn_blocking should wake the scheduler if it's parked while time is paused" ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
161b8c80d58a4a070c7f41db18d43ea258737db7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/task_blocking.rs
281
311
tokio-rs/tokio:tokio/tests/task_blocking.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi doesn't support threads use tokio::{runtime, task, time}; use tokio_test::assert_ok; use std::thread; use std::time::Duration; mod support { pub(crate) mod mpsc_stream; } #[tokio::test] async fn basic_blocking() { // ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
d8a4a5f24bfc5012071eec4e501bb4a58a1181d6
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d8a4a5f24bfc5012071eec4e501bb4a58a1181d6/tokio/tests/task_blocking.rs
1
60
tokio-rs/tokio:tokio/tests/task_blocking.rs:7
.expect("timeout should not trigger") .expect("blocking task should finish"); // Really: Do not auto-advance time, even if the timeout is short and the // blocking task runs for longer than that. It doesn't matter: Tokio time // is paused; system time is not. time::timeout( Duration::from_m...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_blocking.rs
241
300
tokio-rs/tokio:tokio/tests/task_blocking.rs:8
thread::sleep(Duration::from_millis(1)); }); crate::time::sleep(Duration::from_secs(15)).await; a.await.expect("blocking task should finish"); assert!( t0.elapsed() < Duration::from_secs(10), "completing a spawn_blocking should wake the scheduler if it's parked while time is paused" ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
cc86fef9c0d09a688b273c114bb3ad64c40df462
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cc86fef9c0d09a688b273c114bb3ad64c40df462/tokio/tests/task_blocking.rs
281
310
tokio-rs/tokio:tokio/tests/task_blocking.rs:3
task::block_in_place(|| {}); } #[test] fn yes_block_in_threaded_block_on() { let rt = runtime::Runtime::new().unwrap(); rt.block_on(async { task::block_in_place(|| {}); }); } #[test] #[should_panic] fn no_block_in_current_thread_block_on() { let rt = runtime::Builder::new_current_thread().buil...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_blocking.rs
81
140
tokio-rs/tokio:tokio/tests/task_blocking.rs:4
let result = catch_unwind(AssertUnwindSafe(|| { outer.block_on(async { let _ = tokio::runtime::Builder::new_current_thread() .build() .unwrap(); }); })); assert!(result.is_err()); let err = result.unwrap_err(); let err: &'static str = err.down...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_blocking.rs
121
180
tokio-rs/tokio:tokio/tests/task_blocking.rs:7
.expect("blocking task should finish"); // Really: Do not auto-advance time, even if the timeout is short and the // blocking task runs for longer than that. It doesn't matter: Tokio time // is paused; system time is not. time::timeout( Duration::from_millis(1), task::spawn_blocking(|| ...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_blocking.rs
241
300
tokio-rs/tokio:tokio/tests/task_blocking.rs:8
}); crate::time::sleep(Duration::from_secs(15)).await; a.await.expect("blocking task should finish"); assert!( t0.elapsed() < Duration::from_secs(10), "completing a spawn_blocking should wake the scheduler if it's parked while time is paused" ); } #[cfg(feature = "test-util")] #[tokio:...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/task_blocking.rs
281
309
tokio-rs/tokio:tokio/tests/task_blocking.rs:1
#![warn(rust_2018_idioms)] #![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi doesn't support threads use tokio::{runtime, task, time}; use tokio_test::assert_ok; use std::thread; use std::time::Duration; mod support { pub(crate) mod mpsc_stream; } #[tokio::test] async fn basic_blocking() { // Run a fe...
rust
rust
testsuite
tokio-rs/tokio
tokio/tests/task_blocking.rs
MIT
e14ca72e68fbfa04f12408ed916bf5f857dfa232
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/tests/task_blocking.rs
1
60