rustc_codegen_cranelift icon indicating copy to clipboard operation
rustc_codegen_cranelift copied to clipboard

Wrong Nightly version used for macros / build scripts

Open luxalpa opened this issue 6 months ago • 3 comments

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.

luxalpa avatar Apr 21 '25 11:04 luxalpa