Skip to content

error[E0599]: no method named local_file found for struct proc_macro2::Span in the current scope #3676

@tofuwu-dev

Description

@tofuwu-dev

I'm having a new trouble when I build anchor initial project today:

error[E0599]: no method named local_file found for struct proc_macro2::Span in the current scope
--> /home/haodev007/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/anchor-syn-0.31.1/src/idl/defined.rs:501:22
|
500 | let source_path = proc_macro2::Span::call_site()
| ______________-
501 | | .local_file()
| | -^^^^^^^^^^ method not found in Span
| |
|
|

I've checked the issue #3662 yesterday and downgraded proc-macro2 crate version
cargo update -p proc-macro2 --precise 1.0.94
It worked with anchor version 0.31.0 yesterday after downgraded proc-macro2 version but it doesnt work again

current rust and anchor version is
rustc 1.86.0 (05f9846f8 2025-03-31)
anchor-cli 0.31.1

Please help me, thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions