Add an example on how to use watch with a loop - example by Alice Ryhl #6892
Cirrus CI / FreeBSD 64-bit
failed
Oct 9, 2024 in 6m 28s
Task Summary
Instruction test failed in 06:11
Details
✅ 00:03 clone
✅ 00:11 setup
❌ 06:11 test
test tokio/src/time/sleep.rs - time::sleep::sleep (line 90) ... ok
test tokio/src/time/sleep.rs - time::sleep::sleep_until (line 28) ... ok
test tokio/src/time/timeout.rs - time::timeout::timeout (line 51) ... ok
test tokio/src/time/timeout.rs - time::timeout::timeout_at (line 128) ... ok
failures:
---- tokio/src/sync/watch.rs - sync::watch (line 63) stdout ----
error[E0425]: cannot find value `recv` in this scope
--> tokio/src/sync/watch.rs:64:7
|
4 | while recv.changed().await.is_ok() {
| ^^^^ not found in this scope
|
help: consider importing one of these functions
|
3 + use libc::recv;
|
3 + use nix::sys::socket::recv;
|
error[E0425]: cannot find value `recv` in this scope
--> tokio/src/sync/watch.rs:65:17
|
5 | let value = recv.borrow();
| ^^^^ not found in this scope
|
help: consider importing one of these functions
|
3 + use libc::recv;
|
3 + use nix::sys::socket::recv;
|
error[E0728]: `await` is only allowed inside `async` functions and blocks
--> tokio/src/sync/watch.rs:64:22
|
3 | fn main() { #[allow(non_snake_case)] fn _doctest_main_tokio_src_sync_watch_rs_63_0() {
| ----------------------------------------------- this is not `async`
4 | while recv.changed().await.is_ok() {
| ^^^^^ only allowed inside `async` functions and blocks
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0425, E0728.
For more information about an error, try `rustc --explain E0425`.
Couldn't compile the test.
failures:
tokio/src/sync/watch.rs - sync::watch (line 63)
test result: FAILED. 685 passed; 1 failed; 64 ignored; 0 measured; 0 filtered out; finished in 95.47s
error: doctest failed, to rerun pass `-p tokio --doc`
Exit status: 101
Loading