Workspace path to another workspace, and crate lookup

I just tried, and failed, to do something that I thought I had done before.

I have a workspace A and a workspace B (two different projects). There are crates in B that reference crates in A. I have some vague memory of being able to do this (in B/Cargo.toml):

# workspace dependencies
[dependencies]
crate-in-a = { path = "../A", version = "0.1.0" }

I.e. it points to the workspace root in path rather than point to the specific crate. I somehow expected it to be able to automatically find the crate-in-a in A automatically.

I’m pretty sure I’ve seen this behavior. Am I going crazy? Is/was this thing? Or is it possible in some specific context only? (via git?).

git dependencies require a repository address and will search the repository for a package (mainly, I expect, because there is no standard for addressing directories within a repository). path dependencies don’t, and must refer to exactly the package.

In both cases, it doesn’t matter whether the package to be found is in a workspace or not.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.