diff options
author | 2023-04-13 05:38:13 +0000 | |
---|---|---|
committer | 2023-04-13 05:38:13 +0000 | |
commit | f741475a3f552585f789b3b2b9c622b090e72057 (patch) | |
tree | b2696705d5a97ec53041a772378beaf70b5c5642 /rtic-macros/src/syntax/parse/resource.rs | |
parent | 44c614d792c65aa2660f841e969db575f1ee6e86 (diff) | |
parent | e47914ee50b838cceca77cd881dce9caaf689901 (diff) | |
download | rtic-f741475a3f552585f789b3b2b9c622b090e72057.tar.gz rtic-f741475a3f552585f789b3b2b9c622b090e72057.tar.zst rtic-f741475a3f552585f789b3b2b9c622b090e72057.zip |
Merge #730
730: remove vis restriction for local and shared resources r=korken89 a=andrewgazelka
Co-authored-by: Andrew Gazelka <andrew.gazelka@gmail.com>
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(), }) } } |