Skip to content
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

Updating error with Cargo.lock #311

Closed
alexchandel opened this issue Aug 3, 2014 · 6 comments
Closed

Updating error with Cargo.lock #311

alexchandel opened this issue Aug 3, 2014 · 6 comments

Comments

@alexchandel
Copy link

If I had cargo had built repos before Cargo.lock was introduced, then it fails to update them.

$ cargo build -u
The -u flag has been deprecated, please use the `cargo update` command instead
$ cargo update
A Cargo.lock must exist before it is updated

And of course cargo build fails because the packages are outdated.

This is fixed by deleting ~/.cargo. To say nothing about the inappropriate location of this folder, which should be ~/.cache/cargo, as #148 recommends.

PistonDevelopers/hematite#54 and PistonDevelopers/sdl2_window#23 are related.

@steveklabnik
Copy link
Member

I wonder if running cargo generate-lockfile and then cargo update would work too.

@alexchandel
Copy link
Author

I still wonder why rm -rf ~/.cargo worked.

@steveklabnik
Copy link
Member

Killing it worked because then, the repo would have been re-downloaded, and therefore, been at HEAD. Basically, cargo did not check that your local HEAD was equal to origin/master's HEAD.

@alexcrichton
Copy link
Member

Closing, it sounds like this is working as intended. You should not be able to generate a lockfile from a build that does not work through cargo-build as the lockfile represents a state of the build that does work.

As @steveklabnik mentioned, you can force generation of a lockfile through cargo generate-lockfile but it is not necessarily recommended.

@alexchandel
Copy link
Author

Perhaps this should be documented somewhere, say on crates.io?

@alexcrichton
Copy link
Member

Sadly the website documentation lags a little behind master, but we're slated to update the documentation soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants