Description
openedon Jul 16, 2022
Problem
I have a project with nested, non-workspace cargo projects. It's a niche but real use case.
I found that if the parent project has a broken manifest, the child project cannot be built, even if its manifest is completely valid. Here's an example project, the child is in testbins/does-build.
does-build • cargo build
error: failed to parse manifest at `/home/jason/Code/test-binary/Cargo.toml`
Caused by:
can't find `test_it_builds` bin at `src/bin/test_it_builds.rs` or `src/bin/test_it_builds/main.rs`. Please specify bin.path if you want to use a non-default path.
Note that the error is in the parent project. The child project is fine. It's the same if I use --manifest-path ./Cargo.toml.
Steps
- Clone linked project.
- Change directory to
testbins/does-build. cargo build --manifest-path ./Cargo.toml.
Possible Solution(s)
It all works, and crucially, builds the child project but not the parent, if the parent manifest is fixed.
Notes
Seems related: #7871
The docs say:
Path to the Cargo.toml file. By default, Cargo searches for the Cargo.toml file in the current directory or any parent directory.
I would expect that by default it stops when it finds one, but that's not explicitly stated. However, the behaviour with --manifest-path seems very unexpected.
Version
cargo 1.62.0 (a748cf5a3 2022-06-08)`
Activity