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

New defaults to bin #5029

Merged
merged 3 commits into from Feb 13, 2018

Conversation

Projects
None yet
6 participants
@matklad
Copy link
Member

matklad commented Feb 12, 2018

So this switches cargo new default from --lib to --bin, as discussed on IRC.

The first two commits are just refactorings, and the last one actually flips the switch. Surprisingly enough, no tests need to be modified it seems!

r? @withoutboats

@ehuss

This comment has been minimized.

Copy link
Contributor

ehuss commented Feb 12, 2018

Will updating the Cargo book be done separately? It's not clear to me how that is published.

@matklad matklad force-pushed the matklad:new-defaults-to-bin branch from 4137497 to da8012c Feb 12, 2018

@matklad

This comment has been minimized.

Copy link
Member

matklad commented Feb 12, 2018

An excellent comment @ehuss!

I've updated the docs to mention both --bin and --lib. I think it's better to pass an explicit argument in the docs at least for some time, because there may be older Cargos in packages managers and such.

I am almost sure that this is not the only one place in the docs which needs to be updated though :(

Let's cc @steveklabnik just in case :)

@@ -7,7 +7,7 @@ $ cargo new hello_world --bin
```

We’re passing `--bin` because we’re making a binary program: if we
were making a library, we’d leave it off.
were making a library, we’d pass `--lib`.

This comment has been minimized.

@ehuss

ehuss Feb 12, 2018

Contributor

I think src/doc/src/guide/creating-a-new-project.md also needs to be updated, since it talks about --bin in more detail.

@matklad matklad force-pushed the matklad:new-defaults-to-bin branch from da8012c to 9cb10e6 Feb 12, 2018

@withoutboats

This comment has been minimized.

Copy link
Contributor

withoutboats commented Feb 13, 2018

cc @rust-lang/cargo

Big +1 on this change, I'd like to get it in the same beta as the other change to cargo new, but I know we cut a beta soon so maybe the other change should be held back.

We should be very proactive about announcing this change. Not only do our docs need to change, we also need to inform other people who may be teaching Rust of the change to the default behavior, since they'll likely be walking people through this as a first step.

@withoutboats withoutboats self-requested a review Feb 13, 2018

@withoutboats

This comment has been minimized.

Copy link
Contributor

withoutboats commented Feb 13, 2018

@bors r+

2:50 AM <matklad> 6 weeks seem plenty to me for this change: it seems *much*
less troublesome than the recent CWD change, for example
2:50 AM <matklad> and reverting that `rust-` change to make sure it goes in the
same release as `new --bin` seems like a hassle :)  
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

📌 Commit 9cb10e6 has been approved by withoutboats

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

⌛️ Testing commit 9cb10e6 with merge 1780cdf...

bors added a commit that referenced this pull request Feb 13, 2018

Auto merge of #5029 - matklad:new-defaults-to-bin, r=withoutboats
New defaults to bin

So this switches `cargo new` default from `--lib` to `--bin`, as discussed on IRC.

The first two commits are just refactorings, and the last one actually flips the switch. Surprisingly enough, no tests need to be modified it seems!

r? @withoutboats
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

💡 This pull request was already approved, no need to approve it again.

  • This pull request is currently being tested. If there's no response from the continuous integration service, you may use retry to trigger a build again.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

📌 Commit 9cb10e6 has been approved by withoutboats

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

⌛️ Testing commit 9cb10e6 with merge 7320c30...

bors added a commit that referenced this pull request Feb 13, 2018

Auto merge of #5029 - matklad:new-defaults-to-bin, r=withoutboats
New defaults to bin

So this switches `cargo new` default from `--lib` to `--bin`, as discussed on IRC.

The first two commits are just refactorings, and the last one actually flips the switch. Surprisingly enough, no tests need to be modified it seems!

r? @withoutboats
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

💡 This pull request was already approved, no need to approve it again.

  • This pull request is currently being tested. If there's no response from the continuous integration service, you may use retry to trigger a build again.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

📌 Commit 9cb10e6 has been approved by withoutboats

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

⌛️ Testing commit 9cb10e6 with merge 5891aec...

bors added a commit that referenced this pull request Feb 13, 2018

Auto merge of #5029 - matklad:new-defaults-to-bin, r=withoutboats
New defaults to bin

So this switches `cargo new` default from `--lib` to `--bin`, as discussed on IRC.

The first two commits are just refactorings, and the last one actually flips the switch. Surprisingly enough, no tests need to be modified it seems!

r? @withoutboats
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Feb 13, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: withoutboats
Pushing 5891aec to master...

@bors bors merged commit 9cb10e6 into rust-lang:master Feb 13, 2018

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@matklad matklad deleted the matklad:new-defaults-to-bin branch Feb 13, 2018

@pwoolcoc

This comment has been minimized.

Copy link
Contributor

pwoolcoc commented Feb 21, 2018

@matklad got here from TWIR, I was wondering if the reasoning was recorded anywhere other than IRC? I'm just curious what the reasoning was.

@matklad

This comment has been minimized.

Copy link
Member

matklad commented Feb 21, 2018

@pwoolcoc sure, #5013 (comment) I believe is the most recent discussion (it includes the link to urlo post as well).

The TL;DR is

  • new users want --bin for hello world.
  • some old users (for example @matklad) create a dozen of crates per day just for experimentation, and for experiments --bin makes more sense.
@pwoolcoc

This comment has been minimized.

Copy link
Contributor

pwoolcoc commented Feb 22, 2018

@matklad thanks!

@ramn

This comment has been minimized.

Copy link

ramn commented Feb 25, 2018

What do you think about allowing cargo bin and cargo lib? Silly proof of concept: https://crates.io/crates/cargo-bin-lib

You know what you will get and with less typing to boot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment