]> git.proxmox.com Git - cargo.git/commitdiff
Swap out some outdated repo urls in documentation
authorDavid Tolnay <dtolnay@gmail.com>
Tue, 31 Aug 2021 20:13:35 +0000 (13:13 -0700)
committerDavid Tolnay <dtolnay@gmail.com>
Tue, 31 Aug 2021 20:33:02 +0000 (13:33 -0700)
src/cargo/util/canonical_url.rs
src/doc/src/guide/cargo-toml-vs-cargo-lock.md
src/doc/src/guide/tests.md
src/doc/src/guide/working-on-an-existing-project.md
src/doc/src/reference/specifying-dependencies.md
tests/testsuite/install.rs

index c6f30527932f1c7b6058af82a50027af608eae16..7516e0356913e31fc295996d3c88c568c5e0cfee 100644 (file)
@@ -19,7 +19,7 @@ impl CanonicalUrl {
     pub fn new(url: &Url) -> CargoResult<CanonicalUrl> {
         let mut url = url.clone();
 
-        // cannot-be-a-base-urls (e.g., `github.com:rust-lang-nursery/rustfmt.git`)
+        // cannot-be-a-base-urls (e.g., `github.com:rust-lang/rustfmt.git`)
         // are not supported.
         if url.cannot_be_a_base() {
             anyhow::bail!(
index f6100454eea863ed502456c1e71bf5a401d4366e..80e3aa8d1e5565161d45eea4829628779be8e4bd 100644 (file)
@@ -29,17 +29,17 @@ name = "hello_world"
 version = "0.1.0"
 
 [dependencies]
-rand = { git = "https://github.com/rust-lang-nursery/rand.git" }
+regex = { git = "https://github.com/rust-lang/regex.git" }
 ```
 
-This package has a single dependency, on the `rand` library. We’ve stated in
+This package has a single dependency, on the `regex` library. We’ve stated in
 this case that we’re relying on a particular Git repository that lives on
 GitHub. Since we haven’t specified any other information, Cargo assumes that
 we intend to use the latest commit on the `master` branch to build our package.
 
 Sound good? Well, there’s one problem: If you build this package today, and
 then you send a copy to me, and I build this package tomorrow, something bad
-could happen. There could be more commits to `rand` in the meantime, and my
+could happen. There could be more commits to `regex` in the meantime, and my
 build would include new commits while yours would not. Therefore, we would
 get different builds. This would be bad because we want reproducible builds.
 
@@ -47,7 +47,7 @@ We could fix this problem by putting a `rev` line in our `Cargo.toml`:
 
 ```toml
 [dependencies]
-rand = { git = "https://github.com/rust-lang-nursery/rand.git", rev = "9f35b8e" }
+regex = { git = "https://github.com/rust-lang/regex.git", rev = "9f9f693" }
 ```
 
 Now our builds will be the same. But there’s a big drawback: now we have to
@@ -64,7 +64,7 @@ name = "hello_world"
 version = "0.1.0"
 
 [dependencies]
-rand = { git = "https://github.com/rust-lang-nursery/rand.git" }
+regex = { git = "https://github.com/rust-lang/regex.git" }
 ```
 
 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
 name = "hello_world"
 version = "0.1.0"
 dependencies = [
- "rand 0.1.0 (git+https://github.com/rust-lang-nursery/rand.git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9)",
+ "regex 1.5.0 (git+https://github.com/rust-lang/regex.git#9f9f693768c584971a4d53bc3c586c33ed3a6831)",
 ]
 
 [[package]]
-name = "rand"
-version = "0.1.0"
-source = "git+https://github.com/rust-lang-nursery/rand.git#9f35b8e439eeedd60b9414c58f389bdc6a3284f9"
+name = "regex"
+version = "1.5.0"
+source = "git+https://github.com/rust-lang/regex.git#9f9f693768c584971a4d53bc3c586c33ed3a6831"
 ```
 
 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
 re-calculate the dependencies and update things for us:
 
 ```console
-$ cargo update           # updates all dependencies
-$ cargo update -p rand   # updates just “rand
+$ cargo update            # updates all dependencies
+$ cargo update -p regex   # updates just “regex
 ```
 
 This will write out a new `Cargo.lock` with the new version information. Note
 that the argument to `cargo update` is actually a
-[Package ID Specification](../reference/pkgid-spec.md) and `rand` is just a short
-specification.
+[Package ID Specification](../reference/pkgid-spec.md) and `regex` is just a
+short specification.
 
 [def-manifest]:  ../appendix/glossary.md#manifest  '"manifest" (glossary entry)'
 [def-package]:   ../appendix/glossary.md#package   '"package" (glossary entry)'
index 479efb920af14c30eed3c35762597c66e4c53714..50ee6ddb00042f10e428425ca648535c658ee9be 100644 (file)
@@ -11,7 +11,7 @@ currently has no tests:
 
 ```console
 $ cargo test
-   Compiling rand v0.1.0 (https://github.com/rust-lang-nursery/rand.git#9f35b8e)
+   Compiling regex v1.5.0 (https://github.com/rust-lang/regex.git#9f9f693)
    Compiling hello_world v0.1.0 (file:///path/to/package/hello_world)
      Running target/test/hello_world-9c2b65bbb79eabce
 
index b0ddb18a88e9f2cfa9ec04d6d485ff0c0310b12e..f9c26cd90b45dde0dda83df6dd5dfc0ddd4849ac 100644 (file)
@@ -3,19 +3,19 @@
 If you download an existing [package][def-package] that uses Cargo, it’s
 really easy to get going.
 
-First, get the package from somewhere. In this example, we’ll use `rand`
+First, get the package from somewhere. In this example, we’ll use `regex`
 cloned from its repository on GitHub:
 
 ```console
-$ git clone https://github.com/rust-lang-nursery/rand.git
-$ cd rand
+$ git clone https://github.com/rust-lang/regex.git
+$ cd regex
 ```
 
 To build, use `cargo build`:
 
 ```console
 $ cargo build
-   Compiling rand v0.1.0 (file:///path/to/package/rand)
+   Compiling regex v1.5.0 (file:///path/to/package/regex)
 ```
 
 This will fetch all of the dependencies and then build them, along with the
index ac6821363a76e67234f01e30568ce64d621c6e2f..62789a4b879e2131e4b45407389f4fe8931bf8c9 100644 (file)
@@ -128,7 +128,7 @@ you need to specify is the location of the repository with the `git` key:
 
 ```toml
 [dependencies]
-rand = { git = "https://github.com/rust-lang-nursery/rand" }
+regex = { git = "https://github.com/rust-lang/regex" }
 ```
 
 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`:
 
 ```toml
 [dependencies]
-rand = { git = "https://github.com/rust-lang-nursery/rand", branch = "next" }
+regex = { git = "https://github.com/rust-lang/regex", branch = "next" }
 ```
 
 Once a `git` dependency has been added, Cargo will lock that dependency to the
index 4e8ca4bcbd5b9998031b17bb280b87730426a00b..abdd861f8374483689af593e7c24528979d37e16 100644 (file)
@@ -1265,10 +1265,12 @@ but cannot be used multiple times
 
 #[cargo_test]
 fn test_install_git_cannot_be_a_base_url() {
-    cargo_process("install --git github.com:rust-lang-nursery/rustfmt.git")
+    cargo_process("install --git github.com:rust-lang/rustfmt.git")
         .with_status(101)
-        .with_stderr("\
-[ERROR] invalid url `github.com:rust-lang-nursery/rustfmt.git`: cannot-be-a-base-URLs are not supported")
+        .with_stderr(
+            "\
+[ERROR] invalid url `github.com:rust-lang/rustfmt.git`: cannot-be-a-base-URLs are not supported",
+        )
         .run();
 }