1 // compile-flags: --edition=2018
10 println!("non_async_func was covered");
13 println!("non_async_func println in block");
20 async fn async_func() {
21 println!("async_func was covered");
24 println!("async_func println in block");
31 async fn async_func_just_println() {
32 println!("async_func_just_println was covered");
36 println!("codecovsample::main");
40 executor::block_on(async_func());
41 executor::block_on(async_func_just_println());
48 task::{Context, Poll, RawWaker, RawWakerVTable, Waker},
51 pub fn block_on<F: Future>(mut future: F) -> F::Output {
52 let mut future = unsafe { Pin::new_unchecked(&mut future) };
53 use std::hint::unreachable_unchecked;
54 static VTABLE: RawWakerVTable = RawWakerVTable::new(
55 |_| unsafe { unreachable_unchecked() }, // clone
56 |_| unsafe { unreachable_unchecked() }, // wake
57 |_| unsafe { unreachable_unchecked() }, // wake_by_ref
60 let waker = unsafe { Waker::from_raw(RawWaker::new(core::ptr::null(), &VTABLE)) };
61 let mut context = Context::from_waker(&waker);
64 if let Poll::Ready(val) = future.as_mut().poll(&mut context) {