diff options
| author | Emil Fresk <emil.fresk@gmail.com> | 2021-04-08 18:25:09 +0200 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2021-04-08 19:58:20 +0200 |
| commit | 6aa0fb450f417ce899b43f4539eb226b391a0f2e (patch) | |
| tree | 2202c8bb4aa2ba2451f025784a5bad99c4370b2e /macros/src/codegen/locals.rs | |
| parent | 43c5ad79c27fbdefa00e2373eba554ec11e1d9df (diff) | |
Goodbye static mut
Diffstat (limited to 'macros/src/codegen/locals.rs')
| -rw-r--r-- | macros/src/codegen/locals.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/macros/src/codegen/locals.rs b/macros/src/codegen/locals.rs index 5725a15..0fb8c6d 100644 --- a/macros/src/codegen/locals.rs +++ b/macros/src/codegen/locals.rs @@ -50,11 +50,11 @@ pub fn codegen( items.push(quote!( #(#cfgs)* #[doc(hidden)] - static mut #name: #ty = #expr + static #name: rtic::RacyCell<#ty> = rtic::RacyCell::new(#expr) )); values.push(quote!( #(#cfgs)* - #name: &mut #name + #name: #name.get_mut_unchecked() )); names.push(name); pats.push(quote!( @@ -64,7 +64,7 @@ pub fn codegen( } if lt.is_some() && has_cfgs { - fields.push(quote!(__marker__: core::marker::PhantomData<&'a mut ()>)); + fields.push(quote!(__marker__: core::marker::PhantomData<&'a ()>)); values.push(quote!(__marker__: core::marker::PhantomData)); } |
