diff options
author | 2023-04-11 13:10:26 -0700 | |
---|---|---|
committer | 2023-04-12 15:26:06 -0700 | |
commit | e47914ee50b838cceca77cd881dce9caaf689901 (patch) | |
tree | b2696705d5a97ec53041a772378beaf70b5c5642 /rtic-macros/src/syntax/parse/resource.rs | |
parent | 44c614d792c65aa2660f841e969db575f1ee6e86 (diff) | |
download | rtic-e47914ee50b838cceca77cd881dce9caaf689901.tar.gz rtic-e47914ee50b838cceca77cd881dce9caaf689901.tar.zst rtic-e47914ee50b838cceca77cd881dce9caaf689901.zip |
remove vis restriction for local and shared resources
Diffstat (limited to 'rtic-macros/src/syntax/parse/resource.rs')
-rw-r--r-- | rtic-macros/src/syntax/parse/resource.rs | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/rtic-macros/src/syntax/parse/resource.rs b/rtic-macros/src/syntax/parse/resource.rs index ff100576..9ce67253 100644 --- a/rtic-macros/src/syntax/parse/resource.rs +++ b/rtic-macros/src/syntax/parse/resource.rs @@ -1,5 +1,4 @@ -use proc_macro2::Span; -use syn::{parse, Field, Visibility}; +use syn::{parse, Field}; use crate::syntax::parse::util::FilterAttrs; use crate::syntax::{ @@ -8,14 +7,7 @@ use crate::syntax::{ }; impl SharedResource { - pub(crate) fn parse(item: &Field, span: Span) -> parse::Result<Self> { - if item.vis != Visibility::Inherited { - return Err(parse::Error::new( - span, - "this field must have inherited / private visibility", - )); - } - + pub(crate) fn parse(item: &Field) -> parse::Result<Self> { let FilterAttrs { cfgs, mut attrs, @@ -30,19 +22,13 @@ impl SharedResource { docs, ty: Box::new(item.ty.clone()), properties: SharedResourceProperties { lock_free }, + vis: item.vis.clone(), }) } } impl LocalResource { - pub(crate) fn parse(item: &Field, span: Span) -> parse::Result<Self> { - if item.vis != Visibility::Inherited { - return Err(parse::Error::new( - span, - "this field must have inherited / private visibility", - )); - } - + pub(crate) fn parse(item: &Field) -> parse::Result<Self> { let FilterAttrs { cfgs, attrs, docs } = util::filter_attributes(item.attrs.clone()); Ok(LocalResource { @@ -50,6 +36,7 @@ impl LocalResource { attrs, docs, ty: Box::new(item.ty.clone()), + vis: item.vis.clone(), }) } } |