Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rtic-macros/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ For each category, *Added*, *Changed*, *Fixed* add new entries at the top!

## [Unreleased]

### Fixed

- Generated mutexes for shared resourses no longer implement `Send`. They are meant to be used inside a task locally.

### Added

- Outer attributes applied to RTIC app module are now forwarded to the generated code.
Expand Down
7 changes: 6 additions & 1 deletion rtic-macros/src/codegen/shared_resources.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,14 @@ pub fn codegen(app: &App, analysis: &Analysis) -> TokenStream2 {
#[allow(non_camel_case_types)]
#(#cfgs)*
pub struct #shared_name<'a> {
__rtic_internal_p: ::core::marker::PhantomData<&'a ()>,
__rtic_internal_p: ::core::marker::PhantomData<(&'a (), *const u8)>,
}

// Opt out from `Send`.
// `#shared_name` is trivially `Sync` because there are no `&self` methods.
// See https://doc.rust-lang.org/std/sync/struct.Exclusive.html .
unsafe impl<'a> Sync for #shared_name<'a> {}

#(#cfgs)*
impl<'a> #shared_name<'a> {
#[inline(always)]
Expand Down
Loading