-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changing edition makes incremental compilation wrong #19195
Comments
At first, I wondered if rust-lang/cargo#14973 did this but manifest metatdata did not include the edition. Looking at https://doc.rust-lang.org/nightly/nightly-rustc/cargo/core/compiler/fingerprint/index.html, edition is suppose to be part of the fingerprint through the target. Target comes from the unit This makes me wonder if this is from the compiler's side of incremental compilation. Granted, this was all done by inspection. |
If this is from the compiler's side, should I post this issue in rust main repo? |
@Evian-Zhang, do you have a minimal repro? I've tried this fn main() {
let [&x, y] = &[&(), &()];
} After changing to |
Oh I finally realize how to reproduce this. When changing "2021" to "2024", you should keep rust-analyzer running (I use VSCode for this). The corrected steps are:
|
Hmmm, should I post this issue to rust-analyzer instead of here? |
I cannot reproduce it in VS Code with bundled rust-analyzer Could you clarify how you compile a Rust package? Clear and exact reproducible steps would help. |
@rustbot transfer rust-analyzer If it turns out a cargo issue, feel free to transfer it back! |
Minimal working example:
#[no_mangle]
fn foo() {
}
fn main() {
println!("Hello, world!");
}
[package]
name = "edition-test"
version = "0.1.0"
edition = "2021"
[dependencies] Step:
This example is 100% reproducible in my machine. The RA version is |
Could you also share what cargo says in |
In
And for rust-analyzer, it is more subtle: After I edit |
Confirmed that it is reproducible from also Neovim with the same steps. Not VS Code specific. When no rust-analyzer involved, i.e., |
Seems like a filesystem lock or cache problem |
Might be the rustc wrapper causing issues again #14722, it at least sounds very like it. Not much we can do about that unfortunately. |
Problem
For a Rust package written and compiled with edition 2021 before, if we do not use
cargo clean
to removetarget
directory, and change the edition inCargo.toml
from "2021" to "2024", the compilation cannot report correctly.Steps
cargo clean
Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: