Open P-E-Meunier opened 1 week ago
Ran cargo vendor
didn't give me that output. With which version of Cargo under which directory should I run cargo vendor
?
So, in my example repo, you need to run those steps from subdirectory a
.
In #14729, you additionally need to start a fake private registry before, using the following command from the root of the repo:
python -m http.server 8080 --bind 127.0.0.1 --directory .
In https://github.com/rust-lang/cargo/issues/14729, you additionally need to start a fake private registry before
You need to start the fake registry in either of those, otherwise Cargo cannot connect to them.
Anyway I can reproduce it now. This reminds me https://github.com/rust-lang/cargo/issues/10310 though they don't seem to be the same, and also one of the two c
crate is vendored. The issue is kind of hitting several bad cases of cargo vendor
?
It is indeed. This isn't an artificial case though, it was triggered by migrating a registry from one domain to another: some versions of some crates are mirrored on both, leading to this situation.
Fortunately, the fix for #14729 doesn't have any unintended effects: the only thing it does is replace more sources in .cargo/config.toml
, which can't hurt if these registries aren't used, and fixes the issue when they are.
The fix for this issue is a little different, since it changes the rustc invocations when sources are replaced:
.cargo/config.toml
, the metadata doesn't change, meaning that Cargo considers the two sources (original and replaced) to be the same. IIUC, both would be valid since an original crate and its replacement never appear in the same rustc
invocation.
Problem
When replacing sources in
.cargo/config.toml
so that two different sources point to the same vendored directory, cargo identifies a single package from two different sources as different, giving rise to a confusing error message where a type from a file is claimed to be distinct from itself:Steps
cargo vendor ../vendor
from subdirectorya
, which yields a wrong output (as per #14729).a/.cargo/config.toml
, should be:cargo build
from subdirectorya
.