forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#27512 - Manishearth:rollup, r=Manishearth
- Successful merges: rust-lang#27397, rust-lang#27398, rust-lang#27460, rust-lang#27470, rust-lang#27491, rust-lang#27498, rust-lang#27502 - Failed merges:
- Loading branch information
Showing
9 changed files
with
127 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,13 +8,13 @@ so it is assumed that Rust projects will use Cargo from the beginning. | |
[cratesio]: http://doc.crates.io | ||
|
||
Cargo manages three things: building your code, downloading the dependencies | ||
your code needs, and building those dependencies. At first, your | ||
program doesn’t have any dependencies, so we’ll only be using the first part of | ||
its functionality. Eventually, we’ll add more. Since we started off by using | ||
Cargo, it'll be easy to add later. | ||
your code needs, and building those dependencies. At first, your program doesn’t | ||
have any dependencies, so we’ll only be using the first part of its | ||
functionality. Eventually, we’ll add more. Since we started off by using Cargo, | ||
it'll be easy to add later. | ||
|
||
If you installed Rust via the official installers you will also have Cargo. If | ||
you installed Rust some other way, you may want to [check the Cargo | ||
If we installed Rust via the official installers we will also have Cargo. If we | ||
installed Rust some other way, we may want to [check the Cargo | ||
README][cargoreadme] for specific instructions about installing it. | ||
|
||
[cargoreadme]: https://github.com/rust-lang/cargo#installing-cargo-from-nightlies | ||
|
@@ -23,20 +23,21 @@ README][cargoreadme] for specific instructions about installing it. | |
|
||
Let’s convert Hello World to Cargo. | ||
|
||
To Cargo-ify our project, we need to do two things: Make a `Cargo.toml` | ||
configuration file, and put our source file in the right place. Let's | ||
do that part first: | ||
To Cargo-ify our project, we need to do three things: Make a `Cargo.toml` | ||
configuration file, put our source file in the right place, and get rid of the | ||
old executable (`main.exe` on Windows, `main` everywhere else). Let's do that part first: | ||
|
||
```bash | ||
$ mkdir src | ||
$ mv main.rs src/main.rs | ||
$ rm main # or main.exe on Windows | ||
``` | ||
|
||
Note that since we're creating an executable, we used `main.rs`. If we | ||
want to make a library instead, we should use `lib.rs`. This convention is required | ||
for Cargo to successfully compile our projects, but it can be overridden if we wish. | ||
Custom file locations for the entry point can be specified | ||
with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file. | ||
Note that since we're creating an executable, we retain `main.rs` as the source | ||
filename. If we want to make a library instead, we should use `lib.rs`. This | ||
convention is used by Cargo to successfully compile our projects, but it can be | ||
overridden if we wish. Custom file locations for the entry point can be | ||
specified with a [`[lib]` or `[[bin]]`][crates-custom] key in the TOML file. | ||
|
||
[crates-custom]: http://doc.crates.io/manifest.html#configuring-a-target | ||
|
||
|
@@ -63,8 +64,8 @@ version = "0.0.1" | |
authors = [ "Your name <[email protected]>" ] | ||
``` | ||
|
||
This file is in the [TOML][toml] format. TOML is similar to INI, but has some | ||
extra goodies. According to the TOML docs, | ||
This file is in the [TOML][toml] format. TOML is similar to INI, but has some | ||
extra goodies. According to the TOML docs, | ||
|
||
> TOML aims to be a minimal configuration file format that's easy to read due | ||
> to obvious semantics. TOML is designed to map unambiguously to a hash table. | ||
|
@@ -73,7 +74,8 @@ extra goodies. According to the TOML docs, | |
[toml]: https://github.com/toml-lang/toml | ||
|
||
Once you have this file in place, we should be ready to build! To do so, run: | ||
Once we have this file in place in our project's root directory, we should be | ||
ready to build! To do so, run: | ||
|
||
```bash | ||
$ cargo build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters