Skip to content

Wrong Nightly version used for macros / build scripts #1573

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

Open
luxalpa opened this issue Apr 21, 2025 · 3 comments
Open

Wrong Nightly version used for macros / build scripts #1573

luxalpa opened this issue Apr 21, 2025 · 3 comments

Comments

@luxalpa
Copy link

luxalpa commented Apr 21, 2025

I have set my toolchain via rust-toolchain.toml to nightly-2025-04-17. This works with cargo build, but cargo clif build seems to be using a different version (I don't know which one) for the build scripts / macros.
Edit: It's using nightly-2025-04-14-x86_64-pc-windows-msvc for some reason. I uninstalled all the other nightly versions and then it went and automatically installed this one. I am guessing it takes this from the rust-toolchain.toml in rustc_codegen_cranelift itself for some reason?

I am getting the error:

no method named file found for struct proc_macro::Span in the current scope

... which is due to a recent nightly change (I think in 2025-04-15 ?), so it must be using an older nightly version.

Proc macro code:

#![feature(proc_macro_span)]

#[proc_macro]
pub fn my_macro(input: proc_macro::TokenStream) -> proc_macro::TokenStream {
    input
}

fn some_fn(span: proc_macro::Span) {
    span.file();
}

I am on Windows 11.

@bjorn3
Copy link
Member

bjorn3 commented Apr 21, 2025

cargo-clif indeed ignores rust-toolchain.toml. It has to because every cg_clif build links against a single rustc version. If you need a specific nightly rustc, you can use instructions from https://github.com./rust-lang/rustc_codegen_cranelift?tab=readme-ov-file#download-using-rustup instead of downloading a release from this repo and using cargo-clif. This will get you a cg_clif build exactly matching the specific nightly you installed.

@luxalpa
Copy link
Author

luxalpa commented Apr 21, 2025

ahh ok, thanks, that kinda makes sense. Unfortunately those seem to be Linux / Mac only though.

@bjorn3
Copy link
Member

bjorn3 commented Apr 21, 2025

Right, you are running on Windows. Unfortunately there are still some ABI compatibility issues between cg_clif and cg_llvm that are preventing rustup distribution of cg_clif. (rustup distributed cg_clif uses a cg_llvm compiled standard library) If using nightly-2025-04-21 would work for you too, then updating to the latest release of cg_clif should work. I updated cg_clif to the latest nightly a couple of hours ago.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants