From 6aa0fb450f417ce899b43f4539eb226b391a0f2e Mon Sep 17 00:00:00 2001 From: Emil Fresk Date: Thu, 8 Apr 2021 18:25:09 +0200 Subject: Goodbye static mut --- macros/src/codegen/locals.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'macros/src/codegen/locals.rs') 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)); } -- cgit v1.2.3