-
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 recompiles many of my crate's deps when my the case for my CWD changes on windows #4961
Comments
If you set the environment variable |
@ehuss Thanks! Yes, I get lots of fingerprint errors (for all direct deps) when doing |
@Boscop that's saying |
No idea. It uses the same Cargo.toml files, is called from the same dir (workspace root) etc. Both building in debug mode using the same nightly. |
I'm having a hard time reproducing this, or thinking of ways it could fail. One possibility is that your environment variables are different in your shell versus Sublime, in particular the It might also help if you could post a project with the minimum needed to reproduce it. |
And they are the same for both. I have a .cargo\config file in this workspace, so it's also the same for both: [build]
rustflags = "-C target-cpu=native" And I have a global .cargo\config file but it's also the same for both. What else could be the reason? |
Given the way the profile hash is defined my guess is that this has something to do with incremental compilation. @Boscop are you sure that its consistently either incremental or not? If not it may be the case that different paths are being passed down messing with the hash. Can you get the verbose output of Cargo in both situations? |
It's nightly 01-16 and I haven't set |
Here is the full output of Here is the full output of Here is the full environment of cmder (as reported by the Here is the full env of cmd.exe spawned from sublime. |
It looks like the drive path is changing from |
Cmder shows all paths with lowercase drive letters for the prompt too. |
But yes, when I spawn a new "tab" (another shell in Cmder) and enter the dir path with capital drive letter, then build in sublime, then in that new tab, it doesn't trigger the rebuild! But then when I switch to the old tab (with lowercase drive letter) that triggers the rebuild (just switching between those two cmder shell instances). |
I believe what's happening here is:
@Boscop would you be curious to help work on a patch for this? I think we could solve this by basically returning some custom structure from |
I'd be interested to help but I'm not familiar with cargo internals at all and super busy with my job and studies at the moment.. Not sure how much time would be needed to read all the code necessary to come up with a good solution vs someone who is already familiar with the internals.. I guess a solution would be that instead of flattening But maybe an even simpler solution would make sense: just normalize all paths on windows to lowercase before concatenating with |
Indeed yeah! I think we'd basically just change
to
where it'd just store a |
But why not normalize paths on windows to lowercase before concatenating with |
I'm personally not a huge fan of normalization in general b/c of the bugs it can introduce, and sticking with the source of truth I don't think will be too large of a change here. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Is this still an issue? Looks like the cargo code has changed considerably and been re-organised since this was raised. |
I haven't seen this problem in a long while. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
cargo check
in sublime and cargo build
in shell
There are many reasons why a rebuild may be happening. This is focusing on one specific case that was narrowed down to a change in the case for the CWD. We first need a test for this case. If it doesn't reproduce, great, let's merge it. If it does reproduce then we can work on fixing it. Most of the fingerprinting code lives at https://github.com/rust-lang/cargo/tree/master/src/cargo/core/compiler/fingerprint these days |
cargo recompiles many of my crate's deps when I switch between
cargo check
in sublime andcargo build
in cmd.exe, why?Usually I have
cargo watch -x run
running inCmder
while coding in sublime and doingcargo check
there. Until today, it was working fine, but now it always recompiles many of my crate's dependencies whenever I docargo check
in the editor, becausecargo watch -x run
has built it in the meantime, also with the deps which don't need to be built: it always recompiles them for both (from the shell and from the editor).This is very frustrating because it's a huge project which takes a long time to compile, even with incremental compilation.
Btw, I tested it also with a cmd.exe spawned from sublime, and switching between that and the cmd.exe in Cmder. Same behavior. It always rebuilds when I switch shell and
cargo build
.Btw, it only rebuilds direct deps that are in the combined Cargo.toml's of this workspace, not indirect deps, those are always still
Fresh
. Why would it rebuild all direct deps though?This is with nightly 01-16 btw. It didn't happen before.
In the env I don't see any env vars that could cause cargo to recompile..
Why doesn't
cargo build -vvvv
print out more info about why it decides to rebuild those crates? (just"Compiling <crate>.."
)The text was updated successfully, but these errors were encountered: