path
dependency on git
dependency not found on monorepo with several workspaces
#14946
Labels
A-git
Area: anything dealing with git
A-workspaces
Area: workspaces
C-bug
Category: bug
S-needs-info
Status: Needs more info, such as a reproduction or more background for a feature request.
Problem
When a crate (
LOCAL
) tries to import a crate (A
) from a git repository (monorepo that has several cargo workspaces), if the crate (A
) has apath
dependency to another crate (B
) in the same monorepo but different workspace, it won't find it when building theLOCAL
crate.It will fail with an error like:
This is extra confusing because it seems that cargo treats the a path dependency as a git dependency in this case. So
location searched
is the same git link as the link of the crateA
. Which makes sense, because they exist in the same repo and thus makes sense to search them in the same folder where the git repo syncs. It is just a bit confusing when reading.The issues seems to be that cargo scans the whole monorepo to find packages (even if the root folder is not a workspace) for resolving
A
, but it doesn't when searching forB
.Steps
Create a repo with 2 cargo workspaces. Make a crate in each workspace (
A
andB
).Make A depend on
B
using apath
definition on theCargo.toml
.Create a local crate in your computer and add a
git
dependency to the crateA
. See it fail to resolveB
.Possible Solution(s)
When resolving
B
, the samecrawl
explained in here: #1462 (comment) should happen, so the package can be foundNotes
This is happening using our internal gitlab instance. I assume this would happen with any remote git provider. For this case we used https links.
Version
The text was updated successfully, but these errors were encountered: