Skip to content

Commit

Permalink
Throw error if main output isn't public (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
knoellle authored Jan 24, 2025
1 parent 4541fc6 commit 64ef1df
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions crates/context_attribute/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use syn::{
token::Mut,
AngleBracketedGenericArguments, Expr, ExprLit, GenericArgument, GenericParam, ItemStruct,
Lifetime, LifetimeParam, Lit, Path, PathArguments, PathSegment, Type, TypeParam, TypePath,
TypeReference,
TypeReference, Visibility,
};

#[proc_macro_attribute]
Expand Down Expand Up @@ -121,7 +121,10 @@ pub fn context(_attributes: TokenStream, input: TokenStream) -> TokenStream {
_ => abort!(first_segment, "expected exactly two generic parameters"),
}
}
"MainOutput" => {}
"MainOutput" => match &field.vis {
Visibility::Public(_) => {}
_ => abort!(field, "fields of type MainOutput must be `pub`lic"),
},
"HardwareInterface" => {
requires_lifetime_parameter = true;
requires_hardware_interface_parameter = true;
Expand Down

0 comments on commit 64ef1df

Please sign in to comment.