rust-lang / rust-lang/rustc_codegen_cranelift

Wrong Nightly version used for macros / build scripts

Open
#1,573 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2.1k
Forks
157
Avg merge
1d 19h
Merged PRs (30d)
3

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the repository's rust-toolchain.toml and the cargo clif build entry point, then compare the toolchain selected for build scripts and macros with the user's configured nightly. Reproduce the Windows proc_macro::Span::file() example and verify that the configured nightly is used consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.