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

Cargo install documentation should no longer mention default location #13200

Closed
manfredbrandl opened this issue Dec 23, 2023 · 4 comments · Fixed by #13205
Closed

Cargo install documentation should no longer mention default location #13200

manfredbrandl opened this issue Dec 23, 2023 · 4 comments · Fixed by #13205
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@manfredbrandl
Copy link

manfredbrandl commented Dec 23, 2023

Problem

cargo install without --path is no longer supported. cargo --list explains cargo install as "Install a Rust binary. Default location is $HOME/.cargo/bin". Please replace "Default location ... " with "Requires --path".

Steps

cargo --list ; cargo install

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.74.1 (ecb9851 2023-10-18)

@manfredbrandl manfredbrandl added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Dec 23, 2023
@ehuss
Copy link
Contributor

ehuss commented Dec 23, 2023

Thanks for the report! I believe there may be a misunderstanding of what it means by "default location". That is the default location where the binaries will be installed into. That can be overridden with --root. The --path option is to set where cargo installs from.

Would it be clearer if the text instead said this?

Install a Rust binary. Default installs into $HOME/.cargo/bin

FWIW, I'm on the fence as to whether or not it is appropriate to even include that text at all. It was added in #6354 due to some confusion, but I wouldn't expect this tiny bit of text be the appropriate way to learn what the command does.

@weihanglo
Copy link
Member

Instead, I think we might want to revert #6354. People wanting to learn more than the one-line explanation from cargo --list should run cargo install --help or even cargo help install.

@manfredbrandl
Copy link
Author

manfredbrandl commented Dec 25, 2023

cargo install tells me:
error: Using cargo install to install the binaries for the package in current working directory is no longer supported, use cargo install --path . instead. Use cargo build if you want to simply build the package.
So there is no default location to install into any more.

cargo install —help tells me:

Usage: cargo install [OPTIONS] [crate]...

But there is no install without —path.

cargo help install tells me:

The installation root is determined, in order of precedence:

• $HOME/.cargo

But there is no install, not into existing $HOME/.cargo

Did I miss anything or does the documentation describe behavior cargo does not deliver?

@weihanglo
Copy link
Member

From cargo help install:

…all executables are installed into the installation root’s bin folder

and

There are multiple sources from which a crate can be installed. The default location is crates.io but the --git, --path, and --registry flags can change this source.

Should be fairly clear I guess.

-path option in cargo install defines the "source" your binary would be installed "from". --path has nothing to do with the default installation root a.k.a. the installation destination.

FWIW, I just posted a PR to clarify it a bit #13205.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants