-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
cargo run
and cargo build
don't seem to reflect recent changes
#12090
Comments
What is your folder structure? What is your Cargo.toml? What is your OS? |
anand@anands-MacBook-Pro ~/.c/d/lorenz (main)> tree
.
├── Cargo.lock
├── Cargo.toml
├── README.md
├── data
│ └── Euler_dt0.01.csv
├── src
│ ├── lib.rs
│ └── main.rs
anand@anands-MacBook-Pro ~/.c/d/lorenz (main)> cat Cargo.toml
[package]
name = "lorenz"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
pyo3 = { version = "0.18.3", features = ["extension-module"] }
[lib]
name = "lorenz"
path = "src/lib.rs"
crate-type = ["lib"]
anand@anands-MacBook-Pro ~/.c/d/lorenz (main)> uname -a
Darwin anands-MacBook-Pro.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103 arm64 heres also a short clip displaying what i see 2023-05-05.12-46-19.mp4 |
Some file system questions that might help rule out potential problems: what file system are you using? does the file get written immediately? does the modification time update correctly? |
im using macos 13. i haven't messed with the FS. vscode saves after 1 second or so but i see that that's not the issue, since i can also repro after making a change to src/main.rs from vim. is that any help? |
What would happen if you execute Besides, could you follow this FAQ and run this?
|
does this clip provide any more information? 2023-05-20.16-24-01.mp4here is the output of doing the build after a clean anand@anands-MacBook-Pro ~/.c/d/mwe (main) [1]> cargo clean
anand@anands-MacBook-Pro ~/.c/d/mwe (main)> CARGO_LOG=cargo::core::compiler::fingerprint=info cargo build --verbose
[2023-05-20T20:28:19Z INFO cargo::core::compiler::fingerprint] fingerprint error for mwe v0.1.0 (/Users/anand/.cargo/dev/mwe)/Build/TargetInner { name: "mwe", doc: true, ..: with_path("/Users/anand/.cargo/dev/mwe/src/main.rs", Edition2021) }
[2023-05-20T20:28:19Z INFO cargo::core::compiler::fingerprint] err: failed to read `/Users/anand/.cargo/dev/mwe/target/debug/.fingerprint/mwe-b730d5b325c44352/bin-mwe`
Caused by:
No such file or directory (os error 2)
Compiling mwe v0.1.0 (/Users/anand/.cargo/dev/mwe)
Running `rustc --crate-name mwe --edition=2021 src/main.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=162 --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C metadata=b730d5b325c44352 -C extra-filename=-b730d5b325c44352 --out-dir /Users/anand/.cargo/dev/mwe/target/debug/deps -C incremental=/Users/anand/.cargo/dev/mwe/target/debug/incremental -L dependency=/Users/anand/.cargo/dev/mwe/target/debug/deps`
Finished dev [unoptimized + debuginfo] target(s) in 0.32s |
Also affected by this. I have a workspace with a lot of binaries. I use I've managed to bisect the issue somewhat:
Sadly, the versions in between can't build the project, and I failed to reproduce the issue with a smaller projects so far. |
If you can reproduce it, can you do the following:
and post all of the output? (You can zip it up, or post it in a gist if it is too large.) @weihanglo Just FYI, that range includes #11672 and #11252 which are pretty suspicious. (Also #11665, but less so.) |
anand@anands-MacBook-Pro ~/.c/d/mwe (main)> CARGO_LOG=cargo::core::compiler::fingerprint=trace,cargo_util:
:paths=trace cargo check
[2023-05-31T06:05:14Z DEBUG cargo::core::compiler::fingerprint] fingerprint at: /Users/anand/.cargo/dev/mwe/target/debug/.fingerprint/mwe-4f282b851a48d248/bin-mwe
[2023-05-31T06:05:14Z DEBUG cargo::core::compiler::fingerprint] failed to get mtime of "/Users/anand/.cargo/dev/mwe/target/debug/deps/libmwe-4f282b851a48d248.rmeta": failed to stat `/Users/anand/.cargo/dev/mwe/target/debug/deps/libmwe-4f282b851a48d248.rmeta`
[2023-05-31T06:05:14Z INFO cargo::core::compiler::fingerprint] fingerprint error for mwe v0.1.0 (/Users/anand/.cargo/dev/mwe)/Check { test: false }/TargetInner { name: "mwe", doc: true, ..: with_path("/Users/anand/.cargo/dev/mwe/src/main.rs", Edition2021) }
[2023-05-31T06:05:14Z INFO cargo::core::compiler::fingerprint] err: failed to read `/Users/anand/.cargo/dev/mwe/target/debug/.fingerprint/mwe-4f282b851a48d248/bin-mwe`
Caused by:
No such file or directory (os error 2)
Checking mwe v0.1.0 (/Users/anand/.cargo/dev/mwe)
[2023-05-31T06:05:14Z DEBUG cargo_util::paths] invocation time for "/Users/anand/.cargo/dev/mwe/target/debug/.fingerprint/mwe-4f282b851a48d248" is 1685513114.120240879s
[2023-05-31T06:05:14Z DEBUG cargo_util::paths] set file mtime /Users/anand/.cargo/dev/mwe/target/debug/.fingerprint/mwe-4f282b851a48d248/dep-bin-mwe to 1685513114.120240879s
[2023-05-31T06:05:14Z DEBUG cargo::core::compiler::fingerprint] write fingerprint (6df1dc200f794b51) : /Users/anand/.cargo/dev/mwe/target/debug/.fingerprint/mwe-4f282b851a48d248/bin-mwe
Finished dev [unoptimized + debuginfo] target(s) in 0.25s this was the only thing related to an error that I saw. sorry i'm not more helpful here |
Now I just realized your project is under Could you check if you move the project out of |
Assuming the problem is indeed with |
Yep. Warning is an approach. The other way is that Cargo should only exclude |
To fix this, I propose the approach in this #12090 (comment). The change will happen here. I would not suggest adding a warning as this moment. It could be too verbose and noisy. We can have that warning once Cargo gets its own lint rules control. @rustbot label -S-needs-info +S-accepted +A-errors +E-easy |
@ilammy, it would be helpful you could provide more info or a minimal reproduction. I am not sure whether it is the same bug as the original issue. |
Closes rust-lang#12090 Commit Fix formatting
Closes rust-lang#12090 Commit Fix formatting Fix tests
Closes rust-lang#12090 Commit Fix formatting Fix tests Fix formatting
Closes rust-lang#12090 Commit Fix formatting Fix tests Fix formatting Fix formatting
fix: only skip mtime check on `~/.cargo/{git,registry}` Fixes #12090 Make cargo only skip mtime checks on `$CARGO_HOME/{git, registry}`.
Problem
i've been using vscode and
and i have a simple lib. when i change some stuff then rerun
cargo run
it runs the old code.i found this which seems similar to my issue
https://stackoverflow.com/questions/57087386/cargo-run-does-not-reflect-any-code-changes-in-main-rs
but in my case the only way that i reliably found to get cargo to register the changes is by deleting the
target
folder and rerunning.happy to provide more information if needed! i am probably doing something silly (pretty new to rust) but im confused
Steps
No response
Possible Solution(s)
No response
Notes
No response
Version
No response
The text was updated successfully, but these errors were encountered: