Skip to content

Commit

Permalink
idl: Fix panicking on tests (#3197)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Aug 25, 2024
1 parent 679c130 commit 0498580
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- lang: Fix compilation warnings due to unused deprecated program id macros ([#3170](https://github.com/coral-xyz/anchor/pull/3170)).
- ts: Remove `crypto-hash` dependency ([#3171](https://github.com/coral-xyz/anchor/pull/3171)).
- ts: Improve error message of unsupported `view` method ([#3177](https://github.com/coral-xyz/anchor/pull/3177)).
- idl: Fix panicking on tests ([#3197](https://github.com/coral-xyz/anchor/pull/3197)).

### Breaking

Expand Down
4 changes: 1 addition & 3 deletions lang/syn/src/idl/defined.rs
Original file line number Diff line number Diff line change
Expand Up @@ -497,9 +497,7 @@ pub fn gen_idl_type(
use quote::ToTokens;

let source_path = proc_macro2::Span::call_site().source_file().path();
let lib_path = find_path("lib.rs", &source_path).expect("lib.rs should exist");

if let Ok(ctx) = CrateContext::parse(lib_path) {
if let Ok(Ok(ctx)) = find_path("lib.rs", &source_path).map(CrateContext::parse) {
let name = path.path.segments.last().unwrap().ident.to_string();
let alias = ctx.type_aliases().find(|ty| ty.ident == name);
if let Some(alias) = alias {
Expand Down

0 comments on commit 0498580

Please sign in to comment.