@@ -29,25 +29,25 @@ name = "hello_world"
29
29
version = " 0.1.0"
30
30
31
31
[dependencies ]
32
- rand = { git = " https://github.com/rust-lang-nursery/rand .git" }
32
+ regex = { git = " https://github.com/rust-lang/regex .git" }
33
33
```
34
34
35
- This package has a single dependency, on the ` rand ` library. We’ve stated in
35
+ This package has a single dependency, on the ` regex ` library. We’ve stated in
36
36
this case that we’re relying on a particular Git repository that lives on
37
37
GitHub. Since we haven’t specified any other information, Cargo assumes that
38
38
we intend to use the latest commit on the ` master ` branch to build our package.
39
39
40
40
Sound good? Well, there’s one problem: If you build this package today, and
41
41
then you send a copy to me, and I build this package tomorrow, something bad
42
- could happen. There could be more commits to ` rand ` in the meantime, and my
42
+ could happen. There could be more commits to ` regex ` in the meantime, and my
43
43
build would include new commits while yours would not. Therefore, we would
44
44
get different builds. This would be bad because we want reproducible builds.
45
45
46
46
We could fix this problem by putting a ` rev ` line in our ` Cargo.toml ` :
47
47
48
48
``` toml
49
49
[dependencies ]
50
- rand = { git = " https://github.com/rust-lang-nursery/rand .git" , rev = " 9f35b8e " }
50
+ regex = { git = " https://github.com/rust-lang/regex .git" , rev = " 9f9f693 " }
51
51
```
52
52
53
53
Now our builds will be the same. But there’s a big drawback: now we have to
@@ -64,7 +64,7 @@ name = "hello_world"
64
64
version = " 0.1.0"
65
65
66
66
[dependencies ]
67
- rand = { git = " https://github.com/rust-lang-nursery/rand .git" }
67
+ regex = { git = " https://github.com/rust-lang/regex .git" }
68
68
```
69
69
70
70
Cargo will take the latest commit and write that information out into our
@@ -75,13 +75,13 @@ Cargo will take the latest commit and write that information out into our
75
75
name = " hello_world"
76
76
version = " 0.1.0"
77
77
dependencies = [
78
- " rand 0.1. 0 (git+https://github.com/rust-lang-nursery/rand .git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9 )" ,
78
+ " regex 1.5. 0 (git+https://github.com/rust-lang/regex .git#9f9f693768c584971a4d53bc3c586c33ed3a6831 )" ,
79
79
]
80
80
81
81
[[package ]]
82
- name = " rand "
83
- version = " 0.1 .0"
84
- source = " git+https://github.com/rust-lang-nursery/rand .git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9 "
82
+ name = " regex "
83
+ version = " 1.5 .0"
84
+ source = " git+https://github.com/rust-lang/regex .git#9f9f693768c584971a4d53bc3c586c33ed3a6831 "
85
85
```
86
86
87
87
You can see that there’s a lot more information here, including the exact
@@ -93,14 +93,14 @@ When we’re ready to opt in to a new version of the library, Cargo can
93
93
re-calculate the dependencies and update things for us:
94
94
95
95
``` console
96
- $ cargo update # updates all dependencies
97
- $ cargo update -p rand # updates just “rand ”
96
+ $ cargo update # updates all dependencies
97
+ $ cargo update -p regex # updates just “regex ”
98
98
```
99
99
100
100
This will write out a new ` Cargo.lock ` with the new version information. Note
101
101
that the argument to ` cargo update ` is actually a
102
- [ Package ID Specification] ( ../reference/pkgid-spec.md ) and ` rand ` is just a short
103
- specification.
102
+ [ Package ID Specification] ( ../reference/pkgid-spec.md ) and ` regex ` is just a
103
+ short specification.
104
104
105
105
[ def-manifest ] : ../appendix/glossary.md#manifest ' "manifest" (glossary entry) '
106
106
[ def-package ] : ../appendix/glossary.md#package ' "package" (glossary entry) '
0 commit comments