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

Incorrect flag in --locked --offline error message #10504

Closed
QSchulz opened this issue Mar 24, 2022 · 1 comment · Fixed by #10512
Closed

Incorrect flag in --locked --offline error message #10504

QSchulz opened this issue Mar 24, 2022 · 1 comment · Fixed by #10512
Assignees
Labels
C-bug Category: bug

Comments

@QSchulz
Copy link

QSchulz commented Mar 24, 2022

Problem

Trying to build a crate with:

cargo build --locked --offline

when no Cargo.lock file is provided in the crate source repository leads to the following error message:

error: the lock file /path/to/Cargo.lock needs to be updated but --frozen was passed to prevent this
If you want to try to generate the lock file without accessing the network, remove the --frozen flag and use --offline instead.

It should mention --locked and not --frozen.

Steps

No response

Possible Solution(s)

https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/lockfile.rs#L50-L54

        let flag = if ws.config().network_allowed() {
            "--locked"
        } else {
            "--frozen"
        };

could actually be:

        let flag = if ws.config().locked() {
            "--locked"
        } else {
            "--frozen"
        };

Notes

(Never done rust and didn't compile the suggestion)

The absence of Cargo.lock file shouldn't matter to reproduce the bug but it's an easy way to reproduce it.

Version

No response

@QSchulz QSchulz added the C-bug Category: bug label Mar 24, 2022
@Rustin170506
Copy link
Member

I can reproduce it.
@rustbot claim

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

Successfully merging a pull request may close this issue.

2 participants