--locked doesn't prevent removing crates from workspace
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 15.5k
- Forks
- 3k
- Avg merge
- 23h 30m
- Merged PRs (30d)
- 51
Description
Using --locked doesn't prevent removing a crate from a workspace. I would expect cargo to fail when invoked with --locked on a removed crate, but instead it succeeds and instead doesn't modify Cargo.lock.
To reproduce
In an empty directory, create Cargo.toml with the following contents
[workspace]
members = ["foo", "bar"]
run
cargo new foo
cargo new bar
cargo build
Keep track of the current state of Cargo.lock (e.g. by checking everything into git.)
Now run
rm -rf bar
and edit Cargo.toml to
[workspace]
members = ["foo"]
run cargo build --locked
Behavior
This command will successfully build foo and will not modify Cargo.lock, i.e. Cargo.lock will still contain a reference to the bar crate. (Running cargo build leads to Cargo.lock being updated to remove references to bar, as expected.)
Expected
The expected behavior would be for the last command to fail with an error message saying Cargo.lock needs to be updated.
Version
cargo 1.44.1 (88ba85757 2020-06-11)
(on OS X)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the workspace setup with foo and bar, remove bar, edit Cargo.toml, and run cargo build --locked. Compare the behavior with an unlocked build and inspect how Cargo handles the workspace and Cargo.lock; done means the locked build fails when the lockfile still references the removed crate.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100