Skip to content

Cargo gets confused about hashes when switching between toolchain versions #9085

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

Closed
jyn514 opened this issue Jan 18, 2021 · 3 comments
Closed
Labels
A-rebuild-detection Area: rebuild detection and fingerprinting C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.

Comments

@jyn514
Copy link
Member

jyn514 commented Jan 18, 2021

Problem

error[E0460]: found possibly newer version of crate `la_arena` which `profile` depends on
   --> crates/syntax/src/algo.rs:126:18
    |
126 |         let _p = profile::span("into_text_edit");
    |                  ^^^^^^^
    |
    = note: perhaps that crate needs to be recompiled?
    = note: the following crate versions were found:
            crate `la_arena`: /home/joshua/.local/lib/cargo/target/debug/deps/libla_arena-30ef6779a35b7e2f.rmeta
            crate `la_arena`: /home/joshua/.local/lib/cargo/target/debug/deps/libla_arena-af7c500c62bd5e59.rmeta
            crate `la_arena`: /home/joshua/.local/lib/cargo/target/debug/deps/libla_arena-af7c500c62bd5e59.rlib
            crate `profile`: /home/joshua/.local/lib/cargo/target/debug/deps/libprofile-6846f1b303b1dfdb.rmeta

error: aborting due to previous error

Steps

I am not able to replicate this. The original steps I did were something like this:

  1. git clone https://github.com/rust-analyzer/rust-analyzer/ && cd rust-analyzer
  2. cargo +stable doc --document-private-items
  3. git fetch origin pull/7341/head && git checkout FETCH_HEAD
  4. cargo +nightly doc --document-private-items
  5. cargo +stable doc --document-private-items

But I tried running that again and it works fine now, so I don't know what went wrong. Probably this is related to incremental somehow? Let me know if this should be moved to rust-lang/rust.

Possible Solution(s)

🤷

Notes

I don't understand how I constantly run into bugs the first time I compile a project 🤦 Not always cargo bugs. But always bugs. The last one was #8838, the one before was rust-lang/rust#71819, the one before that was rust-lang/docs.rs#432. I think hello world worked, though.

Output of cargo version:

> cargo +stable --version
cargo 1.49.0 (d00d64df9 2020-12-05)
> cargo +nightly --version
cargo 1.50.0-nightly (75d5d8cff 2020-12-22)

Ubuntu 20.04, x86_64-unknown-linux-gnu

@jyn514 jyn514 added the C-bug Category: bug label Jan 18, 2021
@ehuss
Copy link
Contributor

ehuss commented Jan 22, 2021

Hm, I'm unable to think of a way this could happen. Unfortunately without a repro or more information, it will be pretty difficult to figure it out.

This isn't related to incremental. I'm not sure if you're familiar with SVH. That is the hash that is stored in the rlib that causes this error. The key factor is probably the git command which changed some HIR node or something causing the SVH to change, but somehow between commands Cargo didn't rebuild it.

There were some extra steps that happened before the steps you listed above. Since there is a .rlib file, that means you ran cargo build at some point.

Also, /home/joshua/.local/lib/cargo/target is not a standard layout. It can be helpful if you have any non-default settings to mention them as well.

Generally, showing all the output can help. Even better is to create a tarball of the target directory immediately after it happens. If you can reproduce it at all, also adding CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build can help.

@ehuss ehuss added A-rebuild-detection Area: rebuild detection and fingerprinting S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request. labels Jan 22, 2021
@jyn514
Copy link
Member Author

jyn514 commented Jan 22, 2021

Also, /home/joshua/.local/lib/cargo/target is not a standard layout. It can be helpful if you have any non-default settings to mention them as well.

The only non-default settings I have are

> set | grep _HOME
CARGO_HOME=/home/joshua/.local/lib/cargo
RUSTUP_HOME=/home/joshua/.local/lib/rustup

Generally, showing all the output can help. Even better is to create a tarball of the target directory immediately after it happens. If you can reproduce it at all, also adding CARGO_LOG=cargo::core::compiler::fingerprint=trace cargo build can help.

I'll do that next time, sorry. Unfortunately I'm not able to reproduce this anymore.

@Eh2406
Copy link
Contributor

Eh2406 commented May 28, 2021

When you are able to reproduce please reopen or make a new issue!

@Eh2406 Eh2406 closed this as completed May 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rebuild-detection Area: rebuild detection and fingerprinting C-bug Category: bug S-needs-info Status: Needs more info, such as a reproduction or more background for a feature request.
Projects
None yet
Development

No branches or pull requests

3 participants