-
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
cargo clean and cargo build fails to handle renamed sub-crate in a workspace #9319
Comments
Hm, sorry you're running into that problem. I'm unable to reproduce with the steps given, though. I tried: mkdir ws9319
cd ws9319
cargo new app
cargo new --lib foo
cat <<EOF > Cargo.toml
[workspace]
members = [
"app",
"foo"
]
EOF
cargo build
mv foo bar
sed -i -e 's/foo/bar/g' Cargo.toml
sed -i -e 's/foo/bar/g' bar/Cargo.toml
cargo build The last step successfully built Do you maybe have a The error message definitely could be better here. |
Thank you for your quick response. Could you please try to add the following and see if the error happens? i.e. use
Thanks! |
Yea, if there is a dependency It would be good if the error message pointed to where that dependency is defined. |
you are right, my bad, I missed that. Will close this. Thanks! |
If you don't mind, I'm going to reopen this to track improving the error message. |
Of course I don't mind. That will be great to improve the error message. Thanks! |
Problem
In a workspace, after doing
git mv foo bar
to rename a sub-crate,cargo build
andcargo clean
fails to find renamed sub-crate.what currently happens:
what you expected to happen:
cargo build
, especiallycargo clean
can findfoo
was renamed tobar
, and continue to work.Steps
app
andfoo
. The rootCargo.toml
looks like:app
is an application (executable), whilefoo
is a library. The structure looks like this:foo
, itsCargo.toml
looks like this:build the project using
cargo build
. It should succeed.rename
foo
tobar
:git mv foo bar
.modify root
Cargo.toml
to replacefoo
withbar
.modify sub-crate
Cargo.toml
underbar/
, to replacefoo
withbar
.Now run
cargo build
again, orcargo clean
. Will see the errors.Possible Solution(s)
Not a real fix: remove the project and use git to re-pull the project.
Notes
Tried to remove
target/
and removeCargo.lock
, did not fix the issue.Output of
cargo version
:cargo 1.51.0 (43b129a 2021-03-16)
The text was updated successfully, but these errors were encountered: