-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix: Update proc-macro2
usage for latest nightly
#3663
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
fix: Update proc-macro2
usage for latest nightly
#3663
Conversation
proc-macro2
usage for latest nightly
proc-macro2
usage for latest nightlyproc-macro2
usage for latest nightly
as far as I can tell it also affects stable, not only nightly (at least on my local build) |
Replace the respective error line with 📁 File:
📝 Line 499:let source_path = proc_macro2::Span::call_site().file(); |
I'm facing this problem too even though I use stable version of rustc. |
same. Not only nightly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick fix.
We're also planning to make the IDL generation use the stable compiler by default and make code that required nightly
optional via a CLI flag to avoid issues like this one. It sounds like these methods will be stabilized (as mentioned in rust-lang/rust#139671), so we might be able to avoid nightly
completely when that happens.
Related: There is an open issue (rust-lang/rust#139903) regarding the naming of local_file
.
Is anything that I can help maybe?, I need this fix ASAP. Also, I want to tell the CI failed
|
@hryer we're waiting on the update and I'll check into the CI |
Hello. Is this going to be released as a hotfix for Anchor v0.31.0? |
Please fix it ASAP. |
having the same issue |
this is the temporary fix that worked best for me: |
Facing the same issue. |
i can't find this file , where would i locate it ? |
Using |
so how do i generate IDL for frontend use ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're most likely going to make a patch release for this issue. Thanks for the fix and also responsiveness!
54d5396
into
solana-foundation:master
Hi, how to pull these changes? Will it be released in anchor 0.31.1? |
How will these changes be reflected? In anchor 0.31.1 ? |
anchor-cli 0.31.0 |
Is it fixed? |
So what's the solution? |
Update to anchor 0.31.1 which was released today |
please check the issue, I figured out the issue yesterday but today I am facing a new issue |
@hryer this line: let source_path = proc_macro2::Span::call_site().source_file().path(); |
For anyone still runing into this issue: Make sure you're using
|
Getting below error while using
Error no method named error[E0599]: no method named |
have you tried reverting proc_macro2 v0.1.95 to proc_macro2 v0.1.94? |
Hi @0xm4ud ,
With below configuration
I am getting this error no method named |
@rotcan I saw that error this morning. What I did was: cargo update -p proc-macro2, rustup override set 1.81, which solved it for me. |
@0xm4ud , still getting same error with below setting :(
no method named |
@rotcan hmm.. cargo update -p proc-macro2 should've changed/updated your proc-macro2 version, but by your post I see still is 1.94, try removing the lib /proc-macro2-1.0.94/directory and running cargo update -p proc-macro2 again. |
@0xm4ud Got it working thanks. I deleted proc-macro2-1.0.94 & 95 directory and anchor-syn-0.31.1 directory in cargo registry. Then ran rustup update. |
Was confused by people saying you need nightly rust. You don't need to be using nightly in your workspace, but you DO need to update your nightly because anchor idl generation uses it. Make sure you have run |
this works for me:
|
As of nightly-2025-04-16,
SourceFile
and the methods around it don't exist anymore, so anyone updating rust or installing rust won't be able to compile the idl anymore.proc-macro2
already updated, this PR updates anchor accordingly. Note that this will require users to update to the latest nightly (and will break users with an older nightly). Idk if this counts as a breaking change since it only affects nightly...Fixes #3662