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

[[bin]] stanza of Cargo.toml not documented well #6913

Closed
jweinst1 opened this issue May 6, 2019 · 2 comments · Fixed by #7733
Closed

[[bin]] stanza of Cargo.toml not documented well #6913

jweinst1 opened this issue May 6, 2019 · 2 comments · Fixed by #7733
Labels
A-documenting-cargo-itself Area: Cargo's documentation

Comments

@jweinst1
Copy link

jweinst1 commented May 6, 2019

Problem

In various crates on github, i have seen that the [[bin]] stanza in Cargo.toml can be used to specify executables that will be installed upon installing the crate, such as

[[bin]]
bench = false
path = "src/main.rs"
name = "rg"

Except, that stanza is not documented well on https://doc.rust-lang.org/cargo/reference/manifest.html it mentions it as specifying an executable, but not anything about where that executable is installed, or that it's even put on the PATH. I think this would be an important knowledge point because it's relevant to how executables can be used after installing a crate, instead of doing cargo build and cargo run.

Steps

  1. Go to https://doc.rust-lang.org/cargo/reference/manifest.html

Possible Solution(s)

Document the following

  1. More info on how executables are installed, should be similar in explanation to make install from cmake.
  2. What the [bin] stanza means and how it relates to executables getting put on the PATH.

Notes

Output of cargo version: Not applicable , docs related

@jweinst1 jweinst1 added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label May 6, 2019
@ehuss
Copy link
Contributor

ehuss commented May 6, 2019

Seems reasonable to have a short note to indicate that [[bin]] and [[example]] targets can be used with cargo install.

Just FYI, the documentation for installation is on the cargo install page, which explains where binaries are installed.

I have a long-term goal to split up the manifest.md page into separate pages since it is somewhat disorganized. One of those pages would be "Cargo Targets" which would have detailed information about the different target kinds, and might do well to include this.

@ehuss ehuss added A-documenting-cargo-itself Area: Cargo's documentation and removed C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` labels May 6, 2019
@jweinst1
Copy link
Author

jweinst1 commented May 6, 2019

I see, makes sense.

Basically I am approaching this from a stand point of "I want to make a cli program people can use from their terminal, how can I do this so it's installed correctly?"

Once I found out that if the [bin] is specified they can just install the crate and be ready to go that was a huge buy in for me to choose rust for some of my side projects over C++, as with C++ you need to have cmake, xcode cli tools (if on mac), run several commands, make sure the cmake install prefix is correct, etc. etc.

ehuss added a commit to ehuss/cargo that referenced this issue Dec 21, 2019
bors added a commit that referenced this issue Dec 22, 2019
Various doc updates

This is a collection of documentation updates that have been in my todo list for a while. Each change is in a separate commit.

The "features" chapter will probably get significant changes in the future, as it is pretty bare right now. Similarly the "workspace" chapter could probably use more examples.

Closes #3062
Closes #3817
Closes #3971
Closes #4212
Closes #4438
Closes #4756
Closes #5822
Closes #6913
Closes #7055
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-documenting-cargo-itself Area: Cargo's documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants