Skip to content

Changing edition makes incremental compilation wrong #19195

Open
@Evian-Zhang

Description

@Evian-Zhang

Problem

For a Rust package written and compiled with edition 2021 before, if we do not use cargo clean to remove target directory, and change the edition in Cargo.toml from "2021" to "2024", the compilation cannot report correctly.

Steps

  1. Compile a Rust package of edition 2021 (with some codes that compile in 2021 but not compile in 2024)
  2. Change edition from 2021 to 2024
  3. Compile again, it does not say anything wrong
  4. cargo clean
  5. Compile again. It now correctly reports something is wrong.

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.85.0 (d73d2caf9 2024-12-31)
release: 1.85.0
commit-hash: d73d2caf9e41a39daf2a8d6ce60ec80bf354d2a7
commit-date: 2024-12-31
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 22.4.0 (jammy) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions