浏览代码

idl: Update `proc-macro2` usage for latest nightly (#3663)

cryptopapi997 5 月之前
父节点
当前提交
54d5396acb
共有 3 个文件被更改,包括 8 次插入3 次删除
  1. 1 0
      CHANGELOG.md
  2. 2 2
      Cargo.lock
  3. 5 1
      lang/syn/src/idl/defined.rs

+ 1 - 0
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

+ 2 - 2
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",
 ]

+ 5 - 1
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);