Skip to content

Commit 74d7f07

Browse files
committed
Auto merge of #9862 - dtolnay-contrib:repos, r=ehuss
Swap out some outdated repo urls in documentation I noticed that `rand` and `rustfmt` are no longer located in rust-lang-nursery. Rather than updating `rand` to github.com/rust-random/rand, I've swapped it out for `regex` in this PR. Some considerations: - Preference for github.com/rust-lang over github.com/rust-random to reduce the perception of unnecessarily endorsing a project that isn't already endorsed by being in Cargo's org. - Ruled out `libc` because make-your-own-libcpocalypse is not a fun detour for anyone following along and experimenting with git dependencies. - Ruled out everything with a -rs suffix (`git2-rs`, `flate2-rs`, `backtrace-rs`, `futures-rs`) out of personal distaste. - Went for something that has comparable name recognition to rand, i.e. ruled out `hashbrown`. We could alternatively use dummy URLs like github.com/user/example everywhere but I feel that maintaining this every several years is not a big deal and is worth it for the character of the documentation.
2 parents c227565 + 05f6604 commit 74d7f07

File tree

6 files changed

+26
-24
lines changed

6 files changed

+26
-24
lines changed

src/cargo/util/canonical_url.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl CanonicalUrl {
1919
pub fn new(url: &Url) -> CargoResult<CanonicalUrl> {
2020
let mut url = url.clone();
2121

22-
// cannot-be-a-base-urls (e.g., `github.com:rust-lang-nursery/rustfmt.git`)
22+
// cannot-be-a-base-urls (e.g., `github.com:rust-lang/rustfmt.git`)
2323
// are not supported.
2424
if url.cannot_be_a_base() {
2525
anyhow::bail!(

src/doc/src/guide/cargo-toml-vs-cargo-lock.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@ name = "hello_world"
2929
version = "0.1.0"
3030

3131
[dependencies]
32-
rand = { git = "https://github.com/rust-lang-nursery/rand.git" }
32+
regex = { git = "https://github.com/rust-lang/regex.git" }
3333
```
3434

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
3636
this case that we’re relying on a particular Git repository that lives on
3737
GitHub. Since we haven’t specified any other information, Cargo assumes that
3838
we intend to use the latest commit on the `master` branch to build our package.
3939

4040
Sound good? Well, there’s one problem: If you build this package today, and
4141
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
4343
build would include new commits while yours would not. Therefore, we would
4444
get different builds. This would be bad because we want reproducible builds.
4545

4646
We could fix this problem by putting a `rev` line in our `Cargo.toml`:
4747

4848
```toml
4949
[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" }
5151
```
5252

5353
Now our builds will be the same. But there’s a big drawback: now we have to
@@ -64,7 +64,7 @@ name = "hello_world"
6464
version = "0.1.0"
6565

6666
[dependencies]
67-
rand = { git = "https://github.com/rust-lang-nursery/rand.git" }
67+
regex = { git = "https://github.com/rust-lang/regex.git" }
6868
```
6969

7070
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
7575
name = "hello_world"
7676
version = "0.1.0"
7777
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)",
7979
]
8080

8181
[[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"
8585
```
8686

8787
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
9393
re-calculate the dependencies and update things for us:
9494

9595
```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
9898
```
9999

100100
This will write out a new `Cargo.lock` with the new version information. Note
101101
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.
104104

105105
[def-manifest]: ../appendix/glossary.md#manifest '"manifest" (glossary entry)'
106106
[def-package]: ../appendix/glossary.md#package '"package" (glossary entry)'

src/doc/src/guide/tests.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ currently has no tests:
1111

1212
```console
1313
$ cargo test
14-
Compiling rand v0.1.0 (https://github.com/rust-lang-nursery/rand.git#9f35b8e)
14+
Compiling regex v1.5.0 (https://github.com/rust-lang/regex.git#9f9f693)
1515
Compiling hello_world v0.1.0 (file:///path/to/package/hello_world)
1616
Running target/test/hello_world-9c2b65bbb79eabce
1717

src/doc/src/guide/working-on-an-existing-project.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
If you download an existing [package][def-package] that uses Cargo, it’s
44
really easy to get going.
55

6-
First, get the package from somewhere. In this example, we’ll use `rand`
6+
First, get the package from somewhere. In this example, we’ll use `regex`
77
cloned from its repository on GitHub:
88

99
```console
10-
$ git clone https://github.com/rust-lang-nursery/rand.git
11-
$ cd rand
10+
$ git clone https://github.com/rust-lang/regex.git
11+
$ cd regex
1212
```
1313

1414
To build, use `cargo build`:
1515

1616
```console
1717
$ cargo build
18-
Compiling rand v0.1.0 (file:///path/to/package/rand)
18+
Compiling regex v1.5.0 (file:///path/to/package/regex)
1919
```
2020

2121
This will fetch all of the dependencies and then build them, along with the

src/doc/src/reference/specifying-dependencies.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ you need to specify is the location of the repository with the `git` key:
128128

129129
```toml
130130
[dependencies]
131-
rand = { git = "https://github.com/rust-lang-nursery/rand" }
131+
regex = { git = "https://github.com/rust-lang/regex" }
132132
```
133133

134134
Cargo will fetch the `git` repository at this location then look for a
@@ -144,7 +144,7 @@ the latest commit on a branch named `next`:
144144

145145
```toml
146146
[dependencies]
147-
rand = { git = "https://github.com/rust-lang-nursery/rand", branch = "next" }
147+
regex = { git = "https://github.com/rust-lang/regex", branch = "next" }
148148
```
149149

150150
Once a `git` dependency has been added, Cargo will lock that dependency to the

tests/testsuite/install.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,10 +1265,12 @@ but cannot be used multiple times
12651265

12661266
#[cargo_test]
12671267
fn test_install_git_cannot_be_a_base_url() {
1268-
cargo_process("install --git github.com:rust-lang-nursery/rustfmt.git")
1268+
cargo_process("install --git github.com:rust-lang/rustfmt.git")
12691269
.with_status(101)
1270-
.with_stderr("\
1271-
[ERROR] invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported")
1270+
.with_stderr(
1271+
"\
1272+
[ERROR] invalid url `github.com:rust-lang/rustfmt.git`: cannot-be-a-base-URLs are not supported",
1273+
)
12721274
.run();
12731275
}
12741276

0 commit comments

Comments
 (0)