Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang: ignore unnamed structs instead of panic #605

Merged
merged 1 commit into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ incremented for features.

## [Unreleased]

### Features

* lang: Ignore `Unnamed` structs instead of panic ([#605](https://github.com/project-serum/anchor/pull/605)).

## [0.13.2] - 2021-08-11

### Fixes
Expand Down
3 changes: 2 additions & 1 deletion lang/syn/src/idl/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,8 @@ fn parse_ty_defs(ctx: &CrateContext) -> Result<Vec<IdlTypeDefinition>> {
})
})
.collect::<Result<Vec<IdlField>>>(),
_ => panic!("Only named structs are allowed."),
syn::Fields::Unnamed(_) => return None,
_ => panic!("Empty structs are allowed."),
};

Some(fields.map(|fields| IdlTypeDefinition {
Expand Down