Skip to content

Commit 0b0c89e

Browse files
committed
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.
2 parents c78c099 + ac3301e commit 0b0c89e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/doc/trpl/hello-cargo.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ $ mv main.rs src/main.rs
3333
```
3434

3535
Note that since we're creating an executable, we used `main.rs`. If we
36-
want to make a library instead, we should use `lib.rs`.
36+
want to make a library instead, we should use `lib.rs`. This convention is required
37+
for Cargo to successfully compile our projects, but it can be overridden if we wish.
3738
Custom file locations for the entry point can be specified
3839
with a [`[[lib]]` or `[[bin]]`][crates-custom] key in the TOML file described below.
3940

@@ -62,18 +63,17 @@ version = "0.0.1"
6263
authors = [ "Your name <[email protected]>" ]
6364
```
6465

65-
This file is in the [TOML][toml] format. Let’s let it explain itself to you:
66+
This file is in the [TOML][toml] format. TOML is similar to INI, but has some
67+
extra goodies. According to the TOML docs,
6668

6769
> TOML aims to be a minimal configuration file format that's easy to read due
6870
> to obvious semantics. TOML is designed to map unambiguously to a hash table.
6971
> TOML should be easy to parse into data structures in a wide variety of
7072
> languages.
7173
72-
TOML is very similar to INI, but with some extra goodies.
73-
7474
[toml]: https://github.com/toml-lang/toml
7575

76-
Once you have this file in place, we should be ready to build! Try this:
76+
Once you have this file in place, we should be ready to build! To do so, run:
7777

7878
```bash
7979
$ cargo build
@@ -82,7 +82,7 @@ $ ./target/debug/hello_world
8282
Hello, world!
8383
```
8484

85-
Bam! We build our project with `cargo build`, and run it with
85+
Bam! We built our project with `cargo build`, and ran it with
8686
`./target/debug/hello_world`. We can do both in one step with `cargo run`:
8787

8888
```bash
@@ -103,9 +103,9 @@ Hello, world!
103103
```
104104

105105
This hasn’t bought us a whole lot over our simple use of `rustc`, but think
106-
about the future: when our project gets more complex, we would need to do more
106+
about the future: when our project gets more complex, we need to do more
107107
things to get all of the parts to properly compile. With Cargo, as our project
108-
grows, we can just `cargo build`, and it’ll work the right way.
108+
grows, we can just run `cargo build`, and it’ll work the right way.
109109

110110
When your project is finally ready for release, you can use
111111
`cargo build --release` to compile your project with optimizations.
@@ -118,7 +118,7 @@ name = "hello_world"
118118
version = "0.0.1"
119119
```
120120

121-
This file is used by Cargo to keep track of dependencies in your application.
121+
The `Cargo.lock` file is used by Cargo to keep track of dependencies in your application.
122122
Right now, we don’t have any, so it’s a bit sparse. You won't ever need
123123
to touch this file yourself, just let Cargo handle it.
124124

0 commit comments

Comments
 (0)