Skip to content

Commit 9ba2bc8

Browse files
committed
Fixed it for real, i think...
1 parent 53fcdd1 commit 9ba2bc8

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

examples/embassy-stm32g4/src/bin/spawn_local.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ mod app {
4141
#[task(priority = 1)]
4242
async fn task1(cx: task1::Context) {
4343
defmt::info!("Hello from task1!");
44-
cx.local_spawner.task2(Default::default());
44+
cx.local_spawner.task2(Default::default()).ok();
4545
}
4646

4747
#[task(priority = 1, is_local_task = true)]

rtic-macros/src/codegen/module.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
198198
.collect();
199199

200200
if !local_tasks_on_same_executor.is_empty() {
201-
let local_spawner = util::internal_task_ident(ident, "LocalSpawner");
201+
let local_spawner = util::internal_task_ident(t, "LocalSpawner");
202202
fields.push(quote! {
203203
/// Used to spawn tasks on the same executor
204204
///
@@ -223,19 +223,20 @@ pub fn codegen(ctxt: Context, app: &App, analysis: &Analysis) -> TokenStream2 {
223223
quote!(<'a>)
224224
};
225225
let input_vals = inputs.iter().map(|i| &i.pat).collect::<Vec<_>>();
226+
let (_input_args, _input_tupled, _input_untupled, input_ty) = util::regroup_inputs(&task.inputs);
226227
quote! {
227228
#(#attrs)*
228229
#(#cfgs)*
229230
#[allow(non_snake_case)]
230-
pub(super) fn #ident #generics(&self #(,#inputs)*) {
231+
pub(super) fn #ident #generics(&self #(,#inputs)*) -> ::core::result::Result<(), #input_ty> {
231232
// SAFETY: This is safe to call since this can only be called
232233
// from the same executor
233-
unsafe { super::#internal_spawn_ident(#(#input_vals,)*) }
234+
unsafe { #internal_spawn_ident(#(#input_vals,)*) }
234235
}
235236
}
236237
})
237238
.collect::<Vec<_>>();
238-
values.push(quote!(local_spawner: #t::LocalSpawner { _p: core::marker::PhantomData }));
239+
values.push(quote!(local_spawner: #local_spawner { _p: core::marker::PhantomData }));
239240
items.push(quote! {
240241
struct #local_spawner {
241242
_p: core::marker::PhantomData<*mut ()>,

0 commit comments

Comments
 (0)