diff --git a/CHANGELOG.md b/CHANGELOG.md index 34cc9f6c39..df68ca5fbb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The minor version will be incremented upon a breaking change and the patch versi ### Fixes +- idl: Update `proc-macro2` usage for latest nightly ([#3663](https://github.com/solana-foundation/anchor/pull/3663)) - cli, docker: Replace `backpackapp/build` Docker image with `solanafoundation/anchor` ([#3619](https://github.com/coral-xyz/anchor/pull/3619)). ### Breaking diff --git a/Cargo.lock b/Cargo.lock index 92db1ffa26..fa50d7b9b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3000,9 +3000,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.89" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] diff --git a/lang/syn/src/idl/defined.rs b/lang/syn/src/idl/defined.rs index 334387a20c..07786d2db0 100644 --- a/lang/syn/src/idl/defined.rs +++ b/lang/syn/src/idl/defined.rs @@ -496,7 +496,11 @@ pub fn gen_idl_type( use crate::parser::context::CrateContext; use quote::ToTokens; - let source_path = proc_macro2::Span::call_site().source_file().path(); + // If no path was found, just return an empty path and let the find_path function handle it + let source_path = proc_macro2::Span::call_site() + .local_file() + .unwrap_or_default(); + 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);