-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Panic when running cargo update
in a [workspace]
only crate with 2 package crate in it's dir
#3080
Comments
Minimal reproduction:
Probably should complain about |
I believe that the unwrap is this line, and yeah I think Cargo just needs to yield an error here instead saying you can't generate a lock file for an empty workspace. |
Should be an easy bug to tackle though! |
@alexcrichton I can have a look at this if nobody else is doing it. |
@jhbabon all yours! Let me know if you need any pointers. |
@alexcrichton I was thinking, maybe it is cargo/src/cargo/core/workspace.rs Line 320 in b931a0f
|
Hm yeah, that actually sounds like a much better place to put it! |
@alexcrichton so I've been investigating a bit more, and I think this error happens with commands like If this is the case, maybe we can validate that the workspace it's not virtual during the execution of the
|
I came up with this solution, but I don't know if it's the best option: #3092 |
…chton FIX: Don't try to generate Gargo.lock on empty workspaces. There was a `panic!` when the command `cargo update` was executed in a workspace like this: mkdir ws cd ws echo '[workspace]' > Cargo.toml cargo new p1 cargo new p2 cargo update The problem is that cargo tries to generate the `Cargo.lock` file even if there aren't any members on the workspace. This fix checks the existence of members in the workspace before trying to do anything so at least we report an error instead of throwing a `panic!`. Issue related #3080
Should we consider to close this after this merge #3092 ? |
Indeed, thanks @jhbabon! |
src: https://github.com/jmesmon/ioctl/tree/workspace-cargo-bug
The text was updated successfully, but these errors were encountered: