mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-19 14:25:18 +01:00
Goodbye static mut
This commit is contained in:
parent
43c5ad79c2
commit
6aa0fb450f
11 changed files with 145 additions and 59 deletions
|
|
@ -79,9 +79,9 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
|
|||
let is_late = expr.is_none();
|
||||
if is_late {
|
||||
let expr = if access.is_exclusive() {
|
||||
quote!(&mut *#mangled_name.as_mut_ptr())
|
||||
quote!(&mut *#mangled_name.get_mut_unchecked().as_mut_ptr())
|
||||
} else {
|
||||
quote!(&*#mangled_name.as_ptr())
|
||||
quote!(&*#mangled_name.get_unchecked().as_ptr())
|
||||
};
|
||||
|
||||
values.push(quote!(
|
||||
|
|
@ -91,7 +91,7 @@ pub fn codegen(ctxt: Context, needs_lt: &mut bool, app: &App) -> (TokenStream2,
|
|||
} else {
|
||||
values.push(quote!(
|
||||
#(#cfgs)*
|
||||
#name: &#mut_ #mangled_name
|
||||
#name: #mangled_name.get_mut_unchecked()
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue