From ed141ab54d2fa9917c1e7eaf4c110aa715e1f02a Mon Sep 17 00:00:00 2001 From: Lukas Kalbertodt Date: Thu, 7 Apr 2022 13:59:09 +0200 Subject: [PATCH] Fix generation bug for `pub` and `pub(in path)` structs --- macro/src/gen.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macro/src/gen.rs b/macro/src/gen.rs index ccddbb4..531ada0 100644 --- a/macro/src/gen.rs +++ b/macro/src/gen.rs @@ -421,7 +421,7 @@ impl ToTokens for ir::Expr { fn inner_visibility(outer: &syn::Visibility, span: Span) -> TokenStream { match outer { // These visibilities can be used as they are. No adjustment needed. - syn::Visibility::Public(_) | syn::Visibility::Crate(_) => quote_spanned! {span=> outer }, + syn::Visibility::Public(_) | syn::Visibility::Crate(_) => quote_spanned! {span=> #outer }, // The inherited one is relative to the parent module. syn::Visibility::Inherited => quote_spanned! {span=> pub(super) }, @@ -434,7 +434,7 @@ fn inner_visibility(outer: &syn::Visibility, span: Span) -> TokenStream { // If the path in the `pub(in )` visibility is absolute, we can // use it like that as well. syn::Visibility::Restricted(r) if r.path.leading_colon.is_some() => { - quote_spanned! {span=> outer } + quote_spanned! {span=> #outer } }, // But in the case `pub(in )` with a relative path, we have to