Skip to content

Commit 888086d

Browse files
committed
Undid changes involving misunderstanding of 0.3.x
Didn't realise 0.3.0 referred to all 0.3.x versions! Fixed my mistakes. Should have just updated the Cargo.toml now.
1 parent 0bc6fe5 commit 888086d

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

src/doc/trpl/guessing-game.md

+11-10
Original file line numberDiff line numberDiff line change
@@ -371,13 +371,15 @@ Now, without changing any of our code, let’s build our project:
371371
```bash
372372
$ cargo build
373373
Updating registry `https://github.com/rust-lang/crates.io-index`
374-
Downloading rand v0.3.0
374+
Downloading rand v0.3.8
375375
Downloading libc v0.1.6
376376
Compiling libc v0.1.6
377-
Compiling rand v0.3.0
377+
Compiling rand v0.3.8
378378
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
379379
```
380380

381+
(You may see different versions, of course.)
382+
381383
Lots of new output! Now that we have an external dependency, Cargo fetches the
382384
latest versions of everything from the registry, which is a copy of data from
383385
[Crates.io][cratesio]. Crates.io is where people in the Rust ecosystem
@@ -407,19 +409,19 @@ $ cargo build
407409
Compiling guessing_game v0.1.0 (file:///home/you/projects/guessing_game)
408410
```
409411

410-
Let's pretend that we told Cargo we wanted the latest version of `rand` (using `*`)
411-
for a bit. It would have fetched `v0.3.8` (at the time this was written).
412-
But what happens when next week, version `v0.3.9` comes out, with an important
413-
bugfix? While getting bugfixes is important, what if `0.3.9` contains a regression
414-
that breaks our code?
412+
So, we told Cargo we wanted any `0.3.x` version of `rand`, and so it fetched the latest
413+
version at the time this was written, `v0.3.8`. But what happens when next
414+
week, version `v0.3.9` comes out, with an important bugfix? While getting
415+
bugfixes is important, what if `0.3.9` contains a regression that breaks our
416+
code?
415417

416418
The answer to this problem is the `Cargo.lock` file you’ll now find in your
417419
project directory. When you build your project for the first time, Cargo
418420
figures out all of the versions that fit your criteria, and then writes them
419421
to the `Cargo.lock` file. When you build your project in the future, Cargo
420422
will see that the `Cargo.lock` file exists, and then use that specific version
421423
rather than do all the work of figuring out versions again. This lets you
422-
have a repeatable build automatically. In other words, we’ll stay at `0.3.0`
424+
have a repeatable build automatically. In other words, we’ll stay at `0.3.8`
423425
until we explicitly upgrade, and so will anyone who we share our code with,
424426
thanks to the lock file.
425427

@@ -439,8 +441,7 @@ projects which are assembled out of a number of sub-packages.
439441
[doccargo]: http://doc.crates.io
440442
[doccratesio]: http://doc.crates.io/crates-io.html
441443

442-
Let’s get on to actually _using_ `rand`. Keep the version as `0.3.0` for this
443-
project. Here’s our next step:
444+
Let’s get on to actually _using_ `rand`. Here’s our next step:
444445

445446
```rust,ignore
446447
extern crate rand;

0 commit comments

Comments
 (0)