From b40e09d502208b8c9fe2d35c63065bb82417ff89 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Tue, 3 Nov 2020 22:12:45 +0100 Subject: [PATCH] Allow spawning tasks with non-copy args. --- embassy-macros/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/embassy-macros/src/lib.rs b/embassy-macros/src/lib.rs index db4afcb9..b11fc4ae 100644 --- a/embassy-macros/src/lib.rs +++ b/embassy-macros/src/lib.rs @@ -93,7 +93,7 @@ pub fn task(args: TokenStream, item: TokenStream) -> TokenStream { #task_fn type F = impl ::core::future::Future + 'static; static POOL: [::embassy::executor::Task; #pool_size] = [::embassy::executor::Task::new(); #pool_size]; - unsafe { ::embassy::executor::Task::spawn(&POOL, || task(#arg_names)) } + unsafe { ::embassy::executor::Task::spawn(&POOL, move || task(#arg_names)) } } }; result.into()