#![warn(rust_2018_idioms)] use tokio_executor::{self, DefaultExecutor}; use std::future::Future; use std::pin::Pin; mod out_of_executor_context { use super::*; use tokio_executor::Executor; fn test(spawn: F) where F: Fn(Pin + Send>>) -> Result<(), E>, { let res = spawn(Box::pin(async {})); assert!(res.is_err()); } #[test] fn spawn() { test(|f| DefaultExecutor::current().spawn(f)); } }