diff options
author | 2018-12-15 22:04:30 +0100 | |
---|---|---|
committer | 2018-12-15 22:04:30 +0100 | |
commit | 4f00d8bd781455535e0710879bc31c197e51c71b (patch) | |
tree | c8aa311dfde52894f76732734554798cee94e413 /macros/src/codegen.rs | |
parent | eba691a5f2ac42d6a50203f58632209a27ab9566 (diff) | |
download | rtic-4f00d8bd781455535e0710879bc31c197e51c71b.tar.gz rtic-4f00d8bd781455535e0710879bc31c197e51c71b.tar.zst rtic-4f00d8bd781455535e0710879bc31c197e51c71b.zip |
codegen/statics: forward #[cfg] attributes
fixes #110
Diffstat (limited to 'macros/src/codegen.rs')
-rw-r--r-- | macros/src/codegen.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/macros/src/codegen.rs b/macros/src/codegen.rs index 8e1970f5..6b8e1594 100644 --- a/macros/src/codegen.rs +++ b/macros/src/codegen.rs @@ -1808,14 +1808,17 @@ fn mk_locals(locals: &HashMap<Ident, Static>, once: bool) -> proc_macro2::TokenS .iter() .map(|(name, static_)| { let attrs = &static_.attrs; + let cfgs = &static_.cfgs; let expr = &static_.expr; let ident = name; let ty = &static_.ty; quote!( #[allow(non_snake_case)] + #(#cfgs)* let #ident: &#lt mut #ty = { #(#attrs)* + #(#cfgs)* static mut #ident: #ty = #expr; unsafe { &mut #ident } |