Skip to content

Cargo recompiles unchanged re-saved files #8616

Description

@mattrossman

Problem
Re-saving a file but not changing its contents causes cargo to recompile the project.

This doesn't follow what's written in the Rust Programming Language book:

Cargo figured out that the files hadn’t changed, so it just ran the binary. If you had modified your source code, Cargo would have rebuilt the project before running

Steps

  1. Create a new project and build it
cargo new hello
cd hello
cargo build
  1. Open main.rs and re-save it, e.g. with vim src/main.rs and :wq
  2. Run another cargo build

Cargo will show a "Compiling" phase before "Finished" as if the file had changed.

Possible Solution(s)
Not sure what the current implementation is but perhaps it's considering the timestamp at which files were modified?

Notes

Output of cargo version:

cargo 1.45.1 (f242df6ed 2020-07-22)

I am on WSL running Ubuntu 20.04.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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