Skip to content

Wrong Nightly version used for macros / build scripts #1573

@luxalpa

Description

@luxalpa

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions