Skip to content

Commit 316de5f

Browse files
committed
---
yaml --- r: 216737 b: refs/heads/stable c: 888086d h: refs/heads/master i: 216735: 833c48f v: v3
1 parent 2b1a989 commit 316de5f

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ refs/heads/tmp: 378a370ff2057afeb1eae86eb6e78c476866a4a6
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: a5286998df566e736b32f6795bfc3803bdaf453d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 0bc6fe5ea0b4e4fcbc98145855a1c416d08dfab0
32+
refs/heads/stable: 888086d959e7d1b840b0d7644e4e49b6941ecf73
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375

branches/stable/src/doc/trpl/guessing-game.md

Lines changed: 11 additions & 10 deletions
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)