diff options
| author | bors <bors@rust-lang.org> | 2015-06-05 21:44:21 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2015-06-05 21:44:21 +0000 |
| commit | 0b0c89efb37d1f7f6a72bf1a82a505cd1ca8b8eb (patch) | |
| tree | a004981fa7cdee51878e3e4d882687dd53f6d152 | |
| parent | c78c0994b1df5e365058f301330d06fa035c3734 (diff) | |
| parent | ac3301ec3b71daee43a0ad5d671767d44d3280a4 (diff) | |
Auto merge of #26032 - achiwhane:master, r=steveklabnik
Added a sentence that tells the user that using main.rs and/or lib.rs is required for Cargo.
| -rw-r--r-- | src/doc/trpl/hello-cargo.md | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/doc/trpl/hello-cargo.md b/src/doc/trpl/hello-cargo.md index cc8747d1fa7..32002ebd1ec 100644 --- a/src/doc/trpl/hello-cargo.md +++ b/src/doc/trpl/hello-cargo.md @@ -33,7 +33,8 @@ $ mv main.rs src/main.rs ``` 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`. +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 described below. @@ -62,18 +63,17 @@ version = "0.0.1" authors = [ "Your name <you@example.com>" ] ``` -This file is in the [TOML][toml] format. Let’s let it explain itself to you: +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. > TOML should be easy to parse into data structures in a wide variety of > languages. -TOML is very similar to INI, but with some extra goodies. - [toml]: https://github.com/toml-lang/toml -Once you have this file in place, we should be ready to build! Try this: +Once you have this file in place, we should be ready to build! To do so, run: ```bash $ cargo build @@ -82,7 +82,7 @@ $ ./target/debug/hello_world Hello, world! ``` -Bam! We build our project with `cargo build`, and run it with +Bam! We built our project with `cargo build`, and ran it with `./target/debug/hello_world`. We can do both in one step with `cargo run`: ```bash @@ -103,9 +103,9 @@ Hello, world! ``` This hasn’t bought us a whole lot over our simple use of `rustc`, but think -about the future: when our project gets more complex, we would need to do more +about the future: when our project gets more complex, we need to do more things to get all of the parts to properly compile. With Cargo, as our project -grows, we can just `cargo build`, and it’ll work the right way. +grows, we can just run `cargo build`, and it’ll work the right way. When your project is finally ready for release, you can use `cargo build --release` to compile your project with optimizations. @@ -118,7 +118,7 @@ name = "hello_world" version = "0.0.1" ``` -This file is used by Cargo to keep track of dependencies in your application. +The `Cargo.lock` file is used by Cargo to keep track of dependencies in your application. Right now, we don’t have any, so it’s a bit sparse. You won't ever need to touch this file yourself, just let Cargo handle it. |
