]> git.proxmox.com Git - rustc.git/blame - src/doc/edition-guide/src/rust-2018/cargo-and-crates-io/cargo-new-defaults-to-a-binary-project.md
New upstream version 1.53.0+dfsg1
[rustc.git] / src / doc / edition-guide / src / rust-2018 / cargo-and-crates-io / cargo-new-defaults-to-a-binary-project.md
CommitLineData
450edc1f
XL
1# `cargo new` defaults to a binary project
2
3![Minimum Rust version: 1.25](https://img.shields.io/badge/Minimum%20Rust%20Version-1.25-brightgreen.svg)
4
5`cargo new` will now default to generating a binary, rather than a library.
6We try to keep Cargo’s CLI quite stable, but this change is important, and is
7unlikely to cause breakage.
8
dc9dc135 9For some background, `cargo new` accepts two flags: `--lib`, for creating
450edc1f
XL
10libraries, and `--bin`, for creating binaries, or executables. If you don’t
11pass one of these flags, it used to default to `--lib`. At the time, we made
12this decision because each binary (often) depends on many libraries, and so
13we thought the library case would be more common. However, this is incorrect;
14each library is depended upon by many binaries. Furthermore, when getting
15started, what you often want is a program you can run and play around with.
16It’s not just new Rustaceans though; even very long-time community members
17have said that they find this default surprising. As such, we’ve changed it,
18and it now defaults to `--bin`.