Browse Source

lang: Use `pub(crate)` visibility for `__nonce` field (#489)

suscd 4 years ago
parent
commit
2d486f55fa
1 changed files with 7 additions and 2 deletions
  1. 7 2
      lang/attribute/account/src/lib.rs

+ 7 - 2
lang/attribute/account/src/lib.rs

@@ -1,7 +1,7 @@
 extern crate proc_macro;
 
 use quote::quote;
-use syn::parse_macro_input;
+use syn::{parse_macro_input, parse_quote};
 
 /// A data structure representing a Solana account, implementing various traits:
 ///
@@ -218,7 +218,12 @@ pub fn associated(
             });
             fields.named.push(syn::Field {
                 attrs: Vec::new(),
-                vis: syn::Visibility::Inherited,
+                vis: syn::Visibility::Restricted(syn::VisRestricted {
+                    pub_token: syn::token::Pub::default(),
+                    paren_token: syn::token::Paren::default(),
+                    in_token: None,
+                    path: Box::new(parse_quote!(crate))
+                }),
                 ident: Some(syn::Ident::new("__nonce", proc_macro2::Span::call_site())),
                 colon_token: Some(syn::token::Colon {
                     spans: [proc_macro2::Span::call_site()],