From 31705facd36bc810225c0ab51d3c0f579052cddd Mon Sep 17 00:00:00 2001 From: priks Date: Wed, 15 Mar 2023 15:54:20 +0530 Subject: [PATCH 001/229] Bumped retry --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- src/utils/utils.rs | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d6557a823e..88a2d40275 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2129,9 +2129,9 @@ dependencies = [ [[package]] name = "retry" -version = "1.3.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac95c60a949a63fd2822f4964939662d8f2c16c4fa0624fd954bc6e703b9a3f6" +checksum = "9166d72162de3575f950507683fac47e30f6f2c3836b71b7fbc61aa517c9c5f4" dependencies = [ "rand 0.8.5", ] diff --git a/Cargo.toml b/Cargo.toml index 30f41e120b..9d0382ecaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -73,7 +73,7 @@ trycmd = "0.14.13" [dependencies.retry] default-features = false features = ["random"] -version = "1.3.1" +version = "2.0.0" [dependencies.rs_tracing] features = ["rs_tracing"] diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 694b53351e..742d3c7fa0 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -409,9 +409,7 @@ pub fn remove_file(name: &'static str, path: &Path) -> Result<()> { pub(crate) fn ensure_file_removed(name: &'static str, path: &Path) -> Result<()> { let result = remove_file(name, path); if let Err(err) = &result { - if let Some(retry::Error::Operation { error: e, .. }) = - err.downcast_ref::>() - { + if let Some(retry::Error { error: e, .. }) = err.downcast_ref::>() { if e.kind() == io::ErrorKind::NotFound { return Ok(()); } From 8fa95662b8e061b83b883d64d3bf3d4d8bc5dfa2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 21 Mar 2023 20:31:06 +0000 Subject: [PATCH 002/229] Update Rust crate enum-map to 2.5.0 --- Cargo.lock | 4 ++-- Cargo.toml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c46658670..a208ed83cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -484,9 +484,9 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c25992259941eb7e57b936157961b217a4fc8597829ddef0596d6c3cd86e1a" +checksum = "988f0d17a0fa38291e5f41f71ea8d46a5d5497b9054d5a759fae2cbb819f2356" dependencies = [ "enum-map-derive", ] diff --git a/Cargo.toml b/Cargo.toml index 4d985a0ab9..73f989e7d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,7 +41,7 @@ clap = { version = "3", features = ["wrap_help"] } clap_complete = "3" download = { path = "download", default-features = false } effective-limits = "0.5.5" -enum-map = "2.4.2" +enum-map = "2.5.0" flate2 = "1" git-testament = "0.2" home = "0.5.4" @@ -116,7 +116,7 @@ features = [ version = "0.3" [dev-dependencies] -enum-map = "2.4.2" +enum-map = "2.5.0" once_cell = "1.17.1" trycmd = "0.14.13" walkdir = "2" From 1ede209051033907b04dc4ceaa3bcbed60e745d8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Mar 2023 08:45:47 +0000 Subject: [PATCH 003/229] Update Rust crate opener to 0.6.0 --- Cargo.lock | 5 +++-- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5c46658670..a0b869fcb4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1159,11 +1159,12 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opener" -version = "0.5.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "293c15678e37254c15bd2f092314abb4e51d7fdde05c2021279c12631b54f005" +checksum = "d57fbd03b7f4ab9605d497df6f1cb7ea0ac60b18a2038b1e66e5ab34fe01fa99" dependencies = [ "bstr", + "normpath", "winapi", ] diff --git a/Cargo.toml b/Cargo.toml index 4d985a0ab9..982a8fff64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ home = "0.5.4" lazy_static.workspace = true libc = "0.2" num_cpus = "1.15" -opener = "0.5.2" +opener = "0.6.0" # Used by `curl` or `reqwest` backend although it isn't imported by our rustup : # this allows controlling the vendoring status without exposing the presence of # the download crate. From 6aeefaccd6a2c780eb2f41a623caf4ffec120016 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 2 Apr 2023 19:04:12 +0000 Subject: [PATCH 004/229] Lock file maintenance --- Cargo.lock | 589 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 377 insertions(+), 212 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4e915c165f..b111c64f46 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -35,11 +35,51 @@ dependencies = [ "libc", ] +[[package]] +name = "anstream" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-wincon", + "concolor-override", + "concolor-query", + "is-terminal", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" + +[[package]] +name = "anstyle-parse" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-wincon" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +dependencies = [ + "anstyle", + "windows-sys 0.45.0", +] + [[package]] name = "anyhow" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" [[package]] name = "as-slice" @@ -94,18 +134,18 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] [[package]] name = "bstr" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ffdb39cb703212f3c11973452c2861b972f757b021158f3516ba10f2fa8b2c1" +checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" dependencies = [ "memchr", "once_cell", @@ -154,9 +194,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.23" +version = "0.4.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16b0a3d9ed01224b22057780a37bb8c5dbfe1be8ba48678e7bf57ec4b385411f" +checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" dependencies = [ "iana-time-zone", "js-sys", @@ -212,21 +252,19 @@ dependencies = [ ] [[package]] -name = "concolor" -version = "0.0.12" +name = "concolor-override" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b3e3c41e9488eeda196b6806dbf487742107d61b2e16485bcca6c25ed5755b" -dependencies = [ - "bitflags", - "concolor-query", - "is-terminal", -] +checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" [[package]] name = "concolor-query" -version = "0.1.0" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317" +checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" +dependencies = [ + "windows-sys 0.45.0", +] [[package]] name = "content_inspector" @@ -255,9 +293,9 @@ checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" dependencies = [ "libc", ] @@ -273,9 +311,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2dd04ddaf88237dc3b8d8f9a3c1004b506b54b3313403944054d23c0870c521" +checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -283,9 +321,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "715e8152b692bba2d374b53d4875445368fdf21a94751410af607a5ac677d1fc" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", @@ -294,9 +332,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.13" +version = "0.9.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a" +checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -307,9 +345,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if 1.0.0", ] @@ -341,9 +379,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.60+curl-7.88.1" +version = "0.4.61+curl-8.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "717abe2cb465a5da6ce06617388a3980c9a2844196734bec8ccb8e575250f13f" +checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" dependencies = [ "cc", "libc", @@ -356,18 +394,18 @@ dependencies = [ [[package]] name = "cvt" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac344c7efccb80cd25bc61b2170aec26f2f693fd40e765a539a1243db48c71" +checksum = "d2ae9bf77fbf2d39ef573205d554d87e86c12f1994e9ea335b0651b9b278bcf1" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] name = "cxx" -version = "1.0.91" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86d3488e7665a7a483b57e25bdd90d0aeb2bc7608c8d0346acf2ad3f1caf1d62" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" dependencies = [ "cc", "cxxbridge-flags", @@ -377,9 +415,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.91" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48fcaf066a053a41a81dfb14d57d99738b767febb8b735c3016e469fac5da690" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" dependencies = [ "cc", "codespan-reporting", @@ -387,24 +425,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn", + "syn 2.0.13", ] [[package]] name = "cxxbridge-flags" -version = "1.0.91" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2ef98b8b717a829ca5603af80e1f9e2e48013ab227b68ef37872ef84ee479bf" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" [[package]] name = "cxxbridge-macro" -version = "1.0.91" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "086c685979a698443656e5cf7856c95c642295a38599f12fb1ff76fb28d19892" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] @@ -469,9 +507,9 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.4.2" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c25992259941eb7e57b936157961b217a4fc8597829ddef0596d6c3cd86e1a" +checksum = "988f0d17a0fa38291e5f41f71ea8d46a5d5497b9054d5a759fae2cbb819f2356" dependencies = [ "enum-map-derive", ] @@ -484,7 +522,7 @@ checksum = "2a4da76b3b6116d758c7ba93f7ec6a35d2e2cf24feda76c6e38a375f4d5c59f2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -508,6 +546,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "errno" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.45.0", +] + [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -535,7 +584,7 @@ checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "windows-sys 0.45.0", ] @@ -581,9 +630,9 @@ dependencies = [ [[package]] name = "fs_at" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3dfc546714a30e1e1f2eb5e1d233a6c1254c4a3d25ac35c09743e824a39d35e" +checksum = "37047c0d530b3aefc64e4c4d7c6b1e23030c65973661b70e12c826f426f3f675" dependencies = [ "aligned", "cfg-if 1.0.0", @@ -596,42 +645,42 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-io" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-core", "futures-io", @@ -644,9 +693,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -682,7 +731,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "time 0.3.20", ] @@ -802,9 +851,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.24" +version = "0.14.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" +checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" dependencies = [ "bytes", "futures-channel", @@ -852,16 +901,16 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.53" +version = "0.1.54" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +checksum = "0c17cc76786e99f8d2f055c11159e7f0091c42474dcc3189fbab96072e873e6d" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "winapi", + "windows", ] [[package]] @@ -886,9 +935,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -905,43 +954,44 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.5" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" dependencies = [ + "hermit-abi 0.3.1", "libc", "windows-sys 0.45.0", ] [[package]] name = "ipnet" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix", + "rustix 0.37.6", "windows-sys 0.45.0", ] [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] @@ -963,9 +1013,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" [[package]] name = "libz-sys" @@ -994,6 +1044,12 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + [[package]] name = "log" version = "0.4.17" @@ -1022,18 +1078,18 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.7.1" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" dependencies = [ "autocfg", ] [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" @@ -1100,11 +1156,11 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "normpath" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "972dec05f98e7c787ede35d7a9ea4735eb7788c299287352757b3def6cc1f7b5" +checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" dependencies = [ - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1154,9 +1210,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.45" +version = "0.10.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1169,13 +1225,13 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] @@ -1186,20 +1242,19 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.25.1+1.1.1t" +version = "111.25.2+1.1.1t" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef9a9cc6ea7d9d5e7c4a913dc4b48d0e359eddf01af1dfec96ba7064b4aba10" +checksum = "320708a054ad9b3bf314688b5db87cf4d6683d64cfc835e2337924ae62bf4431" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.80" +version = "0.9.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" dependencies = [ - "autocfg", "cc", "libc", "openssl-src", @@ -1219,9 +1274,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.4.1" +version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" +checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" [[package]] name = "percent-encoding" @@ -1255,9 +1310,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.51" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" +checksum = "1d0dd4be24fcdcfeaa12a432d588dc59bbad6cad3510c67e74a2b6b2fc950564" dependencies = [ "unicode-ident", ] @@ -1275,9 +1330,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -1314,9 +1369,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.6.1" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" dependencies = [ "either", "rayon-core", @@ -1324,9 +1379,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.2" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" +checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" dependencies = [ "crossbeam-channel", "crossbeam-deque", @@ -1343,11 +1398,20 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" -version = "1.7.1" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" dependencies = [ "aho-corasick", "memchr", @@ -1362,15 +1426,15 @@ checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "remove_dir_all" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7174320e07c29945955cedd70b865995b286847111c8308d349a1f3a9e3af555" +checksum = "23895cfadc1917fed9c6ed76a8c2903615fa3704f7493ff82b364c6540acc02b" dependencies = [ "aligned", "cfg-if 1.0.0", @@ -1385,9 +1449,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" dependencies = [ "async-compression", "base64", @@ -1464,15 +1528,29 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.8" +version = "0.36.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" dependencies = [ "bitflags", - "errno", + "errno 0.2.8", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.37.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +dependencies = [ + "bitflags", + "errno 0.3.0", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.1", "windows-sys 0.45.0", ] @@ -1562,9 +1640,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "same-file" @@ -1592,9 +1670,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "sct" @@ -1631,35 +1709,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" +checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.152" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.159" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] name = "serde_json" -version = "1.0.93" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" +checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" dependencies = [ "itoa", "ryu", @@ -1736,16 +1814,17 @@ checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "snapbox" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4389a6395e9925166f19d67b64874e526ec28a4b8455f3321b686c912299c3ea" +checksum = "9615402f9cff539301119bdf2c2f328739cf2b45c2116666618fb6ac399f75bb" dependencies = [ - "concolor", + "anstream", + "anstyle", "content_inspector", "dunce", "filetime", @@ -1758,20 +1837,22 @@ dependencies = [ "wait-timeout", "walkdir", "windows-sys 0.45.0", - "yansi", ] [[package]] name = "snapbox-macros" -version = "0.3.1" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "485e65c1203eb37244465e857d15a26d3a85a5410648ccb53b18bd44cb3a7336" +checksum = "f8e40c667388ed1cb5060f545d0013bf0a23efdfa6c5c3e9ef592de391cd860f" +dependencies = [ + "anstream", +] [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -1812,6 +1893,17 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "syn" +version = "2.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "sys-info" version = "0.9.1" @@ -1835,15 +1927,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.4.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if 1.0.0", "fastrand", - "redox_syscall", - "rustix", - "windows-sys 0.42.0", + "redox_syscall 0.3.5", + "rustix 0.37.6", + "windows-sys 0.45.0", ] [[package]] @@ -1871,7 +1963,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c9afddd2cec1c0909f06b00ef33f94ab2cc0578c4a610aa208ddfec8aa2b43a" dependencies = [ - "rustix", + "rustix 0.36.11", "windows-sys 0.45.0", ] @@ -1886,22 +1978,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.13", ] [[package]] @@ -1968,19 +2060,18 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.25.0" +version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ "autocfg", "bytes", "libc", - "memchr", "mio", "num_cpus", "pin-project-lite", "socket2", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -2050,9 +2141,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.19.4" +version = "0.19.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" +checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" dependencies = [ "indexmap", "serde", @@ -2095,9 +2186,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trycmd" -version = "0.14.13" +version = "0.14.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2311fe1144338119b5b9b31499286c7f60eaf00ce0dcacf5a445a12eb47aed29" +checksum = "32564b3f936a9ebedf5cc07dcf1e7e661204766d35f92c03bf347b099d84e783" dependencies = [ "glob", "humantime", @@ -2126,15 +2217,15 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.10" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-normalization" @@ -2168,6 +2259,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" + [[package]] name = "vcpkg" version = "0.2.15" @@ -2191,12 +2288,11 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.2" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" +checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" dependencies = [ "same-file", - "winapi", "winapi-util", ] @@ -2243,7 +2339,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -2277,7 +2373,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2339,19 +2435,28 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +dependencies = [ + "windows-targets 0.42.2", +] + [[package]] name = "windows-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -2360,71 +2465,137 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.3.3" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" +checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" dependencies = [ "memchr", ] @@ -2466,12 +2637,6 @@ dependencies = [ "lzma-sys", ] -[[package]] -name = "yansi" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" - [[package]] name = "zstd" version = "0.12.3+zstd.1.5.2" From 7fc9326c1f90b19c8dd9556eb960531ad2259c12 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Wed, 19 Apr 2023 13:38:06 -0700 Subject: [PATCH 005/229] Upgrade CI image to FreeBSD 13.2 13.0 is EoL --- .cirrus.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.cirrus.yml b/.cirrus.yml index 7df435be07..f07c6523c3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -4,7 +4,7 @@ task: name: FreeBSD freebsd_instance: - image: freebsd-13-0-release-amd64 + image: freebsd-13-2-release-amd64 setup_script: | pkg install -y git gmake bash echo "=========" From 8fcf207678942a119b587f78bb6c444d989e8385 Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Tue, 25 Apr 2023 04:51:53 -0700 Subject: [PATCH 006/229] Compile static Mutex where possible A few of Rustup's `lazy_static!` instances are for simple locks. These are easy to evaluate at compile time, and doing so is stable, so reduce usage of the more heavyweight dependency. --- download/tests/read-proxy-env.rs | 5 +---- src/cli/self_update/test.rs | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/download/tests/read-proxy-env.rs b/download/tests/read-proxy-env.rs index 6c707908ef..1f0893a659 100644 --- a/download/tests/read-proxy-env.rs +++ b/download/tests/read-proxy-env.rs @@ -9,13 +9,10 @@ use std::thread; use std::time::Duration; use env_proxy::for_url; -use lazy_static::lazy_static; use reqwest::{blocking::Client, Proxy}; use url::Url; -lazy_static! { - static ref SERIALISE_TESTS: Mutex<()> = Mutex::new(()); -} +static SERIALISE_TESTS: Mutex<()> = Mutex::new(()); fn scrub_env() { remove_var("http_proxy"); diff --git a/src/cli/self_update/test.rs b/src/cli/self_update/test.rs index d29d578069..f6f610befb 100644 --- a/src/cli/self_update/test.rs +++ b/src/cli/self_update/test.rs @@ -2,7 +2,6 @@ use std::sync::Mutex; -use lazy_static::lazy_static; #[cfg(not(unix))] use winreg::{ enums::{HKEY_CURRENT_USER, KEY_READ, KEY_WRITE}, @@ -38,9 +37,7 @@ fn restore_path(p: Option) { /// Support testing of code that mutates global path state pub fn with_saved_path(f: &mut dyn FnMut()) { // Lock protects concurrent mutation of registry - lazy_static! { - static ref LOCK: Mutex<()> = Mutex::new(()); - } + static LOCK: Mutex<()> = Mutex::new(()); let _g = LOCK.lock(); // On windows these tests mess with the user's PATH. Save From 4cdf0aabca68fc98aa284381f85fa81842b3468c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 01:12:40 +0000 Subject: [PATCH 007/229] Update Rust crate tempfile to 3.5 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 567292709e..7f02007d30 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -131,7 +131,7 @@ members = ["download"] [workspace.dependencies] anyhow = "1.0.69" lazy_static = "1" -tempfile = "3.4" +tempfile = "3.5" thiserror = "1.0" url = "2.3" From dc7953cb171283e788de66ad61fbbc5e03d1c249 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 26 Apr 2023 01:14:46 +0000 Subject: [PATCH 008/229] Update Rust crate winreg to 0.50 --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33163ba603..57ace06416 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1633,7 +1633,7 @@ dependencies = [ "wait-timeout", "walkdir", "winapi", - "winreg 0.11.0", + "winreg 0.50.0", "xz2", "zstd", ] @@ -2611,12 +2611,12 @@ dependencies = [ [[package]] name = "winreg" -version = "0.11.0" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a1a57ff50e9b408431e8f97d5456f2807f8eb2a2cd79b06068fc87f8ecf189" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ "cfg-if 1.0.0", - "winapi", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 567292709e..aa516112ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -87,7 +87,7 @@ version = "1.1.0" [target."cfg(windows)".dependencies] cc = "1" -winreg = "0.11" +winreg = "0.50" [target."cfg(windows)".dependencies.winapi] features = [ From d32cd592dd70dcbdda2fc856d0865a1666fda5d9 Mon Sep 17 00:00:00 2001 From: Nan Date: Wed, 26 Apr 2023 15:37:33 -0700 Subject: [PATCH 009/229] Fix small typo --- doc/src/installation/windows-msvc.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/installation/windows-msvc.md b/doc/src/installation/windows-msvc.md index 7bc1feaf9f..ef2307f52d 100644 --- a/doc/src/installation/windows-msvc.md +++ b/doc/src/installation/windows-msvc.md @@ -41,7 +41,7 @@ This will includes all needed components for Rust: ### Installing only the required components (optional) -If you'd like a more minimal install (and won't doing C++ development) then you can use the "Individual Components" tab to select just the essentials, which are: +If you'd like a more minimal install (and won't be doing C++ development) then you can use the "Individual Components" tab to select just the essentials, which are: * MSVC v143 - VS 2022 C++ x64/x86 build tools (Latest) * Windows 11 SDK (10.0.22621.0) From 395e49270394680dd03c74f69dcfedc6c3283ab5 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Thu, 27 Apr 2023 09:55:53 +0800 Subject: [PATCH 010/229] Suggest right toolchain when running clippy Signed-off-by: hi-rustin --- CONTRIBUTING.md | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eb45429647..eecf535e67 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,12 +4,14 @@ 2. Create your feature branch: `git checkout -b my-new-feature` 3. Test it: `cargo test` 4. Lint it: `cargo +beta clippy --all --all-targets -- -D warnings` + > We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. However, not all lints provided by `cargo clippy` are relevant or applicable to our project. > We may choose to ignore some lints if they are unstable, experimental, or specific to our project. > If you are unsure about a lint, please ask us in the [rustup Discord channel](https://discord.com/channels/442252698964721669/463480252723888159). -5. Commit your changes: `git commit -am 'Add some feature'` -6. Push to the branch: `git push origin my-new-feature` -7. Submit a pull request :D + +1. Commit your changes: `git commit -am 'Add some feature'` +2. Push to the branch: `git push origin my-new-feature` +3. Submit a pull request :D For developing on `rustup` itself, you may want to install into a temporary directory, with a series of commands similar to this: @@ -72,7 +74,7 @@ clippy is a moving target that can make it hard to merge for little benefit. We do ask that contributors keep the clippy status clean themselves. -Minimally, run `cargo +nightly clippy --all --all-targets -- -D warnings` before +Minimally, run `cargo +beta clippy --all --all-targets -- -D warnings` before submitting code. If possible, adding `--all-features` to the command is useful, but will require From 1586a22a003976709de5acc696107e7f96068e5c Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Wed, 26 Apr 2023 16:24:28 +0200 Subject: [PATCH 011/229] Update Rust crate toml to 0.7.3 Fixes #3241. --- Cargo.lock | 7 +++++-- Cargo.toml | 2 +- src/dist/config.rs | 2 +- src/dist/manifest.rs | 2 +- src/settings.rs | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 073b3436a1..77c1253de7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2124,11 +2124,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.11" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index c1aaf67f03..2c8680d246 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -70,7 +70,7 @@ tempfile.workspace = true term = "=0.5.1" thiserror.workspace = true threadpool = "1" -toml = "0.5" +toml = "0.7" url.workspace = true wait-timeout = "0.2" xz2 = "0.1.3" diff --git a/src/dist/config.rs b/src/dist/config.rs index 235e3e14c2..2febfb48c5 100644 --- a/src/dist/config.rs +++ b/src/dist/config.rs @@ -48,7 +48,7 @@ impl Config { } pub(crate) fn stringify(self) -> String { - toml::Value::Table(self.into_toml()).to_string() + self.into_toml().to_string() } fn toml_to_components(arr: toml::value::Array, path: &str) -> Result> { diff --git a/src/dist/manifest.rs b/src/dist/manifest.rs index 6916cd07c5..04ff941c6d 100644 --- a/src/dist/manifest.rs +++ b/src/dist/manifest.rs @@ -117,7 +117,7 @@ impl Manifest { Ok(manifest) } pub fn stringify(self) -> String { - toml::Value::Table(self.into_toml()).to_string() + self.into_toml().to_string() } pub(crate) fn from_toml(mut table: toml::value::Table, path: &str) -> Result { diff --git a/src/settings.rs b/src/settings.rs index 1a5051d5e3..02e445278e 100644 --- a/src/settings.rs +++ b/src/settings.rs @@ -143,7 +143,7 @@ impl Settings { } pub(crate) fn stringify(self) -> String { - toml::Value::Table(self.into_toml()).to_string() + self.into_toml().to_string() } pub(crate) fn from_toml(mut table: toml::value::Table, path: &str) -> Result { From a7b62306e82a269196b13cacb138d456504e458a Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Thu, 27 Apr 2023 09:59:18 +0800 Subject: [PATCH 012/229] Make clippy happy Signed-off-by: hi-rustin --- CONTRIBUTING.md | 8 +++----- tests/suite/cli_rustup.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index eecf535e67..ed2fca269c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -4,14 +4,12 @@ 2. Create your feature branch: `git checkout -b my-new-feature` 3. Test it: `cargo test` 4. Lint it: `cargo +beta clippy --all --all-targets -- -D warnings` - > We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. However, not all lints provided by `cargo clippy` are relevant or applicable to our project. > We may choose to ignore some lints if they are unstable, experimental, or specific to our project. > If you are unsure about a lint, please ask us in the [rustup Discord channel](https://discord.com/channels/442252698964721669/463480252723888159). - -1. Commit your changes: `git commit -am 'Add some feature'` -2. Push to the branch: `git push origin my-new-feature` -3. Submit a pull request :D +5. Commit your changes: `git commit -am 'Add some feature'` +6. Push to the branch: `git push origin my-new-feature` +7. Submit a pull request :D For developing on `rustup` itself, you may want to install into a temporary directory, with a series of commands similar to this: diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 54e4f7c20f..43efd9dd39 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -583,7 +583,7 @@ fn recursive_cargo() { let cargo_bin_path = config.cargodir.join("bin"); let cargo_subcommand = cargo_bin_path.join(format!("cargo-foo{}", EXE_SUFFIX)); fs::create_dir_all(&cargo_bin_path).unwrap(); - fs::copy(&real_mock_cargo, &cargo_subcommand).unwrap(); + fs::copy(real_mock_cargo, cargo_subcommand).unwrap(); // Verify the default behavior, which is currently broken on Windows. let args = &["cargo", "--recursive-cargo-subcommand"]; From d64c1423bfb5ebf6b847ac0df06ff2d61638989f Mon Sep 17 00:00:00 2001 From: cui fliter Date: Mon, 1 May 2023 14:42:09 +0800 Subject: [PATCH 013/229] Remove repeated definite article Signed-off-by: cui fliter --- src/cli/self_update/unix.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/self_update/unix.rs b/src/cli/self_update/unix.rs index ce4a79c14b..ba20e1fb33 100644 --- a/src/cli/self_update/unix.rs +++ b/src/cli/self_update/unix.rs @@ -140,7 +140,7 @@ pub(crate) fn run_update(setup_path: &Path) -> Result { } /// This function is as the final step of a self-upgrade. It replaces -/// `CARGO_HOME`/bin/rustup with the running exe, and updates the the +/// `CARGO_HOME`/bin/rustup with the running exe, and updates the /// links to it. pub(crate) fn self_replace() -> Result { install_bins()?; From d9e684c748bd74442ebda9d5a6a11edb9b62f95a Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 26 Mar 2023 09:50:56 +0200 Subject: [PATCH 014/229] Add in opentelemetry tracing as a feature This is an evolution on the previous tracing support I added a few years back. See CONTRIBUTING for details. The rs_tracing crate is functionally fine but very limited in features compared to the tracing crate that provides the developer interface for opentelemetry instrumentation. As we start looking at performance again I think this tooling will be useful. Included is support for both tracing rustup-init and individual tests --- CONTRIBUTING.md | 80 ++- Cargo.lock | 953 +++++++++++++++++++++++----- Cargo.toml | 32 +- download/Cargo.toml | 19 +- rustup-macros/Cargo.toml | 15 + rustup-macros/src/lib.rs | 147 +++++ src/bin/rustup-init.rs | 62 +- src/cli/common.rs | 1 + src/cli/download_tracker.rs | 3 + src/cli/proxy_mode.rs | 5 +- src/cli/rustup_mode.rs | 6 + src/cli/self_update.rs | 3 + src/cli/self_update/windows.rs | 3 + src/cli/setup_mode.rs | 1 + src/config.rs | 7 + src/currentprocess.rs | 2 + src/diskio/test.rs | 18 +- src/dist/dist.rs | 4 +- src/dist/manifestation.rs | 1 + src/dist/triple.rs | 3 + src/env_var.rs | 8 +- src/lib.rs | 2 + src/test.rs | 90 ++- src/toolchain.rs | 6 +- src/utils/units.rs | 2 + src/utils/utils.rs | 2 + tests/mock/clitools.rs | 4 + tests/mock/dist.rs | 7 + tests/suite/cli_exact.rs | 4 +- tests/suite/cli_inst_interactive.rs | 1 + tests/suite/cli_misc.rs | 1 + tests/suite/cli_paths.rs | 2 + tests/suite/cli_rustup.rs | 1 + tests/suite/cli_self_upd.rs | 1 + tests/suite/cli_ui.rs | 2 + tests/suite/cli_v1.rs | 1 + tests/suite/cli_v2.rs | 1 + tests/suite/dist.rs | 1 + tests/suite/dist_install.rs | 1 + tests/suite/dist_manifest.rs | 1 + tests/suite/dist_transactions.rs | 8 +- 41 files changed, 1311 insertions(+), 200 deletions(-) create mode 100644 rustup-macros/Cargo.toml create mode 100644 rustup-macros/src/lib.rs diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ed2fca269c..366deafce0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -96,6 +96,11 @@ task, but not currently run per-platform, which means there is no way to find out the status of clippy per platform without running it on that platform as a developer. +### import rustup-macros::{integration,unit}_test into test modules + +These test helpers add pre-and-post logic to tests to enable the use of tracing +inside tests, which can be helpful for tracking down behaviours in larger tests. + ## Version numbers If you ever see a released version of rustup which has `::` in its version string @@ -217,8 +222,8 @@ break our testing (like `RUSTUP_TOOLCHAIN`, `SHELL`, `ZDOTDIR`, `RUST_BACKTRACE` But if you want to debug locally, you may need backtrace. `RUSTUP_BACKTRACE` is used like `RUST_BACKTRACE` to enable backtraces of failed tests. -**NOTE**: This is a backtrace for the test, not for any rustup process running -in the test +**NOTE**: This is a backtrace for the test, not for any subprocess invocation of +rustup process running in the test ```bash $ RUSTUP_BACKTRACE=1 cargo test --release --test cli-v1 -- remove_toolchain_then_add_again @@ -273,3 +278,74 @@ test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 26 filtered out error: test failed, to rerun pass '--test cli-v1' ``` + +## Tracing + +The feature "otel" can be used when building rustup to turn on Opentelemetry +tracing with an OLTP GRPC exporter. This requires protoc installed, which can be +downloaded from GitHub or installed via package manager. + +The normal [OTLP environment +variables](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md) +can be used to customise its behaviour, but often the simplest thing is to just +run a Jaeger docker container on the same host: + +```sh +docker run -d --name jaeger -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -e COLLECTOR_OTLP_ENABLED=true -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 14250:14250 -p 14268:14268 -p 14269:14269 -p 9411:9411 jaegertracing/all-in-one:latest +``` + +Then build rustup-init with tracing: + +```sh +cargo build --features=otel +``` + +Run the operation you want to analyze: + +```sh +RUSTUP_FORCE_ARG0="rustup" ./target/debug/rustup-init show +``` + +And [look in Jaeger for a trace](http://localhost:16686/search?service=rustup). + +### Tracing and tests + +The custom macro `rustup_macros::test` adds a prelude and suffix to each test to +ensure that there is a tracing context setup, that the test function is a span, +and that the spans from the test are flushed. Build with features=otel to +use this feature. + +### Adding instrumentation + +The `otel` feature uses conditional compilation to only add function instrument +when enabled. Instrumenting a currently uninstrumented function is mostly simply +done like so: + +```rust +#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] +``` + +`skip_all` is not required, but some core structs don't implement Debug yet, and +others have a lot of output in Debug : tracing adds some overheads, so keeping +spans lightweight can help avoid frequency bias in the results - where +parameters with large debug in frequently called functions show up as much +slower than they are. + +Some good general heuristics: + +- Do instrument slow blocking functions +- Do instrument functions with many callers or that call many different things, + as these tend to help figure the puzzle of what-is-happening +- Default to not instrumenting thin shim functions (or at least, only instrument + them temporarily while figuring out the shape of a problem) +- Be way of debug build timing - release optimisations make a huge difference, + though debug is a lot faster to iterate on. If something isn't a problem in + release don't pay it too much heed in debug. + +### Caveats + +Cross-thread propogation isn't connected yet. This will cause instrumentation in +a thread to make a new root span until it is fixed. If any Tokio runtime-related +code gets added in those threads this will also cause a panic. We have a couple +of threadpools in use today; if you need to instrument within that context, use +a thunk to propogate the tokio runtime into those threads. \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 77c1253de7..8b3aaf7751 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -10,9 +10,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" dependencies = [ "memchr", ] @@ -37,49 +37,58 @@ dependencies = [ [[package]] name = "anstream" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342258dd14006105c2b75ab1bd7543a03bdf0cfc94383303ac212a04939dff6f" +checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" dependencies = [ "anstyle", "anstyle-parse", + "anstyle-query", "anstyle-wincon", - "concolor-override", - "concolor-query", + "colorchoice", "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "0.3.5" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ea9e81bd02e310c216d080f6223c179012256e5151c41db88d12c88a1684d2" +checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" [[package]] name = "anstyle-parse" -version = "0.1.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7d1bb534e9efed14f3e5f44e7dd1a4f709384023a4165199a4241e18dff0116" +checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" dependencies = [ "utf8parse", ] +[[package]] +name = "anstyle-query" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +dependencies = [ + "windows-sys 0.48.0", +] + [[package]] name = "anstyle-wincon" -version = "0.2.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3127af6145b149f3287bb9a0d10ad9c5692dba8c53ad48285e5bec4063834fa" +checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" dependencies = [ "anstyle", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "anyhow" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" +checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" [[package]] name = "as-slice" @@ -103,6 +112,39 @@ dependencies = [ "tokio", ] +[[package]] +name = "async-stream" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + +[[package]] +name = "async-trait" +version = "0.1.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "atty" version = "0.2.14" @@ -120,6 +162,57 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "axum" +version = "0.6.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b70caf9f1b0c045f7da350636435b775a9733adf2df56e8aa2a29210fbc335d4" +dependencies = [ + "async-trait", + "axum-core", + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "hyper", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "sync_wrapper", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "axum-core" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759fa577a247914fd3f7f76d62972792636412fbfd634cd452f6a385a74d2d2c" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "mime", + "rustversion", + "tower-layer", + "tower-service", +] + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + [[package]] name = "base64" version = "0.21.0" @@ -155,9 +248,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" [[package]] name = "byteorder" @@ -209,9 +302,9 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.23" +version = "3.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", "bitflags", @@ -252,19 +345,10 @@ dependencies = [ ] [[package]] -name = "concolor-override" +name = "colorchoice" version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a855d4a1978dc52fb0536a04d384c2c0c1aa273597f08b77c8c4d3b2eec6037f" - -[[package]] -name = "concolor-query" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d11d52c3d7ca2e6d0040212be9e4dbbcd78b6447f535b6b561f449427944cf" -dependencies = [ - "windows-sys 0.45.0", -] +checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" [[package]] name = "content_inspector" @@ -287,15 +371,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" dependencies = [ "libc", ] @@ -311,9 +395,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf2b3e8478797446514c91ef04bafcb59faba183e621ad488df88983cc14128c" +checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -425,7 +509,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -442,7 +526,20 @@ checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", +] + +[[package]] +name = "dashmap" +version = "5.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" +dependencies = [ + "cfg-if 1.0.0", + "hashbrown", + "lock_api", + "once_cell", + "parking_lot_core", ] [[package]] @@ -473,9 +570,9 @@ dependencies = [ [[package]] name = "dunce" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0bd4b30a6560bbd9b4620f4de34c3f14f60848e58a9b7216801afcb4c7b31c3c" +checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "effective-limits" @@ -537,24 +634,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" -dependencies = [ - "errno-dragonfly", - "libc", - "winapi", -] - -[[package]] -name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -578,21 +664,27 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall 0.2.16", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] +[[package]] +name = "fixedbitset" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" + [[package]] name = "flate2" -version = "1.0.25" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a2db397cb1c8772f31494cb8917e48cd1e64f0fa7efac59fbd741a0a8ce841" +checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" dependencies = [ "crc32fast", "miniz_oxide", @@ -630,9 +722,9 @@ dependencies = [ [[package]] name = "fs_at" -version = "0.1.4" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37047c0d530b3aefc64e4c4d7c6b1e23030c65973661b70e12c826f426f3f675" +checksum = "0504bab20f4487fdf1c20ed48e3e32c7951827a778cd3dfded1768f90b6abb0a" dependencies = [ "aligned", "cfg-if 1.0.0", @@ -640,7 +732,21 @@ dependencies = [ "libc", "nix", "smart-default", - "windows-sys 0.45.0", + "windows-sys 0.48.0", +] + +[[package]] +name = "futures" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", ] [[package]] @@ -650,6 +756,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -658,12 +765,34 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +[[package]] +name = "futures-executor" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + [[package]] name = "futures-io" version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[package]] +name = "futures-macro" +version = "0.3.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "futures-sink" version = "0.3.28" @@ -682,8 +811,11 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ + "futures-channel", "futures-core", "futures-io", + "futures-macro", + "futures-sink", "futures-task", "memchr", "pin-project-lite", @@ -703,9 +835,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if 1.0.0", "libc", @@ -743,9 +875,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" dependencies = [ "bytes", "fnv", @@ -766,6 +898,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -792,11 +930,11 @@ checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "home" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "747309b4b440c06d57b0b25f2aee03ee9b5e5397d288c60e21fc709bb98a7408" +checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" dependencies = [ - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -851,9 +989,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -886,6 +1024,18 @@ dependencies = [ "tokio-rustls", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -901,9 +1051,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.54" +version = "0.1.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c17cc76786e99f8d2f055c11159e7f0091c42474dcc3189fbab96072e873e6d" +checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -954,13 +1104,13 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -971,14 +1121,23 @@ checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" [[package]] name = "is-terminal" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256017f749ab3117e93acb91063009e1f1bb56d03965b14c2c8df4eb02c524d8" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix 0.37.6", - "windows-sys 0.45.0", + "rustix", + "windows-sys 0.48.0", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", ] [[package]] @@ -1013,15 +1172,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.140" +version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99227334921fae1a979cf0bfdfcc6b3e5ce376ef57e16fb6fb3ea2ed6095f80c" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" [[package]] name = "libz-sys" -version = "1.1.8" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" dependencies = [ "cc", "libc", @@ -1040,15 +1199,19 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c" [[package]] -name = "linux-raw-sys" -version = "0.3.1" +name = "lock_api" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" +dependencies = [ + "autocfg", + "scopeguard", +] [[package]] name = "log" @@ -1070,6 +1233,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata", +] + +[[package]] +name = "matchit" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" + [[package]] name = "memchr" version = "2.5.0" @@ -1093,9 +1271,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.6.2" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" dependencies = [ "adler", ] @@ -1112,6 +1290,12 @@ dependencies = [ "windows-sys 0.45.0", ] +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "native-tls" version = "0.2.11" @@ -1163,6 +1347,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + [[package]] name = "num-integer" version = "0.1.45" @@ -1200,9 +1394,9 @@ checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opener" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d57fbd03b7f4ab9605d497df6f1cb7ea0ac60b18a2038b1e66e5ab34fe01fa99" +checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788" dependencies = [ "bstr", "normpath", @@ -1211,9 +1405,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.49" +version = "0.10.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d2f106ab837a24e03672c59b1239669a0596406ff657c3c0835b6b7f0f35a33" +checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1232,7 +1426,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] @@ -1243,18 +1437,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.25.2+1.1.1t" +version = "111.25.3+1.1.1t" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320708a054ad9b3bf314688b5db87cf4d6683d64cfc835e2337924ae62bf4431" +checksum = "924757a6a226bf60da5f7dd0311a34d2b52283dd82ddeb103208ddc66362f80c" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.84" +version = "0.9.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a20eace9dc2d82904039cb76dcf50fb1a0bba071cfd1629720b5d6f1ddba0fa" +checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" dependencies = [ "cc", "libc", @@ -1263,14 +1457,94 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "opentelemetry" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69d6c3d7288a106c0a363e4b0e8d308058d56902adefb16f4936f417ffef086e" +dependencies = [ + "opentelemetry_api", + "opentelemetry_sdk", +] + +[[package]] +name = "opentelemetry-otlp" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1c928609d087790fc936a1067bdc310ae702bdf3b090c3f281b713622c8bbde" +dependencies = [ + "async-trait", + "futures", + "futures-util", + "http", + "opentelemetry", + "opentelemetry-proto", + "prost", + "thiserror", + "tokio", + "tonic", +] + +[[package]] +name = "opentelemetry-proto" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d61a2f56df5574508dd86aaca016c917489e589ece4141df1b5e349af8d66c28" +dependencies = [ + "futures", + "futures-util", + "opentelemetry", + "prost", + "tonic", + "tonic-build", +] + +[[package]] +name = "opentelemetry_api" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c24f96e21e7acc813c7a8394ee94978929db2bcc46cf6b5014fc612bf7760c22" +dependencies = [ + "fnv", + "futures-channel", + "futures-util", + "indexmap", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", +] + +[[package]] +name = "opentelemetry_sdk" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ca41c4933371b61c2a2f214bf16931499af4ec90543604ec828f7a625c09113" +dependencies = [ + "async-trait", + "crossbeam-channel", + "dashmap", + "fnv", + "futures-channel", + "futures-executor", + "futures-util", + "once_cell", + "opentelemetry_api", + "percent-encoding", + "rand", + "thiserror", + "tokio", + "tokio-stream", +] + [[package]] name = "os_pipe" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a53dbb20faf34b16087a931834cba2d7a73cc74af2b7ef345a4c8324e2409a12" +checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177" dependencies = [ "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1279,12 +1553,61 @@ version = "6.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parking_lot_core" +version = "0.9.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "redox_syscall 0.2.16", + "smallvec", + "windows-sys 0.45.0", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "petgraph" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" +dependencies = [ + "fixedbitset", + "indexmap", +] + +[[package]] +name = "pin-project" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "pin-project-lite" version = "0.2.9" @@ -1309,15 +1632,79 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "prettyplease" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" +dependencies = [ + "proc-macro2", + "syn 1.0.109", +] + [[package]] name = "proc-macro2" -version = "1.0.55" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d0dd4be24fcdcfeaa12a432d588dc59bbad6cad3510c67e74a2b6b2fc950564" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] +[[package]] +name = "prost" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" +dependencies = [ + "bytes", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn 1.0.109", + "tempfile", + "which", +] + +[[package]] +name = "prost-derive" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +dependencies = [ + "anyhow", + "itertools", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "prost-types" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" +dependencies = [ + "prost", +] + [[package]] name = "pulldown-cmark" version = "0.9.2" @@ -1410,13 +1797,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.7.1", ] [[package]] @@ -1424,6 +1811,9 @@ name = "regex-automata" version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] [[package]] name = "regex-syntax" @@ -1431,6 +1821,12 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" + [[package]] name = "remove_dir_all" version = "0.8.2" @@ -1450,12 +1846,12 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.16" +version = "0.11.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" dependencies = [ "async-compression", - "base64", + "base64 0.21.0", "bytes", "encoding_rs", "futures-core", @@ -1529,30 +1925,16 @@ dependencies = [ [[package]] name = "rustix" -version = "0.36.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4165c9963ab29e422d6c26fbc1d37f15bace6b2810221f9d925023480fcf0e" -dependencies = [ - "bitflags", - "errno 0.2.8", - "io-lifetimes", - "libc", - "linux-raw-sys 0.1.4", - "windows-sys 0.45.0", -] - -[[package]] -name = "rustix" -version = "0.37.6" +version = "0.37.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d097081ed288dfe45699b72f5b5d648e5f15d64d900c7080273baa20c16a6849" +checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" dependencies = [ "bitflags", - "errno 0.3.0", + "errno", "io-lifetimes", "libc", - "linux-raw-sys 0.3.1", - "windows-sys 0.45.0", + "linux-raw-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1585,7 +1967,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64", + "base64 0.21.0", ] [[package]] @@ -1610,12 +1992,15 @@ dependencies = [ "once_cell", "opener", "openssl", + "opentelemetry", + "opentelemetry-otlp", "pulldown-cmark", "rand", "regex", "remove_dir_all", "retry", "rs_tracing", + "rustup-macros", "same-file", "scopeguard", "semver", @@ -1628,7 +2013,11 @@ dependencies = [ "term", "thiserror", "threadpool", + "tokio", "toml", + "tracing", + "tracing-opentelemetry", + "tracing-subscriber", "trycmd", "url", "wait-timeout", @@ -1639,6 +2028,23 @@ dependencies = [ "zstd", ] +[[package]] +name = "rustup-macros" +version = "0.1.0" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "sha2", + "syn 2.0.15", +] + +[[package]] +name = "rustversion" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" + [[package]] name = "ryu" version = "1.0.13" @@ -1716,29 +2122,29 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.159" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c04e8343c3daeec41f58990b9d77068df31209f2af111e059e9fe9646693065" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.159" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c614d17805b093df4b147b51339e7e44bf05ef59fba1e45d83500bcfb4d8585" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.95" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d721eca97ac802aa7777b701877c8004d950fc142651367300d21c1cc0194744" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -1807,22 +2213,28 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" + [[package]] name = "smart-default" -version = "0.6.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "133659a15339456eeeb07572eb02a91c91e9815e9cbc89566944d2c8d3efdbf6" +checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] name = "snapbox" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9615402f9cff539301119bdf2c2f328739cf2b45c2116666618fb6ac399f75bb" +checksum = "f6bccd62078347f89a914e3004d94582e13824d4e3d8a816317862884c423835" dependencies = [ "anstream", "anstyle", @@ -1842,9 +2254,9 @@ dependencies = [ [[package]] name = "snapbox-macros" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8e40c667388ed1cb5060f545d0013bf0a23efdfa6c5c3e9ef592de391cd860f" +checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" dependencies = [ "anstream", ] @@ -1896,15 +2308,21 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.13" +version = "2.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + [[package]] name = "sys-info" version = "0.9.1" @@ -1935,7 +2353,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", - "rustix 0.37.6", + "rustix", "windows-sys 0.45.0", ] @@ -1960,12 +2378,12 @@ dependencies = [ [[package]] name = "terminal_size" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9afddd2cec1c0909f06b00ef33f94ab2cc0578c4a610aa208ddfec8aa2b43a" +checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix 0.36.11", - "windows-sys 0.45.0", + "rustix", + "windows-sys 0.48.0", ] [[package]] @@ -1994,7 +2412,17 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.13", + "syn 2.0.15", +] + +[[package]] +name = "thread_local" +version = "1.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +dependencies = [ + "cfg-if 1.0.0", + "once_cell", ] [[package]] @@ -2061,9 +2489,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.27.0" +version = "1.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" +checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" dependencies = [ "autocfg", "bytes", @@ -2072,7 +2500,29 @@ dependencies = [ "num_cpus", "pin-project-lite", "socket2", - "windows-sys 0.45.0", + "tokio-macros", + "windows-sys 0.48.0", +] + +[[package]] +name = "tokio-io-timeout" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", ] [[package]] @@ -2108,11 +2558,22 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -2156,6 +2617,77 @@ dependencies = [ "winnow", ] +[[package]] +name = "tonic" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" +dependencies = [ + "async-stream", + "async-trait", + "axum", + "base64 0.13.1", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + +[[package]] +name = "tonic-build" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "tower" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand", + "slab", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" + [[package]] name = "tower-service" version = "0.3.2" @@ -2170,9 +2702,21 @@ checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ "cfg-if 1.0.0", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + [[package]] name = "tracing-core" version = "0.1.30" @@ -2180,6 +2724,60 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-log" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +dependencies = [ + "lazy_static", + "log", + "tracing-core", +] + +[[package]] +name = "tracing-opentelemetry" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21ebb87a95ea13271332df069020513ab70bdb5637ca42d6e492dc3bbbad48de" +dependencies = [ + "once_cell", + "opentelemetry", + "tracing", + "tracing-core", + "tracing-log", + "tracing-subscriber", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", ] [[package]] @@ -2190,9 +2788,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trycmd" -version = "0.14.15" +version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32564b3f936a9ebedf5cc07dcf1e7e661204766d35f92c03bf347b099d84e783" +checksum = "2925e71868a12b173c1eb166018c2d2f9dfaedfcaec747bdb6ea2246785d258e" dependencies = [ "glob", "humantime", @@ -2269,6 +2867,12 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "vcpkg" version = "0.2.15" @@ -2408,6 +3012,17 @@ dependencies = [ "untrusted", ] +[[package]] +name = "which" +version = "4.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" +dependencies = [ + "either", + "libc", + "once_cell", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2441,11 +3056,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.46.0" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" +checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.42.2", + "windows-targets 0.48.0", ] [[package]] @@ -2597,9 +3212,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "5617da7e1f97bf363947d767b91aaf3c2bbc19db7fda9c65af1278713d58e0a2" dependencies = [ "memchr", ] @@ -2652,9 +3267,9 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.4+zstd.1.5.4" +version = "6.0.5+zstd.1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7afb4b54b8910cf5447638cb54bf4e8a65cbedd783af98b98c62ffe91f185543" +checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" dependencies = [ "libc", "zstd-sys", @@ -2662,9 +3277,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.7+zstd.1.5.4" +version = "2.0.8+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94509c3ba2fe55294d752b79842c530ccfab760192521df74a081a78d2b3c7f5" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" dependencies = [ "cc", "libc", diff --git a/Cargo.toml b/Cargo.toml index 2c8680d246..c19a19dd2f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,15 @@ reqwest-rustls-tls = ["download/reqwest-rustls-tls"] # Include in the default set to disable self-update and uninstall. no-self-update = [] +# Include an Opentelemetry sink for tracing events +otel = [ + "dep:opentelemetry-otlp", + "dep:tracing-opentelemetry", + "dep:tracing-subscriber", + "dep:opentelemetry", + "dep:tokio", +] + # Sorted by alphabetic order [dependencies] anyhow.workspace = true @@ -48,11 +57,14 @@ home = "0.5.4" lazy_static.workspace = true libc = "0.2" num_cpus = "1.15" +once_cell.workspace = true opener = "0.6.0" # Used by `curl` or `reqwest` backend although it isn't imported by our rustup : # this allows controlling the vendoring status without exposing the presence of # the download crate. openssl = { version = "0.10", optional = true } +opentelemetry = { workspace = true, optional = true } +opentelemetry-otlp = { workspace = true, optional = true } pulldown-cmark = { version = "0.9", default-features = false } rand = "0.8" regex = "1" @@ -70,7 +82,13 @@ tempfile.workspace = true term = "=0.5.1" thiserror.workspace = true threadpool = "1" +tokio = { workspace = true, optional = true } toml = "0.7" +tracing-opentelemetry = { workspace = true, optional = true } +tracing-subscriber = { workspace = true, optional = true, features = [ + "env-filter", +] } +tracing.workspace = true url.workspace = true wait-timeout = "0.2" xz2 = "0.1.3" @@ -117,7 +135,9 @@ version = "0.3" [dev-dependencies] enum-map = "2.5.0" -once_cell = "1.17.1" +once_cell.workspace = true +rustup-macros.workspace = true +tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } trycmd = "0.14.13" walkdir = "2" @@ -126,13 +146,21 @@ lazy_static = "1" regex = "1" [workspace] -members = ["download"] +members = ["download", "rustup-macros"] [workspace.dependencies] anyhow = "1.0.69" lazy_static = "1" +once_cell = "1.17.1" +opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } +opentelemetry-otlp = { version = "0.11.0" } +rustup-macros = { path = "rustup-macros" } tempfile = "3.5" thiserror = "1.0" +tokio = { version = "1.26.0", default-features = false } +tracing = "0.1" +tracing-opentelemetry = { version = "0.18.0" } +tracing-subscriber = "0.3.16" url = "2.3" [lib] diff --git a/download/Cargo.toml b/download/Cargo.toml index 024d37e4d8..f1b7c97dad 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -17,14 +17,21 @@ reqwest-rustls-tls = ["reqwest/rustls-tls-native-roots"] [dependencies] anyhow.workspace = true -curl = {version = "0.4.44", optional = true} -env_proxy = {version = "0.4.1", optional = true} -lazy_static = {workspace=true, optional = true} -reqwest = {version = "0.11", default-features = false, features = ["blocking", "gzip", "socks"], optional = true} +curl = { version = "0.4.44", optional = true } +env_proxy = { version = "0.4.1", optional = true } +lazy_static = { workspace = true, optional = true } +reqwest = { version = "0.11", default-features = false, features = [ + "blocking", + "gzip", + "socks", +], optional = true } thiserror.workspace = true url.workspace = true [dev-dependencies] -hyper = {version = "0.14", default-features = false, features = ["tcp", "server"]} +hyper = { version = "0.14", default-features = false, features = [ + "tcp", + "server", +] } tempfile.workspace = true -tokio = {version = "1", default-features = false, features = ["sync"]} +tokio = { workspace = true, default-features = false, features = ["sync"] } diff --git a/rustup-macros/Cargo.toml b/rustup-macros/Cargo.toml new file mode 100644 index 0000000000..45c8efdce7 --- /dev/null +++ b/rustup-macros/Cargo.toml @@ -0,0 +1,15 @@ +[package] +edition = "2021" +name = "rustup-macros" +publish = false +version = "0.1.0" + +[lib] +proc-macro = true + +[dependencies] +proc-macro2 = "1.0.51" +quote = "1.0.23" +regex = "1.7.1" +sha2 = "0.10.6" +syn = { version = "2.0.13", features = ["full"] } diff --git a/rustup-macros/src/lib.rs b/rustup-macros/src/lib.rs new file mode 100644 index 0000000000..247f480c98 --- /dev/null +++ b/rustup-macros/src/lib.rs @@ -0,0 +1,147 @@ +//! Procedural macros for `rustup`. + +use ::quote::quote; +use proc_macro2::TokenStream; +use quote::format_ident; +use syn::{parse_macro_input, parse_quote, Block, Expr, ItemFn, LitStr}; + +/// Custom wrapper macro around `#[test]` and `#[tokio::test]`. +/// +/// Calls `rustup::test::before_test()` before the test body, and +/// `rustup::test::after_test()` after, even in the event of an unwinding panic. +/// For async functions calls the async variants of these functions. +#[proc_macro_attribute] +pub fn integration_test( + args: proc_macro::TokenStream, + input: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + let mut path: Option = None; + if !args.is_empty() { + let test_parser = syn::meta::parser(|meta| { + if meta.path.is_ident("mod_path") { + path = Some(meta.value()?.parse()?); + Ok(()) + } else { + Err(meta.error("unsupported test property")) + } + }); + + parse_macro_input!(args with test_parser); + } + let input = parse_macro_input!(input); + test_inner( + path.map(|s| s.value()).unwrap_or("::rustup::test".into()), + Clone::clone(&input), + ) + .unwrap_or_else(|err| { + let err = err.to_compile_error(); + quote! { #err #input } + }) + .into() +} + +/// Custom wrapper macro around `#[test]` and `#[tokio::test]` for unit tests. +/// +/// Calls `rustup::test::before_test()` before the test body, and +/// `rustup::test::after_test()` after, even in the event of an unwinding panic. +/// For async functions calls the async variants of these functions. +#[proc_macro_attribute] +pub fn unit_test( + args: proc_macro::TokenStream, + input: proc_macro::TokenStream, +) -> proc_macro::TokenStream { + let mut path: Option = None; + + if !args.is_empty() { + let test_parser = syn::meta::parser(|meta| { + if meta.path.is_ident("mod_path") { + path = Some(meta.value()?.parse()?); + Ok(()) + } else { + Err(meta.error("unsupported test property")) + } + }); + + parse_macro_input!(args with test_parser); + } + + let input = parse_macro_input!(input); + + test_inner( + path.map(|s| s.value()).unwrap_or("crate::test".into()), + Clone::clone(&input), + ) + .unwrap_or_else(|err| { + let err = err.to_compile_error(); + quote! { #err #input } + }) + .into() +} + +fn test_inner(mod_path: String, mut input: ItemFn) -> syn::Result { + if input.sig.asyncness.is_some() { + let before_ident = format_ident!("{}::before_test_async", mod_path); + let after_ident = format_ident!("{}::after_test_async", mod_path); + + let inner = input.block; + let name = input.sig.ident.clone(); + let new_block: Block = parse_quote! { + { + #before_ident().await; + // Define a function with same name we can instrument inside the + // tracing enablement logic. + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + async fn #name() { #inner } + // Thunk through a new thread to permit catching the panic + // without grabbing the entire state machine defined by the + // outer test function. + let result = ::std::panic::catch_unwind(||{ + let handle = tokio::runtime::Handle::current().clone(); + ::std::thread::spawn(move || handle.block_on(#name())).join().unwrap() + }); + #after_ident().await; + match result { + Ok(result) => result, + Err(err) => ::std::panic::resume_unwind(err) + } + } + }; + + input.block = Box::new(new_block); + + Ok(quote! { + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + #[::tokio::test(flavor = "multi_thread", worker_threads = 1)] + #input + }) + } else { + let before_ident = format!("{}::before_test", mod_path); + let before_ident = syn::parse_str::(&before_ident)?; + let after_ident = format!("{}::after_test", mod_path); + let after_ident = syn::parse_str::(&after_ident)?; + + let inner = input.block; + let name = input.sig.ident.clone(); + let new_block: Block = parse_quote! { + { + #before_ident(); + // Define a function with same name we can instrument inside the + // tracing enablement logic. + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + fn #name() { #inner } + let result = ::std::panic::catch_unwind(#name); + #after_ident(); + match result { + Ok(result) => result, + Err(err) => ::std::panic::resume_unwind(err) + } + } + }; + + input.block = Box::new(new_block); + Ok(quote! { + #[::std::prelude::v1::test] + #input + }) + } +} diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index 35ed9866fd..e6bbe59574 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -30,7 +30,7 @@ use rustup::utils::utils; fn main() { let process = OSProcess::default(); - with(Box::new(process), || match run_rustup() { + with(Box::new(process), || match maybe_trace_rustup() { Err(e) => { common::report_error(&e); std::process::exit(1); @@ -39,6 +39,65 @@ fn main() { }); } +fn maybe_trace_rustup() -> Result { + #[cfg(not(feature = "otel"))] + { + run_rustup() + } + #[cfg(feature = "otel")] + { + use std::time::Duration; + + use opentelemetry::sdk::{ + trace::{self, Sampler}, + Resource, + }; + use opentelemetry::KeyValue; + use opentelemetry::{global, sdk::propagation::TraceContextPropagator}; + use opentelemetry_otlp::WithExportConfig; + use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; + + // Background submission requires a runtime, and since we're probably + // going to want async eventually, we just use tokio. + let threaded_rt = tokio::runtime::Runtime::new()?; + + let result = threaded_rt.block_on(async { + global::set_text_map_propagator(TraceContextPropagator::new()); + let tracer = opentelemetry_otlp::new_pipeline() + .tracing() + .with_exporter( + opentelemetry_otlp::new_exporter() + .tonic() + .with_timeout(Duration::from_secs(3)), + ) + .with_trace_config( + trace::config() + .with_sampler(Sampler::AlwaysOn) + .with_resource(Resource::new(vec![KeyValue::new( + "service.name", + "rustup", + )])), + ) + .install_batch(opentelemetry::runtime::Tokio)?; + let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("INFO")); + let telemetry = tracing_opentelemetry::layer().with_tracer(tracer); + let subscriber = Registry::default().with(env_filter).with(telemetry); + tracing::subscriber::set_global_default(subscriber)?; + let result = run_rustup(); + // We're tracing, so block until all spans are exported. + opentelemetry::global::shutdown_tracer_provider(); + result + }); + // default runtime behaviour is to block until nothing is running; + // instead we supply a timeout, as we're either already errored and are + // reporting back without care for lost threads etc... or everything + // completed. + threaded_rt.shutdown_timeout(Duration::from_millis(5)); + result + } +} + +#[cfg_attr(feature = "otel", tracing::instrument)] fn run_rustup() -> Result { if let Ok(dir) = process().var("RUSTUP_TRACE_DIR") { open_trace_file!(dir)?; @@ -50,6 +109,7 @@ fn run_rustup() -> Result { result } +#[cfg_attr(feature = "otel", tracing::instrument(err))] fn run_rustup_inner() -> Result { // Guard against infinite proxy recursion. This mostly happens due to // bugs in rustup. diff --git a/src/cli/common.rs b/src/cli/common.rs index 9a6a68d4a0..122c0a0f74 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -156,6 +156,7 @@ impl NotifyOnConsole { } } +#[cfg_attr(feature = "otel", tracing::instrument)] pub(crate) fn set_globals(verbose: bool, quiet: bool) -> Result { use std::cell::RefCell; diff --git a/src/cli/download_tracker.rs b/src/cli/download_tracker.rs index c14fd5bfec..7db1373c7a 100644 --- a/src/cli/download_tracker.rs +++ b/src/cli/download_tracker.rs @@ -268,7 +268,10 @@ fn format_dhms(sec: u64) -> (u64, u8, u8, u8) { #[cfg(test)] mod tests { + use rustup_macros::unit_test as test; + use super::format_dhms; + #[test] fn download_tracker_format_dhms_test() { assert_eq!(format_dhms(2), (0, 0, 0, 2)); diff --git a/src/cli/proxy_mode.rs b/src/cli/proxy_mode.rs index 7b62934c31..52813f4f01 100644 --- a/src/cli/proxy_mode.rs +++ b/src/cli/proxy_mode.rs @@ -1,5 +1,4 @@ use std::ffi::OsString; -use std::process; use anyhow::Result; @@ -10,6 +9,7 @@ use crate::command::run_command_for_dir; use crate::utils::utils::{self, ExitCode}; use crate::Cfg; +#[cfg_attr(feature = "otel", tracing::instrument)] pub fn main(arg0: &str) -> Result { self_update::cleanup_self_updater()?; @@ -38,9 +38,10 @@ pub fn main(arg0: &str) -> Result { direct_proxy(&cfg, arg0, toolchain, &cmd_args)? }; - process::exit(c) + Ok(ExitCode(c)) } +#[cfg_attr(feature = "otel", tracing::instrument(skip(cfg)))] fn direct_proxy( cfg: &Cfg, arg0: &str, diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 09d137965d..8960d9de29 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -68,6 +68,7 @@ where callee(cfg, matches) } +#[cfg_attr(feature = "otel", tracing::instrument(fields(args = format!("{:?}", process().args_os().collect::>()))))] pub fn main() -> Result { self_update::cleanup_self_updater()?; @@ -82,6 +83,7 @@ pub fn main() -> Result { write!(process().stdout().lock(), "{err}")?; info!("This is the version for the rustup toolchain manager, not the rustc compiler."); + #[cfg_attr(feature = "otel", tracing::instrument)] fn rustc_version() -> std::result::Result> { let cfg = &mut common::set_globals(false, true)?; let cwd = std::env::current_dir()?; @@ -1105,6 +1107,7 @@ fn which(cfg: &Cfg, m: &ArgMatches) -> Result { Ok(utils::ExitCode(0)) } +#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn show(cfg: &Cfg, m: &ArgMatches) -> Result { let verbose = m.get_flag("verbose"); @@ -1266,6 +1269,7 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { Ok(utils::ExitCode(0)) } +#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result { let verbose = m.get_flag("verbose"); let cwd = utils::current_dir()?; @@ -1293,6 +1297,7 @@ fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result { Ok(utils::ExitCode(0)) } +#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn show_rustup_home(cfg: &Cfg) -> Result { writeln!(process().stdout(), "{}", cfg.rustup_dir.display())?; Ok(utils::ExitCode(0)) @@ -1665,6 +1670,7 @@ fn set_auto_self_update(cfg: &mut Cfg, m: &ArgMatches) -> Result Result { writeln!(process().stdout(), "{}", cfg.get_profile()?)?; Ok(utils::ExitCode(0)) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 267f26c5e0..3a97ae4c01 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -1210,6 +1210,7 @@ pub(crate) fn check_rustup_update() -> Result<()> { Ok(()) } +#[cfg_attr(feature = "otel", tracing::instrument)] pub(crate) fn cleanup_self_updater() -> Result<()> { let cargo_home = utils::cargo_home()?; let setup = cargo_home.join(format!("bin/rustup-init{EXE_SUFFIX}")); @@ -1235,6 +1236,8 @@ mod tests { use anyhow::Result; + use rustup_macros::unit_test as test; + use crate::cli::common; use crate::dist::dist::ToolchainDesc; use crate::test::{test_dir, with_rustup_home, Env}; diff --git a/src/cli/self_update/windows.rs b/src/cli/self_update/windows.rs index fb7943cbb7..c1e0702e5f 100644 --- a/src/cli/self_update/windows.rs +++ b/src/cli/self_update/windows.rs @@ -259,6 +259,7 @@ fn has_windows_sdk_libs() -> bool { } /// Run by rustup-gc-$num.exe to delete CARGO_HOME +#[cfg_attr(feature = "otel", tracing::instrument)] pub fn complete_windows_uninstall() -> Result { use std::process::Stdio; @@ -703,6 +704,8 @@ mod tests { use winreg::enums::{RegType, HKEY_CURRENT_USER, KEY_READ, KEY_WRITE}; use winreg::{RegKey, RegValue}; + use rustup_macros::unit_test as test; + use crate::currentprocess; use crate::test::with_saved_path; diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 6dd04ec2d4..4f8aec8cb6 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -7,6 +7,7 @@ use crate::dist::dist::Profile; use crate::process; use crate::utils::utils; +#[cfg_attr(feature = "otel", tracing::instrument)] pub fn main() -> Result { let args: Vec<_> = process().args().collect(); let arg1 = args.get(1).map(|a| &**a); diff --git a/src/config.rs b/src/config.rs index 240dd59c56..acb77d4b5a 100644 --- a/src/config.rs +++ b/src/config.rs @@ -387,6 +387,7 @@ impl Cfg { Ok(toolchain.binary_file(binary)) } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn upgrade_data(&self) -> Result<()> { let current_version = self.settings_file.with(|s| Ok(s.version.clone()))?; @@ -623,6 +624,7 @@ impl Cfg { } } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn find_or_install_override_toolchain_or_default( &self, path: &Path, @@ -731,6 +733,7 @@ impl Cfg { user_opt } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn list_toolchains(&self) -> Result> { if utils::is_directory(&self.toolchains_dir) { let mut toolchains: Vec<_> = utils::read_dir("toolchains", &self.toolchains_dir)? @@ -784,6 +787,7 @@ impl Cfg { Ok(channels.collect()) } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn check_metadata_version(&self) -> Result<()> { utils::assert_is_directory(&self.rustup_dir)?; @@ -887,6 +891,7 @@ impl Cfg { }) } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn get_default_host_triple(&self) -> Result { Ok(self .settings_file @@ -926,6 +931,8 @@ enum ParseMode { #[cfg(test)] mod tests { + use rustup_macros::unit_test as test; + use super::*; #[test] diff --git a/src/currentprocess.rs b/src/currentprocess.rs index f9e579ec9d..1a0bc54e7c 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -268,6 +268,8 @@ mod tests { use std::collections::HashMap; use std::env; + use rustup_macros::unit_test as test; + use super::{process, with, ProcessSource, TestProcess}; #[test] diff --git a/src/diskio/test.rs b/src/diskio/test.rs index 242e26c38a..45bd407e55 100644 --- a/src/diskio/test.rs +++ b/src/diskio/test.rs @@ -2,6 +2,8 @@ use std::collections::HashMap; use anyhow::Result; +use rustup_macros::unit_test as test; + use crate::test::test_dir; use super::{get_executor, Executor, Item, Kind}; @@ -156,21 +158,21 @@ fn test_complete_file(io_threads: &str) -> Result<()> { } #[test] -fn test_incremental_file_immediate() -> Result<()> { - test_incremental_file("1") +fn test_incremental_file_immediate() { + test_incremental_file("1").unwrap() } #[test] -fn test_incremental_file_threaded() -> Result<()> { - test_incremental_file("2") +fn test_incremental_file_threaded() { + test_incremental_file("2").unwrap() } #[test] -fn test_complete_file_immediate() -> Result<()> { - test_complete_file("1") +fn test_complete_file_immediate() { + test_complete_file("1").unwrap() } #[test] -fn test_complete_file_threaded() -> Result<()> { - test_complete_file("2") +fn test_complete_file_threaded() { + test_complete_file("2").unwrap() } diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 480e61595e..cd6f8e6acf 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -650,6 +650,7 @@ pub(crate) fn valid_profile_names() -> String { // an upgrade then all the existing components will be upgraded. // // Returns the manifest's hash if anything changed. +#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn update_from_dist( download: DownloadCfg<'_>, update_hash: Option<&Path>, @@ -664,7 +665,6 @@ pub(crate) fn update_from_dist( ) -> Result> { let fresh_install = !prefix.path().exists(); let hash_exists = update_hash.map(Path::exists).unwrap_or(false); - // fresh_install means the toolchain isn't present, but hash_exists means there is a stray hash file if fresh_install && hash_exists { // It's ok to unwrap, because hash have to exist at this point @@ -1077,6 +1077,8 @@ fn date_from_manifest_date(date_str: &str) -> Option { #[cfg(test)] mod tests { + use rustup_macros::unit_test as test; + use super::*; #[test] diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index a58b5bae86..48ad384211 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -359,6 +359,7 @@ impl Manifestation { } } + #[cfg_attr(feature = "otel", tracing::instrument)] pub fn load_manifest(&self) -> Result> { let prefix = self.installation.prefix(); let old_manifest_path = prefix.manifest_file(DIST_MANIFEST); diff --git a/src/dist/triple.rs b/src/dist/triple.rs index a51e95d303..ad27adb146 100644 --- a/src/dist/triple.rs +++ b/src/dist/triple.rs @@ -97,7 +97,10 @@ impl PartialTargetTriple { #[cfg(test)] mod test { + use rustup_macros::unit_test as test; + use super::*; + #[test] fn test_partial_target_triple_new() { let success_cases = vec![ diff --git a/src/env_var.rs b/src/env_var.rs index 50c66c059d..7d28f054ba 100644 --- a/src/env_var.rs +++ b/src/env_var.rs @@ -38,13 +38,15 @@ pub(crate) fn inc(name: &str, cmd: &mut Command) { #[cfg(test)] mod tests { + use std::collections::HashMap; + use std::ffi::{OsStr, OsString}; + + use rustup_macros::unit_test as test; + use super::*; use crate::currentprocess; use crate::test::{with_saved_path, Env}; - use std::collections::HashMap; - use std::ffi::{OsStr, OsString}; - #[test] fn prepend_unique_path() { let mut vars = HashMap::new(); diff --git a/src/lib.rs b/src/lib.rs index b4e88fa34d..ffe0d8da51 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -100,6 +100,8 @@ pub mod utils; #[cfg(test)] mod tests { + use rustup_macros::unit_test as test; + use crate::{is_proxyable_tools, DUP_TOOLS, TOOLS}; #[test] diff --git a/src/test.rs b/src/test.rs index cbd6fe6513..6914a3ff7c 100644 --- a/src/test.rs +++ b/src/test.rs @@ -169,7 +169,7 @@ macro_rules! for_host { }; } -#[derive(Clone)] +#[derive(Clone, Debug)] /// The smallest form of test isolation: an isolated RUSTUP_HOME, for codepaths /// that read and write config files but do not invoke processes, download data /// etc. @@ -217,3 +217,91 @@ where let rustup_home = RustupHome::new_in(test_dir)?; f(&rustup_home) } + +#[cfg(feature = "otel")] +use once_cell::sync::Lazy; +#[cfg(feature = "otel")] +use tokio; + +/// A tokio runtime for the sync tests, permitting the use of tracing. This is +/// never shutdown, instead it is just dropped at end of process. +#[cfg(feature = "otel")] +static TRACE_RUNTIME: Lazy = + Lazy::new(|| tokio::runtime::Runtime::new().unwrap()); +/// A tracer for the tests. +#[cfg(feature = "otel")] +static TRACER: Lazy = Lazy::new(|| { + use std::time::Duration; + + use opentelemetry::KeyValue; + use opentelemetry::{ + global, + sdk::{ + propagation::TraceContextPropagator, + trace::{self, Sampler}, + Resource, + }, + }; + use opentelemetry_otlp::WithExportConfig; + use tokio::runtime::Handle; + use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; + + // Use the current runtime, or the sync test runtime otherwise. + let handle = match Handle::try_current() { + Ok(handle) => handle, + Err(_) => TRACE_RUNTIME.handle().clone(), + }; + let _guard = handle.enter(); + + let tracer = opentelemetry_otlp::new_pipeline() + .tracing() + .with_exporter( + opentelemetry_otlp::new_exporter() + .tonic() + .with_timeout(Duration::from_secs(3)), + ) + .with_trace_config( + trace::config() + .with_sampler(Sampler::AlwaysOn) + .with_resource(Resource::new(vec![KeyValue::new("service.name", "rustup")])), + ) + .install_batch(opentelemetry::runtime::Tokio) + .unwrap(); + + global::set_text_map_propagator(TraceContextPropagator::new()); + let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("INFO")); + let telemetry = tracing_opentelemetry::layer().with_tracer(tracer.clone()); + let subscriber = Registry::default().with(env_filter).with(telemetry); + tracing::subscriber::set_global_default(subscriber).unwrap(); + tracer +}); + +pub fn before_test() { + #[cfg(feature = "otel")] + { + Lazy::force(&TRACER); + } +} + +pub async fn before_test_async() { + #[cfg(feature = "otel")] + { + Lazy::force(&TRACER); + } +} + +pub fn after_test() { + #[cfg(feature = "otel")] + { + let handle = TRACE_RUNTIME.handle(); + let _guard = handle.enter(); + TRACER.provider().map(|p| p.force_flush()); + } +} + +pub async fn after_test_async() { + #[cfg(feature = "otel")] + { + TRACER.provider().map(|p| p.force_flush()); + } +} diff --git a/src/toolchain.rs b/src/toolchain.rs index 99759ade1d..b88eb4cf6c 100644 --- a/src/toolchain.rs +++ b/src/toolchain.rs @@ -1,4 +1,3 @@ -use std::env; use std::env::consts::EXE_SUFFIX; use std::ffi::OsStr; use std::ffi::OsString; @@ -7,6 +6,7 @@ use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use std::str::FromStr; use std::time::Duration; +use std::{env, fmt::Debug}; use anyhow::{anyhow, bail, Context, Result}; use thiserror::Error as ThisError; @@ -240,6 +240,7 @@ impl<'a> Toolchain<'a> { path } // Distributable and Custom. Installed only. + #[cfg_attr(feature = "otel", tracing::instrument)] pub fn rustc_version(&self) -> String { if let Ok(installed) = self.as_installed_common() { let rustc_path = self.binary_file("rustc"); @@ -521,6 +522,7 @@ impl<'a> InstalledToolchain<'a> for CustomToolchain<'a> { } /// Newtype to facilitate splitting out distributable-toolchain specific code. +#[derive(Debug)] pub struct DistributableToolchain<'a>(&'a Toolchain<'a>); impl<'a> DistributableToolchain<'a> { @@ -803,6 +805,7 @@ impl<'a> DistributableToolchain<'a> { } } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn get_toolchain_desc_with_manifest( &self, ) -> Result> { @@ -824,6 +827,7 @@ impl<'a> DistributableToolchain<'a> { })) } + #[cfg_attr(feature = "otel", tracing::instrument)] pub fn list_components(&self) -> Result> { if let Some(toolchain) = self.get_toolchain_desc_with_manifest()? { toolchain.list_components() diff --git a/src/utils/units.rs b/src/utils/units.rs index 365c99d7c5..7dbf64a632 100644 --- a/src/utils/units.rs +++ b/src/utils/units.rs @@ -77,6 +77,8 @@ impl Display for Size { #[cfg(test)] mod tests { + use rustup_macros::unit_test as test; + #[test] fn unit_formatter_test() { use crate::utils::units::{Size, Unit, UnitMode}; diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 0d065aed04..04ab85117a 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -741,6 +741,8 @@ pub(crate) fn home_dir_from_passwd() -> Option { #[cfg(test)] mod tests { + use rustup_macros::unit_test as test; + use super::*; #[test] diff --git a/tests/mock/clitools.rs b/tests/mock/clitools.rs index 6d4a0d5fe1..64aa9dfaf9 100644 --- a/tests/mock/clitools.rs +++ b/tests/mock/clitools.rs @@ -32,6 +32,7 @@ use crate::mock::topical_doc_data; use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; /// The configuration used by the tests in this module +#[derive(Debug)] pub struct Config { /// Where we put the rustup / rustc / cargo bins pub exedir: PathBuf, @@ -678,6 +679,7 @@ impl Config { output } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn run_inprocess(&self, name: &str, args: I, env: &[(&str, &str)]) -> Output where I: IntoIterator, @@ -957,6 +959,7 @@ impl Release { } } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn link(&self, path: &Path) { // Also create the manifests for releases by version let _ = hard_link( @@ -1009,6 +1012,7 @@ impl Release { } // Creates a mock dist server populated with some test data +#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn create_mock_dist_server(path: &Path, s: Scenario) { let chans = match s { Scenario::None => return, diff --git a/tests/mock/dist.rs b/tests/mock/dist.rs index 8d1aad2b8c..1be0807a8f 100644 --- a/tests/mock/dist.rs +++ b/tests/mock/dist.rs @@ -65,6 +65,7 @@ pub const MOCK_MANIFEST_VERSION: &str = "2"; // A mock Rust v2 distribution server. Create it and and run `write` // to write its structure to a directory. +#[derive(Debug)] pub struct MockDistServer { // The local path to the dist server root pub path: PathBuf, @@ -72,6 +73,7 @@ pub struct MockDistServer { } // A Rust distribution channel +#[derive(Debug)] pub struct MockChannel { // e.g. "nightly" pub name: String, @@ -121,6 +123,7 @@ pub enum ManifestVersion { } impl MockDistServer { + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub fn write(&self, vs: &[ManifestVersion], enable_xz: bool, enable_zst: bool) { fs::create_dir_all(&self.path).unwrap(); @@ -139,6 +142,7 @@ impl MockDistServer { } } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn build_package( &self, channel: &MockChannel, @@ -179,6 +183,7 @@ impl MockDistServer { } // Returns the hash of the tarball + #[cfg_attr(feature = "otel", tracing::instrument(skip_all, fields(format=%format)))] fn build_target_package( &self, channel: &MockChannel, @@ -267,6 +272,7 @@ impl MockDistServer { } // The v1 manifest is just the directory listing of the rust tarballs + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn write_manifest_v1(&self, channel: &MockChannel) { let mut buf = String::new(); let package = channel.packages.iter().find(|p| p.name == "rust").unwrap(); @@ -295,6 +301,7 @@ impl MockDistServer { hard_link(&hash_path, archive_hash_path).unwrap(); } + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn write_manifest_v2( &self, channel: &MockChannel, diff --git a/tests/suite/cli_exact.rs b/tests/suite/cli_exact.rs index d650ab4932..21a6d8a1d2 100644 --- a/tests/suite/cli_exact.rs +++ b/tests/suite/cli_exact.rs @@ -1,9 +1,11 @@ //! Yet more cli test cases. These are testing that the output //! is exactly as expected. -use crate::mock::clitools::{self, set_current_dist_date, with_update_server, Config, Scenario}; use rustup::for_host; use rustup::test::this_host_triple; +use rustup_macros::integration_test as test; + +use crate::mock::clitools::{self, set_current_dist_date, with_update_server, Config, Scenario}; fn test(f: &dyn Fn(&mut Config)) { clitools::test(Scenario::None, f); diff --git a/tests/suite/cli_inst_interactive.rs b/tests/suite/cli_inst_interactive.rs index 0c00ce255a..4d73cea9bf 100644 --- a/tests/suite/cli_inst_interactive.rs +++ b/tests/suite/cli_inst_interactive.rs @@ -8,6 +8,7 @@ use rustup::for_host; use rustup::test::this_host_triple; use rustup::test::with_saved_path; use rustup::utils::raw; +use rustup_macros::integration_test as test; use crate::mock::clitools::{self, set_current_dist_date, Config, SanitizedOutput, Scenario}; diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index b793b2ebfe..1b0f92953e 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -7,6 +7,7 @@ use std::{env::consts::EXE_SUFFIX, path::Path}; use rustup::for_host; use rustup::test::this_host_triple; use rustup::utils::utils; +use rustup_macros::integration_test as test; use crate::mock::clitools::{self, set_current_dist_date, Config, Scenario}; diff --git a/tests/suite/cli_paths.rs b/tests/suite/cli_paths.rs index bf645f802d..7c155dcd5a 100644 --- a/tests/suite/cli_paths.rs +++ b/tests/suite/cli_paths.rs @@ -12,6 +12,7 @@ mod unix { use std::path::PathBuf; use rustup::utils::raw; + use rustup_macros::integration_test as test; use super::INIT_NONE; use crate::mock::clitools::{self, Scenario}; @@ -351,6 +352,7 @@ export PATH="$HOME/apple/bin" #[cfg(windows)] mod windows { use rustup::test::{get_path, with_saved_path}; + use rustup_macros::integration_test as test; use super::INIT_NONE; use crate::mock::clitools::{self, Scenario}; diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 43efd9dd39..8b8588e90c 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -7,6 +7,7 @@ use std::path::{PathBuf, MAIN_SEPARATOR}; use rustup::for_host; use rustup::test::this_host_triple; use rustup::utils::raw; +use rustup_macros::integration_test as test; use crate::mock::{ self, diff --git a/tests/suite/cli_self_upd.rs b/tests/suite/cli_self_upd.rs index d20c502c98..0ad0be95f8 100644 --- a/tests/suite/cli_self_upd.rs +++ b/tests/suite/cli_self_upd.rs @@ -11,6 +11,7 @@ use remove_dir_all::remove_dir_all; use rustup::test::{this_host_triple, with_saved_path}; use rustup::utils::{raw, utils}; use rustup::{for_host, Notification, DUP_TOOLS, TOOLS}; +use rustup_macros::integration_test as test; use crate::mock::{ clitools::{self, output_release_file, self_update_setup, Config, Scenario}, diff --git a/tests/suite/cli_ui.rs b/tests/suite/cli_ui.rs index 3349f81a33..afa8d8831a 100644 --- a/tests/suite/cli_ui.rs +++ b/tests/suite/cli_ui.rs @@ -1,5 +1,7 @@ use std::{fs, path::PathBuf}; +use rustup_macros::integration_test as test; + #[test] fn rustup_ui_doc_text_tests() { let t = trycmd::TestCases::new(); diff --git a/tests/suite/cli_v1.rs b/tests/suite/cli_v1.rs index 10b14cf967..274701fef9 100644 --- a/tests/suite/cli_v1.rs +++ b/tests/suite/cli_v1.rs @@ -4,6 +4,7 @@ use std::fs; use rustup::for_host; +use rustup_macros::integration_test as test; use crate::mock::clitools::{self, set_current_dist_date, Config, Scenario}; diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index ef13462882..54d2c4c3ab 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -7,6 +7,7 @@ use std::io::Write; use rustup::dist::dist::TargetTriple; use rustup::for_host; use rustup::test::this_host_triple; +use rustup_macros::integration_test as test; use crate::mock::clitools::{self, set_current_dist_date, Config, Scenario}; diff --git a/tests/suite/dist.rs b/tests/suite/dist.rs index 87a9db6290..d473792a85 100644 --- a/tests/suite/dist.rs +++ b/tests/suite/dist.rs @@ -24,6 +24,7 @@ use rustup::dist::Notification; use rustup::errors::RustupError; use rustup::utils::raw as utils_raw; use rustup::utils::utils; +use rustup_macros::integration_test as test; use crate::mock::dist::*; use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; diff --git a/tests/suite/dist_install.rs b/tests/suite/dist_install.rs index 9e33c0de06..c26576a8f5 100644 --- a/tests/suite/dist_install.rs +++ b/tests/suite/dist_install.rs @@ -9,6 +9,7 @@ use rustup::dist::prefix::InstallPrefix; use rustup::dist::temp; use rustup::dist::Notification; use rustup::utils::utils; +use rustup_macros::integration_test as test; use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; diff --git a/tests/suite/dist_manifest.rs b/tests/suite/dist_manifest.rs index ab8c77978a..6d4a75c2da 100644 --- a/tests/suite/dist_manifest.rs +++ b/tests/suite/dist_manifest.rs @@ -1,6 +1,7 @@ use rustup::dist::dist::TargetTriple; use rustup::dist::manifest::Manifest; use rustup::RustupError; +use rustup_macros::integration_test as test; // Example manifest from https://public.etherpad-mozilla.org/p/Rust-infra-work-week static EXAMPLE: &str = include_str!("channel-rust-nightly-example.toml"); diff --git a/tests/suite/dist_transactions.rs b/tests/suite/dist_transactions.rs index c4728513a5..b82164c598 100644 --- a/tests/suite/dist_transactions.rs +++ b/tests/suite/dist_transactions.rs @@ -1,3 +1,7 @@ +use std::fs; +use std::io::Write; +use std::path::PathBuf; + use rustup::dist::component::Transaction; use rustup::dist::dist::DEFAULT_DIST_SERVER; use rustup::dist::prefix::InstallPrefix; @@ -6,9 +10,7 @@ use rustup::dist::Notification; use rustup::utils::raw as utils_raw; use rustup::utils::utils; use rustup::RustupError; -use std::fs; -use std::io::Write; -use std::path::PathBuf; +use rustup_macros::integration_test as test; #[test] fn add_file() { From 2c9297d51a077d9a364e98ad8ebaee2301cd0c0d Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 26 Mar 2023 14:27:24 +0200 Subject: [PATCH 015/229] Rework Toolchain model and drop relative file path overrides Relative path overrides permit a freshly downloaded source tree to execute arbitrary code on any rustup command that executes a binary from the configured toolchain, and its a reasonable tradeoff for us to remove this feature. Absolute path overrides are kept intact - these were added to support users of large monorepo tool systems, and can be kept with reasonable safety. Introduce an interior model for toolchain names which allows the elimination of conditional code for custom vs named vs path based toolchains. Fixes #3130. Finishes the separation of Toolchain vs DistributableToolchain vs CustomToolchain started some time ago. Moves some test support into the src tree in order to keep symbols private and adds a 'test' feature required for self-testing, ensuring that that code doesn't affect production builds. Changes the CI debug builds to use the new test feature and also otel, so that otel doesn't bitrot. --- .github/workflows/all-features.yaml | 46 + .../workflows/centos-fmt-clippy-on-all.yaml | 11 +- .github/workflows/linux-builds-on-master.yaml | 4 + .github/workflows/linux-builds-on-pr.yaml | 4 + .github/workflows/linux-builds-on-stable.yaml | 4 + .../workflows/windows-builds-on-master.yaml | 4 +- .github/workflows/windows-builds-on-pr.yaml | 4 +- .../workflows/windows-builds-on-stable.yaml | 4 +- CONTRIBUTING.md | 4 +- Cargo.lock | 113 +- Cargo.toml | 51 +- .../centos-fmt-clippy-template.yaml | 11 +- .../linux-builds-template.yaml | 4 + .../windows-builds-template.yaml | 4 +- ci/run.bash | 14 +- doc/src/environment-variables.md | 7 +- download/src/lib.rs | 11 + src/cli/common.rs | 192 ++-- src/cli/help.rs | 26 +- src/cli/proxy_mode.rs | 38 +- src/cli/rustup_mode.rs | 667 ++++++----- src/cli/self_update.rs | 218 ++-- src/cli/setup_mode.rs | 20 +- src/command.rs | 12 +- src/config.rs | 588 +++++----- src/dist/component/mod.rs | 3 + .../dist/component/tests.rs | 69 +- src/dist/dist.rs | 54 +- src/dist/manifest.rs | 174 +++ .../tests}/channel-rust-nightly-example.toml | 0 .../tests}/channel-rust-nightly-example2.toml | 0 src/dist/manifestation.rs | 3 + .../dist/manifestation/tests.rs | 33 +- src/dist/prefix.rs | 38 +- src/dist/triple.rs | 2 +- src/errors.rs | 37 +- src/install.rs | 184 +-- src/lib.rs | 8 +- src/notifications.rs | 39 +- src/test.rs | 3 + {tests => src/test}/mock/clitools.rs | 96 +- {tests => src/test}/mock/dist.rs | 4 +- {tests => src/test}/mock/mock_bin_src.rs | 0 {tests => src/test}/mock/mod.rs | 2 +- {tests => src/test}/mock/topical_doc_data.rs | 0 src/toolchain.rs | 1009 +---------------- src/toolchain/custom.rs | 47 + src/toolchain/distributable.rs | 535 +++++++++ src/toolchain/names.rs | 700 ++++++++++++ src/toolchain/toolchain.rs | 358 ++++++ src/utils/raw.rs | 27 + src/utils/utils.rs | 62 - .../rustup_default_cmd_help_flag_stdout.toml | 4 +- ...override_cmd_add_cmd_help_flag_stdout.toml | 4 +- ...override_cmd_set_cmd_help_flag_stdout.toml | 4 +- .../rustup_run_cmd_help_flag_stdout.toml | 8 +- ...rustup_toolchain_cmd_help_flag_stdout.toml | 4 +- ...olchain_cmd_link_cmd_help_flag_stdout.toml | 10 +- ...in_cmd_uninstall_cmd_help_flag_stdout.toml | 4 +- .../rustup/rustup_unknown_arg_stdout.toml | 2 +- .../rustup_which_cmd_help_flag_stdout.toml | 8 +- tests/suite/cli_exact.rs | 50 +- tests/suite/cli_inst_interactive.rs | 14 +- tests/suite/cli_misc.rs | 43 +- tests/suite/cli_paths.rs | 4 +- tests/suite/cli_rustup.rs | 189 ++- tests/suite/cli_self_upd.rs | 65 +- tests/suite/cli_v1.rs | 2 +- tests/suite/cli_v2.rs | 33 +- tests/suite/dist_install.rs | 2 +- tests/suite/dist_manifest.rs | 110 -- tests/suite/mod.rs | 3 - tests/test_bonanza.rs | 1 - 73 files changed, 3663 insertions(+), 2449 deletions(-) create mode 100644 .github/workflows/all-features.yaml rename tests/suite/dist_transactions.rs => src/dist/component/tests.rs (91%) rename {tests/suite => src/dist/manifest/tests}/channel-rust-nightly-example.toml (100%) rename {tests/suite => src/dist/manifest/tests}/channel-rust-nightly-example2.toml (100%) rename tests/suite/dist.rs => src/dist/manifestation/tests.rs (98%) rename {tests => src/test}/mock/clitools.rs (96%) rename {tests => src/test}/mock/dist.rs (99%) rename {tests => src/test}/mock/mock_bin_src.rs (100%) rename {tests => src/test}/mock/mod.rs (98%) rename {tests => src/test}/mock/topical_doc_data.rs (100%) create mode 100644 src/toolchain/custom.rs create mode 100644 src/toolchain/distributable.rs create mode 100644 src/toolchain/names.rs create mode 100644 src/toolchain/toolchain.rs delete mode 100644 tests/suite/dist_manifest.rs diff --git a/.github/workflows/all-features.yaml b/.github/workflows/all-features.yaml new file mode 100644 index 0000000000..beb62cece6 --- /dev/null +++ b/.github/workflows/all-features.yaml @@ -0,0 +1,46 @@ +name: AllFeatures (PR) + +# This is an additional workflow to test building with all feature combinations. +# Unlike our main workflows, this doesn't self-test the rustup install scripts, +# nor run on the rust docker images. This permits a smaller workflow without the +# templating and so on. + +on: + pull_request: + branches: + - "*" + - renovate/* + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + # Might add more targets in future. + target: + - x86_64-unknown-linux-gnu + steps: + - name: Clone repo + uses: actions/checkout@v3 + - name: Install rustup stable + run: rustup toolchain install stable --profile minimal + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.x" + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 + - name: Install cargo-all-features + run: cargo install cargo-all-features --git https://github.com/rbtcollins/cargo-all-features.git + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Build every combination + run: | + cargo check-all-features --root-only diff --git a/.github/workflows/centos-fmt-clippy-on-all.yaml b/.github/workflows/centos-fmt-clippy-on-all.yaml index d073a488a2..47f1ca8d06 100644 --- a/.github/workflows/centos-fmt-clippy-on-all.yaml +++ b/.github/workflows/centos-fmt-clippy-on-all.yaml @@ -22,7 +22,8 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - name: Clone repo + uses: actions/checkout@v3 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 @@ -71,6 +72,10 @@ jobs: run: | rustup component add rustfmt rustup component add clippy + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.x' - name: Run the centos check within the docker image run: | docker run \ @@ -91,6 +96,6 @@ jobs: cargo fmt --all --check - name: Run cargo check and clippy run: | - cargo check --all --all-targets + cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --all --all-targets + cargo clippy --all --all-targets --features test diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml index c037f90fcc..1eab933359 100644 --- a/.github/workflows/linux-builds-on-master.yaml +++ b/.github/workflows/linux-builds-on-master.yaml @@ -98,6 +98,10 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml index d5ee9e8cd2..da3da8c630 100644 --- a/.github/workflows/linux-builds-on-pr.yaml +++ b/.github/workflows/linux-builds-on-pr.yaml @@ -92,6 +92,10 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml index 35eed32622..df8b435e1c 100644 --- a/.github/workflows/linux-builds-on-stable.yaml +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -121,6 +121,10 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml index 5f17c53169..186bfc210d 100644 --- a/.github/workflows/windows-builds-on-master.yaml +++ b/.github/workflows/windows-builds-on-master.yaml @@ -113,9 +113,9 @@ jobs: TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | - cargo check --all --all-targets + cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v3 diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml index 7842f91d26..206151b8b8 100644 --- a/.github/workflows/windows-builds-on-pr.yaml +++ b/.github/workflows/windows-builds-on-pr.yaml @@ -107,9 +107,9 @@ jobs: TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | - cargo check --all --all-targets + cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v3 diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml index bcdb3e43e3..d8cc830853 100644 --- a/.github/workflows/windows-builds-on-stable.yaml +++ b/.github/workflows/windows-builds-on-stable.yaml @@ -116,9 +116,9 @@ jobs: TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | - cargo check --all --all-targets + cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v3 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 366deafce0..6e9f70f886 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,7 +2,7 @@ 1. Fork it! 2. Create your feature branch: `git checkout -b my-new-feature` -3. Test it: `cargo test` +3. Test it: `cargo test --features=test` 4. Lint it: `cargo +beta clippy --all --all-targets -- -D warnings` > We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. However, not all lints provided by `cargo clippy` are relevant or applicable to our project. > We may choose to ignore some lints if they are unstable, experimental, or specific to our project. @@ -312,7 +312,7 @@ And [look in Jaeger for a trace](http://localhost:16686/search?service=rustup). The custom macro `rustup_macros::test` adds a prelude and suffix to each test to ensure that there is a tracing context setup, that the test function is a span, -and that the spans from the test are flushed. Build with features=otel to +and that the spans from the test are flushed. Build with features=otel,test to use this feature. ### Adding instrumentation diff --git a/Cargo.lock b/Cargo.lock index 8b3aaf7751..2755ca33e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6342bd4f5a1205d7f41e94a41a901f5647c938cdfa96036338e8533c9d6c2450" +checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" dependencies = [ "anstyle", "anstyle-parse", @@ -164,9 +164,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.6.17" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b70caf9f1b0c045f7da350636435b775a9733adf2df56e8aa2a29210fbc335d4" +checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39" dependencies = [ "async-trait", "axum-core", @@ -219,6 +219,21 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + [[package]] name = "bitflags" version = "1.3.2" @@ -542,6 +557,17 @@ dependencies = [ "parking_lot_core", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.10.6" @@ -1176,6 +1202,12 @@ version = "0.2.142" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +[[package]] +name = "libm" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" + [[package]] name = "libz-sys" version = "1.1.9" @@ -1374,6 +1406,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", + "libm", ] [[package]] @@ -1622,9 +1655,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.26" +version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" +checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" [[package]] name = "ppv-lite86" @@ -1651,6 +1684,27 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" +dependencies = [ + "bit-set", + "bitflags", + "byteorder", + "lazy_static", + "num-traits", + "quick-error 2.0.1", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax 0.6.29", + "rusty-fork", + "tempfile", + "unarray", +] + [[package]] name = "prost" version = "0.11.9" @@ -1716,6 +1770,18 @@ dependencies = [ "unicase", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quick-error" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" + [[package]] name = "quote" version = "1.0.26" @@ -1755,6 +1821,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.7.0" @@ -1980,10 +2055,12 @@ dependencies = [ "chrono", "clap", "clap_complete", + "derivative", "download", "effective-limits", "enum-map", "flate2", + "fs_at", "git-testament", "home", "lazy_static", @@ -1994,6 +2071,7 @@ dependencies = [ "openssl", "opentelemetry", "opentelemetry-otlp", + "proptest", "pulldown-cmark", "rand", "regex", @@ -2023,6 +2101,7 @@ dependencies = [ "wait-timeout", "walkdir", "winapi", + "windows-sys 0.45.0", "winreg 0.50.0", "xz2", "zstd", @@ -2045,6 +2124,18 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error 1.2.3", + "tempfile", + "wait-timeout", +] + [[package]] name = "ryu" version = "1.0.13" @@ -2808,6 +2899,12 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicase" version = "2.6.0" @@ -3212,9 +3309,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5617da7e1f97bf363947d767b91aaf3c2bbc19db7fda9c65af1278713d58e0a2" +checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" dependencies = [ "memchr", ] diff --git a/Cargo.toml b/Cargo.toml index c19a19dd2f..6012ded1d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,9 @@ otel = [ "dep:tokio", ] +# Exports code dependent on private interfaces for the integration test suite +test = ["dep:once_cell", "dep:walkdir"] + # Sorted by alphabetic order [dependencies] anyhow.workspace = true @@ -48,21 +51,19 @@ cfg-if = "1.0" chrono = "0.4" clap = { version = "3", features = ["wrap_help"] } clap_complete = "3" +derivative.workspace = true download = { path = "download", default-features = false } effective-limits = "0.5.5" enum-map = "2.5.0" flate2 = "1" +fs_at.workspace = true git-testament = "0.2" home = "0.5.4" lazy_static.workspace = true libc = "0.2" num_cpus = "1.15" -once_cell.workspace = true +once_cell = { workspace = true, optional = true } opener = "0.6.0" -# Used by `curl` or `reqwest` backend although it isn't imported by our rustup : -# this allows controlling the vendoring status without exposing the presence of -# the download crate. -openssl = { version = "0.10", optional = true } opentelemetry = { workspace = true, optional = true } opentelemetry-otlp = { workspace = true, optional = true } pulldown-cmark = { version = "0.9", default-features = false } @@ -78,8 +79,7 @@ sharded-slab = "0.1.1" strsim = "0.10" tar = "0.4.26" tempfile.workspace = true -# FIXME(issue #1818, #1826, and friends) -term = "=0.5.1" +term = "=0.5.1" # FIXME(issue #1818, #1826, and friends) thiserror.workspace = true threadpool = "1" tokio = { workspace = true, optional = true } @@ -91,9 +91,17 @@ tracing-subscriber = { workspace = true, optional = true, features = [ tracing.workspace = true url.workspace = true wait-timeout = "0.2" +walkdir = { workspace = true, optional = true } xz2 = "0.1.3" zstd = "0.12" +[dependencies.openssl] +# Used by `curl` or `reqwest` backend although it isn't imported by our rustup : +# this allows controlling the vendoring status without exposing the presence of +# the download crate. +optional = true +version = "0.10" + [dependencies.retry] default-features = false features = ["random"] @@ -133,13 +141,28 @@ features = [ ] version = "0.3" +[target."cfg(windows)".dependencies.windows-sys] +features = [ + "Win32_Foundation", + "Win32_Storage_FileSystem", + "Win32_System_SystemServices", + "Win32_System_Threading", + "Win32_System_WindowsProgramming", + "Win32_Security", + "Win32_System_Kernel", + "Win32_System_IO", + "Win32_System_Ioctl", +] +version = "0.45.0" + + [dev-dependencies] enum-map = "2.5.0" once_cell.workspace = true +proptest.workspace = true rustup-macros.workspace = true tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } trycmd = "0.14.13" -walkdir = "2" [build-dependencies] lazy_static = "1" @@ -150,18 +173,24 @@ members = ["download", "rustup-macros"] [workspace.dependencies] anyhow = "1.0.69" +derivative = "2.2.0" +fs_at = "0.1.6" lazy_static = "1" once_cell = "1.17.1" opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.11.0" } +proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.5" thiserror = "1.0" -tokio = { version = "1.26.0", default-features = false } +tokio = { version = "1.26.0", default-features = false, features = [ + "rt-multi-thread", +] } tracing = "0.1" tracing-opentelemetry = { version = "0.18.0" } tracing-subscriber = "0.3.16" url = "2.3" +walkdir = "2" [lib] name = "rustup" @@ -174,3 +203,7 @@ lto = true # Reduce build time by setting proc-macro crates non optimized. [profile.release.build-override] opt-level = 0 + +[package.metadata.cargo-all-features] +# Building with no web backend will error. +always_include_features = ["reqwest-backend", "reqwest-rustls-tls"] diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index d073a488a2..47f1ca8d06 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -22,7 +22,8 @@ jobs: strategy: fail-fast: false steps: - - uses: actions/checkout@v3 + - name: Clone repo + uses: actions/checkout@v3 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 @@ -71,6 +72,10 @@ jobs: run: | rustup component add rustfmt rustup component add clippy + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.x' - name: Run the centos check within the docker image run: | docker run \ @@ -91,6 +96,6 @@ jobs: cargo fmt --all --check - name: Run cargo check and clippy run: | - cargo check --all --all-targets + cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --all --all-targets + cargo clippy --all --all-targets --features test diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 0e10e868fd..8799eb3655 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -130,6 +130,10 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 94c673ca3b..3e102b7c14 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -125,9 +125,9 @@ jobs: TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | - cargo check --all --all-targets + cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v3 diff --git a/ci/run.bash b/ci/run.bash index eae7d8f26a..41eda29eda 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -56,26 +56,28 @@ download_pkg_test() { # Machines have 7GB of RAM, and our target/ contents is large enough that # thrashing will occur if we build-run-build-run rather than -# build-build-build-run-run-run. +# build-build-build-run-run-run. Since this is used soley for non-release +# artifacts, we try to keep features consistent across the builds, whether for +# docs/test/runs etc. build_test() { cmd="$1" shift download_pkg_test "${cmd}" - if [ "build" = "${cmd}" ]; then - target_cargo "${cmd}" --workspace --all-targets + if [ "build" = "${cmd}" ]; then + target_cargo "${cmd}" --workspace --all-targets --features test else # free runners have 2 or 3(mac) cores - target_cargo "${cmd}" --workspace --tests -- --test-threads 2 + target_cargo "${cmd}" --workspace --features test --tests -- --test-threads 2 fi if [ "build" != "${cmd}" ]; then - target_cargo "${cmd}" --doc --workspace + target_cargo "${cmd}" --doc --workspace --features test fi } if [ -z "$SKIP_TESTS" ]; then - cargo run --locked --profile "$BUILD_PROFILE" --target "$TARGET" "${FEATURES[@]}" -- --dump-testament + cargo run --locked --profile "$BUILD_PROFILE" --features test --target "$TARGET" "${FEATURES[@]}" -- --dump-testament build_test build build_test test fi diff --git a/doc/src/environment-variables.md b/doc/src/environment-variables.md index baac718ea1..8ef3351945 100644 --- a/doc/src/environment-variables.md +++ b/doc/src/environment-variables.md @@ -4,9 +4,10 @@ root `rustup` folder, used for storing installed toolchains and configuration options. -- `RUSTUP_TOOLCHAIN` (default: none) If set, will [override] the toolchain - used for all rust tool invocations. A toolchain with this name should be - installed, or invocations will fail. +- `RUSTUP_TOOLCHAIN` (default: none) If set, will [override] the toolchain used + for all rust tool invocations. A toolchain with this name should be installed, + or invocations will fail. This can specify custom toolchains, installable + toolchains, or the absolute path to a toolchain. - `RUSTUP_DIST_SERVER` (default: `https://static.rust-lang.org`) Sets the root URL for downloading static resources related to Rust. You can change this to diff --git a/download/src/lib.rs b/download/src/lib.rs index 812a4e3370..b13361b478 100644 --- a/download/src/lib.rs +++ b/download/src/lib.rs @@ -48,6 +48,7 @@ fn download_with_backend( } type DownloadCallback<'a> = &'a dyn Fn(Event<'_>) -> Result<()>; + pub fn download_to_path_with_backend( backend: Backend, url: &Url, @@ -138,6 +139,9 @@ pub fn download_to_path_with_backend( }) } +#[cfg(all(not(feature = "reqwest-backend"), not(feature = "curl-backend")))] +compile_error!("Must enable at least one backend"); + /// Download via libcurl; encrypt with the native (or OpenSSl) TLS /// stack via libcurl #[cfg(feature = "curl-backend")] @@ -255,10 +259,17 @@ pub mod curl { #[cfg(feature = "reqwest-backend")] pub mod reqwest_be { + #[cfg(all( + not(feature = "reqwest-rustls-tls"), + not(feature = "reqwest-default-tls") + ))] + compile_error!("Must select a reqwest TLS backend"); + use std::io; use std::time::Duration; use anyhow::{anyhow, Context, Result}; + #[cfg(feature = "reqwest-rustls-tls")] use lazy_static::lazy_static; use reqwest::blocking::{Client, ClientBuilder, Response}; use reqwest::{header, Proxy}; diff --git a/src/cli/common.rs b/src/cli/common.rs index 122c0a0f74..36827de323 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -1,5 +1,6 @@ //! Just a dumping ground for cli stuff +use std::fmt::Display; use std::fs; use std::io::{BufRead, ErrorKind, Write}; use std::path::Path; @@ -13,13 +14,15 @@ use term2::Terminal; use super::self_update; use super::term2; -use crate::dist::notifications as dist_notifications; -use crate::process; -use crate::toolchain::DistributableToolchain; use crate::utils::notifications as util_notifications; use crate::utils::notify::NotificationLevel; use crate::utils::utils; -use crate::{Cfg, Notification, Toolchain, UpdateStatus}; +use crate::{dist::dist::ToolchainDesc, install::UpdateStatus}; +use crate::{ + dist::notifications as dist_notifications, toolchain::distributable::DistributableToolchain, +}; +use crate::{process, toolchain::toolchain::Toolchain}; +use crate::{Cfg, Notification}; pub(crate) const WARN_COMPLETE_PROFILE: &str = "downloading with complete profile isn't recommended unless you are a developer of the rust language"; @@ -178,51 +181,71 @@ pub(crate) fn set_globals(verbose: bool, quiet: bool) -> Result { pub(crate) fn show_channel_update( cfg: &Cfg, - name: &str, + name: PackageUpdate, updated: Result, ) -> Result<()> { - show_channel_updates(cfg, vec![(name.to_string(), updated)]) + show_channel_updates(cfg, vec![(name, updated)]) } -fn show_channel_updates(cfg: &Cfg, toolchains: Vec<(String, Result)>) -> Result<()> { - let data = toolchains.into_iter().map(|(name, result)| { - let toolchain = cfg.get_toolchain(&name, false)?; - let mut version: String = toolchain.rustc_version(); - - let banner; - let color; - let mut previous_version: Option = None; - match result { - Ok(UpdateStatus::Installed) => { - banner = "installed"; - color = Some(term2::color::GREEN); - } - Ok(UpdateStatus::Updated(v)) => { - if name == "rustup" { - previous_version = Some(env!("CARGO_PKG_VERSION").into()); - version = v; - } else { - previous_version = Some(v); - } - banner = "updated"; - color = Some(term2::color::GREEN); - } - Ok(UpdateStatus::Unchanged) => { - if name == "rustup" { - version = env!("CARGO_PKG_VERSION").into(); - } - banner = "unchanged"; - color = None; +pub(crate) enum PackageUpdate { + Rustup, + Toolchain(ToolchainDesc), +} + +impl Display for PackageUpdate { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + PackageUpdate::Rustup => write!(f, "rustup"), + PackageUpdate::Toolchain(t) => write!(f, "{t}"), + } + } +} + +fn show_channel_updates( + cfg: &Cfg, + updates: Vec<(PackageUpdate, Result)>, +) -> Result<()> { + let data = updates.into_iter().map(|(pkg, result)| { + let (banner, color) = match &result { + Ok(UpdateStatus::Installed) => ("installed", Some(term2::color::GREEN)), + Ok(UpdateStatus::Updated(_)) => ("updated", Some(term2::color::GREEN)), + Ok(UpdateStatus::Unchanged) => ("unchanged", None), + Err(_) => ("update failed", Some(term2::color::RED)), + }; + + let (previous_version, version) = match &pkg { + PackageUpdate::Rustup => { + let previous_version: Option = match result { + Ok(UpdateStatus::Installed) | Ok(UpdateStatus::Unchanged) | Err(_) => None, + _ => Some(env!("CARGO_PKG_VERSION").into()), + }; + let version = match result { + Err(_) | Ok(UpdateStatus::Installed) | Ok(UpdateStatus::Unchanged) => { + env!("CARGO_PKG_VERSION").into() + } + Ok(UpdateStatus::Updated(v)) => v, + }; + (previous_version, version) } - Err(_) => { - banner = "update failed"; - color = Some(term2::color::RED); + PackageUpdate::Toolchain(name) => { + // this is a bit strange: we don't supply the version we + // presumably had (for Installed and Unchanged), so we query it + // again. Perhaps we can do better. + let version = match Toolchain::new(cfg, name.into()) { + Ok(t) => t.rustc_version(), + Err(_) => String::from("(toolchain not installed)"), + }; + let previous_version: Option = match result { + Ok(UpdateStatus::Installed) | Ok(UpdateStatus::Unchanged) | Err(_) => None, + Ok(UpdateStatus::Updated(v)) => Some(v), + }; + (previous_version, version) } - } + }; - let width = name.len() + 1 + banner.len(); + let width = pkg.to_string().len() + 1 + banner.len(); - Ok((name, banner, width, color, version, previous_version)) + Ok((pkg, banner, width, color, version, previous_version)) }); let mut t = term2::stdout(); @@ -232,7 +255,7 @@ fn show_channel_updates(cfg: &Cfg, toolchains: Vec<(String, Result .iter() .fold(0, |a, &(_, _, width, _, _, _)| cmp::max(a, width)); - for (name, banner, width, color, version, previous_version) in data { + for (pkg, banner, width, color, version, previous_version) in data { let padding = max_width - width; let padding: String = " ".repeat(padding); let _ = write!(t, " {padding}"); @@ -240,8 +263,7 @@ fn show_channel_updates(cfg: &Cfg, toolchains: Vec<(String, Result if let Some(color) = color { let _ = t.fg(color); } - let _ = write!(t, "{name} "); - let _ = write!(t, "{banner}"); + let _ = write!(t, "{pkg} {banner}"); let _ = t.reset(); let _ = write!(t, " - {version}"); if let Some(previous_version) = previous_version { @@ -269,7 +291,11 @@ pub(crate) fn update_all_channels( if !toolchains.is_empty() { writeln!(process().stdout())?; - show_channel_updates(cfg, toolchains)?; + let t = toolchains + .into_iter() + .map(|(p, s)| (PackageUpdate::Toolchain(p), s)) + .collect(); + show_channel_updates(cfg, t)?; } Ok(utils::ExitCode(0)) }; @@ -342,10 +368,12 @@ where Ok(utils::ExitCode(0)) } -pub(crate) fn list_targets(toolchain: &Toolchain<'_>) -> Result { +pub(crate) fn list_targets(distributable: DistributableToolchain<'_>) -> Result { let mut t = term2::stdout(); - let distributable = DistributableToolchain::new_for_components(toolchain)?; - let components = distributable.list_components()?; + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + let components = manifest.query_components(distributable.desc(), &config)?; for component in components { if component.component.short_name_in_manifest() == "rust-std" { let target = component @@ -366,10 +394,14 @@ pub(crate) fn list_targets(toolchain: &Toolchain<'_>) -> Result Ok(utils::ExitCode(0)) } -pub(crate) fn list_installed_targets(toolchain: &Toolchain<'_>) -> Result { +pub(crate) fn list_installed_targets( + distributable: DistributableToolchain<'_>, +) -> Result { let mut t = term2::stdout(); - let distributable = DistributableToolchain::new_for_components(toolchain)?; - let components = distributable.list_components()?; + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + let components = manifest.query_components(distributable.desc(), &config)?; for component in components { if component.component.short_name_in_manifest() == "rust-std" { let target = component @@ -385,10 +417,14 @@ pub(crate) fn list_installed_targets(toolchain: &Toolchain<'_>) -> Result) -> Result { +pub(crate) fn list_components( + distributable: DistributableToolchain<'_>, +) -> Result { let mut t = term2::stdout(); - let distributable = DistributableToolchain::new_for_components(toolchain)?; - let components = distributable.list_components()?; + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + let components = manifest.query_components(distributable.desc(), &config)?; for component in components { let name = component.name; if component.installed { @@ -403,16 +439,19 @@ pub(crate) fn list_components(toolchain: &Toolchain<'_>) -> Result) -> Result { +pub(crate) fn list_installed_components(distributable: DistributableToolchain<'_>) -> Result<()> { let mut t = term2::stdout(); - let distributable = DistributableToolchain::new_for_components(toolchain)?; - let components = distributable.list_components()?; + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + let components = manifest.query_components(distributable.desc(), &config)?; + for component in components { if component.installed { writeln!(t, "{}", component.name)?; } } - Ok(utils::ExitCode(0)) + Ok(()) } fn print_toolchain_path( @@ -422,11 +461,7 @@ fn print_toolchain_path( if_override: &str, verbose: bool, ) -> Result<()> { - let toolchain_path = { - let mut t_path = cfg.toolchains_dir.clone(); - t_path.push(toolchain); - t_path - }; + let toolchain_path = cfg.toolchains_dir.join(toolchain); let toolchain_meta = fs::symlink_metadata(&toolchain_path)?; let toolchain_path = if verbose { if toolchain_meta.is_dir() { @@ -449,35 +484,42 @@ fn print_toolchain_path( } pub(crate) fn list_toolchains(cfg: &Cfg, verbose: bool) -> Result { - let toolchains = cfg.list_toolchains()?; + // Work with LocalToolchainName to accomdate path based overrides + let toolchains = cfg + .list_toolchains()? + .iter() + .map(Into::into) + .collect::>(); if toolchains.is_empty() { writeln!(process().stdout(), "no installed toolchains")?; } else { - let def_toolchain_name = if let Ok(Some(def_toolchain)) = cfg.find_default() { - def_toolchain.name().to_string() - } else { - String::new() - }; + let def_toolchain_name = cfg.get_default()?.map(|t| (&t).into()); let cwd = utils::current_dir()?; let ovr_toolchain_name = if let Ok(Some((toolchain, _reason))) = cfg.find_override(&cwd) { - toolchain.name().to_string() + Some(toolchain) } else { - String::new() + None }; for toolchain in toolchains { - let if_default = if def_toolchain_name == *toolchain { + let if_default = if def_toolchain_name.as_ref() == Some(&toolchain) { " (default)" } else { "" }; - let if_override = if ovr_toolchain_name == *toolchain { + let if_override = if ovr_toolchain_name.as_ref() == Some(&toolchain) { " (override)" } else { "" }; - print_toolchain_path(cfg, &toolchain, if_default, if_override, verbose) - .context("Failed to list toolchains' directories")?; + print_toolchain_path( + cfg, + &toolchain.to_string(), + if_default, + if_override, + verbose, + ) + .context("Failed to list toolchains' directories")?; } } Ok(utils::ExitCode(0)) diff --git a/src/cli/help.rs b/src/cli/help.rs index 20e22bc879..40591b9b6b 100644 --- a/src/cli/help.rs +++ b/src/cli/help.rs @@ -48,8 +48,8 @@ pub(crate) static TOOLCHAIN_HELP: &str = r"DISCUSSION: installation of the Rust compiler. `rustup` supports multiple types of toolchains. The most basic track the official release channels: 'stable', 'beta' and 'nightly'; but `rustup` can also - install toolchains from the official archives, for alternate host - platforms, and from local builds. + install specific toolchains from the official archives, toolchains for + alternate host platforms, and from local builds ('custom toolchains'). Standard release channel toolchain names have the following form: @@ -87,10 +87,12 @@ pub(crate) static TOOLCHAIN_HELP: &str = r"DISCUSSION: pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"DISCUSSION: 'toolchain' is the custom name to be assigned to the new toolchain. - Any name is permitted as long as it does not fully match an initial - substring of a standard release channel. For example, you can use - the names 'latest' or '2017-04-01' but you cannot use 'stable' or - 'beta-i686' or 'nightly-x86_64-unknown-linux-gnu'. + Any name is permitted as long as: + - it does not include '/' or '\' except as the last character + - it is not equal to 'none' + - it does not fully match an initialsubstring of a standard release channel. + For example, you can use the names 'latest' or '2017-04-01' but you cannot + use 'stable' or 'beta-i686' or 'nightly-x86_64-unknown-linux-gnu'. 'path' specifies the directory where the binaries and libraries for the custom toolchain can be found. For example, when used for @@ -274,9 +276,19 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: $ rustup completions zsh cargo > ~/.zfunc/_cargo"; -pub(crate) static TOOLCHAIN_ARG_HELP: &str = "Toolchain name, such as 'stable', 'nightly', \ +pub(crate) static OFFICIAL_TOOLCHAIN_ARG_HELP: &str = + "Toolchain name, such as 'stable', 'nightly', \ or '1.8.0'. For more information see `rustup \ help toolchain`"; +pub(crate) static RESOLVABLE_LOCAL_TOOLCHAIN_ARG_HELP: &str = "Toolchain name, such as 'stable', 'nightly', \ + '1.8.0', or a custom toolchain name, or an absolute path. For more \ + information see `rustup help toolchain`"; +pub(crate) static RESOLVABLE_TOOLCHAIN_ARG_HELP: &str = "Toolchain name, such as 'stable', 'nightly', \ + '1.8.0', or a custom toolchain name. For more information see `rustup \ + help toolchain`"; +pub(crate) static MAYBE_RESOLVABLE_TOOLCHAIN_ARG_HELP: &str = "'none', a toolchain name, such as 'stable', 'nightly', \ + '1.8.0', or a custom toolchain name. For more information see `rustup \ + help toolchain`"; pub(crate) static TOPIC_ARG_HELP: &str = "Topic such as 'core', 'fn', 'usize', 'eprintln!', \ 'core::arch', 'alloc::format!', 'std::fs', \ diff --git a/src/cli/proxy_mode.rs b/src/cli/proxy_mode.rs index 52813f4f01..becb49a4e0 100644 --- a/src/cli/proxy_mode.rs +++ b/src/cli/proxy_mode.rs @@ -2,12 +2,13 @@ use std::ffi::OsString; use anyhow::Result; -use super::common::set_globals; -use super::job; -use super::self_update; -use crate::command::run_command_for_dir; -use crate::utils::utils::{self, ExitCode}; -use crate::Cfg; +use crate::{ + cli::{common::set_globals, job, self_update}, + command::run_command_for_dir, + toolchain::names::{LocalToolchainName, ResolvableLocalToolchainName}, + utils::utils::{self, ExitCode}, + Cfg, +}; #[cfg_attr(feature = "otel", tracing::instrument)] pub fn main(arg0: &str) -> Result { @@ -18,23 +19,26 @@ pub fn main(arg0: &str) -> Result { let mut args = crate::process().args_os().skip(1); - // Check for a toolchain specifier. + // Check for a + toolchain specifier let arg1 = args.next(); - let toolchain_arg = arg1 + let toolchain = arg1 .as_ref() .map(|arg| arg.to_string_lossy()) - .filter(|arg| arg.starts_with('+')); - let toolchain = toolchain_arg.as_ref().map(|a| &a[1..]); + .filter(|arg| arg.starts_with('+')) + .map(|name| ResolvableLocalToolchainName::try_from(&name.as_ref()[1..])) + .transpose()?; // Build command args now while we know whether or not to skip arg 1. - let cmd_args: Vec<_> = if toolchain.is_none() { - crate::process().args_os().skip(1).collect() - } else { - crate::process().args_os().skip(2).collect() - }; + let cmd_args: Vec<_> = crate::process() + .args_os() + .skip(1 + toolchain.is_some() as usize) + .collect(); let cfg = set_globals(false, true)?; cfg.check_metadata_version()?; + let toolchain = toolchain + .map(|t| t.resolve(&cfg.get_default_host_triple()?)) + .transpose()?; direct_proxy(&cfg, arg0, toolchain, &cmd_args)? }; @@ -45,12 +49,12 @@ pub fn main(arg0: &str) -> Result { fn direct_proxy( cfg: &Cfg, arg0: &str, - toolchain: Option<&str>, + toolchain: Option, args: &[OsString], ) -> Result { let cmd = match toolchain { None => cfg.create_command_for_dir(&utils::current_dir()?, arg0)?, - Some(tc) => cfg.create_command_for_toolchain(tc, false, arg0)?, + Some(tc) => cfg.create_command_for_toolchain(&tc, false, arg0)?, }; run_command_for_dir(cmd, arg0, args) } diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 8960d9de29..56d3c5c0cd 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -4,31 +4,43 @@ use std::path::{Path, PathBuf}; use std::process; use std::str::FromStr; -use anyhow::{anyhow, bail, Error, Result}; +use anyhow::{anyhow, Error, Result}; use clap::{ builder::{EnumValueParser, PossibleValuesParser}, AppSettings, Arg, ArgAction, ArgEnum, ArgGroup, ArgMatches, Command, PossibleValue, }; use clap_complete::Shell; -use super::help::*; -use super::self_update; -use super::term2; -use super::term2::Terminal; -use super::topical_doc; -use super::{ - common, - self_update::{check_rustup_update, SelfUpdateMode}, +use crate::{ + cli::{ + common::{self, PackageUpdate}, + errors::CLIError, + help::*, + self_update::{self, check_rustup_update, SelfUpdateMode}, + term2::{self, Terminal}, + topical_doc, + }, + command, + dist::{ + dist::{PartialToolchainDesc, Profile, TargetTriple}, + manifest::{Component, ComponentStatus}, + }, + errors::RustupError, + install::UpdateStatus, + process, + toolchain::{ + distributable::DistributableToolchain, + names::{ + custom_toolchain_name_parser, maybe_resolvable_toolchainame_parser, + partial_toolchain_desc_parser, resolvable_local_toolchainame_parser, + resolvable_toolchainame_parser, CustomToolchainName, MaybeResolvableToolchainName, + ResolvableLocalToolchainName, ResolvableToolchainName, ToolchainName, + }, + toolchain::Toolchain, + }, + utils::utils, + Cfg, Notification, }; -use crate::cli::errors::CLIError; -use crate::dist::dist::{PartialTargetTriple, PartialToolchainDesc, Profile, TargetTriple}; -use crate::dist::manifest::Component; -use crate::errors::RustupError; -use crate::process; -use crate::toolchain::{CustomToolchain, DistributableToolchain}; -use crate::utils::utils; -use crate::Notification; -use crate::{command, Cfg, ComponentStatus, Toolchain}; const TOOLCHAIN_OVERRIDE_ERROR: &str = "To override the toolchain using the 'rustup +toolchain' syntax, \ @@ -90,7 +102,7 @@ pub fn main() -> Result { if let Some(t) = process().args().find(|x| x.starts_with('+')) { debug!("Fetching rustc version from toolchain `{}`", t); - cfg.set_toolchain_override(&t[1..]); + cfg.set_toolchain_override(&ResolvableToolchainName::try_from(&t[1..])?); } let toolchain = cfg.find_or_install_override_toolchain_or_default(&cwd)?.0; @@ -127,8 +139,8 @@ pub fn main() -> Result { let quiet = matches.get_flag("quiet"); let cfg = &mut common::set_globals(verbose, quiet)?; - if let Some(t) = matches.get_one::("+toolchain") { - cfg.set_toolchain_override(&t[1..]); + if let Some(t) = matches.get_one::("+toolchain") { + cfg.set_toolchain_override(t); } if maybe_upgrade_data(cfg, &matches)? { @@ -252,12 +264,10 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("+toolchain") .help("release channel (e.g. +stable) or custom toolchain to set override") .value_parser(|s: &str| { - if s.starts_with('+') { - Ok(s.to_owned()) + if let Some(stripped) = s.strip_prefix('+') { + ResolvableToolchainName::try_from(stripped).map_err(|e| clap::Error::raw(clap::ErrorKind::InvalidValue, e)) } else { - Err(format!( - "\"{s}\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. {TOOLCHAIN_OVERRIDE_ERROR}" - )) + Err(clap::Error::raw(clap::ErrorKind::InvalidSubcommand, format!("\"{s}\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. {TOOLCHAIN_OVERRIDE_ERROR}"))) } }), ) @@ -294,8 +304,9 @@ pub(crate) fn cli() -> Command<'static> { .hide(true) // synonym for 'toolchain install' .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(true) + .value_parser(partial_toolchain_desc_parser) .takes_value(true) .multiple_values(true) ) @@ -329,8 +340,9 @@ pub(crate) fn cli() -> Command<'static> { .hide(true) // synonym for 'toolchain uninstall' .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) + .value_parser(resolvable_toolchainame_parser) .takes_value(true) .multiple_values(true), ), @@ -342,8 +354,9 @@ pub(crate) fn cli() -> Command<'static> { .after_help(UPDATE_HELP) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(false) + .value_parser(partial_toolchain_desc_parser) .takes_value(true) .multiple_values(true), ) @@ -373,8 +386,9 @@ pub(crate) fn cli() -> Command<'static> { .after_help(DEFAULT_HELP) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(MAYBE_RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(false) + .value_parser(maybe_resolvable_toolchainame_parser) ), ) .subcommand( @@ -395,8 +409,9 @@ pub(crate) fn cli() -> Command<'static> { .aliases(&["update", "add"]) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(true) + .value_parser( partial_toolchain_desc_parser) .takes_value(true) .multiple_values(true), ) @@ -461,8 +476,9 @@ pub(crate) fn cli() -> Command<'static> { .alias("remove") .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) + .value_parser(resolvable_toolchainame_parser) .takes_value(true) .multiple_values(true), ), @@ -474,7 +490,8 @@ pub(crate) fn cli() -> Command<'static> { .arg( Arg::new("toolchain") .help("Custom toolchain name") - .required(true), + .required(true) + .value_parser(custom_toolchain_name_parser), ) .arg( Arg::new("path") @@ -492,8 +509,9 @@ pub(crate) fn cli() -> Command<'static> { .about("List installed and available targets") .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") + .value_parser(partial_toolchain_desc_parser) .takes_value(true), ) .arg( @@ -519,9 +537,10 @@ pub(crate) fn cli() -> Command<'static> { ) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser(partial_toolchain_desc_parser), ), ) .subcommand( @@ -537,9 +556,10 @@ pub(crate) fn cli() -> Command<'static> { ) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser(partial_toolchain_desc_parser), ), ), ) @@ -552,9 +572,10 @@ pub(crate) fn cli() -> Command<'static> { .about("List installed and available components") .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser(partial_toolchain_desc_parser), ) .arg( Arg::new("installed") @@ -570,9 +591,10 @@ pub(crate) fn cli() -> Command<'static> { .takes_value(true).multiple_values(true)) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser( partial_toolchain_desc_parser), ) .arg( Arg::new("target") @@ -587,9 +609,10 @@ pub(crate) fn cli() -> Command<'static> { .takes_value(true).multiple_values(true)) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser( partial_toolchain_desc_parser), ) .arg( Arg::new("target") @@ -612,9 +635,10 @@ pub(crate) fn cli() -> Command<'static> { .alias("add") .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) - .takes_value(true), + .takes_value(true) + .value_parser(resolvable_toolchainame_parser), ) .arg( Arg::new("path") @@ -649,9 +673,10 @@ pub(crate) fn cli() -> Command<'static> { .trailing_var_arg(true) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(RESOLVABLE_LOCAL_TOOLCHAIN_ARG_HELP) .required(true) - .takes_value(true), + .takes_value(true) + .value_parser(resolvable_local_toolchainame_parser), ) .arg( Arg::new("command") @@ -673,9 +698,10 @@ pub(crate) fn cli() -> Command<'static> { .arg(Arg::new("command").required(true)) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser(resolvable_toolchainame_parser), ), ) .subcommand( @@ -691,9 +717,10 @@ pub(crate) fn cli() -> Command<'static> { ) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser(partial_toolchain_desc_parser), ) .arg(Arg::new("topic").help(TOPIC_ARG_HELP)) .group( @@ -719,9 +746,10 @@ pub(crate) fn cli() -> Command<'static> { .arg(Arg::new("command").required(true)) .arg( Arg::new("toolchain") - .help(TOOLCHAIN_ARG_HELP) + .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true), + .takes_value(true) + .value_parser(partial_toolchain_desc_parser), ), ); } @@ -807,123 +835,37 @@ fn maybe_upgrade_data(cfg: &Cfg, m: &ArgMatches) -> Result { } } -fn update_bare_triple_check(cfg: &Cfg, name: &str) -> Result<()> { - if let Some(triple) = PartialTargetTriple::new(name) { - warn!("(partial) target triple specified instead of toolchain name"); - let installed_toolchains = cfg.list_toolchains()?; - let default = cfg.find_default()?; - let default_name = default.map(|t| t.name().to_string()).unwrap_or_default(); - let mut candidates = vec![]; - for t in installed_toolchains { - if t == default_name { - continue; - } - if let Ok(desc) = PartialToolchainDesc::from_str(&t) { - fn triple_comp_eq(given: &str, from_desc: Option<&String>) -> bool { - from_desc.map_or(false, |s| *s == *given) - } - - let triple_matches = triple - .arch - .as_ref() - .map_or(true, |s| triple_comp_eq(s, desc.target.arch.as_ref())) - && triple - .os - .as_ref() - .map_or(true, |s| triple_comp_eq(s, desc.target.os.as_ref())) - && triple - .env - .as_ref() - .map_or(true, |s| triple_comp_eq(s, desc.target.env.as_ref())); - if triple_matches { - candidates.push(t); - } - } - } - match candidates.len() { - 0 => err!("no candidate toolchains found"), - 1 => writeln!( - process().stdout(), - "\nyou may use the following toolchain: {}\n", - candidates[0] - )?, - _ => { - writeln!( - process().stdout(), - "\nyou may use one of the following toolchains:" - )?; - for n in &candidates { - writeln!(process().stdout(), "{n}")?; - } - writeln!(process().stdout(),)?; +fn default_(cfg: &Cfg, m: &ArgMatches) -> Result { + if let Some(toolchain) = m.get_one::("toolchain") { + match toolchain.to_owned() { + MaybeResolvableToolchainName::None => { + cfg.set_default(None)?; } - } - bail!(RustupError::ToolchainNotInstalled(name.to_string())); - } - Ok(()) -} - -fn default_bare_triple_check(cfg: &Cfg, name: &str) -> Result<()> { - if let Some(triple) = PartialTargetTriple::new(name) { - warn!("(partial) target triple specified instead of toolchain name"); - let default = cfg.find_default()?; - let default_name = default.map(|t| t.name().to_string()).unwrap_or_default(); - if let Ok(mut desc) = PartialToolchainDesc::from_str(&default_name) { - desc.target = triple; - let maybe_toolchain = format!("{desc}"); - let toolchain = cfg.get_toolchain(maybe_toolchain.as_ref(), false)?; - if toolchain.name() == default_name { - warn!( - "(partial) triple '{}' resolves to a toolchain that is already default", - name - ); - } else { - writeln!( - process().stdout(), - "\nyou may use the following toolchain: {}\n", - toolchain.name() - )?; + MaybeResolvableToolchainName::Some(ResolvableToolchainName::Custom(toolchain_name)) => { + Toolchain::new(cfg, (&toolchain_name).into())?; + cfg.set_default(Some(&toolchain_name.into()))?; } - return Err(RustupError::ToolchainNotInstalled(name.to_string()).into()); - } - } - Ok(()) -} + MaybeResolvableToolchainName::Some(ResolvableToolchainName::Official(toolchain)) => { + let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?; + let status = DistributableToolchain::install_if_not_installed(cfg, &desc)?; -fn default_(cfg: &Cfg, m: &ArgMatches) -> Result { - if let Some(toolchain) = m.get_one::("toolchain") { - default_bare_triple_check(cfg, toolchain)?; - let toolchain = cfg.get_toolchain(toolchain, false)?; - - let status = if !toolchain.is_custom() { - let distributable = DistributableToolchain::new(&toolchain)?; - Some(distributable.install_from_dist_if_not_installed()?) - } else if !toolchain.exists() && toolchain.name() != "none" { - return Err(RustupError::ToolchainNotInstalled(toolchain.name().to_string()).into()); - } else { - None - }; + cfg.set_default(Some(&(&desc).into()))?; - toolchain.make_default()?; + writeln!(process().stdout())?; - if let Some(status) = status { - writeln!(process().stdout())?; - common::show_channel_update(cfg, toolchain.name(), Ok(status))?; - } + common::show_channel_update(cfg, PackageUpdate::Toolchain(desc), Ok(status))?; + } + }; let cwd = utils::current_dir()?; if let Some((toolchain, reason)) = cfg.find_override(&cwd)? { - info!( - "note that the toolchain '{}' is currently in use ({})", - toolchain.name(), - reason - ); + info!("note that the toolchain '{toolchain}' is currently in use ({reason})"); } } else { - let default_toolchain: Result = cfg + let default_toolchain = cfg .get_default()? - .ok_or_else(|| anyhow!("no default toolchain configured")); - writeln!(process().stdout(), "{} (default)", default_toolchain?)?; + .ok_or_else(|| anyhow!("no default toolchain configured"))?; + writeln!(process().stdout(), "{default_toolchain} (default)")?; } Ok(utils::ExitCode(0)) @@ -934,39 +876,34 @@ fn check_updates(cfg: &Cfg) -> Result { let channels = cfg.list_channels()?; for channel in channels { - match channel { - (ref name, Ok(ref toolchain)) => { - let distributable = DistributableToolchain::new(toolchain)?; - let current_version = distributable.show_version()?; - let dist_version = distributable.show_dist_version()?; - let _ = t.attr(term2::Attr::Bold); - write!(t, "{name} - ")?; - match (current_version, dist_version) { - (None, None) => { - let _ = t.fg(term2::color::RED); - writeln!(t, "Cannot identify installed or update versions")?; - } - (Some(cv), None) => { - let _ = t.fg(term2::color::GREEN); - write!(t, "Up to date")?; - let _ = t.reset(); - writeln!(t, " : {cv}")?; - } - (Some(cv), Some(dv)) => { - let _ = t.fg(term2::color::YELLOW); - write!(t, "Update available")?; - let _ = t.reset(); - writeln!(t, " : {cv} -> {dv}")?; - } - (None, Some(dv)) => { - let _ = t.fg(term2::color::YELLOW); - write!(t, "Update available")?; - let _ = t.reset(); - writeln!(t, " : (Unknown version) -> {dv}")?; - } - } + let (name, distributable) = channel; + let current_version = distributable.show_version()?; + let dist_version = distributable.show_dist_version()?; + let _ = t.attr(term2::Attr::Bold); + write!(t, "{name} - ")?; + match (current_version, dist_version) { + (None, None) => { + let _ = t.fg(term2::color::RED); + writeln!(t, "Cannot identify installed or update versions")?; + } + (Some(cv), None) => { + let _ = t.fg(term2::color::GREEN); + write!(t, "Up to date")?; + let _ = t.reset(); + writeln!(t, " : {cv}")?; + } + (Some(cv), Some(dv)) => { + let _ = t.fg(term2::color::YELLOW); + write!(t, "Update available")?; + let _ = t.reset(); + writeln!(t, " : {cv} -> {dv}")?; + } + (None, Some(dv)) => { + let _ = t.fg(term2::color::YELLOW); + write!(t, "Update available")?; + let _ = t.reset(); + writeln!(t, " : (Unknown version) -> {dv}")?; } - (_, Err(err)) => return Err(err), } } @@ -993,72 +930,68 @@ fn update(cfg: &mut Cfg, m: &ArgMatches) -> Result { if cfg.get_profile()? == Profile::Complete { warn!("{}", common::WARN_COMPLETE_PROFILE); } - if let Ok(Some(names)) = m.try_get_many::("toolchain") { - for name in names { - update_bare_triple_check(cfg, name)?; - - let toolchain_has_triple = match PartialToolchainDesc::from_str(name) { - Ok(x) => x.has_triple(), - _ => false, - }; - - if toolchain_has_triple { + if let Ok(Some(names)) = m.try_get_many::("toolchain") { + for name in names.map(|n| n.to_owned()) { + // This needs another pass to fix it all up + if name.has_triple() { let host_arch = TargetTriple::from_host_or_build(); - if let Ok(partial_toolchain_desc) = PartialToolchainDesc::from_str(name) { - let target_triple = partial_toolchain_desc.resolve(&host_arch)?.target; - if !forced && !host_arch.can_run(&target_triple)? { - err!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain as the default."); - warn!( - "toolchain '{}' may not be able to run on this system.", - name - ); - warn!( + + let target_triple = name.clone().resolve(&host_arch)?.target; + if !forced && !host_arch.can_run(&target_triple)? { + err!("DEPRECATED: future versions of rustup will require --force-non-host to install a non-host toolchain."); + warn!("toolchain '{name}' may not be able to run on this system."); + warn!( "If you meant to build software to target that platform, perhaps try `rustup target add {}` instead?", target_triple.to_string() ); - } } } + let desc = name.resolve(&cfg.get_default_host_triple()?)?; - let toolchain = cfg.get_toolchain(name, false)?; - - let status = if !toolchain.is_custom() { - let components: Vec<_> = m - .try_get_many::("components") - .ok() - .flatten() - .map_or_else(Vec::new, |v| v.map(|s| &**s).collect()); - let targets: Vec<_> = m - .try_get_many::("targets") - .ok() - .flatten() - .map_or_else(Vec::new, |v| v.map(|s| &**s).collect()); - let distributable = DistributableToolchain::new(&toolchain)?; - Some(distributable.install_from_dist( - m.get_flag("force"), - matches!(m.try_get_one::("allow-downgrade"), Ok(Some(true))), - &components, - &targets, - None, - )?) - } else if !toolchain.exists() { - bail!(RustupError::InvalidToolchainName( - toolchain.name().to_string() - )); - } else { - None + let components: Vec<_> = m + .try_get_many::("components") + .ok() + .flatten() + .map_or_else(Vec::new, |v| v.map(|s| &**s).collect()); + let targets: Vec<_> = m + .try_get_many::("targets") + .ok() + .flatten() + .map_or_else(Vec::new, |v| v.map(|s| &**s).collect()); + + let force = m.get_flag("force"); + let allow_downgrade = + matches!(m.try_get_one::("allow-downgrade"), Ok(Some(true))); + let profile = cfg.get_profile()?; + let status = match crate::toolchain::distributable::DistributableToolchain::new( + cfg, + desc.clone(), + ) { + Ok(mut d) => { + d.update_extra(&components, &targets, profile, force, allow_downgrade)? + } + Err(RustupError::ToolchainNotInstalled(_)) => { + crate::toolchain::distributable::DistributableToolchain::install( + cfg, + &desc, + &components, + &targets, + profile, + force, + )? + .0 + } + Err(e) => Err(e)?, }; - if let Some(status) = status.clone() { - writeln!(process().stdout())?; - common::show_channel_update(cfg, toolchain.name(), Ok(status))?; - } - - if cfg.get_default()?.is_none() { - use crate::UpdateStatus; - if let Some(UpdateStatus::Installed) = status { - toolchain.make_default()?; - } + writeln!(process().stdout())?; + common::show_channel_update( + cfg, + PackageUpdate::Toolchain(desc.clone()), + Ok(status.clone()), + )?; + if cfg.get_default()?.is_none() && matches!(status, UpdateStatus::Installed) { + cfg.set_default(Some(&desc.into()))?; } } if self_update { @@ -1084,10 +1017,13 @@ fn update(cfg: &mut Cfg, m: &ArgMatches) -> Result { } fn run(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m.get_one::("toolchain").unwrap(); + let toolchain = m + .get_one::("toolchain") + .unwrap(); let args = m.get_many::("command").unwrap(); let args: Vec<_> = args.collect(); - let cmd = cfg.create_command_for_toolchain(toolchain, m.get_flag("install"), args[0])?; + let toolchain = toolchain.resolve(&cfg.get_default_host_triple()?)?; + let cmd = cfg.create_command_for_toolchain(&toolchain, m.get_flag("install"), args[0])?; let code = command::run_command_for_dir(cmd, args[0], &args[1..])?; Ok(code) @@ -1095,8 +1031,9 @@ fn run(cfg: &Cfg, m: &ArgMatches) -> Result { fn which(cfg: &Cfg, m: &ArgMatches) -> Result { let binary = m.get_one::("command").unwrap(); - let binary_path = if let Some(toolchain) = m.get_one::("toolchain") { - cfg.which_binary_by_toolchain(toolchain, binary)? + let binary_path = if let Some(toolchain) = m.get_one::("toolchain") { + let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?; + Toolchain::new(cfg, desc.into())?.binary_file(binary) } else { cfg.which_binary(&utils::current_dir()?, binary)? }; @@ -1137,8 +1074,15 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { // active_toolchain will carry the reason we don't have one in its detail. let active_targets = if let Ok(ref at) = active_toolchain { - if let Ok(distributable) = DistributableToolchain::new(&at.0) { - match distributable.list_components() { + if let Ok(distributable) = DistributableToolchain::try_from(&at.0) { + let components = (|| { + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + manifest.query_components(distributable.desc(), &config) + })(); + + match components { Ok(cs_vec) => cs_vec .into_iter() .filter(|c| c.component.short_name_in_manifest() == "rust-std") @@ -1174,10 +1118,9 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { if show_headers { print_header::(&mut t, "installed toolchains")?; } - let default_name: Result = cfg + let default_name = cfg .get_default()? - .ok_or_else(|| anyhow!("no default toolchain configured")); - let default_name = default_name?; + .ok_or_else(|| anyhow!("no default toolchain configured"))?; for it in installed_toolchains { if default_name == it { writeln!(t, "{it} (default)")?; @@ -1185,9 +1128,8 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { writeln!(t, "{it}")?; } if verbose { - if let Ok(toolchain) = cfg.get_toolchain(&it, false) { - writeln!(process().stdout(), "{}", toolchain.rustc_version())?; - } + let toolchain = Toolchain::new(cfg, it.into())?; + writeln!(process().stdout(), "{}", toolchain.rustc_version())?; // To make it easy to see what rustc that belongs to what // toolchain we separate each pair with an extra newline writeln!(process().stdout())?; @@ -1304,23 +1246,35 @@ fn show_rustup_home(cfg: &Cfg) -> Result { } fn target_list(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let toolchain = m + .get_one::("toolchain") + .map(Into::into); + let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + // downcasting required because the toolchain files can name any toolchain + let distributable = (&toolchain).try_into()?; if m.get_flag("installed") { - common::list_installed_targets(&toolchain) + common::list_installed_targets(distributable) } else { - common::list_targets(&toolchain) + common::list_targets(distributable) } } fn target_add(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let toolchain_name = m + .get_one::("toolchain") + .map(Into::into); + let toolchain = explicit_or_dir_toolchain2(cfg, toolchain_name)?; // XXX: long term move this error to cli ? the normal .into doesn't work // because Result here is the wrong sort and expression type ascription // isn't a feature yet. // list_components *and* add_component would both be inappropriate for // custom toolchains. - let distributable = DistributableToolchain::new_for_components(&toolchain)?; + let distributable = DistributableToolchain::try_from(&toolchain)?; + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + let components = manifest.query_components(distributable.desc(), &config)?; let mut targets: Vec<_> = m .get_many::("target") @@ -1337,7 +1291,7 @@ fn target_add(cfg: &Cfg, m: &ArgMatches) -> Result { } targets.clear(); - for component in distributable.list_components()? { + for component in components { if component.component.short_name_in_manifest() == "rust-std" && component.available && !component.installed @@ -1365,7 +1319,11 @@ fn target_add(cfg: &Cfg, m: &ArgMatches) -> Result { } fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let toolchain = m + .get_one::("toolchain") + .map(Into::into); + let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + let distributable = DistributableToolchain::try_from(&toolchain)?; for target in m.get_many::("target").unwrap() { let new_component = Component::new( @@ -1373,7 +1331,6 @@ fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { Some(TargetTriple::new(target)), false, ); - let distributable = DistributableToolchain::new_for_components(&toolchain)?; distributable.remove_component(new_component)?; } @@ -1382,29 +1339,24 @@ fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { fn component_list(cfg: &Cfg, m: &ArgMatches) -> Result { let toolchain = explicit_or_dir_toolchain(cfg, m)?; + // downcasting required because the toolchain files can name any toolchain + let distributable = (&toolchain).try_into()?; if m.get_flag("installed") { - common::list_installed_components(&toolchain) + common::list_installed_components(distributable)?; } else { - common::list_components(&toolchain)?; - Ok(utils::ExitCode(0)) + common::list_components(distributable)?; } + Ok(utils::ExitCode(0)) } fn component_add(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; - let distributable = DistributableToolchain::new(&toolchain)?; - let target = m - .get_one::("target") - .map(|s| &**s) - .map(TargetTriple::new) - .or_else(|| { - distributable - .desc() - .as_ref() - .ok() - .map(|desc| desc.target.clone()) - }); + let toolchain = m + .get_one::("toolchain") + .map(Into::into); + let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + let distributable = DistributableToolchain::try_from(&toolchain)?; + let target = get_target(m, &distributable); for component in m.get_many::("component").unwrap() { let new_component = Component::new_with_target(component, false) @@ -1415,20 +1367,17 @@ fn component_add(cfg: &Cfg, m: &ArgMatches) -> Result { Ok(utils::ExitCode(0)) } -fn component_remove(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; - let distributable = DistributableToolchain::new_for_components(&toolchain)?; - let target = m - .get_one::("target") +fn get_target(m: &ArgMatches, distributable: &DistributableToolchain<'_>) -> Option { + m.get_one::("target") .map(|s| &**s) .map(TargetTriple::new) - .or_else(|| { - distributable - .desc() - .as_ref() - .ok() - .map(|desc| desc.target.clone()) - }); + .or_else(|| Some(distributable.desc().target.clone())) +} + +fn component_remove(cfg: &Cfg, m: &ArgMatches) -> Result { + let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let distributable = DistributableToolchain::try_from(&toolchain)?; + let target = get_target(m, &distributable); for component in m.get_many::("component").unwrap() { let new_component = Component::new_with_target(component, false) @@ -1440,16 +1389,26 @@ fn component_remove(cfg: &Cfg, m: &ArgMatches) -> Result { } fn explicit_or_dir_toolchain<'a>(cfg: &'a Cfg, m: &ArgMatches) -> Result> { - let toolchain = m.get_one::("toolchain"); - if let Some(toolchain) = toolchain { - let toolchain = cfg.get_toolchain(toolchain, false)?; - return Ok(toolchain); - } + let toolchain = m.get_one::("toolchain"); + explicit_or_dir_toolchain2(cfg, toolchain.cloned()) +} - let cwd = utils::current_dir()?; - let (toolchain, _) = cfg.toolchain_for_dir(&cwd)?; +fn explicit_or_dir_toolchain2( + cfg: &Cfg, + toolchain: Option, +) -> Result> { + match toolchain { + Some(toolchain) => { + let desc = toolchain.resolve(&cfg.get_default_host_triple()?)?; + Ok(Toolchain::new(cfg, desc.into())?) + } + None => { + let cwd = utils::current_dir()?; + let (toolchain, _) = cfg.find_or_install_override_toolchain_or_default(&cwd)?; - Ok(toolchain) + Ok(toolchain) + } + } } fn toolchain_list(cfg: &Cfg, m: &ArgMatches) -> Result { @@ -1457,54 +1416,62 @@ fn toolchain_list(cfg: &Cfg, m: &ArgMatches) -> Result { } fn toolchain_link(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m.get_one::("toolchain").unwrap(); + let toolchain = m.get_one::("toolchain").unwrap(); let path = m.get_one::("path").unwrap(); - let toolchain = cfg.get_toolchain(toolchain, true)?; - - if let Ok(custom) = CustomToolchain::new(&toolchain) { - custom.install_from_dir(Path::new(path), true)?; - Ok(utils::ExitCode(0)) - } else { - Err(anyhow!( - "invalid custom toolchain name: '{}'", - toolchain.name().to_string() - )) - } + cfg.ensure_toolchains_dir()?; + crate::toolchain::custom::CustomToolchain::install_from_dir( + cfg, + Path::new(path), + toolchain, + true, + )?; + Ok(utils::ExitCode(0)) } fn toolchain_remove(cfg: &mut Cfg, m: &ArgMatches) -> Result { - for toolchain in m.get_many::("toolchain").unwrap() { - let toolchain = cfg.get_toolchain(toolchain, false)?; - toolchain.remove()?; + for toolchain_name in m.get_many::("toolchain").unwrap() { + let toolchain_name = toolchain_name.resolve(&cfg.get_default_host_triple()?)?; + Toolchain::ensure_removed(cfg, (&toolchain_name).into())?; } Ok(utils::ExitCode(0)) } fn override_add(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m.get_one::("toolchain").unwrap(); - let toolchain = cfg.get_toolchain(toolchain, false)?; - - let status = if !toolchain.is_custom() { - let distributable = DistributableToolchain::new(&toolchain)?; - Some(distributable.install_from_dist_if_not_installed()?) - } else if !toolchain.exists() { - return Err(RustupError::ToolchainNotInstalled(toolchain.name().to_string()).into()); - } else { - None - }; + let toolchain_name = m.get_one::("toolchain").unwrap(); + let toolchain_name = toolchain_name.resolve(&cfg.get_default_host_triple()?)?; let path = if let Some(path) = m.get_one::("path") { PathBuf::from(path) } else { utils::current_dir()? }; - toolchain.make_override(&path)?; - if let Some(status) = status { - writeln!(process().stdout(),)?; - common::show_channel_update(cfg, toolchain.name(), Ok(status))?; + match Toolchain::new(cfg, (&toolchain_name).into()) { + Ok(_) => {} + Err(e @ RustupError::ToolchainNotInstalled(_)) => match &toolchain_name { + ToolchainName::Custom(_) => Err(e)?, + ToolchainName::Official(desc) => { + let status = DistributableToolchain::install( + cfg, + desc, + &[], + &[], + cfg.get_profile()?, + false, + )? + .0; + writeln!(process().stdout())?; + common::show_channel_update( + cfg, + PackageUpdate::Toolchain(desc.clone()), + Ok(status), + )?; + } + }, + Err(e) => Err(e)?, } + cfg.make_override(&path, &toolchain_name)?; Ok(utils::ExitCode(0)) } @@ -1572,9 +1539,16 @@ const DOCS_DATA: &[(&str, &str, &str)] = &[ ]; fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; - if let Ok(distributable) = DistributableToolchain::new(&toolchain) { - let components = distributable.list_components()?; + let toolchain = m + .get_one::("toolchain") + .map(Into::into); + let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + + if let Ok(distributable) = DistributableToolchain::try_from(&toolchain) { + let manifestation = distributable.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = distributable.get_manifest()?; + let components = manifest.query_components(distributable.desc(), &config)?; if let [_] = components .into_iter() .filter(|cstatus| { @@ -1586,17 +1560,18 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { { info!( "`rust-docs` not installed in toolchain `{}`", - toolchain.name() + distributable.desc() ); info!( "To install, try `rustup component add --toolchain {} rust-docs`", - toolchain.name() + distributable.desc() ); return Err(anyhow!( "unable to view documentation which is not installed" )); } - } + }; + let topical_path: PathBuf; let doc_url = if let Some(topic) = m.get_one::("topic") { @@ -1622,12 +1597,12 @@ fn man(cfg: &Cfg, m: &ArgMatches) -> Result { let command = m.get_one::("command").unwrap(); let toolchain = explicit_or_dir_toolchain(cfg, m)?; - let mut toolchain = toolchain.path().to_path_buf(); - toolchain.push("share"); - toolchain.push("man"); - utils::assert_is_directory(&toolchain)?; + let mut path = toolchain.path().to_path_buf(); + path.push("share"); + path.push("man"); + utils::assert_is_directory(&path)?; - let mut manpaths = std::ffi::OsString::from(toolchain); + let mut manpaths = std::ffi::OsString::from(path); manpaths.push(":"); // prepend to the default MANPATH list if let Some(path) = process().var_os("MANPATH") { manpaths.push(path); diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 3a97ae4c01..8fe4b2f50c 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -32,6 +32,7 @@ #[cfg(unix)] mod shell; +#[cfg(feature = "test")] pub(crate) mod test; #[cfg(unix)] mod unix; @@ -57,26 +58,33 @@ use anyhow::{anyhow, Context, Result}; use cfg_if::cfg_if; use same_file::Handle; -use super::common::{self, ignorable_error, report_error, Confirm}; -use super::errors::*; -use super::markdown::md; -use super::term2; -use crate::cli::term2::Terminal; -use crate::dist::dist::{self, Profile, TargetTriple}; -use crate::process; -use crate::toolchain::{DistributableToolchain, Toolchain}; -use crate::utils::utils; -use crate::utils::Notification; -use crate::{Cfg, UpdateStatus}; -use crate::{DUP_TOOLS, TOOLS}; +use crate::{ + cli::{ + common::{self, ignorable_error, report_error, Confirm, PackageUpdate}, + errors::*, + markdown::md, + term2::{self, Terminal}, + }, + dist::dist::{self, PartialToolchainDesc, Profile, TargetTriple, ToolchainDesc}, + install::UpdateStatus, + process, + toolchain::{ + distributable::DistributableToolchain, + names::{MaybeOfficialToolchainName, ResolvableToolchainName, ToolchainName}, + toolchain::Toolchain, + }, + utils::{utils, Notification}, + Cfg, DUP_TOOLS, TOOLS, +}; + use os::*; pub(crate) use os::{delete_rustup_and_cargo_home, run_update, self_replace}; #[cfg(windows)] pub use windows::complete_windows_uninstall; -pub struct InstallOpts<'a> { +pub(crate) struct InstallOpts<'a> { pub default_host_triple: Option, - pub default_toolchain: Option, + pub default_toolchain: Option, pub profile: String, pub no_modify_path: bool, pub no_update_toolchain: bool, @@ -439,7 +447,7 @@ pub(crate) fn install( } utils::create_rustup_home()?; maybe_install_rust( - opts.default_toolchain.as_deref(), + opts.default_toolchain, &opts.profile, opts.default_host_triple.as_deref(), !opts.no_update_toolchain, @@ -587,17 +595,14 @@ fn do_pre_install_options_sanity_checks(opts: &InstallOpts<'_>) -> Result<()> { .as_ref() .map(|s| dist::TargetTriple::new(s)) .unwrap_or_else(TargetTriple::from_host_or_build); - let toolchain_to_use = match &opts.default_toolchain { - None => "stable", - Some(s) if s == "none" => "stable", - Some(s) => s, + let partial_channel = match &opts.default_toolchain { + None | Some(MaybeOfficialToolchainName::None) => { + ResolvableToolchainName::try_from("stable")? + } + Some(MaybeOfficialToolchainName::Some(s)) => s.into(), }; - let partial_channel = dist::PartialToolchainDesc::from_str(toolchain_to_use)?; - let resolved = partial_channel.resolve(&host_triple)?.to_string(); - debug!( - "Successfully resolved installation toolchain as: {}", - resolved - ); + let resolved = partial_channel.resolve(&host_triple)?; + debug!("Successfully resolved installation toolchain as: {resolved}"); Ok(()) })() .map_err(|e: Box| { @@ -606,7 +611,7 @@ fn do_pre_install_options_sanity_checks(opts: &InstallOpts<'_>) -> Result<()> { If you are unsure of suitable values, the 'stable' toolchain is the default.\n\ Valid host triples look something like: {}", e, - dist::TargetTriple::from_host_or_build() + TargetTriple::from_host_or_build() ) })?; Ok(()) @@ -667,8 +672,9 @@ fn current_install_opts(opts: &InstallOpts<'_>) -> String { .map(|s| TargetTriple::new(s)) .unwrap_or_else(TargetTriple::from_host_or_build), opts.default_toolchain - .as_deref() - .unwrap_or("stable (default)"), + .as_ref() + .map(ToString::to_string) + .unwrap_or("stable (default)".into()), opts.profile, if !opts.no_modify_path { "yes" } else { "no" } ) @@ -691,10 +697,14 @@ fn customize_install(mut opts: InstallOpts<'_>) -> Result> { .unwrap_or_else(|| TargetTriple::from_host_or_build().to_string()), )?); - opts.default_toolchain = Some(common::question_str( + opts.default_toolchain = Some(MaybeOfficialToolchainName::try_from(common::question_str( "Default toolchain? (stable/beta/nightly/none)", - opts.default_toolchain.as_deref().unwrap_or("stable"), - )?); + &opts + .default_toolchain + .as_ref() + .map(ToString::to_string) + .unwrap_or("stable".into()), + )?)?); opts.profile = common::question_str( &format!( @@ -805,7 +815,7 @@ pub(crate) fn install_proxies() -> Result<()> { } fn maybe_install_rust( - toolchain: Option<&str>, + toolchain: Option, profile_str: &str, default_host_triple: Option<&str>, update_existing_toolchain: bool, @@ -825,29 +835,44 @@ fn maybe_install_rust( components, targets, )?; - if let Some(toolchain) = toolchain { - if toolchain.exists() { + if let Some(ref desc) = toolchain { + let status = if Toolchain::exists(&cfg, &desc.into())? { warn!("Updating existing toolchain, profile choice will be ignored"); - } - let distributable = DistributableToolchain::new(&toolchain)?; - let status = distributable.install_from_dist(true, false, components, targets, None)?; - let toolchain_str = toolchain.name().to_owned(); - toolchain.cfg().set_default(&toolchain_str)?; + // If we have a partial install we might not be able to read content here. We could: + // - fail and folk have to delete the partially present toolchain to recover + // - silently ignore it (and provide inconsistent metadata for reporting the install/update change) + // - delete the partial install and start over + // For now, we error. + let mut toolchain = DistributableToolchain::new(&cfg, desc.clone())?; + toolchain.update(components, targets, cfg.get_profile()?)? + } else { + DistributableToolchain::install( + &cfg, + desc, + components, + targets, + cfg.get_profile()?, + true, + )? + .0 + }; + + cfg.set_default(Some(&desc.into()))?; writeln!(process().stdout())?; - common::show_channel_update(toolchain.cfg(), &toolchain_str, Ok(status))?; + common::show_channel_update(&cfg, PackageUpdate::Toolchain(desc.clone()), Ok(status))?; } Ok(()) } -fn _install_selection<'a>( - cfg: &'a mut Cfg, - toolchain_opt: Option<&str>, +fn _install_selection( + cfg: &mut Cfg, + toolchain_opt: Option, profile_str: &str, default_host_triple: Option<&str>, update_existing_toolchain: bool, components: &[&str], targets: &[&str], -) -> Result>> { +) -> Result> { cfg.set_profile(profile_str)?; if let Some(default_host_triple) = default_host_triple { @@ -868,39 +893,54 @@ fn _install_selection<'a>( // a toolchain (updating if it's already present) and then if neither of // those are true, we have a user who doesn't mind, and already has an // install, so we leave their setup alone. - Ok(if toolchain_opt == Some("none") { - info!("skipping toolchain installation"); - if !components.is_empty() { - warn!( - "ignoring requested component{}: {}", - if components.len() == 1 { "" } else { "s" }, - components.join(", ") - ); - } - if !targets.is_empty() { - warn!( - "ignoring requested target{}: {}", - if targets.len() == 1 { "" } else { "s" }, - targets.join(", ") - ); - } - writeln!(process().stdout())?; - None - } else if user_specified_something - || (update_existing_toolchain && cfg.find_default()?.is_none()) - { - Some(match toolchain_opt { - Some(s) => cfg.get_toolchain(s, false)?, - None => match cfg.find_default()? { - Some(t) => t, - None => cfg.get_toolchain("stable", false)?, - }, - }) - } else { - info!("updating existing rustup installation - leaving toolchains alone"); - writeln!(process().stdout())?; - None - }) + Ok( + if matches!(toolchain_opt, Some(MaybeOfficialToolchainName::None)) { + info!("skipping toolchain installation"); + if !components.is_empty() { + warn!( + "ignoring requested component{}: {}", + if components.len() == 1 { "" } else { "s" }, + components.join(", ") + ); + } + if !targets.is_empty() { + warn!( + "ignoring requested target{}: {}", + if targets.len() == 1 { "" } else { "s" }, + targets.join(", ") + ); + } + writeln!(process().stdout())?; + None + } else if user_specified_something + || (update_existing_toolchain && cfg.find_default()?.is_none()) + { + match toolchain_opt { + Some(s) => { + let toolchain_name = match s { + MaybeOfficialToolchainName::None => unreachable!(), + MaybeOfficialToolchainName::Some(n) => n, + }; + Some(toolchain_name.resolve(&cfg.get_default_host_triple()?)?) + } + None => match cfg.get_default()? { + // Default is installable + Some(ToolchainName::Official(t)) => Some(t), + // Default is custom, presumably from a prior install. Do nothing. + Some(ToolchainName::Custom(_)) => None, + None => Some( + "stable" + .parse::()? + .resolve(&cfg.get_default_host_triple()?)?, + ), + }, + } + } else { + info!("updating existing rustup installation - leaving toolchains alone"); + writeln!(process().stdout())?; + None + }, + ) } pub(crate) fn uninstall(no_prompt: bool) -> Result { @@ -1047,11 +1087,19 @@ pub(crate) fn update(cfg: &Cfg) -> Result { } }; - let _ = common::show_channel_update(cfg, "rustup", Ok(UpdateStatus::Updated(version))); + let _ = common::show_channel_update( + cfg, + PackageUpdate::Rustup, + Ok(UpdateStatus::Updated(version)), + ); return run_update(&setup_path); } None => { - let _ = common::show_channel_update(cfg, "rustup", Ok(UpdateStatus::Unchanged)); + let _ = common::show_channel_update( + cfg, + PackageUpdate::Rustup, + Ok(UpdateStatus::Unchanged), + ); // Try again in case we emitted "tool `{}` is already installed" last time. install_proxies()? } @@ -1239,7 +1287,7 @@ mod tests { use rustup_macros::unit_test as test; use crate::cli::common; - use crate::dist::dist::ToolchainDesc; + use crate::dist::dist::PartialToolchainDesc; use crate::test::{test_dir, with_rustup_home, Env}; use crate::{currentprocess, for_host}; @@ -1257,7 +1305,11 @@ mod tests { // callbacks rather than output to the tp sink. let mut cfg = common::set_globals(false, false).unwrap(); assert_eq!( - "stable", + "stable" + .parse::() + .unwrap() + .resolve(&cfg.get_default_host_triple().unwrap()) + .unwrap(), super::_install_selection( &mut cfg, None, // No toolchain specified @@ -1269,10 +1321,6 @@ mod tests { ) .unwrap() // result .unwrap() // option - .name() - .parse::() - .unwrap() - .channel ); Ok(()) })?; diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 4f8aec8cb6..21f93a087e 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -1,11 +1,16 @@ use anyhow::Result; use clap::{builder::PossibleValuesParser, AppSettings, Arg, ArgAction, Command}; -use super::common; -use super::self_update::{self, InstallOpts}; -use crate::dist::dist::Profile; -use crate::process; -use crate::utils::utils; +use crate::{ + cli::{ + common, + self_update::{self, InstallOpts}, + }, + dist::dist::Profile, + process, + toolchain::names::{maybe_official_toolchainame_parser, MaybeOfficialToolchainName}, + utils::utils, +}; #[cfg_attr(feature = "otel", tracing::instrument)] pub fn main() -> Result { @@ -59,7 +64,8 @@ pub fn main() -> Result { Arg::new("default-toolchain") .long("default-toolchain") .takes_value(true) - .help("Choose a default toolchain to install. Use 'none' to not install any toolchains at all"), + .help("Choose a default toolchain to install. Use 'none' to not install any toolchains at all") + .value_parser(maybe_official_toolchainame_parser) ) .arg( Arg::new("profile") @@ -118,7 +124,7 @@ pub fn main() -> Result { .get_one::("default-host") .map(ToOwned::to_owned); let default_toolchain = matches - .get_one::("default-toolchain") + .get_one::("default-toolchain") .map(ToOwned::to_owned); let profile = matches .get_one::("profile") diff --git a/src/command.rs b/src/command.rs index 07b9e3c424..b6d48250a9 100644 --- a/src/command.rs +++ b/src/command.rs @@ -1,13 +1,17 @@ -use std::ffi::OsStr; -use std::io; -use std::process::{self, Command}; +use std::{ + ffi::OsStr, + fmt::Debug, + io, + process::{self, Command}, +}; use anyhow::{Context, Result}; use crate::errors::*; use crate::utils::utils::ExitCode; -pub(crate) fn run_command_for_dir>( +#[cfg_attr(feature = "otel", tracing::instrument(err))] +pub(crate) fn run_command_for_dir + Debug>( mut cmd: Command, arg0: &str, args: &[S], diff --git a/src/config.rs b/src/config.rs index acb77d4b5a..3e1fbcd8a1 100644 --- a/src/config.rs +++ b/src/config.rs @@ -7,22 +7,33 @@ use std::str::FromStr; use std::sync::Arc; use anyhow::{anyhow, bail, Context, Result}; +use derivative::Derivative; use serde::Deserialize; use thiserror::Error as ThisError; -use crate::cli::self_update::SelfUpdateMode; -use crate::dist::download::DownloadCfg; -use crate::dist::{ - dist::{self, Profile}, - temp, +use crate::{ + cli::self_update::SelfUpdateMode, + dist::{ + dist::{self, PartialToolchainDesc, Profile, ToolchainDesc}, + download::DownloadCfg, + temp, + }, + errors::RustupError, + fallback_settings::FallbackSettings, + install::UpdateStatus, + notifications::*, + process, + settings::{Settings, SettingsFile, DEFAULT_METADATA_VERSION}, + toolchain::{ + distributable::DistributableToolchain, + names::{ + LocalToolchainName, PathBasedToolchainName, ResolvableLocalToolchainName, + ResolvableToolchainName, ToolchainName, + }, + toolchain::Toolchain, + }, + utils::utils, }; -use crate::errors::RustupError; -use crate::fallback_settings::FallbackSettings; -use crate::notifications::*; -use crate::process; -use crate::settings::{Settings, SettingsFile, DEFAULT_METADATA_VERSION}; -use crate::toolchain::{DistributableToolchain, Toolchain, UpdateStatus}; -use crate::utils::utils; #[derive(Debug, ThisError)] enum OverrideFileConfigError { @@ -104,22 +115,22 @@ impl Display for OverrideReason { } #[derive(Default, Debug)] -struct OverrideCfg<'a> { - toolchain: Option>, +struct OverrideCfg { + toolchain: Option, components: Vec, targets: Vec, profile: Option, } -impl<'a> OverrideCfg<'a> { - fn from_file( - cfg: &'a Cfg, - cfg_path: Option>, - file: OverrideFile, - ) -> Result { +impl OverrideCfg { + fn from_file(cfg: &Cfg, file: OverrideFile) -> Result { Ok(Self { toolchain: match (file.toolchain.channel, file.toolchain.path) { - (Some(name), None) => Some(Toolchain::from(cfg, &name)?), + (Some(name), None) => Some( + (&ResolvableToolchainName::try_from(name)? + .resolve(&cfg.get_default_host_triple()?)?) + .into(), + ), (None, Some(path)) => { if file.toolchain.targets.is_some() || file.toolchain.components.is_some() @@ -130,7 +141,12 @@ impl<'a> OverrideCfg<'a> { path.display() ) } - Some(Toolchain::from_path(cfg, cfg_path, &path)?) + // We -do not- support relative paths, they permit trivial + // completely arbitrary code execution in a directory. + // Longer term we'll not support path based toolchains at + // all, because they also permit arbitrary code execution, + // though with more challenges to exploit. + Some((&PathBasedToolchainName::try_from(&path as &Path)?).into()) } (Some(channel), Some(path)) => { bail!( @@ -155,7 +171,9 @@ impl<'a> OverrideCfg<'a> { pub(crate) const UNIX_FALLBACK_SETTINGS: &str = "/etc/rustup/settings.toml"; -pub struct Cfg { +#[derive(Derivative)] +#[derivative(Debug)] +pub(crate) struct Cfg { profile_override: Option, pub rustup_dir: PathBuf, pub settings_file: SettingsFile, @@ -164,9 +182,10 @@ pub struct Cfg { pub update_hash_dir: PathBuf, pub download_dir: PathBuf, pub temp_cfg: temp::Cfg, - pub toolchain_override: Option, - pub env_override: Option, + pub toolchain_override: Option, + pub env_override: Option, pub dist_root_url: String, + #[derivative(Debug = "ignore")] pub notify_handler: Arc)>, } @@ -197,11 +216,17 @@ impl Cfg { let update_hash_dir = rustup_dir.join("update-hashes"); let download_dir = rustup_dir.join("downloads"); + // Figure out get_default_host_triple before Config is populated + let default_host_triple = settings_file.with(|s| Ok(get_default_host_triple(s)))?; // Environment override let env_override = process() .var("RUSTUP_TOOLCHAIN") .ok() - .and_then(utils::if_not_empty); + .and_then(utils::if_not_empty) + .map(ResolvableLocalToolchainName::try_from) + .transpose()? + .map(|t| t.resolve(&default_host_triple)) + .transpose()?; let dist_root_server = match process().var("RUSTUP_DIST_SERVER") { Ok(ref s) if !s.is_empty() => s.clone(), @@ -244,8 +269,10 @@ impl Cfg { // Run some basic checks against the constructed configuration // For now, that means simply checking that 'stable' can resolve // for the current configuration. - cfg.resolve_toolchain("stable") - .context("Unable parse configuration")?; + ResolvableToolchainName::try_from("stable")?.resolve( + &cfg.get_default_host_triple() + .context("Unable parse configuration")?, + )?; Ok(cfg) } @@ -267,13 +294,9 @@ impl Cfg { self.profile_override = Some(profile); } - pub(crate) fn set_default(&self, toolchain: &str) -> Result<()> { + pub(crate) fn set_default(&self, toolchain: Option<&ToolchainName>) -> Result<()> { self.settings_file.with_mut(|s| { - s.default_toolchain = if toolchain == "none" { - None - } else { - Some(toolchain.to_owned()) - }; + s.default_toolchain = toolchain.map(|t| t.to_string()); Ok(()) })?; (self.notify_handler)(Notification::SetDefaultToolchain(toolchain)); @@ -309,7 +332,7 @@ impl Cfg { } } - pub(crate) fn set_toolchain_override(&mut self, toolchain_override: &str) { + pub(crate) fn set_toolchain_override(&mut self, toolchain_override: &ResolvableToolchainName) { self.toolchain_override = Some(toolchain_override.to_owned()); } @@ -343,21 +366,18 @@ impl Cfg { }) } - pub(crate) fn get_toolchain(&self, name: &str, create_parent: bool) -> Result> { - if create_parent { - utils::ensure_dir_exists("toolchains", &self.toolchains_dir, &|n| { - (self.notify_handler)(n) - })?; - } - - if name.is_empty() { - anyhow::bail!("toolchain names must not be empty"); - } - - Toolchain::from(self, name) + pub(crate) fn ensure_toolchains_dir(&self) -> Result<(), anyhow::Error> { + utils::ensure_dir_exists("toolchains", &self.toolchains_dir, &|n| { + (self.notify_handler)(n) + })?; + Ok(()) } - pub(crate) fn get_hash_file(&self, toolchain: &str, create_parent: bool) -> Result { + pub(crate) fn get_hash_file( + &self, + toolchain: &ToolchainDesc, + create_parent: bool, + ) -> Result { if create_parent { utils::ensure_dir_exists( "update-hash", @@ -366,20 +386,7 @@ impl Cfg { )?; } - Ok(self.update_hash_dir.join(toolchain)) - } - - pub(crate) fn which_binary_by_toolchain( - &self, - toolchain_name: &str, - binary: &str, - ) -> Result { - let toolchain = self.get_toolchain(toolchain_name, false)?; - if toolchain.exists() { - Ok(toolchain.binary_file(binary)) - } else { - Err(RustupError::ToolchainNotInstalled(toolchain_name.to_string()).into()) - } + Ok(self.update_hash_dir.join(toolchain.to_string())) } pub(crate) fn which_binary(&self, path: &Path, binary: &str) -> Result { @@ -429,41 +436,36 @@ impl Cfg { } pub(crate) fn find_default(&self) -> Result>> { - let opt_name = self.get_default()?; - - if let Some(name) = opt_name { - let toolchain = Toolchain::from(self, &name)?; - Ok(Some(toolchain)) - } else { - Ok(None) - } + Ok(self + .get_default()? + .map(|n| Toolchain::new(self, (&n).into())) + .transpose()?) } pub(crate) fn find_override( &self, path: &Path, - ) -> Result, OverrideReason)>> { - self.find_override_config(path).map(|opt| { - opt.and_then(|(override_cfg, reason)| { - override_cfg.toolchain.map(|toolchain| (toolchain, reason)) - }) - }) + ) -> Result> { + Ok(self + .find_override_config(path)? + .and_then(|(override_cfg, reason)| override_cfg.toolchain.map(|t| (t, reason)))) } - fn find_override_config( - &self, - path: &Path, - ) -> Result, OverrideReason)>> { + fn find_override_config(&self, path: &Path) -> Result> { let mut override_ = None; // First check toolchain override from command if let Some(ref name) = self.toolchain_override { - override_ = Some((name.into(), OverrideReason::CommandLine)); + override_ = Some((name.to_string().into(), OverrideReason::CommandLine)); } // Check RUSTUP_TOOLCHAIN if let Some(ref name) = self.env_override { - override_ = Some((name.into(), OverrideReason::Environment)); + // Because path based toolchain files exist, this has to support + // custom, distributable, and absolute path toolchains otherwise + // rustup's export of a RUSTUP_TOOLCHAIN when running a process will + // error when a nested rustup invocation occurs + override_ = Some((name.to_string().into(), OverrideReason::Environment)); } // Then walk up the directory tree from 'path' looking for either the @@ -500,25 +502,25 @@ impl Cfg { ), }; - let cfg_file = if let OverrideReason::ToolchainFile(ref path) = reason { - Some(path) - } else { - None - }; - - let override_cfg = OverrideCfg::from_file(self, cfg_file, file)?; - if let Some(toolchain) = &override_cfg.toolchain { - // Overridden toolchains can be literally any string, but only - // distributable toolchains will be auto-installed by the wrapping - // code; provide a nice error for this common case. (default could - // be set badly too, but that is much less common). - if !toolchain.exists() && toolchain.is_custom() { - // Strip the confusing NotADirectory error and only mention that the - // override toolchain is not installed. - return Err(anyhow!(reason_err)).with_context(|| { - format!("override toolchain '{}' is not installed", toolchain.name()) - }); + let override_cfg = OverrideCfg::from_file(self, file)?; + // Overridden toolchains can be literally any string, but only + // distributable toolchains will be auto-installed by the wrapping + // code; provide a nice error for this common case. (default could + // be set badly too, but that is much less common). + match &override_cfg.toolchain { + Some(t @ LocalToolchainName::Named(ToolchainName::Custom(_))) + | Some(t @ LocalToolchainName::Path(_)) => { + if let Err(RustupError::ToolchainNotInstalled(_)) = + Toolchain::new(self, t.to_owned()) + { + // Strip the confusing NotADirectory error and only mention that the + // override toolchain is not installed. + return Err(anyhow!(reason_err)) + .with_context(|| format!("override toolchain '{t}' is not installed")); + } } + // Either official (can auto install) or no toolchain specified + _ => {} } Ok(Some((override_cfg, reason))) @@ -572,15 +574,44 @@ impl Cfg { if let Ok(contents) = contents { let add_file_context = || format!("in {}", toolchain_file.to_string_lossy()); + // XXX Should not return the unvalidated contents; but a new + // internal only safe struct let override_file = Cfg::parse_override_file(contents, parse_mode) .with_context(add_file_context)?; - if let Some(toolchain_name) = &override_file.toolchain.channel { - let all_toolchains = self.list_toolchains().with_context(add_file_context)?; - if !all_toolchains.iter().any(|s| s == toolchain_name) { - // The given name is not resolvable as a toolchain, so - // instead check it's plausible for installation later - dist::validate_channel_name(toolchain_name) - .with_context(add_file_context)?; + if let Some(toolchain_name_str) = &override_file.toolchain.channel { + let toolchain_name = ResolvableToolchainName::try_from(toolchain_name_str)?; + let default_host_triple = get_default_host_triple(settings); + // Do not permit architecture/os selection in channels as + // these are host specific and toolchain files are portable. + if let ResolvableToolchainName::Official(ref name) = toolchain_name { + if name.has_triple() { + // Permit fully qualified names IFF the toolchain is installed. TODO(robertc): consider + // disabling this and backing out https://github.com/rust-lang/rustup/pull/2141 (but provide + // the base name in the error to help users) + let resolved_name = &ToolchainName::try_from(toolchain_name_str)?; + let ts = self.list_toolchains()?; + eprintln!("{resolved_name:?} {ts:?}"); + if !self.list_toolchains()?.iter().any(|s| s == resolved_name) { + return Err(anyhow!(format!( + "target triple in channel name '{name}'" + ))); + } + } + } + + // XXX: this awkwardness deals with settings file being locked already + let toolchain_name = toolchain_name.resolve(&default_host_triple)?; + match Toolchain::new(self, (&toolchain_name).into()) { + Err(RustupError::ToolchainNotInstalled(_)) => { + if matches!(toolchain_name, ToolchainName::Custom(_)) { + bail!( + "Toolchain {toolchain_name} in {} is custom and not installed", + toolchain_file.display() + ) + } + } + Ok(_) => {} + Err(e) => Err(e)?, } } @@ -629,50 +660,7 @@ impl Cfg { &self, path: &Path, ) -> Result<(Toolchain<'_>, Option)> { - fn components_exist( - distributable: &DistributableToolchain<'_>, - components: &[&str], - targets: &[&str], - ) -> Result { - let components_requested = !components.is_empty() || !targets.is_empty(); - // If we're here, the toolchain exists on disk and is a dist toolchain - // so we should attempt to load its manifest - let desc = if let Some(desc) = distributable.get_toolchain_desc_with_manifest()? { - desc - } else { - // We can't read the manifest. If this is a v1 install that's understandable - // and we assume the components are all good, otherwise we need to have a go - // at re-fetching the manifest to try again. - return Ok(distributable.guess_v1_manifest()); - }; - match (desc.list_components(), components_requested) { - // If the toolchain does not support components but there were components requested, bubble up the error - (Err(e), true) => Err(e), - // Otherwise check if all the components we want are installed - (Ok(installed_components), _) => Ok(components.iter().all(|name| { - installed_components.iter().any(|status| { - let cname = status.component.short_name(&desc.manifest); - let cname = cname.as_str(); - let cnameim = status.component.short_name_in_manifest(); - let cnameim = cnameim.as_str(); - (cname == *name || cnameim == *name) && status.installed - }) - }) - // And that all the targets we want are installed - && targets.iter().all(|name| { - installed_components - .iter() - .filter(|c| c.component.short_name_in_manifest() == "rust-std") - .any(|status| { - let ctarg = status.component.target(); - (ctarg == *name) && status.installed - }) - })), - _ => Ok(true), - } - } - - if let Some((toolchain, components, targets, reason, profile)) = + let (toolchain, components, targets, reason, profile) = match self.find_override_config(path)? { Some(( OverrideCfg { @@ -682,67 +670,92 @@ impl Cfg { profile, }, reason, - )) => { - let default = if toolchain.is_none() { - self.find_default()? - } else { - None - }; - - toolchain - .or(default) - .map(|toolchain| (toolchain, components, targets, Some(reason), profile)) - } - None => self - .find_default()? - .map(|toolchain| (toolchain, vec![], vec![], None, None)), + )) => (toolchain, components, targets, Some(reason), profile), + None => (None, vec![], vec![], None, None), + }; + let toolchain = match toolchain { + t @ Some(_) => t, + None => self.get_default()?.map(Into::into), + }; + match toolchain { + // No override and no default set + None => Err(RustupError::ToolchainNotSelected.into()), + Some(toolchain @ LocalToolchainName::Named(ToolchainName::Custom(_))) + | Some(toolchain @ LocalToolchainName::Path(_)) => { + Ok((Toolchain::new(self, toolchain)?, reason)) } - { - if toolchain.is_custom() { - if !toolchain.exists() { - return Err( - RustupError::ToolchainNotInstalled(toolchain.name().to_string()).into(), - ); - } - } else { + Some(LocalToolchainName::Named(ToolchainName::Official(desc))) => { let components: Vec<_> = components.iter().map(AsRef::as_ref).collect(); let targets: Vec<_> = targets.iter().map(AsRef::as_ref).collect(); - - let distributable = DistributableToolchain::new(&toolchain)?; - if !toolchain.exists() || !components_exist(&distributable, &components, &targets)? - { - distributable.install_from_dist(true, false, &components, &targets, profile)?; + let toolchain = match DistributableToolchain::new(self, desc.clone()) { + Err(RustupError::ToolchainNotInstalled(_)) => { + DistributableToolchain::install( + self, + &desc, + &components, + &targets, + profile.unwrap_or(Profile::Default), + false, + )? + .1 + } + Ok(mut distributable) => { + if !distributable.components_exist(&components, &targets)? { + distributable.update( + &components, + &targets, + profile.unwrap_or(Profile::Default), + )?; + } + distributable + } + Err(e) => return Err(e.into()), } + .into(); + Ok((toolchain, reason)) } - - Ok((toolchain, reason)) - } else { - // No override and no default set - Err(RustupError::ToolchainNotSelected.into()) } } - pub(crate) fn get_default(&self) -> Result> { + /// Get the configured default toolchain. + /// If none is configured, returns None + /// If a bad toolchain name is configured, errors. + pub(crate) fn get_default(&self) -> Result> { let user_opt = self.settings_file.with(|s| Ok(s.default_toolchain.clone())); - if let Some(fallback_settings) = &self.fallback_settings { + let toolchain_maybe_str = if let Some(fallback_settings) = &self.fallback_settings { match user_opt { - Err(_) | Ok(None) => return Ok(fallback_settings.default_toolchain.clone()), - _ => {} - }; - }; - user_opt + Err(_) | Ok(None) => Ok(fallback_settings.default_toolchain.clone()), + o => o, + } + } else { + user_opt + }?; + toolchain_maybe_str + .map(ResolvableToolchainName::try_from) + .transpose()? + .map(|t| t.resolve(&self.get_default_host_triple()?)) + .transpose() } + /// List all the installed toolchains: that is paths in the toolchain dir + /// that are: + /// - not files + /// - named with a valid resolved toolchain name + /// Currently no notification of incorrect names or entry type is done. #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] - pub(crate) fn list_toolchains(&self) -> Result> { + pub(crate) fn list_toolchains(&self) -> Result> { if utils::is_directory(&self.toolchains_dir) { let mut toolchains: Vec<_> = utils::read_dir("toolchains", &self.toolchains_dir)? + // TODO: this discards errors reading the directory, is that + // correct? could we get a short-read and report less toolchains + // than exist? .filter_map(io::Result::ok) .filter(|e| e.file_type().map(|f| !f.is_file()).unwrap_or(false)) .filter_map(|e| e.file_name().into_string().ok()) + .filter_map(|n| ToolchainName::try_from(&n).ok()) .collect(); - utils::toolchain_sort(&mut toolchains); + crate::toolchain::names::toolchain_sort(&mut toolchains); Ok(toolchains) } else { @@ -750,38 +763,49 @@ impl Cfg { } } - pub(crate) fn list_channels(&self) -> Result>)>> { - let toolchains = self.list_toolchains()?; - - // Convert the toolchain strings to Toolchain values - let toolchains = toolchains.into_iter(); - let toolchains = toolchains.map(|n| (n.clone(), self.get_toolchain(&n, true))); + pub(crate) fn list_channels(&self) -> Result)>> { + self.list_toolchains()? + .into_iter() + .filter_map(|t| { + if let ToolchainName::Official(desc) = t { + Some(desc) + } else { + None + } + }) + .filter(ToolchainDesc::is_tracking) + .map(|n| { + DistributableToolchain::new(self, n.clone()) + .map_err(Into::into) + .map(|t| (n.clone(), t)) + }) + .collect::>>() + } - // Filter out toolchains that don't track a release channel - Ok(toolchains - .filter(|(_, ref t)| t.as_ref().map(Toolchain::is_tracking).unwrap_or(false)) - .collect()) + /// Create an override for a toolchain + pub(crate) fn make_override(&self, path: &Path, toolchain: &ToolchainName) -> Result<()> { + self.settings_file.with_mut(|s| { + s.add_override(path, toolchain.to_string(), self.notify_handler.as_ref()); + Ok(()) + }) } pub(crate) fn update_all_channels( &self, force_update: bool, - ) -> Result)>> { + ) -> Result)>> { let channels = self.list_channels()?; let channels = channels.into_iter(); + let profile = self.get_profile()?; // Update toolchains and collect the results - let channels = channels.map(|(n, t)| { - let st = t.and_then(|t| { - let distributable = DistributableToolchain::new(&t)?; - let st = distributable.install_from_dist(force_update, false, &[], &[], None); - if let Err(ref e) = st { - (self.notify_handler)(Notification::NonFatalError(e)); - } - st - }); + let channels = channels.map(|(desc, mut distributable)| { + let st = distributable.update_extra(&[], &[], profile, force_update, false); - (n, st) + if let Err(ref e) = st { + (self.notify_handler)(Notification::NonFatalError(e)); + } + (desc, st) }); Ok(channels.collect()) @@ -803,45 +827,68 @@ impl Cfg { }) } - pub(crate) fn toolchain_for_dir( - &self, - path: &Path, - ) -> Result<(Toolchain<'_>, Option)> { - self.find_or_install_override_toolchain_or_default(path) - } - pub(crate) fn create_command_for_dir(&self, path: &Path, binary: &str) -> Result { - let (ref toolchain, _) = self.toolchain_for_dir(path)?; - - if let Some(cmd) = self.maybe_do_cargo_fallback(toolchain, binary)? { - Ok(cmd) - } else { - // NB this can only fail in race conditions since we used toolchain - // for dir. - let installed = toolchain.as_installed_common()?; - installed.create_command(binary) - } + let (toolchain, _) = self.find_or_install_override_toolchain_or_default(path)?; + self.create_command_for_toolchain_(toolchain, binary) } pub(crate) fn create_command_for_toolchain( &self, - toolchain: &str, + toolchain_name: &LocalToolchainName, install_if_missing: bool, binary: &str, ) -> Result { - let toolchain = self.get_toolchain(toolchain, false)?; - if install_if_missing && !toolchain.exists() { - let distributable = DistributableToolchain::new(&toolchain)?; - distributable.install_from_dist(true, false, &[], &[], None)?; + match toolchain_name { + LocalToolchainName::Named(ToolchainName::Official(desc)) => { + match DistributableToolchain::new(self, desc.clone()) { + Err(RustupError::ToolchainNotInstalled(_)) => { + if install_if_missing { + DistributableToolchain::install( + self, + desc, + &[], + &[], + self.get_profile()?, + true, + )?; + } + } + o => { + o?; + } + } + } + n => { + if !Toolchain::exists(self, n)? { + return Err(RustupError::ToolchainNotInstallable(n.to_string()).into()); + } + } } - if let Some(cmd) = self.maybe_do_cargo_fallback(&toolchain, binary)? { - Ok(cmd) - } else { - // NB note this really can't fail due to to having installed the toolchain if needed - let installed = toolchain.as_installed_common()?; - installed.create_command(binary) + let toolchain = Toolchain::new(self, toolchain_name.clone())?; + + // NB this can only fail in race conditions since we handle existence above + // for dir. + self.create_command_for_toolchain_(toolchain, binary) + } + + fn create_command_for_toolchain_( + &self, + toolchain: Toolchain<'_>, + binary: &str, + ) -> Result { + // Should push the cargo fallback into a custom toolchain type? And then + // perhaps a trait that create command layers on? + if !matches!( + toolchain.name(), + LocalToolchainName::Named(ToolchainName::Official(_)) + ) { + if let Some(cmd) = self.maybe_do_cargo_fallback(&toolchain, binary)? { + return Ok(cmd); + } } + + toolchain.create_command(binary) } // Custom toolchains don't have cargo, so here we detect that situation and @@ -851,27 +898,31 @@ impl Cfg { toolchain: &Toolchain<'_>, binary: &str, ) -> Result> { - if !toolchain.is_custom() { - return Ok(None); - } - if binary != "cargo" && binary != "cargo.exe" { return Ok(None); } - let cargo_path = toolchain.path().join("bin/cargo"); - let cargo_exe_path = toolchain.path().join("bin/cargo.exe"); + let cargo_path = toolchain.binary_file("cargo"); - if cargo_path.exists() || cargo_exe_path.exists() { + // breadcrumb in case of regression: we used to get the cargo path and + // cargo.exe path separately, not using the binary_file helper. This may + // matter if calling a binary with some personality that allows .exe and + // not .exe to coexist (e.g. wine) - but thats not something we aim to + // support : the host should always be correct. + if cargo_path.exists() { return Ok(None); } - // XXX: This could actually consider all distributable toolchains in principle. - for fallback in &["nightly", "beta", "stable"] { - let fallback = self.get_toolchain(fallback, false)?; - if fallback.exists() { - let distributable = DistributableToolchain::new(&fallback)?; - let cmd = distributable.create_fallback_command("cargo", toolchain)?; + let default_host_triple = self.get_default_host_triple()?; + // XXX: This could actually consider all installed distributable + // toolchains in principle. + for fallback in ["nightly", "beta", "stable"] { + let resolved = + PartialToolchainDesc::from_str(fallback)?.resolve(&default_host_triple)?; + if let Ok(fallback) = + crate::toolchain::distributable::DistributableToolchain::new(self, resolved) + { + let cmd = fallback.create_fallback_command("cargo", toolchain)?; return Ok(Some(cmd)); } } @@ -893,28 +944,25 @@ impl Cfg { #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] pub(crate) fn get_default_host_triple(&self) -> Result { - Ok(self - .settings_file - .with(|s| { - Ok(s.default_host_triple - .as_ref() - .map(|s| dist::TargetTriple::new(s))) - })? - .unwrap_or_else(dist::TargetTriple::from_host_or_build)) + self.settings_file.with(|s| Ok(get_default_host_triple(s))) } - pub(crate) fn resolve_toolchain(&self, name: &str) -> Result { - // remove trailing slashes in toolchain name - let normalized_name = name.trim_end_matches('/'); - if let Ok(desc) = dist::PartialToolchainDesc::from_str(normalized_name) { - let host = self.get_default_host_triple()?; - Ok(desc.resolve(&host)?.to_string()) - } else { - Ok(normalized_name.to_owned()) + /// The path on disk of any concrete toolchain + pub(crate) fn toolchain_path(&self, toolchain: &LocalToolchainName) -> PathBuf { + match toolchain { + LocalToolchainName::Named(name) => self.toolchains_dir.join(name.to_string()), + LocalToolchainName::Path(p) => p.to_path_buf(), } } } +fn get_default_host_triple(s: &Settings) -> dist::TargetTriple { + s.default_host_triple + .as_ref() + .map(|s| dist::TargetTriple::new(s)) + .unwrap_or_else(dist::TargetTriple::from_host_or_build) +} + /// Specifies how a `rust-toolchain`/`rust-toolchain.toml` configuration file should be parsed. enum ParseMode { /// Only permit TOML format in a configuration file. diff --git a/src/dist/component/mod.rs b/src/dist/component/mod.rs index 4f7c3f7ef0..9df43bbf11 100644 --- a/src/dist/component/mod.rs +++ b/src/dist/component/mod.rs @@ -11,3 +11,6 @@ mod transaction; mod package; // The representation of *installed* components, and uninstallation mod components; + +#[cfg(test)] +mod tests; diff --git a/tests/suite/dist_transactions.rs b/src/dist/component/tests.rs similarity index 91% rename from tests/suite/dist_transactions.rs rename to src/dist/component/tests.rs index b82164c598..1c3bf6e5fa 100644 --- a/tests/suite/dist_transactions.rs +++ b/src/dist/component/tests.rs @@ -2,22 +2,23 @@ use std::fs; use std::io::Write; use std::path::PathBuf; -use rustup::dist::component::Transaction; -use rustup::dist::dist::DEFAULT_DIST_SERVER; -use rustup::dist::prefix::InstallPrefix; -use rustup::dist::temp; -use rustup::dist::Notification; -use rustup::utils::raw as utils_raw; -use rustup::utils::utils; -use rustup::RustupError; -use rustup_macros::integration_test as test; +use rustup_macros::unit_test as test; + +use crate::dist::component::Transaction; +use crate::dist::dist::DEFAULT_DIST_SERVER; +use crate::dist::prefix::InstallPrefix; +use crate::dist::temp; +use crate::dist::Notification; +use crate::utils::raw as utils_raw; +use crate::utils::utils; +use crate::RustupError; #[test] fn add_file() { let prefixdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); let txdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let tmpcfg = temp::Cfg::new( txdir.path().to_owned(), @@ -45,7 +46,7 @@ fn add_file_then_rollback() { let prefixdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); let txdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let tmpcfg = temp::Cfg::new( txdir.path().to_owned(), @@ -73,7 +74,7 @@ fn add_file_that_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -104,7 +105,7 @@ fn copy_file() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -131,7 +132,7 @@ fn copy_file_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -158,7 +159,7 @@ fn copy_file_that_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -194,7 +195,7 @@ fn copy_dir() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -228,7 +229,7 @@ fn copy_dir_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -262,7 +263,7 @@ fn copy_dir_that_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -293,7 +294,7 @@ fn remove_file() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -318,7 +319,7 @@ fn remove_file_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -343,7 +344,7 @@ fn remove_file_that_not_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -370,7 +371,7 @@ fn remove_dir() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -396,7 +397,7 @@ fn remove_dir_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -422,7 +423,7 @@ fn remove_dir_that_not_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix, &tmpcfg, ¬ify); @@ -449,7 +450,7 @@ fn write_file() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -476,7 +477,7 @@ fn write_file_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -500,7 +501,7 @@ fn write_file_that_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -531,7 +532,7 @@ fn modify_file_that_not_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -555,7 +556,7 @@ fn modify_file_that_exists() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -579,7 +580,7 @@ fn modify_file_that_not_exists_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -601,7 +602,7 @@ fn modify_file_that_exists_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -628,7 +629,7 @@ fn modify_twice_then_rollback() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -655,7 +656,7 @@ fn do_multiple_op_transaction(rollback: bool) { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); @@ -756,7 +757,7 @@ fn rollback_failure_keeps_going() { Box::new(|_| ()), ); - let prefix = InstallPrefix::from(prefixdir.path().to_owned()); + let prefix = InstallPrefix::from(prefixdir.path()); let notify = |_: Notification<'_>| (); let mut tx = Transaction::new(prefix.clone(), &tmpcfg, ¬ify); diff --git a/src/dist/dist.rs b/src/dist/dist.rs index cd6f8e6acf..a38657f392 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -12,16 +12,21 @@ use lazy_static::lazy_static; use regex::Regex; use thiserror::Error as ThisError; -use crate::dist::download::DownloadCfg; -use crate::dist::manifest::{Component, Manifest as ManifestV2}; -use crate::dist::manifestation::{Changes, Manifestation, UpdateStatus}; -use crate::dist::notifications::*; -use crate::dist::prefix::InstallPrefix; -use crate::dist::temp; pub(crate) use crate::dist::triple::*; -use crate::errors::RustupError; -use crate::process; -use crate::utils::utils; +use crate::{ + dist::{ + download::DownloadCfg, + manifest::{Component, Manifest as ManifestV2}, + manifestation::{Changes, Manifestation, UpdateStatus}, + notifications::*, + prefix::InstallPrefix, + temp, + }, + errors::RustupError, + process, + toolchain::names::ToolchainName, + utils::utils, +}; pub static DEFAULT_DIST_SERVER: &str = "https://static.rust-lang.org"; @@ -83,11 +88,13 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s } #[derive(Debug, ThisError)] -enum DistError { +pub(crate) enum DistError { #[error("{}", components_missing_msg(.0, .1, .2))] ToolchainComponentsMissing(Vec, Box, String), #[error("no release found for '{0}'")] MissingReleaseForToolchain(String), + #[error("invalid toolchain name: '{0}'")] + InvalidOfficialName(String), } #[derive(Debug, PartialEq)] @@ -102,7 +109,7 @@ struct ParsedToolchainDesc { // 'stable-msvc' to work. Partial target triples though are parsed // from a hardcoded set of known triples, whereas target triples // are nearly-arbitrary strings. -#[derive(Debug, Clone)] +#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct PartialToolchainDesc { // Either "nightly", "stable", "beta", or an explicit version number pub channel: String, @@ -113,7 +120,10 @@ pub struct PartialToolchainDesc { // Fully-resolved toolchain descriptors. These always have full target // triples attached to them and are used for canonical identification, // such as naming their installation directory. -#[derive(Debug, Clone)] +// +// as strings they look like stable-x86_64-pc-windows-msvc or +/// 1.55-x86_64-pc-windows-msvc +#[derive(Debug, Clone, Eq, PartialEq, PartialOrd, Ord)] pub struct ToolchainDesc { // Either "nightly", "stable", "beta", or an explicit version number pub channel: String, @@ -426,6 +436,7 @@ impl FromStr for PartialToolchainDesc { } impl PartialToolchainDesc { + /// Create a toolchain desc using input_host to fill in missing fields pub(crate) fn resolve(self, input_host: &TargetTriple) -> Result { let host = PartialTargetTriple::new(&input_host.0).ok_or_else(|| { anyhow!(format!( @@ -534,13 +545,14 @@ impl ToolchainDesc { } } -// A little convenience for just parsing a channel name or archived channel name -pub(crate) fn validate_channel_name(name: &str) -> Result<()> { - let toolchain = PartialToolchainDesc::from_str(name)?; - if toolchain.has_triple() { - Err(anyhow!(format!("target triple in channel name '{name}'"))) - } else { - Ok(()) +impl TryFrom<&ToolchainName> for ToolchainDesc { + type Error = DistError; + + fn try_from(value: &ToolchainName) -> std::result::Result { + match value { + ToolchainName::Custom(n) => Err(DistError::InvalidOfficialName(n.str().into())), + ToolchainName::Official(n) => Ok(n.clone()), + } } } @@ -650,7 +662,7 @@ pub(crate) fn valid_profile_names() -> String { // an upgrade then all the existing components will be upgraded. // // Returns the manifest's hash if anything changed. -#[cfg_attr(feature = "otel", tracing::instrument(skip_all))] +#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all, fields(profile=format!("{profile:?}"), prefix=prefix.path().to_string_lossy().to_string())))] pub(crate) fn update_from_dist( download: DownloadCfg<'_>, update_hash: Option<&Path>, @@ -789,7 +801,7 @@ fn update_from_dist_( // no need to even print anything for missing nightlies, // since we don't really "skip" them } - None => { + _ => { // All other errors break the loop break Err(e); } diff --git a/src/dist/manifest.rs b/src/dist/manifest.rs index 04ff941c6d..c46dd8d2a4 100644 --- a/src/dist/manifest.rs +++ b/src/dist/manifest.rs @@ -22,8 +22,18 @@ use crate::dist::dist::{PartialTargetTriple, Profile, TargetTriple}; use crate::errors::*; use crate::utils::toml_utils::*; +use super::{config::Config, dist::ToolchainDesc}; + pub(crate) const SUPPORTED_MANIFEST_VERSIONS: [&str; 1] = ["2"]; +/// Used by the `installed_components` function +pub(crate) struct ComponentStatus { + pub component: Component, + pub name: String, + pub installed: bool, + pub available: bool, +} + #[derive(Clone, Debug, Eq, PartialEq)] pub struct Manifest { manifest_version: String, @@ -345,6 +355,57 @@ impl Manifest { c }) } + + /// Determine installed components from an installed manifest. + pub(crate) fn query_components( + &self, + desc: &ToolchainDesc, + config: &Config, + ) -> Result> { + // Return all optional components of the "rust" package for the + // toolchain's target triple. + let mut res = Vec::new(); + + let rust_pkg = self + .packages + .get("rust") + .expect("manifest should contain a rust package"); + let targ_pkg = rust_pkg + .targets + .get(&desc.target) + .expect("installed manifest should have a known target"); + + for component in &targ_pkg.components { + let installed = component.contained_within(&config.components); + + let component_target = TargetTriple::new(&component.target()); + + // Get the component so we can check if it is available + let component_pkg = self + .get_package(component.short_name_in_manifest()) + .unwrap_or_else(|_| { + panic!( + "manifest should contain component {}", + &component.short_name(self) + ) + }); + let component_target_pkg = component_pkg + .targets + .get(&component_target) + .expect("component should have target toolchain"); + + res.push(ComponentStatus { + component: component.clone(), + name: component.name(self), + installed, + available: component_target_pkg.available(), + }); + } + + res.sort_by(|a, b| a.component.cmp(&b.component)); + + Ok(res) + } } impl Package { @@ -645,3 +706,116 @@ impl Component { } } } + +#[cfg(test)] +mod tests { + use crate::dist::dist::TargetTriple; + use crate::dist::manifest::Manifest; + use crate::RustupError; + + // Example manifest from https://public.etherpad-mozilla.org/p/Rust-infra-work-week + static EXAMPLE: &str = include_str!("manifest/tests/channel-rust-nightly-example.toml"); + // From brson's live build-rust-manifest.py script + static EXAMPLE2: &str = include_str!("manifest/tests/channel-rust-nightly-example2.toml"); + + #[test] + fn parse_smoke_test() { + let x86_64_unknown_linux_gnu = TargetTriple::new("x86_64-unknown-linux-gnu"); + let x86_64_unknown_linux_musl = TargetTriple::new("x86_64-unknown-linux-musl"); + + let pkg = Manifest::parse(EXAMPLE).unwrap(); + + pkg.get_package("rust").unwrap(); + pkg.get_package("rustc").unwrap(); + pkg.get_package("cargo").unwrap(); + pkg.get_package("rust-std").unwrap(); + pkg.get_package("rust-docs").unwrap(); + + let rust_pkg = pkg.get_package("rust").unwrap(); + assert!(rust_pkg.version.contains("1.3.0")); + + let rust_target_pkg = rust_pkg + .get_target(Some(&x86_64_unknown_linux_gnu)) + .unwrap(); + assert!(rust_target_pkg.available()); + assert_eq!(rust_target_pkg.bins[0].1.url, "example.com"); + assert_eq!(rust_target_pkg.bins[0].1.hash, "..."); + + let component = &rust_target_pkg.components[0]; + assert_eq!(component.short_name_in_manifest(), "rustc"); + assert_eq!(component.target.as_ref(), Some(&x86_64_unknown_linux_gnu)); + + let component = &rust_target_pkg.components[4]; + assert_eq!(component.short_name_in_manifest(), "rust-std"); + assert_eq!(component.target.as_ref(), Some(&x86_64_unknown_linux_musl)); + + let docs_pkg = pkg.get_package("rust-docs").unwrap(); + let docs_target_pkg = docs_pkg + .get_target(Some(&x86_64_unknown_linux_gnu)) + .unwrap(); + assert_eq!(docs_target_pkg.bins[0].1.url, "example.com"); + } + + #[test] + fn renames() { + let manifest = Manifest::parse(EXAMPLE2).unwrap(); + assert_eq!(1, manifest.renames.len()); + assert_eq!(manifest.renames["cargo-old"], "cargo"); + assert_eq!(1, manifest.reverse_renames.len()); + assert_eq!(manifest.reverse_renames["cargo"], "cargo-old"); + } + + #[test] + fn parse_round_trip() { + let original = Manifest::parse(EXAMPLE).unwrap(); + let serialized = original.clone().stringify(); + let new = Manifest::parse(&serialized).unwrap(); + assert_eq!(original, new); + + let original = Manifest::parse(EXAMPLE2).unwrap(); + let serialized = original.clone().stringify(); + let new = Manifest::parse(&serialized).unwrap(); + assert_eq!(original, new); + } + + #[test] + fn validate_components_have_corresponding_packages() { + let manifest = r#" +manifest-version = "2" +date = "2015-10-10" +[pkg.rust] + version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" + [pkg.rust.target.x86_64-unknown-linux-gnu] + available = true + url = "example.com" + hash = "..." + [[pkg.rust.target.x86_64-unknown-linux-gnu.components]] + pkg = "rustc" + target = "x86_64-unknown-linux-gnu" + [[pkg.rust.target.x86_64-unknown-linux-gnu.extensions]] + pkg = "rust-std" + target = "x86_64-unknown-linux-musl" +[pkg.rustc] + version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" + [pkg.rustc.target.x86_64-unknown-linux-gnu] + available = true + url = "example.com" + hash = "..." +"#; + + let err = Manifest::parse(manifest).unwrap_err(); + + match err.downcast::().unwrap() { + RustupError::MissingPackageForComponent(_) => {} + _ => panic!(), + } + } + + // #248 + #[test] + fn manifest_can_contain_unknown_targets() { + let manifest = EXAMPLE.replace("x86_64-unknown-linux-gnu", "mycpu-myvendor-myos"); + + assert!(Manifest::parse(&manifest).is_ok()); + } +} diff --git a/tests/suite/channel-rust-nightly-example.toml b/src/dist/manifest/tests/channel-rust-nightly-example.toml similarity index 100% rename from tests/suite/channel-rust-nightly-example.toml rename to src/dist/manifest/tests/channel-rust-nightly-example.toml diff --git a/tests/suite/channel-rust-nightly-example2.toml b/src/dist/manifest/tests/channel-rust-nightly-example2.toml similarity index 100% rename from tests/suite/channel-rust-nightly-example2.toml rename to src/dist/manifest/tests/channel-rust-nightly-example2.toml diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index 48ad384211..729224de95 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -1,6 +1,9 @@ //! Maintains a Rust installation by installing individual Rust //! platform components from a distribution server. +#[cfg(test)] +mod tests; + use std::path::Path; use anyhow::{anyhow, bail, Context, Result}; diff --git a/tests/suite/dist.rs b/src/dist/manifestation/tests.rs similarity index 98% rename from tests/suite/dist.rs rename to src/dist/manifestation/tests.rs index d473792a85..d97bddb179 100644 --- a/tests/suite/dist.rs +++ b/src/dist/manifestation/tests.rs @@ -13,21 +13,22 @@ use std::sync::Arc; use anyhow::{anyhow, Result}; use url::Url; -use rustup::currentprocess; -use rustup::dist::dist::{Profile, TargetTriple, ToolchainDesc, DEFAULT_DIST_SERVER}; -use rustup::dist::download::DownloadCfg; -use rustup::dist::manifest::{Component, Manifest}; -use rustup::dist::manifestation::{Changes, Manifestation, UpdateStatus}; -use rustup::dist::prefix::InstallPrefix; -use rustup::dist::temp; -use rustup::dist::Notification; -use rustup::errors::RustupError; -use rustup::utils::raw as utils_raw; -use rustup::utils::utils; -use rustup_macros::integration_test as test; - -use crate::mock::dist::*; -use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; +use rustup_macros::unit_test as test; + +use crate::{ + currentprocess, + dist::{ + dist::{Profile, TargetTriple, ToolchainDesc, DEFAULT_DIST_SERVER}, + download::DownloadCfg, + manifest::{Component, Manifest}, + manifestation::{Changes, Manifestation, UpdateStatus}, + prefix::InstallPrefix, + temp, Notification, + }, + errors::RustupError, + test::mock::{dist::*, MockComponentBuilder, MockFile, MockInstallerBuilder}, + utils::{raw as utils_raw, utils}, +}; const SHA256_HASH_LEN: usize = 64; @@ -546,7 +547,7 @@ fn setup_from_dist_server( ); let toolchain = ToolchainDesc::from_str("nightly-x86_64-apple-darwin").unwrap(); - let prefix = InstallPrefix::from(prefix_tempdir.path().to_owned()); + let prefix = InstallPrefix::from(prefix_tempdir.path()); let download_cfg = DownloadCfg { dist_root: "phony", temp_cfg: &temp_cfg, diff --git a/src/dist/prefix.rs b/src/dist/prefix.rs index 76d03461b9..874b27850e 100644 --- a/src/dist/prefix.rs +++ b/src/dist/prefix.rs @@ -1,34 +1,66 @@ use std::path::{Path, PathBuf}; +use crate::utils::utils; + const REL_MANIFEST_DIR: &str = "lib/rustlib"; +static V1_COMMON_COMPONENT_LIST: &[&str] = &["cargo", "rustc", "rust-docs"]; #[derive(Clone, Debug)] pub struct InstallPrefix { path: PathBuf, } impl InstallPrefix { - pub fn from(path: PathBuf) -> Self { - Self { path } - } pub fn path(&self) -> &Path { &self.path } + pub(crate) fn abs_path>(&self, path: P) -> PathBuf { self.path.join(path) } + pub(crate) fn manifest_dir(&self) -> PathBuf { let mut path = self.path.clone(); path.push(REL_MANIFEST_DIR); path } + pub fn manifest_file(&self, name: &str) -> PathBuf { let mut path = self.manifest_dir(); path.push(name); path } + pub(crate) fn rel_manifest_file(&self, name: &str) -> PathBuf { let mut path = PathBuf::from(REL_MANIFEST_DIR); path.push(name); path } + + /// Guess whether this is a V1 or V2 manifest distribution. + pub(crate) fn guess_v1_manifest(&self) -> bool { + // If all the v1 common components are present this is likely to be + // a v1 manifest install. The v1 components are not called the same + // in a v2 install. + for component in V1_COMMON_COMPONENT_LIST { + let manifest = format!("manifest-{component}"); + let manifest_path = self.manifest_file(&manifest); + if !utils::path_exists(manifest_path) { + return false; + } + } + // It's reasonable to assume this is a v1 manifest installation + true + } +} + +impl From<&Path> for InstallPrefix { + fn from(value: &Path) -> Self { + Self { path: value.into() } + } +} + +impl From for InstallPrefix { + fn from(path: PathBuf) -> Self { + Self { path } + } } diff --git a/src/dist/triple.rs b/src/dist/triple.rs index ad27adb146..db64f6b305 100644 --- a/src/dist/triple.rs +++ b/src/dist/triple.rs @@ -47,7 +47,7 @@ static LIST_ENVS: &[&str] = &[ "musl", ]; -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] pub struct PartialTargetTriple { pub arch: Option, pub os: Option, diff --git a/src/errors.rs b/src/errors.rs index 5fbf96b28d..3fd2fe961a 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -2,14 +2,19 @@ use std::ffi::OsString; use std::fmt::Debug; -use std::io::{self, Write}; +#[cfg(not(windows))] +use std::io; +use std::io::Write; use std::path::PathBuf; use thiserror::Error as ThisError; use url::Url; -use crate::currentprocess::process; -use crate::dist::manifest::{Component, Manifest}; +use crate::{currentprocess::process, dist::dist::ToolchainDesc}; +use crate::{ + dist::manifest::{Component, Manifest}, + toolchain::names::{PathBasedToolchainName, ToolchainName}, +}; const TOOLSTATE_MSG: &str = "If you require these components, please install and use the latest successful build version,\n\ @@ -25,7 +30,7 @@ const TOOLSTATE_MSG: &str = pub struct OperationError(pub anyhow::Error); #[derive(ThisError, Debug)] -pub enum RustupError { +pub(crate) enum RustupError { #[error("partially downloaded file may have been damaged and was removed, please try again")] BrokenPartialFile, #[error("component download failed for {0}")] @@ -36,17 +41,13 @@ pub enum RustupError { ComponentMissingFile { name: String, path: PathBuf }, #[error("could not create {name} directory: '{}'", .path.display())] CreatingDirectory { name: &'static str, path: PathBuf }, - #[error("unable to read the PGP key '{}'", .path.display())] - InvalidPgpKey { - path: PathBuf, - source: anyhow::Error, - }, #[error("invalid toolchain name: '{0}'")] InvalidToolchainName(String), #[error("could not create link from '{}' to '{}'", .src.display(), .dest.display())] LinkingFile { src: PathBuf, dest: PathBuf }, #[error("Unable to proceed. Could not locate working directory.")] LocatingWorkingDir, + #[cfg(not(windows))] #[error("failed to set permissions for '{}'", .p.display())] SettingPermissions { p: PathBuf, source: io::Error }, #[error("checksum failed for '{url}', expected: '{expected}', calculated: '{calculated}'")] @@ -59,14 +60,16 @@ pub enum RustupError { ComponentConflict { name: String, path: PathBuf }, #[error("toolchain '{0}' does not support components")] ComponentsUnsupported(String), + #[error("toolchain '{0}' does not support components (v1 manifest)")] + ComponentsUnsupportedV1(String), #[error("component manifest for '{0}' is corrupt")] CorruptComponent(String), #[error("could not download file from '{url}' to '{}'", .path.display())] DownloadingFile { url: Url, path: PathBuf }, #[error("could not download file from '{url}' to '{}'", .path.display())] DownloadNotExists { url: Url, path: PathBuf }, - #[error("Missing manifest in toolchain '{}'", .name)] - MissingManifest { name: String }, + #[error("Missing manifest in toolchain '{}'", .0)] + MissingManifest(ToolchainDesc), #[error("server sent a broken manifest: missing package for component {0}")] MissingPackageForComponent(String), #[error("could not read {name} directory: '{}'", .path.display())] @@ -88,24 +91,26 @@ pub enum RustupError { #[error("toolchain '{0}' is not installable")] ToolchainNotInstallable(String), #[error("toolchain '{0}' is not installed")] - ToolchainNotInstalled(String), + ToolchainNotInstalled(ToolchainName), + #[error("path '{0}' not found")] + PathToolchainNotInstalled(PathBasedToolchainName), #[error( "rustup could not choose a version of {} to run, because one wasn't specified explicitly, and no default is configured.\n{}", process().name().unwrap_or_else(|| "Rust".into()), "help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain." )] ToolchainNotSelected, - #[error("toolchain '{}' does not contain component {}{}{}", .name, .component, if let Some(suggestion) = .suggestion { + #[error("toolchain '{}' does not contain component {}{}{}", .desc, .component, if let Some(suggestion) = .suggestion { format!("; did you mean '{suggestion}'?") } else { "".to_string() }, if .component.contains("rust-std") { format!("\nnote: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html{}", - if name.contains("nightly") { "\nhelp: consider using `cargo build -Z build-std` instead" } else { "" } + if desc.channel == "nightly" { "\nhelp: consider using `cargo build -Z build-std` instead" } else { "" } ) } else { "".to_string() })] UnknownComponent { - name: String, + desc: ToolchainDesc, component: String, suggestion: Option, }, @@ -115,6 +120,8 @@ pub enum RustupError { UnsupportedVersion(String), #[error("could not write {name} file: '{}'", .path.display())] WritingFile { name: &'static str, path: PathBuf }, + #[error("I/O Error")] + IOError(#[from] std::io::Error), } fn remove_component_msg(cs: &Component, manifest: &Manifest, toolchain: &str) -> String { diff --git a/src/install.rs b/src/install.rs index 6cc9345208..732026755a 100644 --- a/src/install.rs +++ b/src/install.rs @@ -1,93 +1,111 @@ //! Installation and upgrade of both distribution-managed and local //! toolchains -use std::path::Path; +use std::path::{Path, PathBuf}; use anyhow::Result; -use crate::dist::dist; -use crate::dist::download::DownloadCfg; -use crate::dist::prefix::InstallPrefix; -use crate::dist::Notification; -use crate::errors::RustupError; -use crate::notifications::Notification as RootNotification; -use crate::toolchain::{CustomToolchain, Toolchain, UpdateStatus}; -use crate::utils::utils; +use crate::{ + config::Cfg, + dist::{dist, download::DownloadCfg, prefix::InstallPrefix, Notification}, + errors::RustupError, + notifications::Notification as RootNotification, + toolchain::{ + names::{CustomToolchainName, LocalToolchainName}, + toolchain::Toolchain, + }, + utils::utils, +}; + +#[derive(Clone, Debug)] +pub(crate) enum UpdateStatus { + Installed, + Updated(String), // Stores the version of rustc *before* the update + Unchanged, +} -#[derive(Copy, Clone)] +#[derive(Clone)] pub(crate) enum InstallMethod<'a> { - Copy(&'a Path, &'a CustomToolchain<'a>), - Link(&'a Path, &'a CustomToolchain<'a>), - // bool is whether to force an update + Copy { + src: &'a Path, + dest: &'a CustomToolchainName, + cfg: &'a Cfg, + }, + Link { + src: &'a Path, + dest: &'a CustomToolchainName, + cfg: &'a Cfg, + }, Dist { + cfg: &'a Cfg, desc: &'a dist::ToolchainDesc, profile: dist::Profile, update_hash: Option<&'a Path>, dl_cfg: DownloadCfg<'a>, - // --force - force_update: bool, - // --allow-downgrade + /// --force bool is whether to force an update/install + force: bool, + /// --allow-downgrade allow_downgrade: bool, - // toolchain already exists + /// toolchain already exists exists: bool, - // currently installed date - old_date: Option<&'a str>, - // Extra components to install from dist + /// currently installed date and version + old_date_version: Option<(String, String)>, + /// Extra components to install from dist components: &'a [&'a str], - // Extra targets to install from dist + /// Extra targets to install from dist targets: &'a [&'a str], }, } impl<'a> InstallMethod<'a> { // Install a toolchain - pub(crate) fn install(&self, toolchain: &Toolchain<'a>) -> Result { - let previous_version = if toolchain.exists() { - Some(toolchain.rustc_version()) - } else { - None - }; - if previous_version.is_some() { - (toolchain.cfg().notify_handler)(RootNotification::UpdatingToolchain(toolchain.name())); - } else { - (toolchain.cfg().notify_handler)(RootNotification::InstallingToolchain( - toolchain.name(), - )); + #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + pub(crate) fn install(&self) -> Result { + let nh = self.cfg().notify_handler.clone(); + match self { + InstallMethod::Copy { .. } + | InstallMethod::Link { .. } + | InstallMethod::Dist { + old_date_version: None, + .. + } => (nh)(RootNotification::InstallingToolchain(&self.dest_basename())), + _ => (nh)(RootNotification::UpdatingToolchain(&self.dest_basename())), } - (toolchain.cfg().notify_handler)(RootNotification::ToolchainDirectory( - toolchain.path(), - toolchain.name(), + + (self.cfg().notify_handler)(RootNotification::ToolchainDirectory( + &self.dest_path(), + &self.dest_basename(), )); - let updated = self.run(toolchain.path(), &|n| { - (toolchain.cfg().notify_handler)(n.into()) + let updated = self.run(&self.dest_path(), &|n| { + (self.cfg().notify_handler)(n.into()) })?; - if !updated { - (toolchain.cfg().notify_handler)(RootNotification::UpdateHashMatches); - } else { - (toolchain.cfg().notify_handler)(RootNotification::InstalledToolchain( - toolchain.name(), - )); - } - - let status = match (updated, previous_version) { - (true, None) => UpdateStatus::Installed, - (true, Some(v)) => UpdateStatus::Updated(v), - (false, _) => UpdateStatus::Unchanged, + let status = match updated { + false => { + (nh)(RootNotification::UpdateHashMatches); + UpdateStatus::Unchanged + } + true => { + (nh)(RootNotification::InstalledToolchain(&self.dest_basename())); + match self { + InstallMethod::Dist { + old_date_version: Some((_, v)), + .. + } => UpdateStatus::Updated(v.clone()), + InstallMethod::Copy { .. } + | InstallMethod::Link { .. } + | InstallMethod::Dist { .. } => UpdateStatus::Installed, + } + } }; // Final check, to ensure we're installed - if !toolchain.exists() { - Err(RustupError::ToolchainNotInstallable(toolchain.name().to_string()).into()) - } else { - Ok(status) + match Toolchain::exists(self.cfg(), &self.local_name())? { + true => Ok(status), + false => Err(RustupError::ToolchainNotInstallable(self.dest_basename()).into()), } } - pub(crate) fn run( - self, - path: &Path, - notify_handler: &dyn Fn(Notification<'_>), - ) -> Result { + fn run(&self, path: &Path, notify_handler: &dyn Fn(Notification<'_>)) -> Result { if path.exists() { // Don't uninstall first for Dist method match self { @@ -99,11 +117,11 @@ impl<'a> InstallMethod<'a> { } match self { - InstallMethod::Copy(src, ..) => { + InstallMethod::Copy { src, .. } => { utils::copy_dir(src, path, notify_handler)?; Ok(true) } - InstallMethod::Link(src, ..) => { + InstallMethod::Link { src, .. } => { utils::symlink_dir(src, path, notify_handler)?; Ok(true) } @@ -112,24 +130,24 @@ impl<'a> InstallMethod<'a> { profile, update_hash, dl_cfg, - force_update, + force: force_update, allow_downgrade, exists, - old_date, + old_date_version, components, targets, .. } => { let prefix = &InstallPrefix::from(path.to_owned()); let maybe_new_hash = dist::update_from_dist( - dl_cfg, - update_hash, + *dl_cfg, + update_hash.as_deref(), desc, - if exists { None } else { Some(profile) }, + if *exists { None } else { Some(*profile) }, prefix, - force_update, - allow_downgrade, - old_date, + *force_update, + *allow_downgrade, + old_date_version.as_ref().map(|dv| dv.0.as_str()), components, targets, )?; @@ -146,6 +164,34 @@ impl<'a> InstallMethod<'a> { } } } + + fn cfg(&self) -> &Cfg { + match self { + InstallMethod::Copy { cfg, .. } => cfg, + InstallMethod::Link { cfg, .. } => cfg, + InstallMethod::Dist { cfg, .. } => cfg, + } + } + + fn local_name(&self) -> LocalToolchainName { + match self { + InstallMethod::Copy { dest, .. } => (*dest).into(), + InstallMethod::Link { dest, .. } => (*dest).into(), + InstallMethod::Dist { desc, .. } => (*desc).into(), + } + } + + fn dest_basename(&self) -> String { + self.local_name().to_string() + } + + fn dest_path(&self) -> PathBuf { + match self { + InstallMethod::Copy { cfg, dest, .. } => cfg.toolchain_path(&(*dest).into()), + InstallMethod::Link { cfg, dest, .. } => cfg.toolchain_path(&(*dest).into()), + InstallMethod::Dist { cfg, desc, .. } => cfg.toolchain_path(&(*desc).into()), + } + } } pub(crate) fn uninstall(path: &Path, notify_handler: &dyn Fn(Notification<'_>)) -> Result<()> { diff --git a/src/lib.rs b/src/lib.rs index ffe0d8da51..2305183470 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,14 +4,15 @@ clippy::type_complexity, clippy::upper_case_acronyms, // see https://github.com/rust-lang/rust-clippy/issues/6974 clippy::vec_init_then_push, // uses two different styles of initialization + clippy::box_default, // its ugly and outside of inner loops irrelevant + clippy::result_large_err, // 288 bytes is our 'large' variant today, which is unlikely to be a performance problem )] #![recursion_limit = "1024"] -pub use crate::config::*; +pub(crate) use crate::config::*; use crate::currentprocess::*; pub use crate::errors::*; -pub use crate::notifications::*; -use crate::toolchain::*; +pub(crate) use crate::notifications::*; pub(crate) use crate::utils::toml_utils; use anyhow::{anyhow, Result}; @@ -94,6 +95,7 @@ mod fallback_settings; mod install; pub mod notifications; mod settings; +#[cfg(feature = "test")] pub mod test; mod toolchain; pub mod utils; diff --git a/src/notifications.rs b/src/notifications.rs index 4420bd4e42..565ef92cd4 100644 --- a/src/notifications.rs +++ b/src/notifications.rs @@ -1,36 +1,36 @@ use std::fmt::{self, Display}; use std::path::{Path, PathBuf}; -use crate::dist::temp; -use crate::utils::notify::NotificationLevel; +use crate::{ + dist::{dist::ToolchainDesc, temp}, + toolchain::names::ToolchainName, + utils::notify::NotificationLevel, +}; #[derive(Debug)] -pub enum Notification<'a> { +pub(crate) enum Notification<'a> { Install(crate::dist::Notification<'a>), Utils(crate::utils::Notification<'a>), Temp(temp::Notification<'a>), - SetDefaultToolchain(&'a str), + SetDefaultToolchain(Option<&'a ToolchainName>), SetOverrideToolchain(&'a Path, &'a str), SetProfile(&'a str), SetSelfUpdate(&'a str), - LookingForToolchain(&'a str), + LookingForToolchain(&'a ToolchainDesc), ToolchainDirectory(&'a Path, &'a str), UpdatingToolchain(&'a str), InstallingToolchain(&'a str), InstalledToolchain(&'a str), - UsingExistingToolchain(&'a str), - UninstallingToolchain(&'a str), - UninstalledToolchain(&'a str), - ToolchainNotInstalled(&'a str), + UsingExistingToolchain(&'a ToolchainDesc), + UninstallingToolchain(&'a ToolchainName), + UninstalledToolchain(&'a ToolchainName), UpdateHashMatches, UpgradingMetadata(&'a str, &'a str), MetadataUpgradeNotNeeded(&'a str), - WritingMetadataVersion(&'a str), ReadMetadataVersion(&'a str), NonFatalError(&'a anyhow::Error), UpgradeRemovesToolchains, - MissingFileDuringSelfUninstall(PathBuf), PlainVerboseMessage(&'a str), /// Both `rust-toolchain` and `rust-toolchain.toml` exist within a directory DuplicateToolchainFile { @@ -64,7 +64,6 @@ impl<'a> Notification<'a> { Temp(n) => n.level(), ToolchainDirectory(_, _) | LookingForToolchain(_) - | WritingMetadataVersion(_) | InstallingToolchain(_) | UpdatingToolchain(_) | ReadMetadataVersion(_) @@ -78,13 +77,10 @@ impl<'a> Notification<'a> { | UsingExistingToolchain(_) | UninstallingToolchain(_) | UninstalledToolchain(_) - | ToolchainNotInstalled(_) | UpgradingMetadata(_, _) | MetadataUpgradeNotNeeded(_) => NotificationLevel::Info, NonFatalError(_) => NotificationLevel::Error, - UpgradeRemovesToolchains - | MissingFileDuringSelfUninstall(_) - | DuplicateToolchainFile { .. } => NotificationLevel::Warn, + UpgradeRemovesToolchains | DuplicateToolchainFile { .. } => NotificationLevel::Warn, } } } @@ -96,8 +92,8 @@ impl<'a> Display for Notification<'a> { Install(n) => n.fmt(f), Utils(n) => n.fmt(f), Temp(n) => n.fmt(f), - SetDefaultToolchain("none") => write!(f, "default toolchain unset"), - SetDefaultToolchain(name) => write!(f, "default toolchain set to '{name}'"), + SetDefaultToolchain(None) => write!(f, "default toolchain unset"), + SetDefaultToolchain(Some(name)) => write!(f, "default toolchain set to '{name}'"), SetOverrideToolchain(path, name) => write!( f, "override toolchain for '{}' set to '{}'", @@ -114,7 +110,6 @@ impl<'a> Display for Notification<'a> { UsingExistingToolchain(name) => write!(f, "using existing install for '{name}'"), UninstallingToolchain(name) => write!(f, "uninstalling toolchain '{name}'"), UninstalledToolchain(name) => write!(f, "toolchain '{name}' uninstalled"), - ToolchainNotInstalled(name) => write!(f, "no toolchain installed for '{name}'"), UpdateHashMatches => write!(f, "toolchain is already up to date"), UpgradingMetadata(from_ver, to_ver) => write!( f, @@ -123,18 +118,12 @@ impl<'a> Display for Notification<'a> { MetadataUpgradeNotNeeded(ver) => { write!(f, "nothing to upgrade: metadata version is already '{ver}'") } - WritingMetadataVersion(ver) => write!(f, "writing metadata version: '{ver}'"), ReadMetadataVersion(ver) => write!(f, "read metadata version: '{ver}'"), NonFatalError(e) => write!(f, "{e}"), UpgradeRemovesToolchains => write!( f, "this upgrade will remove all existing toolchains. you will need to reinstall them" ), - MissingFileDuringSelfUninstall(p) => write!( - f, - "expected file does not exist to uninstall: {}", - p.display() - ), PlainVerboseMessage(r) => write!(f, "{r}"), DuplicateToolchainFile { rust_toolchain, diff --git a/src/test.rs b/src/test.rs index 6914a3ff7c..2dd3626f67 100644 --- a/src/test.rs +++ b/src/test.rs @@ -1,5 +1,8 @@ #![allow(clippy::box_default)] //! Test support module; public to permit use from integration tests. + +pub mod mock; + use std::collections::HashMap; use std::env; use std::ffi::OsStr; diff --git a/tests/mock/clitools.rs b/src/test/mock/clitools.rs similarity index 96% rename from tests/mock/clitools.rs rename to src/test/mock/clitools.rs index 64aa9dfaf9..3d879729e5 100644 --- a/tests/mock/clitools.rs +++ b/src/test/mock/clitools.rs @@ -1,35 +1,38 @@ //! A mock distribution server used by tests/cli-v1.rs and //! tests/cli-v2.rs -use std::cell::RefCell; -use std::collections::HashMap; -use std::env; -use std::env::consts::EXE_SUFFIX; -use std::ffi::OsStr; -use std::fs; -use std::io::{self, Write}; -use std::path::{Path, PathBuf}; -use std::process::Command; -use std::sync::{Arc, RwLock, RwLockWriteGuard}; -use std::time::Instant; +use std::{ + cell::RefCell, + collections::HashMap, + env::{self, consts::EXE_SUFFIX}, + ffi::OsStr, + fmt::Debug, + fs, + io::{self, Write}, + path::{Path, PathBuf}, + process::Command, + sync::{Arc, RwLock, RwLockWriteGuard}, + time::Instant, +}; use enum_map::{enum_map, Enum, EnumMap}; use lazy_static::lazy_static; use once_cell::sync::Lazy; -use rustup::test::const_dist_dir; use url::Url; -use rustup::cli::rustup_mode; -use rustup::currentprocess; -use rustup::test as rustup_test; -use rustup::test::this_host_triple; -use rustup::utils::{raw, utils}; - -use crate::mock::dist::{ - change_channel_date, ManifestVersion, MockChannel, MockComponent, MockDistServer, MockPackage, - MockTargetedPackage, +use crate::cli::rustup_mode; +use crate::currentprocess; +use crate::test as rustup_test; +use crate::test::const_dist_dir; +use crate::test::this_host_triple; +use crate::utils::{raw, utils}; + +use super::{ + dist::{ + change_channel_date, ManifestVersion, MockChannel, MockComponent, MockDistServer, + MockPackage, MockTargetedPackage, + }, + topical_doc_data, MockComponentBuilder, MockFile, MockInstallerBuilder, }; -use crate::mock::topical_doc_data; -use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; /// The configuration used by the tests in this module #[derive(Debug)] @@ -169,7 +172,7 @@ impl ConstState { Some(ref path) => Ok(path.clone()), None => { - let dist_path = self.const_dist_dir.path().join(format!("{:?}", s)); + let dist_path = self.const_dist_dir.path().join(format!("{s:?}")); create_mock_dist_server(&dist_path, s); *lock = Some(dist_path.clone()); Ok(dist_path) @@ -257,7 +260,7 @@ pub fn setup_test_state(test_dist_dir: tempfile::TempDir) -> (tempfile::TempDir, fn link_or_copy( original: &Path, link: &Path, - lock: &mut RwLockWriteGuard, + lock: &mut RwLockWriteGuard<'_, usize>, ) -> io::Result<()> { **lock += 1; if **lock < MAX_TESTS_PER_RUSTUP_EXE { @@ -285,10 +288,10 @@ pub fn setup_test_state(test_dist_dir: tempfile::TempDir) -> (tempfile::TempDir, // Make sure the host triple matches the build triple. Otherwise testing a 32-bit build of // rustup on a 64-bit machine will fail, because the tests do not have the host detection // functionality built in. - config.run("rustup", &["set", "default-host", &this_host_triple()], &[]); + config.run("rustup", ["set", "default-host", &this_host_triple()], &[]); // Set the auto update mode to disable, as most tests do not want to update rustup itself during the test. - config.run("rustup", &["set", "auto-self-update", "disable"], &[]); + config.run("rustup", ["set", "auto-self-update", "disable"], &[]); // Create some custom toolchains create_custom_toolchains(&config.customdir); @@ -302,7 +305,7 @@ pub fn test(s: Scenario, f: &dyn Fn(&mut Config)) { // Things we might cache or what not // Mutable dist server - working toward elimination - let test_dist_dir = rustup::test::test_dist_dir().unwrap(); + let test_dist_dir = crate::test::test_dist_dir().unwrap(); create_mock_dist_server(test_dist_dir.path(), s); // Things that are just about the test itself @@ -509,6 +512,8 @@ impl Config { } } + /// Expect an ok status + #[track_caller] pub fn expect_ok(&mut self, args: &[&str]) { let out = self.run(args[0], &args[1..], &[]); if !out.ok { @@ -518,6 +523,8 @@ impl Config { } } + /// Expect an err status and a string in stderr + #[track_caller] pub fn expect_err(&self, args: &[&str], expected: &str) { let out = self.run(args[0], &args[1..], &[]); if out.ok || !out.stderr.contains(expected) { @@ -528,6 +535,8 @@ impl Config { } } + /// Expect an ok status and a string in stdout + #[track_caller] pub fn expect_stdout_ok(&self, args: &[&str], expected: &str) { let out = self.run(args[0], &args[1..], &[]); if !out.ok || !out.stdout.contains(expected) { @@ -538,6 +547,7 @@ impl Config { } } + #[track_caller] pub fn expect_not_stdout_ok(&self, args: &[&str], expected: &str) { let out = self.run(args[0], &args[1..], &[]); if !out.ok || out.stdout.contains(expected) { @@ -548,6 +558,7 @@ impl Config { } } + #[track_caller] pub fn expect_not_stderr_ok(&self, args: &[&str], expected: &str) { let out = self.run(args[0], &args[1..], &[]); if !out.ok || out.stderr.contains(expected) { @@ -558,6 +569,7 @@ impl Config { } } + #[track_caller] pub fn expect_not_stderr_err(&self, args: &[&str], expected: &str) { let out = self.run(args[0], &args[1..], &[]); if out.ok || out.stderr.contains(expected) { @@ -568,6 +580,8 @@ impl Config { } } + /// Expect an ok status and a string in stderr + #[track_caller] pub fn expect_stderr_ok(&self, args: &[&str], expected: &str) { let out = self.run(args[0], &args[1..], &[]); if !out.ok || !out.stderr.contains(expected) { @@ -578,6 +592,8 @@ impl Config { } } + /// Expect an exact strings on stdout/stderr with an ok status code + #[track_caller] pub fn expect_ok_ex(&mut self, args: &[&str], stdout: &str, stderr: &str) { let out = self.run(args[0], &args[1..], &[]); if !out.ok || out.stdout != stdout || out.stderr != stderr { @@ -591,6 +607,8 @@ impl Config { } } + /// Expect an exact strings on stdout/stderr with an error status code + #[track_caller] pub fn expect_err_ex(&self, args: &[&str], stdout: &str, stderr: &str) { let out = self.run(args[0], &args[1..], &[]); if out.ok || out.stdout != stdout || out.stderr != stderr { @@ -610,6 +628,7 @@ impl Config { } } + #[track_caller] pub fn expect_ok_contains(&self, args: &[&str], stdout: &str, stderr: &str) { let out = self.run(args[0], &args[1..], &[]); if !out.ok || !out.stdout.contains(stdout) || !out.stderr.contains(stderr) { @@ -621,6 +640,7 @@ impl Config { } } + #[track_caller] pub fn expect_ok_eq(&self, args1: &[&str], args2: &[&str]) { let out1 = self.run(args1[0], &args1[1..], &[]); let out2 = self.run(args2[0], &args2[1..], &[]); @@ -633,8 +653,9 @@ impl Config { } } + #[track_caller] pub fn expect_component_executable(&self, cmd: &str) { - let out1 = self.run(cmd, &["--version"], &[]); + let out1 = self.run(cmd, ["--version"], &[]); if !out1.ok { print_command(&[cmd, "--version"], &out1); println!("expected.ok: true"); @@ -642,8 +663,9 @@ impl Config { } } + #[track_caller] pub fn expect_component_not_executable(&self, cmd: &str) { - let out1 = self.run(cmd, &["--version"], &[]); + let out1 = self.run(cmd, ["--version"], &[]); if out1.ok { print_command(&[cmd, "--version"], &out1); println!("expected.ok: false"); @@ -653,15 +675,15 @@ impl Config { pub fn run(&self, name: &str, args: I, env: &[(&str, &str)]) -> SanitizedOutput where - I: IntoIterator + Clone, + I: IntoIterator + Clone + Debug, A: AsRef, { let inprocess = allow_inprocess(name, args.clone()); let start = Instant::now(); let out = if inprocess { - self.run_inprocess(name, args, env) + self.run_inprocess(name, args.clone(), env) } else { - self.run_subprocess(name, args, env) + self.run_subprocess(name, args.clone(), env) }; let duration = Instant::now() - start; let output = SanitizedOutput { @@ -670,6 +692,7 @@ impl Config { stderr: String::from_utf8(out.stderr).unwrap(), }; + println!("ran: {} {:?}", name, args); println!("inprocess: {inprocess}"); println!("status: {:?}", out.status); println!("duration: {:.3}s", duration.as_secs_f32()); @@ -712,7 +735,7 @@ impl Config { let ec = match process_res { Ok(process_res) => process_res, Err(e) => { - currentprocess::with(tp.clone(), || rustup::cli::common::report_error(&e)); + currentprocess::with(tp.clone(), || crate::cli::common::report_error(&e)); utils::ExitCode(1) } }; @@ -723,6 +746,7 @@ impl Config { } } + #[track_caller] pub fn run_subprocess(&self, name: &str, args: I, env: &[(&str, &str)]) -> Output where I: IntoIterator, @@ -770,7 +794,7 @@ pub fn set_current_dist_date(config: &Config, date: &str) { } } -pub(crate) fn print_command(args: &[&str], out: &SanitizedOutput) { +pub fn print_command(args: &[&str], out: &SanitizedOutput) { print!("\n>"); for arg in args { if arg.contains(' ') { @@ -785,7 +809,7 @@ pub(crate) fn print_command(args: &[&str], out: &SanitizedOutput) { print_indented("out.stderr", &out.stderr); } -pub(crate) fn print_indented(heading: &str, text: &str) { +pub fn print_indented(heading: &str, text: &str) { let mut lines = text.lines().count(); // The standard library treats `a\n` and `a` as both being one line. // This is confusing when the test fails because of a missing newline. diff --git a/tests/mock/dist.rs b/src/test/mock/dist.rs similarity index 99% rename from tests/mock/dist.rs rename to src/test/mock/dist.rs index 1be0807a8f..0b42a9ceb6 100644 --- a/tests/mock/dist.rs +++ b/src/test/mock/dist.rs @@ -1,7 +1,6 @@ //! Tools for building and working with the filesystem of a mock Rust //! distribution server, with v1 and v2 manifests. -use crate::mock::MockInstallerBuilder; use lazy_static::lazy_static; use sha2::{Digest, Sha256}; use std::collections::HashMap; @@ -11,7 +10,8 @@ use std::path::{Path, PathBuf}; use std::sync::Mutex; use url::Url; -use crate::mock::clitools::hard_link; +use super::clitools::hard_link; +use super::MockInstallerBuilder; // This function changes the mock manifest for a given channel to that // of a particular date. For advancing the build from e.g. 2016-02-1 diff --git a/tests/mock/mock_bin_src.rs b/src/test/mock/mock_bin_src.rs similarity index 100% rename from tests/mock/mock_bin_src.rs rename to src/test/mock/mock_bin_src.rs diff --git a/tests/mock/mod.rs b/src/test/mock/mod.rs similarity index 98% rename from tests/mock/mod.rs rename to src/test/mock/mod.rs index f636f90d79..aee84232a4 100644 --- a/tests/mock/mod.rs +++ b/src/test/mock/mod.rs @@ -40,7 +40,7 @@ struct MockContents { } impl std::fmt::Debug for MockContents { - fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("MockContents") .field("content_len", &self.contents.len()) .field("executable", &self.executable) diff --git a/tests/mock/topical_doc_data.rs b/src/test/mock/topical_doc_data.rs similarity index 100% rename from tests/mock/topical_doc_data.rs rename to src/test/mock/topical_doc_data.rs diff --git a/src/toolchain.rs b/src/toolchain.rs index b88eb4cf6c..637f2cca4b 100644 --- a/src/toolchain.rs +++ b/src/toolchain.rs @@ -1,1004 +1,5 @@ -use std::env::consts::EXE_SUFFIX; -use std::ffi::OsStr; -use std::ffi::OsString; -use std::io::{BufRead, BufReader}; -use std::path::{Path, PathBuf}; -use std::process::{Command, Stdio}; -use std::str::FromStr; -use std::time::Duration; -use std::{env, fmt::Debug}; - -use anyhow::{anyhow, bail, Context, Result}; -use thiserror::Error as ThisError; -use wait_timeout::ChildExt; - -use crate::component_for_bin; -use crate::config::Cfg; -use crate::dist::dist::Profile; -use crate::dist::dist::TargetTriple; -use crate::dist::dist::ToolchainDesc; -use crate::dist::download::DownloadCfg; -use crate::dist::manifest::Component; -use crate::dist::manifest::Manifest; -use crate::dist::manifestation::{Changes, Manifestation}; -use crate::dist::prefix::InstallPrefix; -use crate::env_var; -use crate::errors::*; -use crate::install::{self, InstallMethod}; -use crate::notifications::*; -use crate::process; -use crate::utils::utils; - -/// An installed toolchain -trait InstalledToolchain<'a> { - /// What (root) paths are associated with this installed toolchain. - fn installed_paths(&self) -> Result>>; -} - -/// Installed paths -enum InstalledPath<'a> { - File { name: &'static str, path: PathBuf }, - Dir { path: &'a Path }, -} - -/// A fully resolved reference to a toolchain which may or may not exist -pub struct Toolchain<'a> { - cfg: &'a Cfg, - name: String, - path: PathBuf, - dist_handler: Box) + 'a>, -} - -/// Used by the `list_component` function -pub struct ComponentStatus { - pub component: Component, - pub name: String, - pub installed: bool, - pub available: bool, -} - -#[derive(Clone, Debug)] -pub enum UpdateStatus { - Installed, - Updated(String), // Stores the version of rustc *before* the update - Unchanged, -} - -static V1_COMMON_COMPONENT_LIST: &[&str] = &["cargo", "rustc", "rust-docs"]; - -impl<'a> Toolchain<'a> { - pub(crate) fn from(cfg: &'a Cfg, name: &str) -> Result { - let resolved_name = cfg.resolve_toolchain(name)?; - let path = cfg.toolchains_dir.join(&resolved_name); - Ok(Toolchain { - cfg, - name: resolved_name, - path, - dist_handler: Box::new(move |n| (cfg.notify_handler)(n.into())), - }) - } - - pub(crate) fn from_path( - cfg: &'a Cfg, - cfg_file: Option>, - path: impl AsRef, - ) -> Result { - let path = if let Some(cfg_file) = cfg_file { - cfg_file.as_ref().parent().unwrap().join(path) - } else { - path.as_ref().to_path_buf() - }; - - #[derive(Debug, ThisError)] - #[error("invalid toolchain path: '{}'", .0.to_string_lossy())] - struct InvalidToolchainPath(PathBuf); - - // Perform minimal validation; there should at least be a `bin/` that might - // contain things for us to run. - if !path.join("bin").is_dir() { - bail!(InvalidToolchainPath(path)); - } - - Ok(Toolchain { - cfg, - name: utils::canonicalize_path(&path, cfg.notify_handler.as_ref()) - .to_str() - .ok_or_else(|| anyhow!(InvalidToolchainPath(path.clone())))? - .to_owned(), - path, - dist_handler: Box::new(move |n| (cfg.notify_handler)(n.into())), - }) - } - - pub fn as_installed_common(&'a self) -> Result> { - if !self.exists() { - // Should be verify perhaps? - return Err(RustupError::ToolchainNotInstalled(self.name.to_owned()).into()); - } - Ok(InstalledCommonToolchain(self)) - } - - fn as_installed(&'a self) -> Result + 'a>> { - if self.is_custom() { - let toolchain = CustomToolchain::new(self)?; - Ok(Box::new(toolchain) as Box>) - } else { - let toolchain = DistributableToolchain::new(self)?; - Ok(Box::new(toolchain) as Box>) - } - } - pub(crate) fn cfg(&self) -> &Cfg { - self.cfg - } - pub fn name(&self) -> &str { - &self.name - } - pub fn path(&self) -> &Path { - &self.path - } - fn is_symlink(&self) -> bool { - use std::fs; - fs::symlink_metadata(&self.path) - .map(|m| m.file_type().is_symlink()) - .unwrap_or(false) - } - /// Is there a filesystem component with the name of the toolchain in the toolchains dir - valid install or not. - /// Used to determine whether this toolchain should be uninstallable. - /// Custom and Distributable. Installed and uninstalled. (perhaps onstalled only?) - pub fn exists(&self) -> bool { - // HACK: linked toolchains are symlinks, and, contrary to what std docs - // lead me to believe `fs::metadata`, used by `is_directory` does not - // seem to follow symlinks on windows. - let is_symlink = if cfg!(windows) { - self.is_symlink() - } else { - false - }; - utils::is_directory(&self.path) || is_symlink - } - /// Is there a valid usable toolchain with this name, either in the toolchains dir, or symlinked from it. - // Could in future check for rustc perhaps. - // Custom and Distributable. Installed only? - pub fn verify(&self) -> Result<()> { - utils::assert_is_directory(&self.path) - } - // Custom and Distributable. Installed only. - pub fn remove(&self) -> Result<()> { - if self.exists() || self.is_symlink() { - (self.cfg.notify_handler)(Notification::UninstallingToolchain(&self.name)); - } else { - (self.cfg.notify_handler)(Notification::ToolchainNotInstalled(&self.name)); - return Ok(()); - } - let installed = self.as_installed()?; - for path in installed.installed_paths()? { - match path { - InstalledPath::File { name, path } => utils::ensure_file_removed(name, &path)?, - InstalledPath::Dir { path } => { - install::uninstall(path, &|n| (self.cfg.notify_handler)(n.into()))? - } - } - } - if !self.exists() { - (self.cfg.notify_handler)(Notification::UninstalledToolchain(&self.name)); - } - Ok(()) - } - - // Custom only - pub fn is_custom(&self) -> bool { - Toolchain::is_custom_name(&self.name) - } - - pub(crate) fn is_custom_name(name: &str) -> bool { - ToolchainDesc::from_str(name).is_err() - } - - // Distributable only - pub fn is_tracking(&self) -> bool { - ToolchainDesc::from_str(&self.name) - .ok() - .map(|d| d.is_tracking()) - == Some(true) - } - - // Custom and Distributable. Installed only. - pub fn doc_path(&self, relative: &str) -> Result { - self.verify()?; - - let parts = vec!["share", "doc", "rust", "html"]; - let mut doc_dir = self.path.clone(); - for part in parts { - doc_dir.push(part); - } - doc_dir.push(relative); - - Ok(doc_dir) - } - // Custom and Distributable. Installed only. - pub fn open_docs(&self, relative: &str) -> Result<()> { - self.verify()?; - - utils::open_browser(&self.doc_path(relative)?) - } - // Custom and Distributable. Installed only. - pub fn make_default(&self) -> Result<()> { - self.cfg.set_default(&self.name) - } - // Custom and Distributable. Installed only. - pub fn make_override(&self, path: &Path) -> Result<()> { - self.cfg.settings_file.with_mut(|s| { - s.add_override(path, self.name.clone(), self.cfg.notify_handler.as_ref()); - Ok(()) - }) - } - // Distributable and Custom. Installed only. - pub fn binary_file(&self, name: &str) -> PathBuf { - let mut path = self.path.clone(); - path.push("bin"); - path.push(name.to_owned() + env::consts::EXE_SUFFIX); - path - } - // Distributable and Custom. Installed only. - #[cfg_attr(feature = "otel", tracing::instrument)] - pub fn rustc_version(&self) -> String { - if let Ok(installed) = self.as_installed_common() { - let rustc_path = self.binary_file("rustc"); - if utils::is_file(&rustc_path) { - let mut cmd = Command::new(&rustc_path); - cmd.arg("--version"); - cmd.stdin(Stdio::null()); - cmd.stdout(Stdio::piped()); - cmd.stderr(Stdio::piped()); - installed.set_ldpath(&mut cmd); - - // some toolchains are faulty with some combinations of platforms and - // may fail to launch but also to timely terminate. - // (known cases include Rust 1.3.0 through 1.10.0 in recent macOS Sierra.) - // we guard against such cases by enforcing a reasonable timeout to read. - let mut line1 = None; - if let Ok(mut child) = cmd.spawn() { - let timeout = Duration::new(10, 0); - match child.wait_timeout(timeout) { - Ok(Some(status)) if status.success() => { - let out = child - .stdout - .expect("Child::stdout requested but not present"); - let mut line = String::new(); - if BufReader::new(out).read_line(&mut line).is_ok() { - let lineend = line.trim_end_matches(&['\r', '\n'][..]).len(); - line.truncate(lineend); - line1 = Some(line); - } - } - Ok(None) => { - let _ = child.kill(); - return String::from("(timeout reading rustc version)"); - } - Ok(Some(_)) | Err(_) => {} - } - } - - if let Some(line1) = line1 { - line1 - } else { - String::from("(error reading rustc version)") - } - } else { - String::from("(rustc does not exist)") - } - } else { - String::from("(toolchain not installed)") - } - } -} - -impl<'a> std::fmt::Debug for Toolchain<'a> { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - f.debug_struct("Toolchain") - .field("name", &self.name) - .field("path", &self.path) - .finish() - } -} - -fn install_msg(bin: &str, toolchain: &str, is_default: bool) -> String { - if Toolchain::is_custom_name(toolchain) { - return "\nnote: this is a custom toolchain, which cannot use `rustup component add`\n\ - help: if you built this toolchain from source, and used `rustup toolchain link`, then you may be able to build the component with `x.py`".to_string(); - } - match component_for_bin(bin) { - Some(c) => format!("\nTo install, run `rustup component add {}{}`", c, { - if is_default { - String::new() - } else { - format!(" --toolchain {toolchain}") - } - }), - None => String::new(), - } -} -/// Newtype hosting functions that apply to both custom and distributable toolchains that are installed. -pub struct InstalledCommonToolchain<'a>(&'a Toolchain<'a>); - -impl<'a> InstalledCommonToolchain<'a> { - pub fn create_command>(&self, binary: T) -> Result { - // Create the path to this binary within the current toolchain sysroot - let binary = if let Some(binary_str) = binary.as_ref().to_str() { - if binary_str.to_lowercase().ends_with(EXE_SUFFIX) { - binary.as_ref().to_owned() - } else { - OsString::from(format!("{binary_str}{EXE_SUFFIX}")) - } - } else { - // Very weird case. Non-unicode command. - binary.as_ref().to_owned() - }; - - let bin_path = self.0.path.join("bin").join(&binary); - let path = if utils::is_file(&bin_path) { - &bin_path - } else { - let recursion_count = process() - .var("RUST_RECURSION_COUNT") - .ok() - .and_then(|s| s.parse().ok()) - .unwrap_or(0); - if recursion_count > env_var::RUST_RECURSION_COUNT_MAX - 1 { - let binary_lossy: String = binary.to_string_lossy().into(); - if let Ok(distributable) = DistributableToolchain::new(self.0) { - if let (Some(component_name), Ok(component_statuses), Ok(Some(manifest))) = ( - component_for_bin(&binary_lossy), - distributable.list_components(), - distributable.get_manifest(), - ) { - let component_status = component_statuses - .iter() - .find(|cs| cs.component.short_name(&manifest) == component_name) - .unwrap_or_else(|| { - panic!("component {component_name} should be in the manifest") - }); - if !component_status.available { - return Err(anyhow!(format!( - "the '{}' component which provides the command '{}' is not available for the '{}' toolchain", component_status.component.short_name(&manifest), binary_lossy, self.0.name))); - } - if component_status.installed { - return Err(anyhow!(format!( - "the '{}' binary, normally provided by the '{}' component, is not applicable to the '{}' toolchain", binary_lossy, component_status.component.short_name(&manifest), self.0.name))); - } - } - } - let defaults = self.0.cfg.get_default()?; - return Err(anyhow!(format!( - "'{}' is not installed for the toolchain '{}'{}", - binary.to_string_lossy(), - self.0.name, - install_msg( - &binary.to_string_lossy(), - &self.0.name, - Some(&self.0.name) == defaults.as_ref() - ) - ))); - } - Path::new(&binary) - }; - let mut cmd = Command::new(path); - self.set_env(&mut cmd); - Ok(cmd) - } - - fn set_env(&self, cmd: &mut Command) { - self.set_ldpath(cmd); - - // Older versions of Cargo used a slightly different definition of - // cargo home. Rustup does not read HOME on Windows whereas the older - // versions of Cargo did. Rustup and Cargo should be in sync now (both - // using the same `home` crate), but this is retained to ensure cargo - // and rustup agree in older versions. - if let Ok(cargo_home) = utils::cargo_home() { - cmd.env("CARGO_HOME", &cargo_home); - } - - env_var::inc("RUST_RECURSION_COUNT", cmd); - - cmd.env("RUSTUP_TOOLCHAIN", &self.0.name); - cmd.env("RUSTUP_HOME", &self.0.cfg.rustup_dir); - } - - fn set_ldpath(&self, cmd: &mut Command) { - let mut new_path = vec![self.0.path.join("lib")]; - - #[cfg(not(target_os = "macos"))] - mod sysenv { - pub const LOADER_PATH: &str = "LD_LIBRARY_PATH"; - } - #[cfg(target_os = "macos")] - mod sysenv { - // When loading and linking a dynamic library or bundle, dlopen - // searches in LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PWD, and - // DYLD_FALLBACK_LIBRARY_PATH. - // In the Mach-O format, a dynamic library has an "install path." - // Clients linking against the library record this path, and the - // dynamic linker, dyld, uses it to locate the library. - // dyld searches DYLD_LIBRARY_PATH *before* the install path. - // dyld searches DYLD_FALLBACK_LIBRARY_PATH only if it cannot - // find the library in the install path. - // Setting DYLD_LIBRARY_PATH can easily have unintended - // consequences. - pub const LOADER_PATH: &str = "DYLD_FALLBACK_LIBRARY_PATH"; - } - if cfg!(target_os = "macos") - && process() - .var_os(sysenv::LOADER_PATH) - .filter(|x| x.len() > 0) - .is_none() - { - // These are the defaults when DYLD_FALLBACK_LIBRARY_PATH isn't - // set or set to an empty string. Since we are explicitly setting - // the value, make sure the defaults still work. - if let Some(home) = process().var_os("HOME") { - new_path.push(PathBuf::from(home).join("lib")); - } - new_path.push(PathBuf::from("/usr/local/lib")); - new_path.push(PathBuf::from("/usr/lib")); - } - - env_var::prepend_path(sysenv::LOADER_PATH, new_path, cmd); - - // Prepend CARGO_HOME/bin to the PATH variable so that we're sure to run - // cargo/rustc via the proxy bins. There is no fallback case for if the - // proxy bins don't exist. We'll just be running whatever happens to - // be on the PATH. - let mut path_entries = vec![]; - if let Ok(cargo_home) = utils::cargo_home() { - path_entries.push(cargo_home.join("bin")); - } - - if cfg!(target_os = "windows") { - // Historically rustup has included the bin directory in PATH to - // work around some bugs (see - // https://github.com/rust-lang/rustup/pull/3178 for more - // information). This shouldn't be needed anymore, and it causes - // problems because calling tools recursively (like `cargo - // +nightly metadata` from within a cargo subcommand). The - // recursive call won't work because it is not executing the - // proxy, so the `+` toolchain override doesn't work. - // - // This is opt-in to allow us to get more real-world testing. - if process() - .var_os("RUSTUP_WINDOWS_PATH_ADD_BIN") - .map_or(true, |s| s == "1") - { - path_entries.push(self.0.path.join("bin")); - } - } - - env_var::prepend_path("PATH", path_entries, cmd); - } -} - -/// Newtype to facilitate splitting out custom-toolchain specific code. -pub struct CustomToolchain<'a>(&'a Toolchain<'a>); - -impl<'a> CustomToolchain<'a> { - pub fn new(toolchain: &'a Toolchain<'a>) -> Result> { - if toolchain.is_custom() { - Ok(CustomToolchain(toolchain)) - } else { - Err(anyhow!(format!( - "{} is not a custom toolchain", - toolchain.name() - ))) - } - } - - // Not installed only. - pub fn install_from_dir(&self, src: &Path, link: bool) -> Result<()> { - let mut pathbuf = PathBuf::from(src); - - pathbuf.push("lib"); - utils::assert_is_directory(&pathbuf)?; - pathbuf.pop(); - pathbuf.push("bin"); - utils::assert_is_directory(&pathbuf)?; - pathbuf.push(format!("rustc{EXE_SUFFIX}")); - utils::assert_is_file(&pathbuf)?; - - if link { - InstallMethod::Link(&utils::to_absolute(src)?, self).install(self.0)?; - } else { - InstallMethod::Copy(src, self).install(self.0)?; - } - - Ok(()) - } -} - -impl<'a> InstalledToolchain<'a> for CustomToolchain<'a> { - fn installed_paths(&self) -> Result>> { - let path = &self.0.path; - Ok(vec![InstalledPath::Dir { path }]) - } -} - -/// Newtype to facilitate splitting out distributable-toolchain specific code. -#[derive(Debug)] -pub struct DistributableToolchain<'a>(&'a Toolchain<'a>); - -impl<'a> DistributableToolchain<'a> { - pub fn new(toolchain: &'a Toolchain<'a>) -> Result> { - if toolchain.is_custom() { - Err(anyhow!(format!( - "{} is a custom toolchain", - toolchain.name() - ))) - } else { - Ok(DistributableToolchain(toolchain)) - } - } - - /// Temporary helper until we further split this into a newtype for - /// InstalledDistributableToolchain - one where the type can protect component operations. - pub fn new_for_components(toolchain: &'a Toolchain<'a>) -> Result> { - DistributableToolchain::new(toolchain).context(RustupError::ComponentsUnsupported( - toolchain.name().to_string(), - )) - } - - // Installed only. - pub(crate) fn add_component(&self, mut component: Component) -> Result<()> { - if let Some(desc) = self.get_toolchain_desc_with_manifest()? { - // Rename the component if necessary. - if let Some(c) = desc.manifest.rename_component(&component) { - component = c; - } - - // Validate the component name - let rust_pkg = desc - .manifest - .packages - .get("rust") - .expect("manifest should contain a rust package"); - let targ_pkg = rust_pkg - .targets - .get(&desc.toolchain.target) - .expect("installed manifest should have a known target"); - - if !targ_pkg.components.contains(&component) { - let wildcard_component = component.wildcard(); - if targ_pkg.components.contains(&wildcard_component) { - component = wildcard_component; - } else { - return Err(RustupError::UnknownComponent { - name: self.0.name.to_string(), - component: component.description(&desc.manifest), - suggestion: self.get_component_suggestion( - &component, - &desc.manifest, - false, - ), - } - .into()); - } - } - - let changes = Changes { - explicit_add_components: vec![component], - remove_components: vec![], - }; - - desc.manifestation.update( - &desc.manifest, - changes, - false, - &self.download_cfg(), - &self.download_cfg().notify_handler, - &desc.toolchain.manifest_name(), - false, - )?; - - Ok(()) - } else { - Err(RustupError::MissingManifest { - name: self.0.name.to_string(), - } - .into()) - } - } - - // Create a command as a fallback for another toolchain. This is used - // to give custom toolchains access to cargo - // Installed only. - pub fn create_fallback_command>( - &self, - binary: T, - primary_toolchain: &Toolchain<'_>, - ) -> Result { - // With the hacks below this only works for cargo atm - assert!(binary.as_ref() == "cargo" || binary.as_ref() == "cargo.exe"); - - if !self.0.exists() { - return Err(RustupError::ToolchainNotInstalled(self.0.name.to_owned()).into()); - } - let installed_primary = primary_toolchain.as_installed_common()?; - - let src_file = self.0.path.join("bin").join(format!("cargo{EXE_SUFFIX}")); - - // MAJOR HACKS: Copy cargo.exe to its own directory on windows before - // running it. This is so that the fallback cargo, when it in turn runs - // rustc.exe, will run the rustc.exe out of the PATH environment - // variable, _not_ the rustc.exe sitting in the same directory as the - // fallback. See the `fallback_cargo_calls_correct_rustc` test case and - // PR 812. - // - // On Windows, spawning a process will search the running application's - // directory for the exe to spawn before searching PATH, and we don't want - // it to do that, because cargo's directory contains the _wrong_ rustc. See - // the documentation for the lpCommandLine argument of CreateProcess. - let exe_path = if cfg!(windows) { - use std::fs; - let fallback_dir = self.0.cfg.rustup_dir.join("fallback"); - fs::create_dir_all(&fallback_dir) - .context("unable to create dir to hold fallback exe")?; - let fallback_file = fallback_dir.join("cargo.exe"); - if fallback_file.exists() { - fs::remove_file(&fallback_file).context("unable to unlink old fallback exe")?; - } - fs::hard_link(&src_file, &fallback_file).context("unable to hard link fallback exe")?; - fallback_file - } else { - src_file - }; - let mut cmd = Command::new(exe_path); - installed_primary.set_env(&mut cmd); // set up the environment to match rustc, not cargo - cmd.env("RUSTUP_TOOLCHAIN", &primary_toolchain.name); - Ok(cmd) - } - - // Installed and not-installed? - pub(crate) fn desc(&self) -> Result { - ToolchainDesc::from_str(&self.0.name) - } - - fn download_cfg(&self) -> DownloadCfg<'_> { - self.0.cfg.download_cfg(&*self.0.dist_handler) - } - - // Installed only? - fn get_component_suggestion( - &self, - component: &Component, - manifest: &Manifest, - only_installed: bool, - ) -> Option { - use strsim::damerau_levenshtein; - - // Suggest only for very small differences - // High number can result in inaccurate suggestions for short queries e.g. `rls` - const MAX_DISTANCE: usize = 3; - - let components = self.list_components(); - if let Ok(components) = components { - let short_name_distance = components - .iter() - .filter(|c| !only_installed || c.installed) - .map(|c| { - ( - damerau_levenshtein( - &c.component.name(manifest)[..], - &component.name(manifest)[..], - ), - c, - ) - }) - .min_by_key(|t| t.0) - .expect("There should be always at least one component"); - - let long_name_distance = components - .iter() - .filter(|c| !only_installed || c.installed) - .map(|c| { - ( - damerau_levenshtein( - &c.component.name_in_manifest()[..], - &component.name(manifest)[..], - ), - c, - ) - }) - .min_by_key(|t| t.0) - .expect("There should be always at least one component"); - - let mut closest_distance = short_name_distance; - let mut closest_match = short_name_distance.1.component.short_name(manifest); - - // Find closer suggestion - if short_name_distance.0 > long_name_distance.0 { - closest_distance = long_name_distance; - - // Check if only targets differ - if closest_distance.1.component.short_name_in_manifest() - == component.short_name_in_manifest() - { - closest_match = long_name_distance.1.component.target(); - } else { - closest_match = long_name_distance - .1 - .component - .short_name_in_manifest() - .to_string(); - } - } else { - // Check if only targets differ - if closest_distance.1.component.short_name(manifest) - == component.short_name(manifest) - { - closest_match = short_name_distance.1.component.target(); - } - } - - // If suggestion is too different don't suggest anything - if closest_distance.0 > MAX_DISTANCE { - None - } else { - Some(closest_match) - } - } else { - None - } - } - - // Installed only. - pub(crate) fn get_manifest(&self) -> Result> { - Ok(self.get_toolchain_desc_with_manifest()?.map(|d| d.manifest)) - } - - // Not installed only? - pub(crate) fn install_from_dist( - &self, - force_update: bool, - allow_downgrade: bool, - components: &[&str], - targets: &[&str], - profile: Option, - ) -> Result { - let update_hash = self.update_hash()?; - let old_date = self.get_manifest().ok().and_then(|m| m.map(|m| m.date)); - InstallMethod::Dist { - desc: &self.desc()?, - profile: profile - .map(Ok) - .unwrap_or_else(|| self.0.cfg.get_profile())?, - update_hash: Some(&update_hash), - dl_cfg: self.download_cfg(), - force_update, - allow_downgrade, - exists: self.0.exists(), - old_date: old_date.as_deref(), - components, - targets, - } - .install(self.0) - } - - // Installed or not installed. - pub fn install_from_dist_if_not_installed(&self) -> Result { - let update_hash = self.update_hash()?; - (self.0.cfg.notify_handler)(Notification::LookingForToolchain(&self.0.name)); - if !self.0.exists() { - Ok(InstallMethod::Dist { - desc: &self.desc()?, - profile: self.0.cfg.get_profile()?, - update_hash: Some(&update_hash), - dl_cfg: self.download_cfg(), - force_update: false, - allow_downgrade: false, - exists: false, - old_date: None, - components: &[], - targets: &[], - } - .install(self.0)?) - } else { - (self.0.cfg.notify_handler)(Notification::UsingExistingToolchain(&self.0.name)); - Ok(UpdateStatus::Unchanged) - } - } - - #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] - pub(crate) fn get_toolchain_desc_with_manifest( - &self, - ) -> Result> { - if !self.0.exists() { - bail!(RustupError::ToolchainNotInstalled(self.0.name.to_owned())); - } - let toolchain = &self.0.name; - let toolchain = ToolchainDesc::from_str(toolchain) - .context(RustupError::ComponentsUnsupported(self.0.name.to_string()))?; - - let prefix = InstallPrefix::from(self.0.path.to_owned()); - let manifestation = Manifestation::open(prefix, toolchain.target.clone())?; - Ok(manifestation - .load_manifest()? - .map(|manifest| ToolchainDescWithManifest { - toolchain, - manifestation, - manifest, - })) - } - - #[cfg_attr(feature = "otel", tracing::instrument)] - pub fn list_components(&self) -> Result> { - if let Some(toolchain) = self.get_toolchain_desc_with_manifest()? { - toolchain.list_components() - } else { - Err(RustupError::ComponentsUnsupported(self.0.name.to_string()).into()) - } - } - - // Installed only. - pub(crate) fn remove_component(&self, mut component: Component) -> Result<()> { - if let Some(desc) = self.get_toolchain_desc_with_manifest()? { - // Rename the component if necessary. - if let Some(c) = desc.manifest.rename_component(&component) { - component = c; - } - - let dist_config = desc.manifestation.read_config()?.unwrap(); - if !dist_config.components.contains(&component) { - let wildcard_component = component.wildcard(); - if dist_config.components.contains(&wildcard_component) { - component = wildcard_component; - } else { - return Err(RustupError::UnknownComponent { - name: self.0.name.to_string(), - component: component.description(&desc.manifest), - suggestion: self.get_component_suggestion(&component, &desc.manifest, true), - } - .into()); - } - } - - let changes = Changes { - explicit_add_components: vec![], - remove_components: vec![component], - }; - - desc.manifestation.update( - &desc.manifest, - changes, - false, - &self.download_cfg(), - &self.download_cfg().notify_handler, - &desc.toolchain.manifest_name(), - false, - )?; - - Ok(()) - } else { - Err(RustupError::MissingManifest { - name: self.0.name.to_string(), - } - .into()) - } - } - - // Installed only. - pub fn show_dist_version(&self) -> Result> { - let update_hash = self.update_hash()?; - - match crate::dist::dist::dl_v2_manifest( - self.download_cfg(), - Some(&update_hash), - &self.desc()?, - )? { - Some((manifest, _)) => Ok(Some(manifest.get_rust_version()?.to_string())), - None => Ok(None), - } - } - - // Installed only. - pub fn show_version(&self) -> Result> { - match self.get_manifest()? { - Some(manifest) => Ok(Some(manifest.get_rust_version()?.to_string())), - None => Ok(None), - } - } - - // Installed only. - fn update_hash(&self) -> Result { - self.0.cfg.get_hash_file(&self.0.name, true) - } - - // Installed only. - pub fn guess_v1_manifest(&self) -> bool { - let prefix = InstallPrefix::from(self.0.path().to_owned()); - // If all the v1 common components are present this is likely to be - // a v1 manifest install. The v1 components are not called the same - // in a v2 install. - for component in V1_COMMON_COMPONENT_LIST { - let manifest = format!("manifest-{component}"); - let manifest_path = prefix.manifest_file(&manifest); - if !utils::path_exists(manifest_path) { - return false; - } - } - // It's reasonable to assume this is a v1 manifest installation - true - } -} - -/// Helper type to avoid parsing a manifest more than once -pub(crate) struct ToolchainDescWithManifest { - toolchain: ToolchainDesc, - manifestation: Manifestation, - pub manifest: Manifest, -} - -impl ToolchainDescWithManifest { - pub(crate) fn list_components(&self) -> Result> { - let config = self.manifestation.read_config()?; - - // Return all optional components of the "rust" package for the - // toolchain's target triple. - let mut res = Vec::new(); - - let rust_pkg = self - .manifest - .packages - .get("rust") - .expect("manifest should contain a rust package"); - let targ_pkg = rust_pkg - .targets - .get(&self.toolchain.target) - .expect("installed manifest should have a known target"); - - for component in &targ_pkg.components { - let installed = config - .as_ref() - .map(|c| component.contained_within(&c.components)) - .unwrap_or(false); - - let component_target = TargetTriple::new(&component.target()); - - // Get the component so we can check if it is available - let component_pkg = self - .manifest - .get_package(component.short_name_in_manifest()) - .unwrap_or_else(|_| { - panic!( - "manifest should contain component {}", - &component.short_name(&self.manifest) - ) - }); - let component_target_pkg = component_pkg - .targets - .get(&component_target) - .expect("component should have target toolchain"); - - res.push(ComponentStatus { - component: component.clone(), - name: component.name(&self.manifest), - installed, - available: component_target_pkg.available(), - }); - } - - res.sort_by(|a, b| a.component.cmp(&b.component)); - - Ok(res) - } -} - -impl<'a> InstalledToolchain<'a> for DistributableToolchain<'a> { - fn installed_paths(&self) -> Result>> { - let path = &self.0.path; - Ok(vec![ - InstalledPath::File { - name: "update hash", - path: self.update_hash()?, - }, - InstalledPath::Dir { path }, - ]) - } -} +pub(crate) mod custom; +pub(crate) mod distributable; +pub(crate) mod names; +#[allow(clippy::module_inception)] +pub(crate) mod toolchain; diff --git a/src/toolchain/custom.rs b/src/toolchain/custom.rs new file mode 100644 index 0000000000..5f47f8cccd --- /dev/null +++ b/src/toolchain/custom.rs @@ -0,0 +1,47 @@ +use std::{ + env::consts::EXE_SUFFIX, + path::{Path, PathBuf}, +}; + +use crate::{config::Cfg, install::InstallMethod, utils::utils}; + +use super::{names::CustomToolchainName, toolchain::InstalledPath}; + +/// An official toolchain installed on the local disk +#[derive(Debug)] +pub(crate) struct CustomToolchain; + +impl CustomToolchain { + pub(crate) fn install_from_dir( + cfg: &Cfg, + src: &Path, + dest: &CustomToolchainName, + link: bool, + ) -> anyhow::Result { + let mut pathbuf = PathBuf::from(src); + + pathbuf.push("lib"); + utils::assert_is_directory(&pathbuf)?; + pathbuf.pop(); + pathbuf.push("bin"); + utils::assert_is_directory(&pathbuf)?; + pathbuf.push(format!("rustc{EXE_SUFFIX}")); + utils::assert_is_file(&pathbuf)?; + + if link { + InstallMethod::Link { + src: &utils::to_absolute(src)?, + dest, + cfg, + } + .install()?; + } else { + InstallMethod::Copy { src, dest, cfg }.install()?; + } + Ok(Self) + } + + pub(crate) fn installed_paths(path: &Path) -> anyhow::Result>> { + Ok(vec![InstalledPath::Dir { path }]) + } +} diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs new file mode 100644 index 0000000000..479ef12b1b --- /dev/null +++ b/src/toolchain/distributable.rs @@ -0,0 +1,535 @@ +use std::{ + convert::Infallible, env::consts::EXE_SUFFIX, ffi::OsStr, fs, path::Path, process::Command, +}; + +use anyhow::{anyhow, Context}; + +use crate::{ + component_for_bin, + config::Cfg, + dist::{ + config::Config, + dist::{Profile, ToolchainDesc}, + manifest::{Component, Manifest}, + manifestation::{Changes, Manifestation}, + prefix::InstallPrefix, + }, + install::{InstallMethod, UpdateStatus}, + notifications::Notification, + RustupError, +}; + +use super::{ + names::{LocalToolchainName, ToolchainName}, + toolchain::{InstalledPath, Toolchain}, +}; + +/// An official toolchain installed on the local disk +#[derive(Debug)] +pub(crate) struct DistributableToolchain<'a> { + toolchain: Toolchain<'a>, + cfg: &'a Cfg, + desc: ToolchainDesc, +} + +impl<'a> DistributableToolchain<'a> { + pub(crate) fn new(cfg: &'a Cfg, desc: ToolchainDesc) -> Result { + Toolchain::new(cfg, (&desc).into()).map(|toolchain| Self { + toolchain, + cfg, + desc, + }) + } + + pub(crate) fn desc(&self) -> &ToolchainDesc { + &self.desc + } + + pub(crate) fn add_component(&self, mut component: Component) -> anyhow::Result<()> { + // TODO: take multiple components? + let manifestation = self.get_manifestation()?; + let manifest = self.get_manifest()?; + // Rename the component if necessary. + if let Some(c) = manifest.rename_component(&component) { + component = c; + } + + // Validate the component name + let rust_pkg = manifest + .packages + .get("rust") + .expect("manifest should contain a rust package"); + let targ_pkg = rust_pkg + .targets + .get(&self.desc.target) + .expect("installed manifest should have a known target"); + + if !targ_pkg.components.contains(&component) { + let wildcard_component = component.wildcard(); + if targ_pkg.components.contains(&wildcard_component) { + component = wildcard_component; + } else { + let config = manifestation.read_config()?.unwrap_or_default(); + return Err(RustupError::UnknownComponent { + desc: self.desc.clone(), + component: component.description(&manifest), + suggestion: self + .get_component_suggestion(&component, &config, &manifest, false), + } + .into()); + } + } + + let changes = Changes { + explicit_add_components: vec![component], + remove_components: vec![], + }; + + let notify_handler = + &|n: crate::dist::Notification<'_>| (self.cfg.notify_handler)(n.into()); + let download_cfg = self.cfg.download_cfg(¬ify_handler); + + manifestation.update( + &manifest, + changes, + false, + &download_cfg, + &download_cfg.notify_handler, + &self.desc.manifest_name(), + false, + )?; + + Ok(()) + } + + /// Are all the components installed in this distribution + pub(crate) fn components_exist( + &self, + components: &[&str], + targets: &[&str], + ) -> anyhow::Result { + let manifestation = self.get_manifestation()?; + let manifest = manifestation.load_manifest()?; + let manifest = match manifest { + None => { + // No manifest found. If this is a v1 install that's understandable + // and we assume the components are all good, otherwise we need to + // have a go at re-fetching the manifest to try again. + return Ok(self.guess_v1_manifest()); + } + Some(manifest) => manifest, + }; + let config = manifestation.read_config()?.unwrap_or_default(); + let installed_components = manifest.query_components(&self.desc, &config)?; + // check if all the components we want are installed + let wanted_components = components.iter().all(|name| { + installed_components.iter().any(|status| { + let cname = status.component.short_name(&manifest); + let cname = cname.as_str(); + let cnameim = status.component.short_name_in_manifest(); + let cnameim = cnameim.as_str(); + (cname == *name || cnameim == *name) && status.installed + }) + }); + // And that all the targets we want are installed + let wanted_targets = targets.iter().all(|name| { + installed_components + .iter() + .filter(|c| c.component.short_name_in_manifest() == "rust-std") + .any(|status| { + let ctarg = status.component.target(); + (ctarg == *name) && status.installed + }) + }); + Ok(wanted_components && wanted_targets) + } + + /// Create a command as a fallback for another toolchain. This is used + /// to give custom toolchains access to cargo + pub fn create_fallback_command>( + &self, + binary: T, + installed_primary: &Toolchain<'_>, + ) -> Result { + // With the hacks below this only works for cargo atm + let binary = binary.as_ref(); + assert!(binary == "cargo" || binary == "cargo.exe"); + + let src_file = self + .toolchain + .path() + .join("bin") + .join(format!("cargo{EXE_SUFFIX}")); + + // MAJOR HACKS: Copy cargo.exe to its own directory on windows before + // running it. This is so that the fallback cargo, when it in turn runs + // rustc.exe, will run the rustc.exe out of the PATH environment + // variable, _not_ the rustc.exe sitting in the same directory as the + // fallback. See the `fallback_cargo_calls_correct_rustc` test case and + // PR 812. + // + // On Windows, spawning a process will search the running application's + // directory for the exe to spawn before searching PATH, and we don't want + // it to do that, because cargo's directory contains the _wrong_ rustc. See + // the documentation for the lpCommandLine argument of CreateProcess. + let exe_path = if cfg!(windows) { + let fallback_dir = self.cfg.rustup_dir.join("fallback"); + fs::create_dir_all(&fallback_dir) + .context("unable to create dir to hold fallback exe")?; + let fallback_file = fallback_dir.join("cargo.exe"); + if fallback_file.exists() { + fs::remove_file(&fallback_file).context("unable to unlink old fallback exe")?; + } + fs::hard_link(&src_file, &fallback_file).context("unable to hard link fallback exe")?; + fallback_file + } else { + src_file + }; + let mut cmd = Command::new(exe_path); + installed_primary.set_env(&mut cmd); // set up the environment to match rustc, not cargo + cmd.env("RUSTUP_TOOLCHAIN", installed_primary.name().to_string()); + Ok(cmd) + } + + fn get_component_suggestion( + &self, + component: &Component, + config: &Config, + manifest: &Manifest, + only_installed: bool, + ) -> Option { + use strsim::damerau_levenshtein; + + // Suggest only for very small differences + // High number can result in inaccurate suggestions for short queries e.g. `rls` + const MAX_DISTANCE: usize = 3; + + let components = manifest.query_components(&self.desc, config); + if let Ok(components) = components { + let short_name_distance = components + .iter() + .filter(|c| !only_installed || c.installed) + .map(|c| { + ( + damerau_levenshtein( + &c.component.name(manifest)[..], + &component.name(manifest)[..], + ), + c, + ) + }) + .min_by_key(|t| t.0) + .expect("There should be always at least one component"); + + let long_name_distance = components + .iter() + .filter(|c| !only_installed || c.installed) + .map(|c| { + ( + damerau_levenshtein( + &c.component.name_in_manifest()[..], + &component.name(manifest)[..], + ), + c, + ) + }) + .min_by_key(|t| t.0) + .expect("There should be always at least one component"); + + let mut closest_distance = short_name_distance; + let mut closest_match = short_name_distance.1.component.short_name(manifest); + + // Find closer suggestion + if short_name_distance.0 > long_name_distance.0 { + closest_distance = long_name_distance; + + // Check if only targets differ + if closest_distance.1.component.short_name_in_manifest() + == component.short_name_in_manifest() + { + closest_match = long_name_distance.1.component.target(); + } else { + closest_match = long_name_distance + .1 + .component + .short_name_in_manifest() + .to_string(); + } + } else { + // Check if only targets differ + if closest_distance.1.component.short_name(manifest) + == component.short_name(manifest) + { + closest_match = short_name_distance.1.component.target(); + } + } + + // If suggestion is too different don't suggest anything + if closest_distance.0 > MAX_DISTANCE { + None + } else { + Some(closest_match) + } + } else { + None + } + } + + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + pub(crate) fn get_manifestation(&self) -> anyhow::Result { + let prefix = InstallPrefix::from(self.toolchain.path()); + Manifestation::open(prefix, self.desc.target.clone()) + } + + /// Get the manifest associated with this distribution + #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] + pub(crate) fn get_manifest(&self) -> anyhow::Result { + self.get_manifestation()? + .load_manifest() + .transpose() + .unwrap_or_else(|| match self.guess_v1_manifest() { + true => Err(RustupError::ComponentsUnsupportedV1(self.desc.to_string()).into()), + false => Err(RustupError::MissingManifest(self.desc.clone()).into()), + }) + } + + /// Guess whether this is a V1 or V2 manifest distribution. + pub(crate) fn guess_v1_manifest(&self) -> bool { + InstallPrefix::from(self.toolchain.path().to_owned()).guess_v1_manifest() + } + + #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + pub(crate) fn install( + cfg: &'a Cfg, + desc: &'_ ToolchainDesc, + components: &[&str], + targets: &[&str], + profile: Profile, + force: bool, + ) -> anyhow::Result<(UpdateStatus, Self)> { + let hash_path = cfg.get_hash_file(desc, true)?; + let update_hash = Some(&hash_path as &Path); + + let status = InstallMethod::Dist { + cfg, + desc, + profile, + update_hash, + dl_cfg: cfg.download_cfg(&|n| (cfg.notify_handler)(n.into())), + force, + allow_downgrade: false, + exists: false, + old_date_version: None, + components, + targets, + } + .install()?; + Ok((status, Self::new(cfg, desc.clone())?)) + } + + #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + pub fn install_if_not_installed( + cfg: &'a Cfg, + desc: &'a ToolchainDesc, + ) -> anyhow::Result { + (cfg.notify_handler)(Notification::LookingForToolchain(desc)); + if Toolchain::exists(cfg, &desc.into())? { + (cfg.notify_handler)(Notification::UsingExistingToolchain(desc)); + Ok(UpdateStatus::Unchanged) + } else { + Ok(Self::install(cfg, desc, &[], &[], cfg.get_profile()?, false)?.0) + } + } + + #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + pub(crate) fn update( + &mut self, + components: &[&str], + targets: &[&str], + profile: Profile, + ) -> anyhow::Result { + self.update_extra(components, targets, profile, true, false) + } + + /// Update a toolchain with control over the channel behaviour + #[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] + pub(crate) fn update_extra( + &mut self, + components: &[&str], + targets: &[&str], + profile: Profile, + force: bool, + allow_downgrade: bool, + ) -> anyhow::Result { + let old_date_version = + // Ignore a missing manifest: we can't report the old version + // correctly, and it probably indicates an incomplete install, so do + // not report an old rustc version either. + self.get_manifest() + .map(|m| { + ( + m.date, + // should rustc_version be a free function on a trait? + // note that prev_version can be junk if the rustc component is missing ... + self.toolchain.rustc_version(), + ) + }) + .ok(); + + let hash_path = self.cfg.get_hash_file(&self.desc, true)?; + let update_hash = Some(&hash_path as &Path); + + InstallMethod::Dist { + cfg: self.cfg, + desc: &self.desc, + profile, + update_hash, + dl_cfg: self + .cfg + .download_cfg(&|n| (self.cfg.notify_handler)(n.into())), + force, + allow_downgrade, + exists: true, + old_date_version, + components, + targets, + } + .install() + } + + pub fn recursion_error(&self, binary_lossy: String) -> Result { + let prefix = InstallPrefix::from(self.toolchain.path()); + let manifestation = Manifestation::open(prefix, self.desc.target.clone())?; + let manifest = self.get_manifest()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let component_statuses = manifest.query_components(&self.desc, &config)?; + let desc = &self.desc; + if let Some(component_name) = component_for_bin(&binary_lossy) { + let component_status = component_statuses + .iter() + .find(|cs| cs.component.short_name(&manifest) == component_name) + .ok_or_else(|| anyhow!("component {component_name} should be in the manifest"))?; + let short_name = component_status.component.short_name(&manifest); + if !component_status.available { + Err(anyhow!( + "the '{short_name}' component which provides the command '{binary_lossy}' is not available for the '{desc}' toolchain")) + } else if component_status.installed { + Err(anyhow!( + "the '{binary_lossy}' binary, normally provided by the '{short_name}' component, is not applicable to the '{desc}' toolchain")) + } else { + // available, not installed, recommend installation + let selector = match self.cfg.get_default()? { + Some(ToolchainName::Official(n)) if n == self.desc => "", + _ => " --toolchain {toolchain}", + }; + Err(anyhow!("'{binary_lossy}' is not installed for the toolchain '{desc}'.\nTo install, run `rustup component add {selector}{component_name}`")) + } + } else { + // Unknown binary - no component to recommend + Err(anyhow!( + "Unknown binary '{binary_lossy}' in official toolchain '{desc}'." + )) + } + } + + pub(crate) fn remove_component(&self, mut component: Component) -> anyhow::Result<()> { + // TODO: take multiple components? + let manifestation = self.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = self.get_manifest()?; + + // Rename the component if necessary. + if let Some(c) = manifest.rename_component(&component) { + component = c; + } + + if !config.components.contains(&component) { + let wildcard_component = component.wildcard(); + if config.components.contains(&wildcard_component) { + component = wildcard_component; + } else { + return Err(RustupError::UnknownComponent { + desc: self.desc.clone(), + component: component.description(&manifest), + suggestion: self.get_component_suggestion(&component, &config, &manifest, true), + } + .into()); + } + } + + let changes = Changes { + explicit_add_components: vec![], + remove_components: vec![component], + }; + + let notify_handler = + &|n: crate::dist::Notification<'_>| (self.cfg.notify_handler)(n.into()); + let download_cfg = self.cfg.download_cfg(¬ify_handler); + + manifestation.update( + &manifest, + changes, + false, + &download_cfg, + &download_cfg.notify_handler, + &self.desc.manifest_name(), + false, + )?; + + Ok(()) + } + + pub fn show_dist_version(&self) -> anyhow::Result> { + let update_hash = self.cfg.get_hash_file(&self.desc, false)?; + let notify_handler = + &|n: crate::dist::Notification<'_>| (self.cfg.notify_handler)(n.into()); + let download_cfg = self.cfg.download_cfg(¬ify_handler); + + match crate::dist::dist::dl_v2_manifest(download_cfg, Some(&update_hash), &self.desc)? { + Some((manifest, _)) => Ok(Some(manifest.get_rust_version()?.to_string())), + None => Ok(None), + } + } + + pub fn show_version(&self) -> anyhow::Result> { + match self.get_manifestation()?.load_manifest()? { + Some(manifest) => Ok(Some(manifest.get_rust_version()?.to_string())), + None => Ok(None), + } + } + + pub(crate) fn installed_paths<'b>( + cfg: &'b Cfg, + desc: &ToolchainDesc, + path: &'b Path, + ) -> anyhow::Result>> { + Ok(vec![ + InstalledPath::File { + name: "update hash", + path: cfg.get_hash_file(desc, false)?, + }, + InstalledPath::Dir { path }, + ]) + } +} + +impl<'a> TryFrom<&Toolchain<'a>> for DistributableToolchain<'a> { + type Error = RustupError; + + fn try_from(value: &Toolchain<'a>) -> Result { + match value.name() { + LocalToolchainName::Named(ToolchainName::Official(desc)) => Ok(Self { + toolchain: value.clone(), + cfg: value.cfg(), + desc: desc.clone(), + }), + n => Err(RustupError::ComponentsUnsupported(n.to_string())), + } + } +} + +impl<'a> From> for Toolchain<'a> { + fn from(value: DistributableToolchain<'a>) -> Self { + value.toolchain + } +} diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs new file mode 100644 index 0000000000..f24764c7c6 --- /dev/null +++ b/src/toolchain/names.rs @@ -0,0 +1,700 @@ +//! Overview of toolchain modeling. +//! +//! From the user (including config files, toolchain files and manifests) we get +//! a String. Strings are convertible into `MaybeOfficialToolchainName`, +//! `ResolvableToolchainName`, and `ResolvableLocalToolchainName`. +//! +//! `MaybeOfficialToolchainName` represents a toolchain passed to rustup-init: +//! 'none' to select no toolchain to install, and otherwise a partial toolchain +//! description - channel and optional triple and optional date. +//! +//! `ResolvableToolchainName` represents a toolchain name from a user. Either a +//! partial toolchain description or a single path component that is not 'none'. +//! +//! `MaybeResolvableToolchainName` is analogous to MaybeOfficialToolchainName +//! for both custom and official names. +//! +//! `ToolchainName` is the result of resolving `ResolvableToolchainName` with a +//! host triple, or parsing an installed toolchain name directly. +//! +//! `ResolvableLocalToolchainName` represents the values permittable in +//! `RUSTUP_TOOLCHAIN`: resolved or not resolved official names, custom names, +//! and absolute paths. +//! +//! `LocalToolchainName` represents all the toolchain names that can make sense +//! for referring to actually present toolchains. One of a `ToolchainName` or an +//! absolute path. +//! +//! From the toolchains directory we can iterate directly over +//! `ResolvedToolchainName`. +//! +//! OfficialToolchainName represents a resolved official toolchain name and can +//! be used to download or install toolchains via a downloader. +//! +//! CustomToolchainName can be used to link toolchains to local paths on disk. +//! +//! PathBasedToolchainName can obtained from rustup toolchain files. +//! +//! State from toolchains on disk can be loaded in an InstalledToolchain struct +//! and passed around and queried. The details on that are still vague :). +//! +//! Generally there are infallible Convert impl's for any safe conversion and +//! fallible ones otherwise. + +use std::{ + fmt::Display, + ops::Deref, + path::{Path, PathBuf}, + str::FromStr, +}; + +use thiserror::Error; + +use crate::dist::dist::{PartialToolchainDesc, TargetTriple, ToolchainDesc}; + +/// Errors related to toolchains +#[derive(Error, Debug)] +pub enum InvalidName { + #[error("invalid official toolchain name '{0}'")] + OfficialName(String), + #[error("invalid custom toolchain name '{0}'")] + CustomName(String), + #[error("invalid path toolchain '{0}'")] + PathToolchain(String), + #[error("relative path toolchain '{0}'")] + PathToolchainRelative(String), + #[error("invalid toolchain: the path '{0}' has no bin/ directory")] + ToolchainPath(String), + #[error("invalid toolchain name '{0}'")] + ToolchainName(String), +} + +macro_rules! from_variant { + ($from:ident, $to:ident, $variant:expr) => { + impl From<$from> for $to { + fn from(value: $from) -> Self { + $variant(value) + } + } + impl From<&$from> for $to { + fn from(value: &$from) -> Self { + $variant(value.to_owned()) + } + } + }; +} + +macro_rules! try_from_str { + ($to:ident) => { + try_from_str!(&str, $to); + try_from_str!(&String, $to); + impl TryFrom for $to { + type Error = InvalidName; + + fn try_from(value: String) -> std::result::Result { + $to::validate(&value) + } + } + }; + ($from:ty, $to:ident) => { + impl TryFrom<$from> for $to { + type Error = InvalidName; + + fn try_from(value: $from) -> std::result::Result { + $to::validate(value) + } + } + }; +} + +/// Common validate rules for all sorts of toolchain names +fn validate(candidate: &str) -> Result<&str, InvalidName> { + let normalized_name = candidate.trim_end_matches('/'); + if normalized_name.is_empty() { + Err(InvalidName::ToolchainName(candidate.into())) + } else { + Ok(normalized_name) + } +} + +/// Thunk to avoid errors like +/// = note: `fn(&'2 str) -> Result>::Error> {>::try_from}` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... +/// = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` +pub(crate) fn partial_toolchain_desc_parser( + value: &str, +) -> Result { + value.parse::() +} + +/// A toolchain name from user input. +#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub(crate) enum ResolvableToolchainName { + Custom(CustomToolchainName), + Official(PartialToolchainDesc), +} + +impl ResolvableToolchainName { + /// Resolve to a concrete toolchain name + pub fn resolve(&self, host: &TargetTriple) -> Result { + match self.clone() { + ResolvableToolchainName::Custom(c) => Ok(ToolchainName::Custom(c)), + ResolvableToolchainName::Official(desc) => { + let resolved = desc.resolve(host)?; + Ok(ToolchainName::Official(resolved)) + } + } + } + + // If candidate could be resolved, return a ready to resolve version of it. + // Otherwise error. + fn validate(candidate: &str) -> Result { + let candidate = validate(candidate)?; + candidate + .parse::() + .map(ResolvableToolchainName::Official) + .or_else(|_| { + CustomToolchainName::try_from(candidate) + .map(ResolvableToolchainName::Custom) + .map_err(|_| InvalidName::ToolchainName(candidate.into())) + }) + } +} + +try_from_str!(ResolvableToolchainName); + +impl From<&PartialToolchainDesc> for ResolvableToolchainName { + fn from(value: &PartialToolchainDesc) -> Self { + ResolvableToolchainName::Official(value.to_owned()) + } +} + +impl Display for ResolvableToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ResolvableToolchainName::Custom(c) => write!(f, "{c}"), + ResolvableToolchainName::Official(o) => write!(f, "{o}"), + } + } +} + +/// Thunk to avoid errors like +/// = note: `fn(&'2 str) -> Result>::Error> {>::try_from}` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... +/// = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` +pub(crate) fn resolvable_toolchainame_parser( + value: &str, +) -> Result { + ResolvableToolchainName::try_from(value) +} + +/// A toolchain name from user input. MaybeToolchainName accepts 'none' or a +/// custom or resolvable official name. Possibly this should be an Option with a +/// local trait for our needs. +#[derive(Debug, Clone)] +pub(crate) enum MaybeResolvableToolchainName { + Some(ResolvableToolchainName), + None, +} + +impl MaybeResolvableToolchainName { + // If candidate could be resolved, return a ready to resolve version of it. + // Otherwise error. + fn validate(candidate: &str) -> Result { + let candidate = validate(candidate)?; + if candidate == "none" { + Ok(MaybeResolvableToolchainName::None) + } else { + Ok(MaybeResolvableToolchainName::Some( + ResolvableToolchainName::validate(candidate)?, + )) + } + } +} + +try_from_str!(MaybeResolvableToolchainName); + +impl Display for MaybeResolvableToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + MaybeResolvableToolchainName::Some(t) => write!(f, "{t}"), + MaybeResolvableToolchainName::None => write!(f, "none"), + } + } +} + +/// Thunk to avoid errors like +/// = note: `fn(&'2 str) -> Result>::Error> {>::try_from}` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... +/// = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` +pub(crate) fn maybe_resolvable_toolchainame_parser( + value: &str, +) -> Result { + MaybeResolvableToolchainName::try_from(value) +} + +/// ResolvableToolchainName + none, for overriding default-has-a-value +/// situations in the CLI with an official toolchain name or none +#[derive(Clone)] +pub(crate) enum MaybeOfficialToolchainName { + None, + Some(PartialToolchainDesc), +} + +impl MaybeOfficialToolchainName { + fn validate(candidate: &str) -> Result { + let candidate = validate(candidate)?; + if candidate == "none" { + Ok(MaybeOfficialToolchainName::None) + } else { + Ok(MaybeOfficialToolchainName::Some( + validate(candidate)? + .parse::() + .map_err(|_| InvalidName::OfficialName(candidate.into()))?, + )) + } + } +} + +try_from_str!(MaybeOfficialToolchainName); + +impl Display for MaybeOfficialToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + MaybeOfficialToolchainName::None => write!(f, "none"), + MaybeOfficialToolchainName::Some(t) => write!(f, "{t}"), + } + } +} + +/// Thunk to avoid errors like +/// = note: `fn(&'2 str) -> Result>::Error> {>::try_from}` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... +/// = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` +pub(crate) fn maybe_official_toolchainame_parser( + value: &str, +) -> Result { + MaybeOfficialToolchainName::try_from(value) +} + +/// ToolchainName can be used in calls to Cfg that alter configuration, +/// like setting overrides, or that depend on configuration, like calculating +/// the toolchain directory. +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub(crate) enum ToolchainName { + Custom(CustomToolchainName), + Official(ToolchainDesc), +} + +impl ToolchainName { + /// If the string is already resolved, allow direct conversion + fn validate(candidate: &str) -> Result { + let candidate = validate(candidate)?; + candidate + .parse::() + .map(ToolchainName::Official) + .or_else(|_| CustomToolchainName::try_from(candidate).map(ToolchainName::Custom)) + .map_err(|_| InvalidName::ToolchainName(candidate.into())) + } +} + +from_variant!(ToolchainDesc, ToolchainName, ToolchainName::Official); +from_variant!(CustomToolchainName, ToolchainName, ToolchainName::Custom); + +try_from_str!(ToolchainName); + +impl Display for ToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ToolchainName::Custom(t) => write!(f, "{t}"), + ToolchainName::Official(t) => write!(f, "{t}"), + } + } +} + +pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { + use semver::{BuildMetadata, Prerelease, Version}; + + fn special_version(ord: u64, s: &str) -> Version { + Version { + major: 0, + minor: 0, + patch: 0, + pre: Prerelease::new(&format!("pre.{}.{}", ord, s.replace('_', "-"))).unwrap(), + build: BuildMetadata::EMPTY, + } + } + + fn toolchain_sort_key(s: &str) -> Version { + if s.starts_with("stable") { + special_version(0, s) + } else if s.starts_with("beta") { + special_version(1, s) + } else if s.starts_with("nightly") { + special_version(2, s) + } else { + Version::parse(&s.replace('_', "-")).unwrap_or_else(|_| special_version(3, s)) + } + } + + v.sort_by(|a, b| { + let a_str = &format!("{a}"); + let b_str = &format!("{b}"); + let a_key = toolchain_sort_key(a_str); + let b_key = toolchain_sort_key(b_str); + a_key.cmp(&b_key) + }); +} + +/// ResolvableLocalToolchainName is used to process values set in +/// RUSTUP_TOOLCHAIN: resolvable and resolved official names, custom names and +/// absolute paths. +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub(crate) enum ResolvableLocalToolchainName { + Named(ResolvableToolchainName), + Path(PathBasedToolchainName), +} + +impl ResolvableLocalToolchainName { + /// Resolve to a concrete toolchain name + pub fn resolve(&self, host: &TargetTriple) -> Result { + match self.clone() { + ResolvableLocalToolchainName::Named(t) => { + Ok(LocalToolchainName::Named(t.resolve(host)?)) + } + ResolvableLocalToolchainName::Path(t) => Ok(LocalToolchainName::Path(t)), + } + } + + /// Validates if the string is a resolvable toolchain, or a path based toolchain. + fn validate(candidate: &str) -> Result { + let candidate = validate(candidate)?; + ResolvableToolchainName::try_from(candidate) + .map(ResolvableLocalToolchainName::Named) + .or_else(|_| { + PathBasedToolchainName::try_from(&PathBuf::from(candidate) as &Path) + .map(ResolvableLocalToolchainName::Path) + }) + } +} + +try_from_str!(ResolvableLocalToolchainName); + +impl Display for ResolvableLocalToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + ResolvableLocalToolchainName::Named(t) => write!(f, "{t}"), + ResolvableLocalToolchainName::Path(t) => write!(f, "{t}"), + } + } +} + +pub(crate) fn resolvable_local_toolchainame_parser( + value: &str, +) -> Result { + ResolvableLocalToolchainName::try_from(value) +} + +/// LocalToolchainName can be used in calls to Cfg that alter configuration, +/// like setting overrides, or that depend on configuration, like calculating +/// the toolchain directory. It is not used to model the RUSTUP_TOOLCHAIN +/// variable, because that can take unresolved toolchain values that are not +/// invalid for referring to an installed toolchain. +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub(crate) enum LocalToolchainName { + Named(ToolchainName), + Path(PathBasedToolchainName), +} + +impl From<&ToolchainDesc> for LocalToolchainName { + fn from(value: &ToolchainDesc) -> Self { + ToolchainName::Official(value.to_owned()).into() + } +} + +impl From<&CustomToolchainName> for LocalToolchainName { + fn from(value: &CustomToolchainName) -> Self { + ToolchainName::Custom(value.to_owned()).into() + } +} + +impl From for LocalToolchainName { + fn from(value: CustomToolchainName) -> Self { + ToolchainName::Custom(value).into() + } +} + +from_variant!(ToolchainName, LocalToolchainName, LocalToolchainName::Named); +from_variant!( + PathBasedToolchainName, + LocalToolchainName, + LocalToolchainName::Path +); + +impl Display for LocalToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + LocalToolchainName::Named(t) => write!(f, "{t}"), + LocalToolchainName::Path(t) => write!(f, "{t}"), + } + } +} + +/// A custom toolchain name, but not an official toolchain name +/// (e.g. my-custom-toolchain) +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub(crate) struct CustomToolchainName(String); + +impl CustomToolchainName { + pub fn str(&self) -> &str { + &self.0 + } + + fn validate(candidate: &str) -> Result { + let candidate = validate(candidate)?; + if candidate.parse::().is_ok() + || candidate == "none" + || candidate.contains('/') + || candidate.contains('\\') + { + Err(InvalidName::CustomName(candidate.into())) + } else { + Ok(CustomToolchainName(candidate.into())) + } + } +} + +try_from_str!(CustomToolchainName); + +impl Display for CustomToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0) + } +} + +/// Thunk to avoid +/// = note: `fn(&'2 str) -> Result>::Error> {>::try_from}` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... +/// = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` +pub(crate) fn custom_toolchain_name_parser( + value: &str, +) -> Result { + CustomToolchainName::try_from(value) +} + +/// An toolchain specified just via its path. Relative paths enable arbitrary +/// code execution in a rust dir, so as a partial mitigation is limited to +/// absolute paths. +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub(crate) struct PathBasedToolchainName(PathBuf, String); + +impl Display for PathBasedToolchainName { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.0.display()) + } +} + +impl TryFrom<&Path> for PathBasedToolchainName { + type Error = InvalidName; + + fn try_from(value: &Path) -> std::result::Result { + // if official || at least a single path component + let as_str = value.display().to_string(); + if PartialToolchainDesc::from_str(&as_str).is_ok() + || !(as_str.contains('/') || as_str.contains('\\')) + { + Err(InvalidName::PathToolchain(as_str)) + } else { + // Perform minimal validation; there should at least be a `bin/` that might + // contain things for us to run. + if !value.is_absolute() { + Err(InvalidName::PathToolchainRelative(as_str)) + } else if !value.join("bin").is_dir() { + Err(InvalidName::ToolchainPath(as_str)) + } else { + Ok(PathBasedToolchainName(value.into(), as_str)) + } + } + } +} + +impl TryFrom<&LocalToolchainName> for PathBasedToolchainName { + type Error = InvalidName; + + fn try_from(value: &LocalToolchainName) -> std::result::Result { + match value { + LocalToolchainName::Named(_) => Err(InvalidName::PathToolchain(format!("{value}"))), + LocalToolchainName::Path(n) => Ok(n.clone()), + } + } +} + +impl Deref for PathBasedToolchainName { + type Target = PathBuf; + + fn deref(&self) -> &PathBuf { + &self.0 + } +} + +#[cfg(test)] +mod tests { + use std::str::FromStr; + + use proptest::{collection::vec, prelude::*, string::string_regex}; + + use crate::{ + dist::dist::PartialToolchainDesc, + toolchain::names::{CustomToolchainName, ResolvableToolchainName, ToolchainName}, + }; + + //Duplicated from triple.rs as a pragmatic step. TODO: remove duplication. + static LIST_ARCHS: &[&str] = &[ + "i386", + "i586", + "i686", + "x86_64", + "arm", + "armv7", + "armv7s", + "aarch64", + "mips", + "mipsel", + "mips64", + "mips64el", + "powerpc", + "powerpc64", + "powerpc64le", + "riscv64gc", + "s390x", + "loongarch64", + ]; + static LIST_OSES: &[&str] = &[ + "pc-windows", + "unknown-linux", + "apple-darwin", + "unknown-netbsd", + "apple-ios", + "linux", + "rumprun-netbsd", + "unknown-freebsd", + "unknown-illumos", + ]; + static LIST_ENVS: &[&str] = &[ + "gnu", + "gnux32", + "msvc", + "gnueabi", + "gnueabihf", + "gnuabi64", + "androideabi", + "android", + "musl", + ]; + + fn partial_toolchain_desc_re() -> String { + let triple_re = format!( + r"(-({}))?(?:-({}))?(?:-({}))?", + LIST_ARCHS.join("|"), + LIST_OSES.join("|"), + LIST_ENVS.join("|") + ); + let partial_toolchain_desc_re = format!( + r"(nightly|beta|stable|\d{{1}}\.\d{{1,3}}(\.\d{{1,2}})?)(-(\d{{4}}-\d{{2}}-\d{{2}}))?{triple_re}" + ); + + partial_toolchain_desc_re + } + + prop_compose! { + fn arb_partial_toolchain_desc() + (s in string_regex(&partial_toolchain_desc_re()).unwrap()) -> String { + s + } + } + + prop_compose! { + fn arb_custom_name() + (s in r"[^\\/]+") -> String { + // perhaps need to filter 'none' and partial toolchains - but they won't typically be generated anyway. + s + } + } + + prop_compose! { + fn arb_resolvable_name() + (case in (0..=1), desc in arb_custom_name(), name in arb_partial_toolchain_desc() ) -> String { + match case { + 0 => name, + _d => desc + } + } + } + + prop_compose! { + fn arb_abspath_name() + (case in (0..=1), segments in vec("[^\\/]", 0..5)) -> String { + match case { + 0 => format!("/{}", segments.join("/")), + _ => format!(r"c:\{}", segments.join(r"\")) + } + } + } + + proptest! { + #[test] + fn test_parse_partial_desc(desc in arb_partial_toolchain_desc()) { + PartialToolchainDesc::from_str(&desc).unwrap(); + } + + #[test] + fn test_parse_custom(name in arb_custom_name()) { + CustomToolchainName::try_from(name).unwrap(); + } + + #[test] + fn test_parse_resolvable_name(name in arb_resolvable_name()) { + ResolvableToolchainName::try_from(name).unwrap(); + } + + // TODO: This needs some thought + // #[test] + // fn test_parse_abs_path_name(name in arb_abspath_name()) { + // let tempdir = tempfile::Builder::new().tempdir().unwrap(); + // let d = tempdir.into_path(); + // fs::create_dir(d.create_directory("bin").unwrap()).unwrap(); + // // .into_path()) + + // PathBasedToolchainName::try_from(Path::new(&name)).unwrap(); + // } + + } + + #[test] + fn test_toolchain_sort() { + let expected = vec![ + "stable-x86_64-unknown-linux-gnu", + "beta-x86_64-unknown-linux-gnu", + "nightly-x86_64-unknown-linux-gnu", + "1.0.0-x86_64-unknown-linux-gnu", + "1.2.0-x86_64-unknown-linux-gnu", + "1.8.0-x86_64-unknown-linux-gnu", + "1.10.0-x86_64-unknown-linux-gnu", + ] + .into_iter() + .map(|s| ToolchainName::try_from(s).unwrap()) + .collect::>(); + + let mut v = vec![ + "1.8.0-x86_64-unknown-linux-gnu", + "1.0.0-x86_64-unknown-linux-gnu", + "nightly-x86_64-unknown-linux-gnu", + "stable-x86_64-unknown-linux-gnu", + "1.10.0-x86_64-unknown-linux-gnu", + "beta-x86_64-unknown-linux-gnu", + "1.2.0-x86_64-unknown-linux-gnu", + ] + .into_iter() + .map(|s| ToolchainName::try_from(s).unwrap()) + .collect::>(); + + super::toolchain_sort(&mut v); + + assert_eq!(expected, v); + } +} diff --git a/src/toolchain/toolchain.rs b/src/toolchain/toolchain.rs new file mode 100644 index 0000000000..767d3a152a --- /dev/null +++ b/src/toolchain/toolchain.rs @@ -0,0 +1,358 @@ +use std::{ + env::{self, consts::EXE_SUFFIX}, + ffi::{OsStr, OsString}, + fmt::Debug, + fs, + io::{self, BufRead, BufReader}, + path::{Path, PathBuf}, + process::{Command, Stdio}, + time::Duration, +}; + +use anyhow::{anyhow, bail}; +use derivative::Derivative; +use fs_at::OpenOptions; +use wait_timeout::ChildExt; + +use crate::{ + config::Cfg, + currentprocess::process, + env_var, install, + notifications::Notification, + utils::{raw::open_dir, utils}, + RustupError, +}; + +use super::{ + custom::CustomToolchain, + distributable::DistributableToolchain, + names::{LocalToolchainName, ToolchainName}, +}; + +/// A toolchain installed on the local disk +#[derive(Derivative)] +#[derivative(Clone, Debug)] +pub(crate) struct Toolchain<'a> { + cfg: &'a Cfg, + name: LocalToolchainName, + path: PathBuf, +} + +impl<'a> Toolchain<'a> { + pub(crate) fn new(cfg: &'a Cfg, name: LocalToolchainName) -> Result { + let path = cfg.toolchain_path(&name); + if !Toolchain::exists(cfg, &name)? { + return Err(match name { + LocalToolchainName::Named(name) => RustupError::ToolchainNotInstalled(name), + LocalToolchainName::Path(name) => RustupError::PathToolchainNotInstalled(name), + }); + } + Ok(Self { cfg, name, path }) + } + + /// Ok(True) if the toolchain exists. Ok(False) if the toolchain or its + /// containing directory don't exist. Err otherwise. + pub(crate) fn exists(cfg: &'a Cfg, name: &LocalToolchainName) -> Result { + let path = cfg.toolchain_path(name); + // toolchain validation should have prevented a situation where there is + // no base dir, but defensive programming is defensive. + let parent = path + .parent() + .ok_or_else(|| RustupError::InvalidToolchainName(name.to_string()))?; + let base_name = path + .file_name() + .ok_or_else(|| RustupError::InvalidToolchainName(name.to_string()))?; + let parent_dir = match open_dir(parent) { + Ok(d) => d, + Err(e) if e.kind() == io::ErrorKind::NotFound => return Ok(false), + e => e?, + }; + let opened = OpenOptions::default() + .read(true) + .follow(true) + .open_dir_at(&parent_dir, base_name); + Ok(opened.is_ok()) + } + + pub(crate) fn cfg(&self) -> &'a Cfg { + self.cfg + } + + pub(crate) fn name(&self) -> &LocalToolchainName { + &self.name + } + + pub(crate) fn path(&self) -> &Path { + &self.path + } + + /// The path to a binary within the toolchain, without regard for cargo-fallback logic + pub fn binary_file(&self, name: &str) -> PathBuf { + let mut path = self.path.clone(); + path.push("bin"); + path.push(name.to_owned() + env::consts::EXE_SUFFIX); + path + } + + /// Not intended to be public, but more code golf required to get it hidden. + /// pub because of create_fallback_command + pub fn set_env(&self, cmd: &mut Command) { + self.set_ldpath(cmd); + + // Older versions of Cargo used a slightly different definition of + // cargo home. Rustup does not read HOME on Windows whereas the older + // versions of Cargo did. Rustup and Cargo should be in sync now (both + // using the same `home` crate), but this is retained to ensure cargo + // and rustup agree in older versions. + if let Ok(cargo_home) = utils::cargo_home() { + cmd.env("CARGO_HOME", &cargo_home); + } + + env_var::inc("RUST_RECURSION_COUNT", cmd); + + cmd.env("RUSTUP_TOOLCHAIN", format!("{}", self.name)); + cmd.env("RUSTUP_HOME", &self.cfg().rustup_dir); + } + + /// Apply the appropriate LD path for a command being run from a toolchain. + fn set_ldpath(&self, cmd: &mut Command) { + let mut new_path = vec![self.path.join("lib")]; + + #[cfg(not(target_os = "macos"))] + mod sysenv { + pub const LOADER_PATH: &str = "LD_LIBRARY_PATH"; + } + #[cfg(target_os = "macos")] + mod sysenv { + // When loading and linking a dynamic library or bundle, dlopen + // searches in LD_LIBRARY_PATH, DYLD_LIBRARY_PATH, PWD, and + // DYLD_FALLBACK_LIBRARY_PATH. + // In the Mach-O format, a dynamic library has an "install path." + // Clients linking against the library record this path, and the + // dynamic linker, dyld, uses it to locate the library. + // dyld searches DYLD_LIBRARY_PATH *before* the install path. + // dyld searches DYLD_FALLBACK_LIBRARY_PATH only if it cannot + // find the library in the install path. + // Setting DYLD_LIBRARY_PATH can easily have unintended + // consequences. + pub const LOADER_PATH: &str = "DYLD_FALLBACK_LIBRARY_PATH"; + } + if cfg!(target_os = "macos") + && process() + .var_os(sysenv::LOADER_PATH) + .filter(|x| x.len() > 0) + .is_none() + { + // These are the defaults when DYLD_FALLBACK_LIBRARY_PATH isn't + // set or set to an empty string. Since we are explicitly setting + // the value, make sure the defaults still work. + if let Some(home) = process().var_os("HOME") { + new_path.push(PathBuf::from(home).join("lib")); + } + new_path.push(PathBuf::from("/usr/local/lib")); + new_path.push(PathBuf::from("/usr/lib")); + } + + env_var::prepend_path(sysenv::LOADER_PATH, new_path, cmd); + + // Prepend CARGO_HOME/bin to the PATH variable so that we're sure to run + // cargo/rustc via the proxy bins. There is no fallback case for if the + // proxy bins don't exist. We'll just be running whatever happens to + // be on the PATH. + let mut path_entries = vec![]; + if let Ok(cargo_home) = utils::cargo_home() { + path_entries.push(cargo_home.join("bin")); + } + + if cfg!(target_os = "windows") { + // Historically rustup has included the bin directory in PATH to + // work around some bugs (see + // https://github.com/rust-lang/rustup/pull/3178 for more + // information). This shouldn't be needed anymore, and it causes + // problems because calling tools recursively (like `cargo + // +nightly metadata` from within a cargo subcommand). The + // recursive call won't work because it is not executing the + // proxy, so the `+` toolchain override doesn't work. + // + // This is opt-in to allow us to get more real-world testing. + if process() + .var_os("RUSTUP_WINDOWS_PATH_ADD_BIN") + .map_or(true, |s| s == "1") + { + path_entries.push(self.path.join("bin")); + } + } + + env_var::prepend_path("PATH", path_entries, cmd); + } + + /// Infallible function that describes the version of rustc in an installed distribution + #[cfg_attr(feature = "otel", tracing::instrument)] + pub fn rustc_version(&self) -> String { + // TODO: use create_command instead of manual construction! + let rustc_path = self.binary_file("rustc"); + if utils::is_file(&rustc_path) { + let mut cmd = Command::new(&rustc_path); + cmd.arg("--version"); + cmd.stdin(Stdio::null()); + cmd.stdout(Stdio::piped()); + cmd.stderr(Stdio::piped()); + self.set_ldpath(&mut cmd); + + // some toolchains are faulty with some combinations of platforms and + // may fail to launch but also to timely terminate. + // (known cases include Rust 1.3.0 through 1.10.0 in recent macOS Sierra.) + // we guard against such cases by enforcing a reasonable timeout to read. + let mut line1 = None; + if let Ok(mut child) = cmd.spawn() { + let timeout = Duration::new(10, 0); + match child.wait_timeout(timeout) { + Ok(Some(status)) if status.success() => { + let out = child + .stdout + .expect("Child::stdout requested but not present"); + let mut line = String::new(); + if BufReader::new(out).read_line(&mut line).is_ok() { + let lineend = line.trim_end_matches(&['\r', '\n'][..]).len(); + line.truncate(lineend); + line1 = Some(line); + } + } + Ok(None) => { + let _ = child.kill(); + return String::from("(timeout reading rustc version)"); + } + Ok(Some(_)) | Err(_) => {} + } + } + + if let Some(line1) = line1 { + line1 + } else { + String::from("(error reading rustc version)") + } + } else { + String::from("(rustc does not exist)") + } + } + + #[cfg_attr(feature="otel", tracing::instrument(err,fields(binary, recursion=process().var("RUST_RECURSION_COUNT").ok())))] + pub fn create_command + Debug>( + &self, + binary: T, + ) -> Result { + // Create the path to this binary within the current toolchain sysroot + let binary = if let Some(binary_str) = binary.as_ref().to_str() { + if binary_str.to_lowercase().ends_with(EXE_SUFFIX) { + binary.as_ref().to_owned() + } else { + OsString::from(format!("{binary_str}{EXE_SUFFIX}")) + } + } else { + // Very weird case. Non-unicode command. + binary.as_ref().to_owned() + }; + + let bin_path = self.path.join("bin").join(&binary); + let path = if utils::is_file(&bin_path) { + &bin_path + } else { + let recursion_count = process() + .var("RUST_RECURSION_COUNT") + .ok() + .and_then(|s| s.parse().ok()) + .unwrap_or(0); + if recursion_count > env_var::RUST_RECURSION_COUNT_MAX - 1 { + let binary_lossy: String = binary.to_string_lossy().into(); + if matches!( + &self.name, + LocalToolchainName::Named(ToolchainName::Official(_)) + ) { + let distributable = DistributableToolchain::try_from(self)?; + // Design note: this is a bit of an awkward cast from + // general (toolchain) to more specialised (distributable); + // perhaps this function should something implemented on a + // trait, permitting removal of that case. + return Err(distributable.recursion_error(binary_lossy).unwrap_err()); + } else { + let t = &self.name; + return Err(anyhow!( + "'{binary_lossy}' is not installed for the custom toolchain '{t}'.\nnote: this is a custom toolchain, which cannot use `rustup component add`\n\ + help: if you built this toolchain from source, and used `rustup toolchain link`, then you may be able to build the component with `x.py`" + )); + } + } + Path::new(&binary) + }; + let mut cmd = Command::new(path); + self.set_env(&mut cmd); + Ok(cmd) + } + + pub fn doc_path(&self, relative: &str) -> anyhow::Result { + let parts = vec!["share", "doc", "rust", "html"]; + let mut doc_dir = self.path.clone(); + for part in parts { + doc_dir.push(part); + } + doc_dir.push(relative); + + Ok(doc_dir) + } + + pub fn open_docs(&self, relative: &str) -> anyhow::Result<()> { + utils::open_browser(&self.doc_path(relative)?) + } + + /// Remove the toolchain from disk + /// + /// + pub fn ensure_removed(cfg: &'a Cfg, name: LocalToolchainName) -> anyhow::Result<()> { + let path = cfg.toolchain_path(&name); + let name = match name { + LocalToolchainName::Named(t) => t, + LocalToolchainName::Path(_) => bail!("Cannot remove a path based toolchain"), + }; + match Self::exists(cfg, &(&name).into())? { + true => { + (cfg.notify_handler)(Notification::UninstallingToolchain(&name)); + let installed_paths = match &name { + ToolchainName::Custom(_) => CustomToolchain::installed_paths(&path), + ToolchainName::Official(desc) => { + DistributableToolchain::installed_paths(cfg, desc, &path) + } + }?; + for path in installed_paths { + match path { + InstalledPath::File { name, path } => { + utils::ensure_file_removed(name, &path)? + } + InstalledPath::Dir { path } => { + install::uninstall(path, &|n| (cfg.notify_handler)(n.into()))? + } + } + } + } + false => { + // Might be a dangling symlink + if path.is_symlink() { + (cfg.notify_handler)(Notification::UninstallingToolchain(&name)); + fs::remove_dir_all(&path)?; + } else { + info!("no toolchain installed for '{name}'"); + } + } + } + + if !path.is_symlink() && !path.exists() { + (cfg.notify_handler)(Notification::UninstalledToolchain(&name)); + } + Ok(()) + } +} + +/// Installed paths +pub(crate) enum InstalledPath<'a> { + File { name: &'static str, path: PathBuf }, + Dir { path: &'a Path }, +} diff --git a/src/utils/raw.rs b/src/utils/raw.rs index b6412d8795..a56133d256 100644 --- a/src/utils/raw.rs +++ b/src/utils/raw.rs @@ -1,11 +1,15 @@ #[cfg(not(windows))] use std::env; use std::fs; +use std::fs::File; use std::io; use std::io::Write; use std::path::Path; use std::str; +#[cfg(not(windows))] +use libc; + #[cfg(not(windows))] use crate::process; @@ -29,6 +33,29 @@ pub fn is_file>(path: P) -> bool { fs::metadata(path).ok().as_ref().map(fs::Metadata::is_file) == Some(true) } +#[cfg(windows)] +pub fn open_dir(p: &Path) -> std::io::Result { + use std::fs::OpenOptions; + use std::os::windows::fs::OpenOptionsExt; + + use windows_sys::Win32::Storage::FileSystem::FILE_FLAG_BACKUP_SEMANTICS; + + let mut options = OpenOptions::new(); + options.read(true); + options.custom_flags(FILE_FLAG_BACKUP_SEMANTICS); + options.open(p) +} +#[cfg(not(windows))] +pub fn open_dir(p: &Path) -> std::io::Result { + use std::fs::OpenOptions; + use std::os::unix::fs::OpenOptionsExt; + + let mut options = OpenOptions::new(); + options.read(true); + options.custom_flags(libc::O_NOFOLLOW); + options.open(p) +} + pub fn path_exists>(path: P) -> bool { fs::metadata(path).is_ok() } diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 04ab85117a..3b62dd254f 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -1,4 +1,3 @@ -use std::cmp::Ord; use std::env; use std::fs::{self, File}; use std::io::{self, BufReader, Write}; @@ -536,40 +535,6 @@ pub(crate) fn format_path_for_display(path: &str) -> String { } } -pub(crate) fn toolchain_sort>(v: &mut [T]) { - use semver::{BuildMetadata, Prerelease, Version}; - - fn special_version(ord: u64, s: &str) -> Version { - Version { - major: 0, - minor: 0, - patch: 0, - pre: Prerelease::new(&format!("pre.{}.{}", ord, s.replace('_', "-"))).unwrap(), - build: BuildMetadata::EMPTY, - } - } - - fn toolchain_sort_key(s: &str) -> Version { - if s.starts_with("stable") { - special_version(0, s) - } else if s.starts_with("beta") { - special_version(1, s) - } else if s.starts_with("nightly") { - special_version(2, s) - } else { - Version::parse(&s.replace('_', "-")).unwrap_or_else(|_| special_version(3, s)) - } - } - - v.sort_by(|a, b| { - let a_str: &str = a.as_ref(); - let b_str: &str = b.as_ref(); - let a_key = toolchain_sort_key(a_str); - let b_key = toolchain_sort_key(b_str); - a_key.cmp(&b_key) - }); -} - #[cfg(target_os = "linux")] fn copy_and_delete<'a, N>( name: &'static str, @@ -745,33 +710,6 @@ mod tests { use super::*; - #[test] - fn test_toolchain_sort() { - let expected = vec![ - "stable-x86_64-unknown-linux-gnu", - "beta-x86_64-unknown-linux-gnu", - "nightly-x86_64-unknown-linux-gnu", - "1.0.0-x86_64-unknown-linux-gnu", - "1.2.0-x86_64-unknown-linux-gnu", - "1.8.0-x86_64-unknown-linux-gnu", - "1.10.0-x86_64-unknown-linux-gnu", - ]; - - let mut v = vec![ - "1.8.0-x86_64-unknown-linux-gnu", - "1.0.0-x86_64-unknown-linux-gnu", - "nightly-x86_64-unknown-linux-gnu", - "stable-x86_64-unknown-linux-gnu", - "1.10.0-x86_64-unknown-linux-gnu", - "beta-x86_64-unknown-linux-gnu", - "1.2.0-x86_64-unknown-linux-gnu", - ]; - - toolchain_sort(&mut v); - - assert_eq!(expected, v); - } - #[test] fn test_remove_file() { let tempdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); diff --git a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml index 834081ef85..cd47e4f43c 100644 --- a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml @@ -8,8 +8,8 @@ USAGE: rustup[EXE] default [toolchain] ARGS: - Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information - see `rustup help toolchain` + 'none', a toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom + toolchain name. For more information see `rustup help toolchain` OPTIONS: -h, --help Print help information diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml index d18211f0d7..95a2e7da31 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml @@ -8,8 +8,8 @@ USAGE: rustup[EXE] override set [OPTIONS] ARGS: - Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information - see `rustup help toolchain` + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain + name. For more information see `rustup help toolchain` OPTIONS: --path Path to the directory diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml index b1dc9680b5..e8c9ead5c0 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml @@ -8,8 +8,8 @@ USAGE: rustup[EXE] override set [OPTIONS] ARGS: - Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information - see `rustup help toolchain` + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain + name. For more information see `rustup help toolchain` OPTIONS: --path Path to the directory diff --git a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml index 9b38e69351..0760ac3465 100644 --- a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml @@ -1,5 +1,6 @@ +args = ["run", "--help"] bin.name = "rustup" -args = ["run","--help"] +stderr = "" stdout = """ ... Run a command with an environment configured for a given toolchain @@ -8,8 +9,8 @@ USAGE: rustup[EXE] run [OPTIONS] ... ARGS: - Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain + name, or an absolute path. For more information see `rustup help toolchain` ... OPTIONS: @@ -31,4 +32,3 @@ DISCUSSION: $ rustup run nightly cargo build """ -stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml index 7a9bc0faae..a555542b27 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml @@ -22,8 +22,8 @@ DISCUSSION: installation of the Rust compiler. `rustup` supports multiple types of toolchains. The most basic track the official release channels: 'stable', 'beta' and 'nightly'; but `rustup` can also - install toolchains from the official archives, for alternate host - platforms, and from local builds. + install specific toolchains from the official archives, toolchains for + alternate host platforms, and from local builds ('custom toolchains'). Standard release channel toolchain names have the following form: diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml index 57bb36057b..e931c63ae3 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml @@ -16,10 +16,12 @@ OPTIONS: DISCUSSION: 'toolchain' is the custom name to be assigned to the new toolchain. - Any name is permitted as long as it does not fully match an initial - substring of a standard release channel. For example, you can use - the names 'latest' or '2017-04-01' but you cannot use 'stable' or - 'beta-i686' or 'nightly-x86_64-unknown-linux-gnu'. + Any name is permitted as long as: + - it does not include '/' or '/' except as the last character + - it is not equal to 'none' + - it does not fully match an initialsubstring of a standard release channel. + For example, you can use the names 'latest' or '2017-04-01' but you cannot + use 'stable' or 'beta-i686' or 'nightly-x86_64-unknown-linux-gnu'. 'path' specifies the directory where the binaries and libraries for the custom toolchain can be found. For example, when used for diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml index 66a9f9b1d1..08aa5aac0a 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml @@ -8,8 +8,8 @@ USAGE: rustup[EXE] toolchain uninstall ... ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` + ... Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom + toolchain name. For more information see `rustup help toolchain` OPTIONS: -h, --help Print help information diff --git a/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml b/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml index 7508714f03..f6e15c1276 100644 --- a/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml @@ -3,7 +3,7 @@ args = ["random"] status.code = 1 stdout = "" stderr = """ -error: Invalid value \"random\" for '<+toolchain>': \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' +error: Invalid value \"random\" for '<+toolchain>': error: \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' For more information try --help """ diff --git a/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml index 97a4c96cd1..799e5ae9af 100644 --- a/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml @@ -1,5 +1,6 @@ +args = ["which", "--help"] bin.name = "rustup" -args = ["which","--help"] +stderr = "" stdout = """ ... Display which binary will be run for a given command @@ -11,8 +12,7 @@ ARGS: OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` + --toolchain Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom + toolchain name. For more information see `rustup help toolchain` -h, --help Print help information """ -stderr = "" diff --git a/tests/suite/cli_exact.rs b/tests/suite/cli_exact.rs index 21a6d8a1d2..9c53486809 100644 --- a/tests/suite/cli_exact.rs +++ b/tests/suite/cli_exact.rs @@ -2,11 +2,13 @@ //! is exactly as expected. use rustup::for_host; -use rustup::test::this_host_triple; +use rustup::test::{ + mock::clitools::{self, set_current_dist_date, with_update_server, Config, Scenario}, + this_host_triple, +}; use rustup_macros::integration_test as test; -use crate::mock::clitools::{self, set_current_dist_date, with_update_server, Config, Scenario}; - +/// Start a test with Scenario::None fn test(f: &dyn Fn(&mut Config)) { clitools::test(Scenario::None, f); } @@ -313,15 +315,9 @@ fn override_again() { config.expect_ok(&["rustup", "override", "add", "nightly"]); config.expect_ok_ex( &["rustup", "override", "add", "nightly"], - for_host!( - r" - nightly-{} unchanged - 1.3.0 (hash-nightly-2) - -" - ), + "", &format!( - r"info: using existing install for 'nightly-{1}' -info: override toolchain for '{}' set to 'nightly-{1}' + r"info: override toolchain for '{}' set to 'nightly-{1}' ", cwd.display(), &this_host_triple() @@ -551,41 +547,32 @@ error: no release found for 'nightly-2016-01-01' // Issue #111 #[test] -fn update_invalid_toolchain() { +fn update_custom_toolchain() { test(&|config| { - config.with_scenario(Scenario::SimpleV2, &|config| { - config.expect_err_ex( + // installable toolchains require 2 digits in the DD and MM fields, so this is + // treated as a custom toolchain, which can't be used with update. + config.expect_err( &["rustup", "update", "nightly-2016-03-1"], - r"", - r"info: syncing channel updates for 'nightly-2016-03-1' -info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2) -error: target '2016-03-1' not found in channel. Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets -", + "invalid toolchain name: 'nightly-2016-03-1'", ); - }) }); } #[test] -fn default_invalid_toolchain() { +fn default_custom_not_installed_toolchain() { test(&|config| { - config.with_scenario(Scenario::SimpleV2, &|config| { - config.expect_err_ex( + // installable toolchains require 2 digits in the DD and MM fields, so this is + // treated as a custom toolchain, which isn't installed. + config.expect_err( &["rustup", "default", "nightly-2016-03-1"], - r"", - r"info: syncing channel updates for 'nightly-2016-03-1' -info: latest update on 2015-01-02, rust version 1.3.0 (hash-nightly-2) -error: target '2016-03-1' not found in channel. Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets -", + "toolchain 'nightly-2016-03-1' is not installed", ); - }) }); } #[test] fn default_none() { test(&|config| { - config.with_scenario(Scenario::SimpleV2, &|config| { config.expect_stderr_ok( &["rustup", "default", "none"], "info: default toolchain unset", @@ -598,7 +585,6 @@ help: run 'rustup default stable' to download the latest stable release of Rust ", ); }) - }) } #[test] @@ -672,7 +658,7 @@ fn undefined_linked_toolchain() { config.expect_err_ex( &["cargo", "+bogus", "test"], r"", - "error: toolchain 'bogus' is not installed\n", + "error: toolchain 'bogus' is not installable\n", ); }) }); diff --git a/tests/suite/cli_inst_interactive.rs b/tests/suite/cli_inst_interactive.rs index 4d73cea9bf..61382a6b7e 100644 --- a/tests/suite/cli_inst_interactive.rs +++ b/tests/suite/cli_inst_interactive.rs @@ -5,13 +5,13 @@ use std::io::Write; use std::process::Stdio; use rustup::for_host; -use rustup::test::this_host_triple; -use rustup::test::with_saved_path; +use rustup::test::{ + mock::clitools::{self, set_current_dist_date, Config, SanitizedOutput, Scenario}, + this_host_triple, with_saved_path, +}; use rustup::utils::raw; use rustup_macros::integration_test as test; -use crate::mock::clitools::{self, set_current_dist_date, Config, SanitizedOutput, Scenario}; - fn run_input(config: &Config, args: &[&str], input: &str) -> SanitizedOutput { run_input_with_env(config, args, input, &[]) } @@ -526,7 +526,7 @@ fn install_stops_if_rustc_exists() { clitools::test(Scenario::SimpleV2, &|config| { let out = config.run( "rustup-init", - &["--no-modify-path"], + ["--no-modify-path"], &[ ("RUSTUP_INIT_SKIP_PATH_CHECK", "no"), ("PATH", temp_dir_path), @@ -556,7 +556,7 @@ fn install_stops_if_cargo_exists() { clitools::test(Scenario::SimpleV2, &|config| { let out = config.run( "rustup-init", - &["--no-modify-path"], + ["--no-modify-path"], &[ ("RUSTUP_INIT_SKIP_PATH_CHECK", "no"), ("PATH", temp_dir_path), @@ -586,7 +586,7 @@ fn with_no_prompt_install_succeeds_if_rustc_exists() { clitools::test(Scenario::SimpleV2, &|config| { let out = config.run( "rustup-init", - &["-y", "--no-modify-path"], + ["-y", "--no-modify-path"], &[ ("RUSTUP_INIT_SKIP_PATH_CHECK", "no"), ("PATH", temp_dir_path), diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index 1b0f92953e..27f5f86152 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -5,12 +5,13 @@ use std::str; use std::{env::consts::EXE_SUFFIX, path::Path}; use rustup::for_host; -use rustup::test::this_host_triple; +use rustup::test::{ + mock::clitools::{self, set_current_dist_date, Config, Scenario}, + this_host_triple, +}; use rustup::utils::utils; use rustup_macros::integration_test as test; -use crate::mock::clitools::{self, set_current_dist_date, Config, Scenario}; - pub fn setup(f: &dyn Fn(&mut Config)) { clitools::test(Scenario::SimpleV2, f); } @@ -25,13 +26,13 @@ fn smoke_test() { #[test] fn version_mentions_rustc_version_confusion() { setup(&|config| { - let out = config.run("rustup", &vec!["--version"], &[]); + let out = config.run("rustup", vec!["--version"], &[]); assert!(out.ok); assert!(out .stderr .contains("This is the version for the rustup toolchain manager")); - let out = config.run("rustup", &vec!["+nightly", "--version"], &[]); + let out = config.run("rustup", vec!["+nightly", "--version"], &[]); assert!(out.ok); assert!(out .stderr @@ -43,7 +44,7 @@ fn version_mentions_rustc_version_confusion() { fn no_colors_in_piped_error_output() { setup(&|config| { let args: Vec<&str> = vec![]; - let out = config.run("rustc", &args, &[]); + let out = config.run("rustc", args, &[]); assert!(!out.ok); assert!(!out.stderr.contains('\x1b')); }); @@ -53,7 +54,7 @@ fn no_colors_in_piped_error_output() { fn rustc_with_bad_rustup_toolchain_env_var() { setup(&|config| { let args: Vec<&str> = vec![]; - let out = config.run("rustc", &args, &[("RUSTUP_TOOLCHAIN", "bogus")]); + let out = config.run("rustc", args, &[("RUSTUP_TOOLCHAIN", "bogus")]); assert!(!out.ok); assert!(out.stderr.contains("toolchain 'bogus' is not installed")); }); @@ -64,15 +65,15 @@ fn custom_invalid_names() { setup(&|config| { config.expect_err( &["rustup", "toolchain", "link", "nightly", "foo"], - for_host!("invalid custom toolchain name: 'nightly-{0}'"), + "invalid custom toolchain name 'nightly'", ); config.expect_err( &["rustup", "toolchain", "link", "beta", "foo"], - for_host!("invalid custom toolchain name: 'beta-{0}'"), + "invalid custom toolchain name 'beta'", ); config.expect_err( &["rustup", "toolchain", "link", "stable", "foo"], - for_host!("invalid custom toolchain name: 'stable-{0}'"), + "invalid custom toolchain name 'stable'", ); }); } @@ -82,15 +83,15 @@ fn custom_invalid_names_with_archive_dates() { setup(&|config| { config.expect_err( &["rustup", "toolchain", "link", "nightly-2015-01-01", "foo"], - for_host!("invalid custom toolchain name: 'nightly-2015-01-01-{0}'"), + "invalid custom toolchain name 'nightly-2015-01-01'", ); config.expect_err( &["rustup", "toolchain", "link", "beta-2015-01-01", "foo"], - for_host!("invalid custom toolchain name: 'beta-2015-01-01-{0}'"), + "invalid custom toolchain name 'beta-2015-01-01'", ); config.expect_err( &["rustup", "toolchain", "link", "stable-2015-01-01", "foo"], - for_host!("invalid custom toolchain name: 'stable-2015-01-01-{0}'"), + "invalid custom toolchain name 'stable-2015-01-01'", ); }); } @@ -532,7 +533,7 @@ fn run_rls_when_not_installed() { config.expect_err( &["rls", "--version"], &format!( - "'rls{}' is not installed for the toolchain 'stable-{}'\nTo install, run `rustup component add rls`", + "'rls{}' is not installed for the toolchain 'stable-{}'.\nTo install, run `rustup component add rls`", EXE_SUFFIX, this_host_triple(), ), @@ -611,7 +612,7 @@ fn rename_rls_list() { config.expect_ok(&["rustup", "update"]); config.expect_ok(&["rustup", "component", "add", "rls"]); - let out = config.run("rustup", &["component", "list"], &[]); + let out = config.run("rustup", ["component", "list"], &[]); assert!(out.ok); assert!(out.stdout.contains(&format!("rls-{}", this_host_triple()))); }); @@ -627,7 +628,7 @@ fn rename_rls_preview_list() { config.expect_ok(&["rustup", "update"]); config.expect_ok(&["rustup", "component", "add", "rls-preview"]); - let out = config.run("rustup", &["component", "list"], &[]); + let out = config.run("rustup", ["component", "list"], &[]); assert!(out.ok); assert!(out.stdout.contains(&format!("rls-{}", this_host_triple()))); }); @@ -679,7 +680,7 @@ fn toolchain_broken_symlink() { fs::symlink_dir(src, dst).unwrap(); } - setup(&|config| { + clitools::test(Scenario::None, &|config| { // We artificially create a broken symlink toolchain -- but this can also happen "legitimately" // by having a proper toolchain there, using "toolchain link", and later removing the directory. fs::create_dir(config.rustupdir.join("toolchains")).unwrap(); @@ -697,11 +698,9 @@ fn toolchain_broken_symlink() { info: toolchain 'test' uninstalled ", ); - config.expect_ok_ex( + config.expect_stderr_ok( &["rustup", "toolchain", "uninstall", "test"], - "", - r"info: no toolchain installed for 'test' -", + "no toolchain installed for 'test'", ); }); } @@ -900,7 +899,7 @@ fn which_asking_uninstalled_toolchain() { ); config.expect_err( &["rustup", "which", "--toolchain=nightly", "rustc"], - "toolchain 'nightly' is not installed", + for_host!("toolchain 'nightly-{}' is not installed"), ); }); } diff --git a/tests/suite/cli_paths.rs b/tests/suite/cli_paths.rs index 7c155dcd5a..762af45d21 100644 --- a/tests/suite/cli_paths.rs +++ b/tests/suite/cli_paths.rs @@ -15,7 +15,7 @@ mod unix { use rustup_macros::integration_test as test; use super::INIT_NONE; - use crate::mock::clitools::{self, Scenario}; + use rustup::test::mock::clitools::{self, Scenario}; // Let's write a fake .rc which looks vaguely like a real script. const FAKE_RC: &str = r#" @@ -351,11 +351,11 @@ export PATH="$HOME/apple/bin" #[cfg(windows)] mod windows { + use rustup::test::mock::clitools::{self, Scenario}; use rustup::test::{get_path, with_saved_path}; use rustup_macros::integration_test as test; use super::INIT_NONE; - use crate::mock::clitools::{self, Scenario}; #[test] /// Smoke test for end-to-end code connectivity of the installer path mgmt on windows. diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 8b8588e90c..304ff48bfd 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -1,15 +1,15 @@ //! Test cases for new rustup UI -use std::env::consts::EXE_SUFFIX; use std::fs; use std::path::{PathBuf, MAIN_SEPARATOR}; +use std::{env::consts::EXE_SUFFIX, path::Path}; use rustup::for_host; use rustup::test::this_host_triple; use rustup::utils::raw; use rustup_macros::integration_test as test; -use crate::mock::{ +use rustup::test::mock::{ self, clitools::{self, Config, Scenario}, }; @@ -579,7 +579,7 @@ fn recursive_cargo() { // The solution here is to copy from the "mock" `cargo.exe` into // `~/.cargo/bin/cargo-foo`. This is just for convenience to avoid // needing to build another executable just for this test. - let output = config.run("rustup", &["which", "cargo"], &[]); + let output = config.run("rustup", ["which", "cargo"], &[]); let real_mock_cargo = output.stdout.trim(); let cargo_bin_path = config.cargodir.join("bin"); let cargo_subcommand = cargo_bin_path.join(format!("cargo-foo{}", EXE_SUFFIX)); @@ -1069,14 +1069,10 @@ fn show_toolchain_env() { test(&|config| { config.with_scenario(Scenario::SimpleV2, &|config| { config.expect_ok(&["rustup", "default", "nightly"]); - let mut cmd = clitools::cmd(config, "rustup", ["show"]); - clitools::env(config, &mut cmd); - cmd.env("RUSTUP_TOOLCHAIN", "nightly"); - let out = cmd.output().unwrap(); - assert!(out.status.success()); - let stdout = String::from_utf8(out.stdout).unwrap(); + let out = config.run("rustup", ["show"], &[("RUSTUP_TOOLCHAIN", "nightly")]); + assert!(out.ok); assert_eq!( - &stdout, + &out.stdout, for_host_and_home!( config, r"Default host: {0} @@ -1323,13 +1319,12 @@ fn toolchain_update_is_like_update() { #[test] fn toolchain_uninstall_is_like_uninstall() { test(&|config| { + config.with_scenario(Scenario::SimpleV2, &|config| { + config.expect_ok(&["rustup", "toolchain", "install", "nightly"]); + }); + config.expect_ok(&["rustup", "default", "none"]); config.expect_ok(&["rustup", "uninstall", "nightly"]); - let mut cmd = clitools::cmd(config, "rustup", ["show"]); - clitools::env(config, &mut cmd); - let out = cmd.output().unwrap(); - assert!(out.status.success()); - let stdout = String::from_utf8(out.stdout).unwrap(); - assert!(!stdout.contains(for_host!("'nightly-2015-01-01-{}'"))); + config.expect_not_stdout_ok(&["rustup", "show"], for_host!("'nightly-{}'")); }); } @@ -1446,30 +1441,52 @@ fn env_override_path() { .join("toolchains") .join(format!("nightly-{}", this_host_triple())); - let mut cmd = clitools::cmd(config, "rustc", ["--version"]); - clitools::env(config, &mut cmd); - cmd.env("RUSTUP_TOOLCHAIN", toolchain_path.to_str().unwrap()); + let out = config.run( + "rustc", + ["--version"], + &[("RUSTUP_TOOLCHAIN", toolchain_path.to_str().unwrap())], + ); + assert!(out.ok); + assert!(out.stdout.contains("hash-nightly-2")); + }) + }); +} - let out = cmd.output().unwrap(); - assert!(String::from_utf8(out.stdout) - .unwrap() - .contains("hash-nightly-2")); +#[test] +fn plus_override_relpath_is_not_supported() { + test(&|config| { + config.with_scenario(Scenario::SimpleV2, &|config| { + config.expect_ok(&["rustup", "default", "stable"]); + config.expect_ok(&["rustup", "toolchain", "install", "nightly"]); + + let toolchain_path = Path::new("..") + .join(config.rustupdir.rustupdir.file_name().unwrap()) + .join("toolchains") + .join(format!("nightly-{}", this_host_triple())); + config.expect_err( + &[ + "rustc", + format!("+{}", toolchain_path.to_str().unwrap()).as_str(), + "--version", + ], + "error: relative path toolchain", + ); }) }); } #[test] -fn plus_override_path() { +fn run_with_relpath_is_not_supported() { test(&|config| { config.with_scenario(Scenario::SimpleV2, &|config| { config.expect_ok(&["rustup", "default", "stable"]); config.expect_ok(&["rustup", "toolchain", "install", "nightly"]); - let toolchain_path = config - .rustupdir + let toolchain_path = Path::new("..") + .join(config.rustupdir.rustupdir.file_name().unwrap()) .join("toolchains") .join(format!("nightly-{}", this_host_triple())); - config.expect_stdout_ok( + config.expect_err( &[ "rustup", "run", @@ -1477,12 +1494,58 @@ fn plus_override_path() { "rustc", "--version", ], - "hash-nightly-2", + "relative path toolchain", ); }) }); } +#[test] +fn plus_override_abspath_is_supported() { + test(&|config| { + config.with_scenario(Scenario::SimpleV2, &|config| { + config.expect_ok(&["rustup", "default", "stable"]); + config.expect_ok(&["rustup", "toolchain", "install", "nightly"]); + + let toolchain_path = config + .rustupdir + .join("toolchains") + .join(format!("nightly-{}", this_host_triple())) + .canonicalize() + .unwrap(); + config.expect_ok(&[ + "rustc", + format!("+{}", toolchain_path.to_str().unwrap()).as_str(), + "--version", + ]); + }) + }); +} + +#[test] +fn run_with_abspath_is_supported() { + test(&|config| { + config.with_scenario(Scenario::SimpleV2, &|config| { + config.expect_ok(&["rustup", "default", "stable"]); + config.expect_ok(&["rustup", "toolchain", "install", "nightly"]); + + let toolchain_path = config + .rustupdir + .join("toolchains") + .join(format!("nightly-{}", this_host_triple())) + .canonicalize() + .unwrap(); + config.expect_ok(&[ + "rustup", + "run", + toolchain_path.to_str().unwrap(), + "rustc", + "--version", + ]); + }) + }); +} + #[test] fn file_override_path() { test(&|config| { @@ -1536,7 +1599,7 @@ fn proxy_override_path() { } #[test] -fn file_override_path_relative() { +fn file_override_path_relative_not_supported() { test(&|config| { config.with_scenario(Scenario::SimpleV2, &|config| { config.expect_ok(&["rustup", "default", "stable"]); @@ -1580,7 +1643,7 @@ fn file_override_path_relative() { let ephemeral = config.current_dir().join("ephemeral"); fs::create_dir_all(&ephemeral).unwrap(); config.change_dir(&ephemeral, &|config| { - config.expect_stdout_ok(&["rustc", "--version"], "hash-nightly-2"); + config.expect_err(&["rustc", "--version"], "relative path toolchain"); }); }) }); @@ -1965,13 +2028,25 @@ fn plus_override_beats_file_override() { } #[test] -fn bad_file_override() { +fn file_override_not_installed_custom() { test(&|config| { let cwd = config.current_dir(); let toolchain_file = cwd.join("rust-toolchain"); raw::write_file(&toolchain_file, "gumbo").unwrap(); - config.expect_err(&["rustc", "--version"], "invalid toolchain name: 'gumbo'"); + config.expect_err(&["rustc", "--version"], "custom and not installed"); + }); +} + +#[test] +fn bad_file_override() { + test(&|config| { + let cwd = config.current_dir(); + let toolchain_file = cwd.join("rust-toolchain"); + // invalid name - cannot specify no toolchain in a toolchain file + raw::write_file(&toolchain_file, "none").unwrap(); + + config.expect_err(&["rustc", "--version"], "invalid toolchain name 'none'"); }); } @@ -1984,6 +2059,7 @@ fn valid_override_settings() { config.expect_ok(&["rustup", "default", "nightly"]); raw::write_file(&toolchain_file, "nightly").unwrap(); config.expect_ok(&["rustc", "--version"]); + // Special case: same version as is installed is permitted. raw::write_file(&toolchain_file, for_host!("nightly-{}")).unwrap(); config.expect_ok(&["rustc", "--version"]); let fullpath = config @@ -2006,17 +2082,17 @@ fn valid_override_settings() { #[test] fn file_override_with_target_info() { + // Target info is not portable between machines, so we reject toolchain + // files that include it. test(&|config| { - config.with_scenario(Scenario::SimpleV2, &|config| { - let cwd = config.current_dir(); - let toolchain_file = cwd.join("rust-toolchain"); - raw::write_file(&toolchain_file, "nightly-x86_64-unknown-linux-gnu").unwrap(); + let cwd = config.current_dir(); + let toolchain_file = cwd.join("rust-toolchain"); + raw::write_file(&toolchain_file, "nightly-x86_64-unknown-linux-gnu").unwrap(); - config.expect_err( - &["rustc", "--version"], - "target triple in channel name 'nightly-x86_64-unknown-linux-gnu'", - ); - }) + config.expect_err( + &["rustc", "--version"], + "target triple in channel name 'nightly-x86_64-unknown-linux-gnu'", + ); }); } @@ -2034,15 +2110,10 @@ fn docs_with_path() { let path = format!("share{MAIN_SEPARATOR}doc{MAIN_SEPARATOR}rust{MAIN_SEPARATOR}html"); assert!(String::from_utf8(out.stdout).unwrap().contains(&path)); - let mut cmd = clitools::cmd( - config, - "rustup", - ["doc", "--path", "--toolchain", "nightly"], + config.expect_stdout_ok( + &["rustup", "doc", "--path", "--toolchain", "nightly"], + "nightly", ); - clitools::env(config, &mut cmd); - - let out = cmd.output().unwrap(); - assert!(String::from_utf8(out.stdout).unwrap().contains("nightly")); }) }); } @@ -2088,13 +2159,11 @@ fn docs_missing() { #[test] fn docs_custom() { test(&|config| { - config.with_scenario(Scenario::SimpleV2, &|config| { - let path = config.customdir.join("custom-1"); - let path = path.to_string_lossy(); - config.expect_ok(&["rustup", "toolchain", "link", "custom", &path]); - config.expect_ok(&["rustup", "default", "custom"]); - config.expect_stdout_ok(&["rustup", "doc", "--path"], "custom"); - }) + let path = config.customdir.join("custom-1"); + let path = path.to_string_lossy(); + config.expect_ok(&["rustup", "toolchain", "link", "custom", &path]); + config.expect_ok(&["rustup", "default", "custom"]); + config.expect_stdout_ok(&["rustup", "doc", "--path"], "custom"); }); } @@ -2132,7 +2201,7 @@ fn non_utf8_arg() { config.expect_ok(&["rustup", "default", "nightly"]); let out = config.run( "rustc", - &[ + [ OsString::from("--echo-args".to_string()), OsString::from("echoed non-utf8 arg:".to_string()), OsString::from_wide(&[0xd801, 0xd801]), @@ -2158,7 +2227,7 @@ fn non_utf8_toolchain() { &[OsStr::from_bytes(b"+\xc3\x28")], &[("RUST_BACKTRACE", "1")], ); - assert!(out.stderr.contains("toolchain '�(' is not installed")); + assert!(out.stderr.contains("toolchain '�(' is not installable")); }) }); } @@ -2174,10 +2243,10 @@ fn non_utf8_toolchain() { config.expect_ok(&["rustup", "default", "nightly"]); let out = config.run( "rustc", - &[OsString::from_wide(&[u16::from(b'+'), 0xd801, 0xd801])], + [OsString::from_wide(&[u16::from(b'+'), 0xd801, 0xd801])], &[("RUST_BACKTRACE", "1")], ); - assert!(out.stderr.contains("toolchain '��' is not installed")); + assert!(out.stderr.contains("toolchain '��' is not installable")); }) }); } diff --git a/tests/suite/cli_self_upd.rs b/tests/suite/cli_self_upd.rs index 0ad0be95f8..c21c99abc8 100644 --- a/tests/suite/cli_self_upd.rs +++ b/tests/suite/cli_self_upd.rs @@ -8,16 +8,21 @@ use std::process::Command; use remove_dir_all::remove_dir_all; -use rustup::test::{this_host_triple, with_saved_path}; +use retry::{ + delay::{jitter, Fibonacci}, + retry, OperationResult, +}; +use rustup::test::{ + mock::{ + clitools::{self, output_release_file, self_update_setup, Config, Scenario}, + dist::calc_hash, + }, + this_host_triple, with_saved_path, +}; use rustup::utils::{raw, utils}; -use rustup::{for_host, Notification, DUP_TOOLS, TOOLS}; +use rustup::{for_host, DUP_TOOLS, TOOLS}; use rustup_macros::integration_test as test; -use crate::mock::{ - clitools::{self, output_release_file, self_update_setup, Config, Scenario}, - dist::calc_hash, -}; - const TEST_VERSION: &str = "1.1.1"; pub fn update_setup(f: &dyn Fn(&mut Config, &Path)) { @@ -254,21 +259,30 @@ fn uninstall_self_delete_works() { // file in CONFIG.CARGODIR/.. ; check that it doesn't exist. #[test] fn uninstall_doesnt_leave_gc_file() { - use std::thread; - use std::time::Duration; - setup_empty_installed(&|config| { config.expect_ok(&["rustup", "self", "uninstall", "-y"]); - - // The gc removal happens after rustup terminates. Give it a moment. - thread::sleep(Duration::from_millis(100)); - let parent = config.cargodir.parent().unwrap(); - // Actually, there just shouldn't be any files here - for dirent in fs::read_dir(parent).unwrap() { - let dirent = dirent.unwrap(); - println!("{}", dirent.path().display()); - panic!(); + + // The gc removal happens after rustup terminates. Typically under + // 100ms, but during the contention of test suites can be substantially + // longer while still succeeding. + + #[derive(thiserror::Error, Debug)] + #[error("garbage remaining: {:?}", .0)] + struct GcErr(Vec); + + match retry(Fibonacci::from_millis(1).map(jitter).take(23), || { + let garbage = fs::read_dir(parent) + .unwrap() + .map(|d| d.unwrap().path().to_string_lossy().to_string()) + .collect::>(); + match garbage.len() { + 0 => OperationResult::Ok(()), + _ => OperationResult::Retry(GcErr(garbage)), + } + }) { + Ok(_) => (), + Err(e) => panic!("{e}"), } }) } @@ -345,7 +359,7 @@ fn update_bogus_version() { config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]); config.expect_err( &["rustup", "update", "1.0.0-alpha"], - "could not download nonexistent rust version `1.0.0-alpha`", + "Invalid value \"1.0.0-alpha\" for '...': invalid toolchain name: '1.0.0-alpha'", ); }); } @@ -660,7 +674,7 @@ fn rustup_init_works_with_weird_names() { clitools::test(Scenario::SimpleV2, &|config| { let old = config.exedir.join(format!("rustup-init{EXE_SUFFIX}")); let new = config.exedir.join(format!("rustup-init(2){EXE_SUFFIX}")); - utils::rename_file("test", &old, &new, &|_: Notification<'_>| {}).unwrap(); + fs::rename(old, new).unwrap(); config.expect_ok(&["rustup-init(2)", "-y", "--no-modify-path"]); let rustup = config.cargodir.join(format!("bin/rustup{EXE_SUFFIX}")); assert!(rustup.exists()); @@ -688,7 +702,7 @@ fn install_but_rustup_sh_is_installed() { fn test_warn_succeed_if_rustup_sh_already_installed_y_flag() { clitools::test(Scenario::SimpleV2, &|config| { config.create_rustup_sh_metadata(); - let out = config.run("rustup-init", &["-y", "--no-modify-path"], &[]); + let out = config.run("rustup-init", ["-y", "--no-modify-path"], &[]); assert!(out.ok); assert!(out .stderr @@ -709,7 +723,7 @@ fn test_succeed_if_rustup_sh_already_installed_env_var_set() { config.create_rustup_sh_metadata(); let out = config.run( "rustup-init", - &["-y", "--no-modify-path"], + ["-y", "--no-modify-path"], &[("RUSTUP_INIT_SKIP_EXISTENCE_CHECKS", "yes")], ); assert!(out.ok); @@ -728,7 +742,10 @@ fn test_succeed_if_rustup_sh_already_installed_env_var_set() { #[test] fn rls_proxy_set_up_after_install() { - setup_installed(&|config| { + clitools::test(Scenario::None, &|config| { + config.with_scenario(Scenario::SimpleV2, &|config| { + config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]); + }); config.expect_err( &["rls", "--version"], &format!( diff --git a/tests/suite/cli_v1.rs b/tests/suite/cli_v1.rs index 274701fef9..4a3d617423 100644 --- a/tests/suite/cli_v1.rs +++ b/tests/suite/cli_v1.rs @@ -6,7 +6,7 @@ use std::fs; use rustup::for_host; use rustup_macros::integration_test as test; -use crate::mock::clitools::{self, set_current_dist_date, Config, Scenario}; +use rustup::test::mock::clitools::{self, set_current_dist_date, Config, Scenario}; pub fn setup(f: &dyn Fn(&mut Config)) { clitools::test(Scenario::SimpleV1, f); diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index 54d2c4c3ab..f796368029 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -6,11 +6,10 @@ use std::io::Write; use rustup::dist::dist::TargetTriple; use rustup::for_host; +use rustup::test::mock::clitools::{self, set_current_dist_date, Config, Scenario}; use rustup::test::this_host_triple; use rustup_macros::integration_test as test; -use crate::mock::clitools::{self, set_current_dist_date, Config, Scenario}; - pub fn setup(f: &dyn Fn(&mut Config)) { clitools::test(Scenario::SimpleV2, f); } @@ -772,7 +771,7 @@ fn add_target_v1_toolchain() { clitools::CROSS_ARCH1, "--toolchain=nightly", ], - for_host!("Missing manifest in toolchain 'nightly-{0}'"), + for_host!("toolchain 'nightly-{0}' does not support components (v1 manifest)"), ); }); } @@ -798,7 +797,7 @@ fn cannot_add_empty_named_custom_toolchain() { let path = path.to_string_lossy(); config.expect_err( &["rustup", "toolchain", "link", "", &path], - "toolchain names must not be empty", + "Invalid value \"\" for '': invalid toolchain name ''", ); }); } @@ -914,7 +913,7 @@ fn remove_target_v1_toolchain() { clitools::CROSS_ARCH1, "--toolchain=nightly", ], - for_host!("Missing manifest in toolchain 'nightly-{0}'"), + for_host!("toolchain 'nightly-{0}' does not support components (v1 manifest)"), ); }); } @@ -975,32 +974,30 @@ fn remove_target_missing_update_hash() { // Issue #1777 #[test] fn warn_about_and_remove_stray_hash() { - setup(&|config| { + clitools::test(Scenario::None, &|config| { let mut hash_path = config.rustupdir.join("update-hashes"); fs::create_dir_all(&hash_path).expect("Unable to make the update-hashes directory"); - hash_path.push(for_host!("nightly-{}")); - let mut file = fs::File::create(&hash_path).expect("Unable to open update-hash file"); file.write_all(b"LEGITHASH") .expect("Unable to write update-hash"); drop(file); - config.expect_stderr_ok( - &["rustup", "toolchain", "install", "nightly"], - &format!( - "removing stray hash found at '{}' in order to continue", - hash_path.display() - ), - ); - config.expect_ok(&["rustup", "default", "nightly"]); - config.expect_stdout_ok(&["rustc", "--version"], "1.3.0"); + config.with_scenario(Scenario::SimpleV2, &|config| { + config.expect_stderr_ok( + &["rustup", "toolchain", "install", "nightly"], + &format!( + "removing stray hash found at '{}' in order to continue", + hash_path.display() + ), + ); + }) }); } fn make_component_unavailable(config: &Config, name: &str, target: &str) { - use crate::mock::dist::create_hash; use rustup::dist::manifest::Manifest; + use rustup::test::mock::dist::create_hash; let manifest_path = config .distdir diff --git a/tests/suite/dist_install.rs b/tests/suite/dist_install.rs index c26576a8f5..b6f20dfcc5 100644 --- a/tests/suite/dist_install.rs +++ b/tests/suite/dist_install.rs @@ -11,7 +11,7 @@ use rustup::dist::Notification; use rustup::utils::utils; use rustup_macros::integration_test as test; -use crate::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; +use rustup::test::mock::{MockComponentBuilder, MockFile, MockInstallerBuilder}; // Just testing that the mocks work #[test] diff --git a/tests/suite/dist_manifest.rs b/tests/suite/dist_manifest.rs deleted file mode 100644 index 6d4a75c2da..0000000000 --- a/tests/suite/dist_manifest.rs +++ /dev/null @@ -1,110 +0,0 @@ -use rustup::dist::dist::TargetTriple; -use rustup::dist::manifest::Manifest; -use rustup::RustupError; -use rustup_macros::integration_test as test; - -// Example manifest from https://public.etherpad-mozilla.org/p/Rust-infra-work-week -static EXAMPLE: &str = include_str!("channel-rust-nightly-example.toml"); -// From brson's live build-rust-manifest.py script -static EXAMPLE2: &str = include_str!("channel-rust-nightly-example2.toml"); - -#[test] -fn parse_smoke_test() { - let x86_64_unknown_linux_gnu = TargetTriple::new("x86_64-unknown-linux-gnu"); - let x86_64_unknown_linux_musl = TargetTriple::new("x86_64-unknown-linux-musl"); - - let pkg = Manifest::parse(EXAMPLE).unwrap(); - - pkg.get_package("rust").unwrap(); - pkg.get_package("rustc").unwrap(); - pkg.get_package("cargo").unwrap(); - pkg.get_package("rust-std").unwrap(); - pkg.get_package("rust-docs").unwrap(); - - let rust_pkg = pkg.get_package("rust").unwrap(); - assert!(rust_pkg.version.contains("1.3.0")); - - let rust_target_pkg = rust_pkg - .get_target(Some(&x86_64_unknown_linux_gnu)) - .unwrap(); - assert!(rust_target_pkg.available()); - assert_eq!(rust_target_pkg.bins[0].1.url, "example.com"); - assert_eq!(rust_target_pkg.bins[0].1.hash, "..."); - - let component = &rust_target_pkg.components[0]; - assert_eq!(component.short_name_in_manifest(), "rustc"); - assert_eq!(component.target.as_ref(), Some(&x86_64_unknown_linux_gnu)); - - let component = &rust_target_pkg.components[4]; - assert_eq!(component.short_name_in_manifest(), "rust-std"); - assert_eq!(component.target.as_ref(), Some(&x86_64_unknown_linux_musl)); - - let docs_pkg = pkg.get_package("rust-docs").unwrap(); - let docs_target_pkg = docs_pkg - .get_target(Some(&x86_64_unknown_linux_gnu)) - .unwrap(); - assert_eq!(docs_target_pkg.bins[0].1.url, "example.com"); -} - -#[test] -fn renames() { - let manifest = Manifest::parse(EXAMPLE2).unwrap(); - assert_eq!(1, manifest.renames.len()); - assert_eq!(manifest.renames["cargo-old"], "cargo"); - assert_eq!(1, manifest.reverse_renames.len()); - assert_eq!(manifest.reverse_renames["cargo"], "cargo-old"); -} - -#[test] -fn parse_round_trip() { - let original = Manifest::parse(EXAMPLE).unwrap(); - let serialized = original.clone().stringify(); - let new = Manifest::parse(&serialized).unwrap(); - assert_eq!(original, new); - - let original = Manifest::parse(EXAMPLE2).unwrap(); - let serialized = original.clone().stringify(); - let new = Manifest::parse(&serialized).unwrap(); - assert_eq!(original, new); -} - -#[test] -fn validate_components_have_corresponding_packages() { - let manifest = r#" -manifest-version = "2" -date = "2015-10-10" -[pkg.rust] - version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" - [pkg.rust.target.x86_64-unknown-linux-gnu] - available = true - url = "example.com" - hash = "..." - [[pkg.rust.target.x86_64-unknown-linux-gnu.components]] - pkg = "rustc" - target = "x86_64-unknown-linux-gnu" - [[pkg.rust.target.x86_64-unknown-linux-gnu.extensions]] - pkg = "rust-std" - target = "x86_64-unknown-linux-musl" -[pkg.rustc] - version = "rustc 1.3.0 (9a92aaf19 2015-09-15)" - [pkg.rustc.target.x86_64-unknown-linux-gnu] - available = true - url = "example.com" - hash = "..." -"#; - - let err = Manifest::parse(manifest).unwrap_err(); - - match err.downcast::().unwrap() { - RustupError::MissingPackageForComponent(_) => {} - _ => panic!(), - } -} - -// #248 -#[test] -fn manifest_can_contain_unknown_targets() { - let manifest = EXAMPLE.replace("x86_64-unknown-linux-gnu", "mycpu-myvendor-myos"); - - assert!(Manifest::parse(&manifest).is_ok()); -} diff --git a/tests/suite/mod.rs b/tests/suite/mod.rs index afb91fd4a2..ddd7f59cb8 100644 --- a/tests/suite/mod.rs +++ b/tests/suite/mod.rs @@ -7,7 +7,4 @@ mod cli_self_upd; mod cli_ui; mod cli_v1; mod cli_v2; -mod dist; mod dist_install; -mod dist_manifest; -mod dist_transactions; diff --git a/tests/test_bonanza.rs b/tests/test_bonanza.rs index 0941d0b40a..7a4d0e3b24 100644 --- a/tests/test_bonanza.rs +++ b/tests/test_bonanza.rs @@ -1,2 +1 @@ -mod mock; mod suite; From 92c3dde86eda6458eda8c642dca3fc5c73c805a4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 15 May 2023 19:16:07 +0000 Subject: [PATCH 016/229] Update Rust crate windows-sys to 0.48.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2755ca33e2..1608b4c7fa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2101,7 +2101,7 @@ dependencies = [ "wait-timeout", "walkdir", "winapi", - "windows-sys 0.45.0", + "windows-sys 0.48.0", "winreg 0.50.0", "xz2", "zstd", diff --git a/Cargo.toml b/Cargo.toml index 6012ded1d2..99b0dbe337 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -153,7 +153,7 @@ features = [ "Win32_System_IO", "Win32_System_Ioctl", ] -version = "0.45.0" +version = "0.48.0" [dev-dependencies] From 3a549b79f96b3c15c069c174233b60ffbcea7e01 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sat, 20 May 2023 23:18:43 +0200 Subject: [PATCH 017/229] TestProcess and friends should be test only Before we had the test feature we had to rely on link time optimisation to remove this code, but there is no need to compile it at all for non-test builds. --- src/currentprocess.rs | 17 ++++++++++++----- src/currentprocess/argsource.rs | 1 + src/currentprocess/cwdsource.rs | 1 + src/currentprocess/filesource.rs | 3 +++ src/currentprocess/homethunk.rs | 7 ++++--- src/currentprocess/varsource.rs | 1 + 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/src/currentprocess.rs b/src/currentprocess.rs index 1a0bc54e7c..7ceca41c45 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -1,15 +1,20 @@ use std::boxed::Box; use std::cell::RefCell; -use std::collections::HashMap; use std::default::Default; use std::fmt::Debug; -use std::io::Cursor; use std::panic; -use std::path::{Path, PathBuf}; +use std::path::PathBuf; use std::sync::Once; -use std::sync::{Arc, Mutex}; +#[cfg(feature = "test")] +use std::{ + collections::HashMap, + io::Cursor, + path::Path, + sync::{Arc, Mutex}, +}; use home::env as home; +#[cfg(feature = "test")] use rand::{thread_rng, Rng}; pub(crate) mod argsource; @@ -204,7 +209,7 @@ impl ProcessSource for OSProcess { } // ------------ test process ---------------- - +#[cfg(feature = "test")] #[derive(Clone, Debug, Default)] pub struct TestProcess { pub cwd: PathBuf, @@ -216,6 +221,7 @@ pub struct TestProcess { pub stderr: TestWriterInner, } +#[cfg(feature = "test")] impl TestProcess { pub fn new, A: AsRef>( cwd: P, @@ -257,6 +263,7 @@ impl TestProcess { } } +#[cfg(feature = "test")] impl ProcessSource for TestProcess { fn id(&self) -> u64 { self.id diff --git a/src/currentprocess/argsource.rs b/src/currentprocess/argsource.rs index 6f274a4c6c..9eaf2d7c11 100644 --- a/src/currentprocess/argsource.rs +++ b/src/currentprocess/argsource.rs @@ -52,6 +52,7 @@ impl> Iterator for VecArgs { } } +#[cfg(feature = "test")] impl ArgSource for super::TestProcess { fn args(&self) -> Box> { Box::new(VecArgs::::from(&self.args)) diff --git a/src/currentprocess/cwdsource.rs b/src/currentprocess/cwdsource.rs index 779ed3f837..1a160cd961 100644 --- a/src/currentprocess/cwdsource.rs +++ b/src/currentprocess/cwdsource.rs @@ -15,6 +15,7 @@ impl CurrentDirSource for super::OSProcess { } } +#[cfg(feature = "test")] impl CurrentDirSource for super::TestProcess { fn current_dir(&self) -> io::Result { Ok(self.cwd.clone()) diff --git a/src/currentprocess/filesource.rs b/src/currentprocess/filesource.rs index 1770e86180..23c905a72f 100644 --- a/src/currentprocess/filesource.rs +++ b/src/currentprocess/filesource.rs @@ -73,6 +73,7 @@ impl Stdin for TestStdin { } } +#[cfg(feature = "test")] impl StdinSource for super::TestProcess { fn stdin(&self) -> Box { Box::new(TestStdin(self.stdin.clone())) @@ -193,12 +194,14 @@ impl Isatty for TestWriter { } } +#[cfg(feature = "test")] impl StdoutSource for super::TestProcess { fn stdout(&self) -> Box { Box::new(TestWriter(self.stdout.clone())) } } +#[cfg(feature = "test")] impl StderrSource for super::TestProcess { fn stderr(&self) -> Box { Box::new(TestWriter(self.stderr.clone())) diff --git a/src/currentprocess/homethunk.rs b/src/currentprocess/homethunk.rs index 1c065d0992..1260f735c8 100644 --- a/src/currentprocess/homethunk.rs +++ b/src/currentprocess/homethunk.rs @@ -1,16 +1,16 @@ /// Adapts currentprocess to the trait home::Env use std::ffi::OsString; use std::io; +#[cfg(feature = "test")] use std::ops::Deref; use std::path::PathBuf; use home::env as home; -use super::CurrentDirSource; use super::HomeProcess; use super::OSProcess; -use super::TestProcess; -use super::VarSource; +#[cfg(feature = "test")] +use super::{CurrentDirSource, TestProcess, VarSource}; impl home::Env for Box { fn home_dir(&self) -> Option { @@ -24,6 +24,7 @@ impl home::Env for Box { } } +#[cfg(feature = "test")] impl home::Env for TestProcess { fn home_dir(&self) -> Option { self.var("HOME").ok().map(|v| v.into()) diff --git a/src/currentprocess/varsource.rs b/src/currentprocess/varsource.rs index 9b1c674852..9692f0652c 100644 --- a/src/currentprocess/varsource.rs +++ b/src/currentprocess/varsource.rs @@ -20,6 +20,7 @@ impl VarSource for super::OSProcess { } } +#[cfg(feature = "test")] impl VarSource for super::TestProcess { fn var(&self, key: &str) -> std::result::Result { match self.var_os(key) { From 105a9338f0252bb940bddb42e3714b805675f2a9 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Thu, 25 May 2023 12:02:32 +0800 Subject: [PATCH 018/229] Update dependencies - libc to v0.2.144 - linux-raw-sys to v0.3.8 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2755ca33e2..7821d29876 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1198,9 +1198,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.142" +version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" +checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" [[package]] name = "libm" @@ -1231,9 +1231,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64f40e5e03e0d54f03845c8197d0291253cdbedfb1cb46b13c2c117554a9f4c" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "lock_api" From 984a4f317cf0718a07954db9f37268bdaafc5b32 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sat, 27 May 2023 23:05:21 +0200 Subject: [PATCH 019/229] Improve CurrentProcess To bring in tokio runtime pervasively we need to evolve CurrentProcess to be a bit more friendly with Send/Sync. Getting at the concrete types is actually clearer than what we had I think, and should ease that process. --- Cargo.lock | 13 ++++ Cargo.toml | 2 + src/bin/rustup-init.rs | 4 +- src/cli/common.rs | 5 ++ src/cli/log.rs | 1 + src/cli/proxy_mode.rs | 1 + src/cli/rustup_mode.rs | 5 ++ src/cli/self_update.rs | 13 ++-- src/cli/self_update/shell.rs | 2 +- src/cli/self_update/unix.rs | 1 + src/cli/self_update/windows.rs | 19 +++--- src/cli/setup_mode.rs | 1 + src/cli/term2.rs | 2 +- src/config.rs | 1 + src/currentprocess.rs | 101 +++++++++++-------------------- src/currentprocess/argsource.rs | 3 + src/currentprocess/cwdsource.rs | 3 + src/currentprocess/filesource.rs | 5 ++ src/currentprocess/homethunk.rs | 22 +++++-- src/currentprocess/varsource.rs | 3 + src/diskio/mod.rs | 1 + src/diskio/test.rs | 12 ++-- src/diskio/threaded.rs | 1 + src/dist/component/package.rs | 1 + src/dist/dist.rs | 2 +- src/dist/manifestation.rs | 1 + src/dist/manifestation/tests.rs | 5 +- src/env_var.rs | 8 +-- src/test.rs | 4 +- src/test/mock/clitools.rs | 15 ++--- src/toolchain/toolchain.rs | 2 +- src/utils/raw.rs | 2 +- src/utils/utils.rs | 2 +- 33 files changed, 147 insertions(+), 116 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2755ca33e2..76eeb50ba7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -648,6 +648,18 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "enum_dispatch" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f36e95862220b211a6e2aa5eca09b4fa391b13cd52ceb8035a24bf65a79de2" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "env_proxy" version = "0.4.1" @@ -2059,6 +2071,7 @@ dependencies = [ "download", "effective-limits", "enum-map", + "enum_dispatch", "flate2", "fs_at", "git-testament", diff --git a/Cargo.toml b/Cargo.toml index 6012ded1d2..37bc4e4bb4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,6 +55,7 @@ derivative.workspace = true download = { path = "download", default-features = false } effective-limits = "0.5.5" enum-map = "2.5.0" +enum_dispatch.workspace = true flate2 = "1" fs_at.workspace = true git-testament = "0.2" @@ -174,6 +175,7 @@ members = ["download", "rustup-macros"] [workspace.dependencies] anyhow = "1.0.69" derivative = "2.2.0" +enum_dispatch = "0.3.11" fs_at = "0.1.6" lazy_static = "1" once_cell = "1.17.1" diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index e6bbe59574..e486ff6fcf 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -23,14 +23,14 @@ use rustup::cli::rustup_mode; #[cfg(windows)] use rustup::cli::self_update; use rustup::cli::setup_mode; -use rustup::currentprocess::{process, with, OSProcess}; +use rustup::currentprocess::{process, varsource::VarSource, with, OSProcess}; use rustup::env_var::RUST_RECURSION_COUNT_MAX; use rustup::is_proxyable_tools; use rustup::utils::utils; fn main() { let process = OSProcess::default(); - with(Box::new(process), || match maybe_trace_rustup() { + with(process.into(), || match maybe_trace_rustup() { Err(e) => { common::report_error(&e); std::process::exit(1); diff --git a/src/cli/common.rs b/src/cli/common.rs index 36827de323..5df516e68d 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -14,6 +14,11 @@ use term2::Terminal; use super::self_update; use super::term2; +use crate::currentprocess::argsource::ArgSource; +use crate::currentprocess::{ + filesource::{StdinSource, StdoutSource}, + varsource::VarSource, +}; use crate::utils::notifications as util_notifications; use crate::utils::notify::NotificationLevel; use crate::utils::utils; diff --git a/src/cli/log.rs b/src/cli/log.rs index 6316fc68cb..66af98f248 100644 --- a/src/cli/log.rs +++ b/src/cli/log.rs @@ -3,6 +3,7 @@ use std::io::Write; use term2::Terminal; use super::term2; +use crate::currentprocess::varsource::VarSource; use crate::process; macro_rules! warn { diff --git a/src/cli/proxy_mode.rs b/src/cli/proxy_mode.rs index becb49a4e0..9490b0ae45 100644 --- a/src/cli/proxy_mode.rs +++ b/src/cli/proxy_mode.rs @@ -5,6 +5,7 @@ use anyhow::Result; use crate::{ cli::{common::set_globals, job, self_update}, command::run_command_for_dir, + currentprocess::argsource::ArgSource, toolchain::names::{LocalToolchainName, ResolvableLocalToolchainName}, utils::utils::{self, ExitCode}, Cfg, diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 56d3c5c0cd..040dd0d6e0 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -21,6 +21,11 @@ use crate::{ topical_doc, }, command, + currentprocess::{ + argsource::ArgSource, + filesource::{StderrSource, StdoutSource}, + varsource::VarSource, + }, dist::{ dist::{PartialToolchainDesc, Profile, TargetTriple}, manifest::{Component, ComponentStatus}, diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 8fe4b2f50c..6be74e8df5 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -65,6 +65,7 @@ use crate::{ markdown::md, term2::{self, Terminal}, }, + currentprocess::{filesource::StdoutSource, varsource::VarSource}, dist::dist::{self, PartialToolchainDesc, Profile, TargetTriple, ToolchainDesc}, install::UpdateStatus, process, @@ -1296,11 +1297,11 @@ mod tests { with_rustup_home(|home| { let mut vars = HashMap::new(); home.apply(&mut vars); - let tp = Box::new(currentprocess::TestProcess { + let tp = currentprocess::TestProcess { vars, ..Default::default() - }); - currentprocess::with(tp.clone(), || -> Result<()> { + }; + currentprocess::with(tp.clone().into(), || -> Result<()> { // TODO: we could pass in a custom cfg to get notification // callbacks rather than output to the tp sink. let mut cfg = common::set_globals(false, false).unwrap(); @@ -1343,11 +1344,11 @@ info: default host triple is {0} let cargo_home = root_dir.path().join("cargo"); let mut vars = HashMap::new(); vars.env("CARGO_HOME", cargo_home.to_string_lossy().to_string()); - let tp = Box::new(currentprocess::TestProcess { + let tp = currentprocess::TestProcess { vars, ..Default::default() - }); - currentprocess::with(tp, || -> Result<()> { + }; + currentprocess::with(tp.into(), || -> Result<()> { super::install_bins().unwrap(); Ok(()) }) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index 3927e531c8..205b6b614c 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -29,7 +29,7 @@ use std::path::PathBuf; use anyhow::{bail, Result}; use super::utils; -use crate::process; +use crate::{currentprocess::varsource::VarSource, process}; pub(crate) type Shell = Box; diff --git a/src/cli/self_update/unix.rs b/src/cli/self_update/unix.rs index ba20e1fb33..7bf169453d 100644 --- a/src/cli/self_update/unix.rs +++ b/src/cli/self_update/unix.rs @@ -5,6 +5,7 @@ use anyhow::{bail, Context, Result}; use super::install_bins; use super::shell; +use crate::currentprocess::varsource::VarSource; use crate::process; use crate::utils::utils; use crate::utils::Notification; diff --git a/src/cli/self_update/windows.rs b/src/cli/self_update/windows.rs index c1e0702e5f..7c84478b67 100644 --- a/src/cli/self_update/windows.rs +++ b/src/cli/self_update/windows.rs @@ -13,6 +13,7 @@ use super::super::errors::*; use super::common; use super::{install_bins, InstallOpts}; use crate::cli::download_tracker::DownloadTracker; +use crate::currentprocess::{filesource::StdoutSource, varsource::VarSource}; use crate::dist::dist::TargetTriple; use crate::process; use crate::utils::utils; @@ -747,9 +748,9 @@ mod tests { #[test] fn windows_path_regkey_type() { // per issue #261, setting PATH should use REG_EXPAND_SZ. - let tp = Box::new(currentprocess::TestProcess::default()); + let tp = currentprocess::TestProcess::default(); with_saved_path(&mut || { - currentprocess::with(tp.clone(), || { + currentprocess::with(tp.clone().into(), || { let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root .open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE) @@ -777,9 +778,9 @@ mod tests { use std::io; // during uninstall the PATH key may end up empty; if so we should // delete it. - let tp = Box::new(currentprocess::TestProcess::default()); + let tp = currentprocess::TestProcess::default(); with_saved_path(&mut || { - currentprocess::with(tp.clone(), || { + currentprocess::with(tp.clone().into(), || { let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root .open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE) @@ -812,15 +813,15 @@ mod tests { #[test] fn windows_doesnt_mess_with_a_non_string_path() { // This writes an error, so we want a sink for it. - let tp = Box::new(currentprocess::TestProcess { + let tp = currentprocess::TestProcess { vars: [("HOME".to_string(), "/unused".to_string())] .iter() .cloned() .collect(), ..Default::default() - }); + }; with_saved_path(&mut || { - currentprocess::with(tp.clone(), || { + currentprocess::with(tp.clone().into(), || { let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root .open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE) @@ -847,9 +848,9 @@ mod tests { #[test] fn windows_treat_missing_path_as_empty() { // during install the PATH key may be missing; treat it as empty - let tp = Box::new(currentprocess::TestProcess::default()); + let tp = currentprocess::TestProcess::default(); with_saved_path(&mut || { - currentprocess::with(tp.clone(), || { + currentprocess::with(tp.clone().into(), || { let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root .open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE) diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 21f93a087e..5f22db8e17 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -6,6 +6,7 @@ use crate::{ common, self_update::{self, InstallOpts}, }, + currentprocess::{argsource::ArgSource, filesource::StdoutSource}, dist::dist::Profile, process, toolchain::names::{maybe_official_toolchainame_parser, MaybeOfficialToolchainName}, diff --git a/src/cli/term2.rs b/src/cli/term2.rs index 05abb5be23..dab860cab0 100644 --- a/src/cli/term2.rs +++ b/src/cli/term2.rs @@ -11,7 +11,7 @@ pub(crate) use term::color; pub(crate) use term::Attr; pub(crate) use term::Terminal; -use crate::currentprocess::filesource::{Isatty, Writer}; +use crate::currentprocess::filesource::{Isatty, StderrSource, StdoutSource, Writer}; use crate::process; mod termhack { diff --git a/src/config.rs b/src/config.rs index 3e1fbcd8a1..ed19012e47 100644 --- a/src/config.rs +++ b/src/config.rs @@ -13,6 +13,7 @@ use thiserror::Error as ThisError; use crate::{ cli::self_update::SelfUpdateMode, + currentprocess::varsource::VarSource, dist::{ dist::{self, PartialToolchainDesc, Profile, ToolchainDesc}, download::DownloadCfg, diff --git a/src/currentprocess.rs b/src/currentprocess.rs index 7ceca41c45..6d3509a8bb 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -1,7 +1,10 @@ use std::boxed::Box; use std::cell::RefCell; use std::default::Default; +use std::env; +use std::ffi::OsString; use std::fmt::Debug; +use std::io; use std::panic; use std::path::PathBuf; use std::sync::Once; @@ -13,15 +16,16 @@ use std::{ sync::{Arc, Mutex}, }; +use enum_dispatch::enum_dispatch; use home::env as home; #[cfg(feature = "test")] use rand::{thread_rng, Rng}; -pub(crate) mod argsource; -pub(crate) mod cwdsource; -pub(crate) mod filesource; +pub mod argsource; +pub mod cwdsource; +pub mod filesource; mod homethunk; -pub(crate) mod varsource; +pub mod varsource; use argsource::*; use cwdsource::*; @@ -58,32 +62,10 @@ use varsource::*; /// needing to thread trait parameters across the entire code base: none of the /// methods are in performance critical loops (except perhaps progress bars - /// and even there we should be doing debouncing and managing update rates). -/// The real trait is CurrentProcess; HomeProcess is a single trait because -/// Box only allows autotraits to be added to it; so we use a subtrait to add -/// home::Env in. -pub trait HomeProcess: CurrentProcess + home::Env { - fn clone_boxed(&self) -> Box; -} - -// Machinery for Cloning boxes - -impl HomeProcess for T -where - T: 'static + CurrentProcess + home::Env + Clone, -{ - fn clone_boxed(&self) -> Box { - Box::new(T::clone(self)) - } -} - -impl Clone for Box { - fn clone(&self) -> Self { - HomeProcess::clone_boxed(self.as_ref()) - } -} - +#[enum_dispatch] pub trait CurrentProcess: - ArgSource + home::Env + + ArgSource + CurrentDirSource + VarSource + StdoutSource @@ -92,31 +74,28 @@ pub trait CurrentProcess: + ProcessSource + Debug { - fn clone_boxed(&self) -> Box; - - fn name(&self) -> Option; } -// Machinery for Cloning boxes - -impl CurrentProcess for T -where - T: 'static - + Clone - + Debug - + ArgSource - + CurrentDirSource - + VarSource - + StdoutSource - + StderrSource - + StdinSource - + ProcessSource, -{ - fn clone_boxed(&self) -> Box { - Box::new(T::clone(self)) - } +/// Allows concrete types for the currentprocess abstraction. +#[derive(Clone, Debug)] +#[enum_dispatch( + CurrentProcess, + ArgSource, + CurrentDirSource, + VarSource, + StdoutSource, + StderrSource, + StdinSource, + ProcessSource +)] +pub enum Process { + OSProcess(OSProcess), + #[cfg(feature = "test")] + TestProcess(TestProcess), +} - fn name(&self) -> Option { +impl Process { + pub fn name(&self) -> Option { let arg0 = match self.var("RUSTUP_FORCE_ARG0") { Ok(v) => Some(v), Err(_) => self.args().next(), @@ -130,19 +109,13 @@ where } } -impl Clone for Box { - fn clone(&self) -> Self { - self.as_ref().clone_boxed() - } -} - /// Obtain the current instance of CurrentProcess -pub fn process() -> Box { - CurrentProcess::clone_boxed(&*home_process()) +pub fn process() -> Process { + home_process() } /// Obtain the current instance of HomeProcess -pub(crate) fn home_process() -> Box { +pub(crate) fn home_process() -> Process { match PROCESS.with(|p| p.borrow().clone()) { None => panic!("No process instance"), Some(p) => p, @@ -155,7 +128,7 @@ static HOOK_INSTALLED: Once = Once::new(); /// /// If the function panics, the process definition *in that thread* is cleared /// by an implicitly installed global panic hook. -pub fn with(process: Box, f: F) -> R +pub fn with(process: Process, f: F) -> R where F: FnOnce() -> R, { @@ -184,11 +157,11 @@ fn clear_process() { } thread_local! { - pub(crate) static PROCESS:RefCell>> = RefCell::new(None); + pub(crate) static PROCESS:RefCell> = RefCell::new(None); } // PID related things - +#[enum_dispatch] pub trait ProcessSource { /// Returns a unique id for the process. /// @@ -287,7 +260,7 @@ mod tests { HashMap::default(), "", ); - with(Box::new(proc.clone()), || { + with(proc.clone().into(), || { assert_eq!(proc.id(), process().id(), "{:?} != {:?}", proc, process()) }); } diff --git a/src/currentprocess/argsource.rs b/src/currentprocess/argsource.rs index 9eaf2d7c11..b3eecf7755 100644 --- a/src/currentprocess/argsource.rs +++ b/src/currentprocess/argsource.rs @@ -4,6 +4,9 @@ use std::env; use std::ffi::OsString; use std::marker::PhantomData; +use enum_dispatch::enum_dispatch; + +#[enum_dispatch] pub trait ArgSource { fn args(&self) -> Box>; fn args_os(&self) -> Box>; diff --git a/src/currentprocess/cwdsource.rs b/src/currentprocess/cwdsource.rs index 1a160cd961..c44db686ca 100644 --- a/src/currentprocess/cwdsource.rs +++ b/src/currentprocess/cwdsource.rs @@ -4,6 +4,9 @@ use std::env; use std::io; use std::path::PathBuf; +use enum_dispatch::enum_dispatch; + +#[enum_dispatch] pub trait CurrentDirSource { fn current_dir(&self) -> io::Result; } diff --git a/src/currentprocess/filesource.rs b/src/currentprocess/filesource.rs index 23c905a72f..9fe4640abd 100644 --- a/src/currentprocess/filesource.rs +++ b/src/currentprocess/filesource.rs @@ -1,6 +1,8 @@ use std::io::{self, BufRead, Cursor, Read, Result, Write}; use std::sync::{Arc, Mutex, MutexGuard}; +use enum_dispatch::enum_dispatch; + use crate::utils::tty; /// Stand-in for std::io::Stdin @@ -13,6 +15,7 @@ pub trait Stdin { pub trait StdinLock: Read + BufRead {} /// Stand-in for std::io::stdin +#[enum_dispatch] pub trait StdinSource { fn stdin(&self) -> Box; } @@ -95,6 +98,7 @@ pub trait Writer: Write + Isatty + Send { } /// Stand-in for std::io::stdout +#[enum_dispatch] pub trait StdoutSource { fn stdout(&self) -> Box; } @@ -102,6 +106,7 @@ pub trait StdoutSource { // -------------- stderr ------------------------------- /// Stand-in for std::io::stderr +#[enum_dispatch] pub trait StderrSource { fn stderr(&self) -> Box; } diff --git a/src/currentprocess/homethunk.rs b/src/currentprocess/homethunk.rs index 1260f735c8..65f2d59e7b 100644 --- a/src/currentprocess/homethunk.rs +++ b/src/currentprocess/homethunk.rs @@ -7,20 +7,32 @@ use std::path::PathBuf; use home::env as home; -use super::HomeProcess; use super::OSProcess; +use super::Process; #[cfg(feature = "test")] use super::{CurrentDirSource, TestProcess, VarSource}; -impl home::Env for Box { +impl home::Env for Process { fn home_dir(&self) -> Option { - (**self).home_dir() + match self { + Process::OSProcess(p) => p.home_dir(), + #[cfg(feature = "test")] + Process::TestProcess(p) => p.home_dir(), + } } fn current_dir(&self) -> Result { - home::Env::current_dir(&(**self)) + match self { + Process::OSProcess(p) => home::Env::current_dir(p), + #[cfg(feature = "test")] + Process::TestProcess(p) => home::Env::current_dir(p), + } } fn var_os(&self, key: &str) -> Option { - home::Env::var_os(&(**self), key) + match self { + Process::OSProcess(p) => home::Env::var_os(p, key), + #[cfg(feature = "test")] + Process::TestProcess(p) => home::Env::var_os(p, key), + } } } diff --git a/src/currentprocess/varsource.rs b/src/currentprocess/varsource.rs index 9692f0652c..1c287cb17d 100644 --- a/src/currentprocess/varsource.rs +++ b/src/currentprocess/varsource.rs @@ -3,6 +3,9 @@ use std::env; use std::ffi::OsString; +use enum_dispatch::enum_dispatch; + +#[enum_dispatch] pub trait VarSource { // In order to support dyn dispatch we use concrete types rather than the // stdlib signature. diff --git a/src/diskio/mod.rs b/src/diskio/mod.rs index a5e597c2d7..33c790032a 100644 --- a/src/diskio/mod.rs +++ b/src/diskio/mod.rs @@ -65,6 +65,7 @@ use std::{fmt::Debug, fs::OpenOptions}; use anyhow::{Context, Result}; +use crate::currentprocess::varsource::VarSource; use crate::process; use crate::utils::notifications::Notification; use threaded::PoolReference; diff --git a/src/diskio/test.rs b/src/diskio/test.rs index 45bd407e55..8130213858 100644 --- a/src/diskio/test.rs +++ b/src/diskio/test.rs @@ -23,11 +23,11 @@ fn test_incremental_file(io_threads: &str) -> Result<()> { let work_dir = test_dir()?; let mut vars = HashMap::new(); vars.insert("RUSTUP_IO_THREADS".to_string(), io_threads.to_string()); - let tp = Box::new(currentprocess::TestProcess { + let tp = currentprocess::TestProcess { vars, ..Default::default() - }); - currentprocess::with(tp, || -> Result<()> { + }; + currentprocess::with(tp.into(), || -> Result<()> { let mut written = 0; let mut file_finished = false; let mut io_executor: Box = get_executor(None, 32 * 1024 * 1024)?; @@ -97,11 +97,11 @@ fn test_complete_file(io_threads: &str) -> Result<()> { let work_dir = test_dir()?; let mut vars = HashMap::new(); vars.insert("RUSTUP_IO_THREADS".to_string(), io_threads.to_string()); - let tp = Box::new(currentprocess::TestProcess { + let tp = currentprocess::TestProcess { vars, ..Default::default() - }); - currentprocess::with(tp, || -> Result<()> { + }; + currentprocess::with(tp.into(), || -> Result<()> { let mut io_executor: Box = get_executor(None, 32 * 1024 * 1024)?; let mut chunk = io_executor.get_buffer(10); chunk.extend(b"0123456789"); diff --git a/src/diskio/threaded.rs b/src/diskio/threaded.rs index e2732da231..b99b7f5fe4 100644 --- a/src/diskio/threaded.rs +++ b/src/diskio/threaded.rs @@ -14,6 +14,7 @@ use enum_map::{enum_map, Enum, EnumMap}; use sharded_slab::pool::{OwnedRef, OwnedRefMut}; use super::{perform, CompletedIo, Executor, Item}; +use crate::currentprocess::varsource::VarSource; use crate::utils::notifications::Notification; use crate::utils::units::Unit; diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs index dfccc661c8..5d48c7d05b 100644 --- a/src/dist/component/package.rs +++ b/src/dist/component/package.rs @@ -11,6 +11,7 @@ use std::path::{Path, PathBuf}; use anyhow::{anyhow, bail, Context, Result}; use tar::EntryType; +use crate::currentprocess::{filesource::StderrSource, varsource::VarSource}; use crate::diskio::{get_executor, CompletedIo, Executor, FileBuffer, Item, Kind, IO_CHUNK_SIZE}; use crate::dist::component::components::*; use crate::dist::component::transaction::*; diff --git a/src/dist/dist.rs b/src/dist/dist.rs index a38657f392..cfbdc68fec 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -14,6 +14,7 @@ use thiserror::Error as ThisError; pub(crate) use crate::dist::triple::*; use crate::{ + currentprocess::varsource::VarSource, dist::{ download::DownloadCfg, manifest::{Component, Manifest as ManifestV2}, @@ -27,7 +28,6 @@ use crate::{ toolchain::names::ToolchainName, utils::utils, }; - pub static DEFAULT_DIST_SERVER: &str = "https://static.rust-lang.org"; // Deprecated diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index 729224de95..fa2e5c92b2 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -10,6 +10,7 @@ use anyhow::{anyhow, bail, Context, Result}; use retry::delay::NoDelay; use retry::{retry, OperationResult}; +use crate::currentprocess::varsource::VarSource; use crate::dist::component::{ Components, Package, TarGzPackage, TarXzPackage, TarZStdPackage, Transaction, }; diff --git a/src/dist/manifestation/tests.rs b/src/dist/manifestation/tests.rs index d97bddb179..9a9de1217b 100644 --- a/src/dist/manifestation/tests.rs +++ b/src/dist/manifestation/tests.rs @@ -558,12 +558,13 @@ fn setup_from_dist_server( }; currentprocess::with( - Box::new(currentprocess::TestProcess::new( + currentprocess::TestProcess::new( env::current_dir().unwrap(), &["rustup"], HashMap::default(), "", - )), + ) + .into(), || f(url, &toolchain, &prefix, &download_cfg, &temp_cfg), ); } diff --git a/src/env_var.rs b/src/env_var.rs index 7d28f054ba..7397e12ac6 100644 --- a/src/env_var.rs +++ b/src/env_var.rs @@ -3,7 +3,7 @@ use std::env; use std::path::PathBuf; use std::process::Command; -use crate::process; +use crate::{currentprocess::varsource::VarSource, process}; pub const RUST_RECURSION_COUNT_MAX: u32 = 20; @@ -54,12 +54,12 @@ mod tests { "PATH", env::join_paths(vec!["/home/a/.cargo/bin", "/home/b/.cargo/bin"].iter()).unwrap(), ); - let tp = Box::new(currentprocess::TestProcess { + let tp = currentprocess::TestProcess { vars, ..Default::default() - }); + }; with_saved_path(&mut || { - currentprocess::with(tp.clone(), || { + currentprocess::with(tp.clone().into(), || { let mut path_entries = vec![]; let mut cmd = Command::new("test"); diff --git a/src/test.rs b/src/test.rs index 2dd3626f67..638bd28554 100644 --- a/src/test.rs +++ b/src/test.rs @@ -124,8 +124,8 @@ pub fn this_host_triple() -> String { // For windows, this host may be different to the target: we may be // building with i686 toolchain, but on an x86_64 host, so run the // actual detection logic and trust it. - let tp = Box::new(currentprocess::TestProcess::default()); - return currentprocess::with(tp, || TargetTriple::from_host().unwrap().to_string()); + let tp = currentprocess::TestProcess::default(); + return currentprocess::with(tp.into(), || TargetTriple::from_host().unwrap().to_string()); } let arch = if cfg!(target_arch = "x86") { "i686" diff --git a/src/test/mock/clitools.rs b/src/test/mock/clitools.rs index 3d879729e5..1c9aa76ede 100644 --- a/src/test/mock/clitools.rs +++ b/src/test/mock/clitools.rs @@ -724,25 +724,20 @@ impl Config { .into_boxed_str(), ); } - let tp = Box::new(currentprocess::TestProcess::new( - &*self.workdir.borrow(), - &arg_strings, - vars, - "", - )); - let process_res = currentprocess::with(tp.clone(), rustup_mode::main); + let tp = currentprocess::TestProcess::new(&*self.workdir.borrow(), &arg_strings, vars, ""); + let process_res = currentprocess::with(tp.clone().into(), rustup_mode::main); // convert Err's into an ec let ec = match process_res { Ok(process_res) => process_res, Err(e) => { - currentprocess::with(tp.clone(), || crate::cli::common::report_error(&e)); + currentprocess::with(tp.clone().into(), || crate::cli::common::report_error(&e)); utils::ExitCode(1) } }; Output { status: Some(ec.0), - stderr: (*tp).get_stderr(), - stdout: (*tp).get_stdout(), + stderr: tp.get_stderr(), + stdout: tp.get_stdout(), } } diff --git a/src/toolchain/toolchain.rs b/src/toolchain/toolchain.rs index 767d3a152a..e666041f99 100644 --- a/src/toolchain/toolchain.rs +++ b/src/toolchain/toolchain.rs @@ -16,7 +16,7 @@ use wait_timeout::ChildExt; use crate::{ config::Cfg, - currentprocess::process, + currentprocess::{process, varsource::VarSource}, env_var, install, notifications::Notification, utils::{raw::open_dir, utils}, diff --git a/src/utils/raw.rs b/src/utils/raw.rs index a56133d256..bbfe799d1e 100644 --- a/src/utils/raw.rs +++ b/src/utils/raw.rs @@ -11,7 +11,7 @@ use std::str; use libc; #[cfg(not(windows))] -use crate::process; +use crate::{currentprocess::varsource::VarSource, process}; pub(crate) fn ensure_dir_exists, F: FnOnce(&Path)>( path: P, diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 3b62dd254f..161d394685 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -10,7 +10,7 @@ use retry::{retry, OperationResult}; use sha2::Sha256; use url::Url; -// use crate::currentprocess::cwdsource::CurrentDirSource; +use crate::currentprocess::{cwdsource::CurrentDirSource, varsource::VarSource}; use crate::errors::*; use crate::utils::notifications::Notification; use crate::utils::raw; From 71eba42b1cdbfd1caf7884cb4b78e74cab5b3606 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 28 May 2023 08:09:56 +0200 Subject: [PATCH 020/229] Group updates to opentelemetry together This might not be the exact pattern we need - we can iterate on it easily. The Rust opentelemetry ecosystem has tight coupling across versions between releases, so it is unlikely for single-dependency upgrades to work. --- .github/renovate.json | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/renovate.json b/.github/renovate.json index aed45505b0..0f3bee1ac0 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -16,5 +16,15 @@ "fileMatch": [ "^ci\\/.*/[^/]+\\.ya?ml$" ] + }, + { + "packageRules": [ + { + "matchPackagePatterns": [ + "opentelemetry" + ], + "groupName": "opentelemetry" + } + ] } } \ No newline at end of file From ec075e7b8829bb754aeeb0e6a10bb31729ee5552 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Sun, 28 May 2023 16:27:53 +0800 Subject: [PATCH 021/229] Fix compile on rust nightly --- download/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/download/src/lib.rs b/download/src/lib.rs index b13361b478..0cf20f7994 100644 --- a/download/src/lib.rs +++ b/download/src/lib.rs @@ -269,7 +269,7 @@ pub mod reqwest_be { use std::time::Duration; use anyhow::{anyhow, Context, Result}; - #[cfg(feature = "reqwest-rustls-tls")] + #[cfg(any(feature = "reqwest-rustls-tls", feature = "reqwest-default-tls"))] use lazy_static::lazy_static; use reqwest::blocking::{Client, ClientBuilder, Response}; use reqwest::{header, Proxy}; From 8a704172114133095086c11b649afed6a64b3d95 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Thu, 25 May 2023 10:34:41 +0800 Subject: [PATCH 022/229] CI support for loongarch64-unknown-linux-gnu skip-stable because we're not going to release this for now --- ci/actions-templates/README.md | 1 + ci/actions-templates/linux-builds-template.yaml | 1 + ci/docker/loongarch64-unknown-linux-gnu/Dockerfile | 4 ++++ ci/fetch-rust-docker.bash | 1 + ci/run.bash | 2 ++ 5 files changed, 9 insertions(+) create mode 100644 ci/docker/loongarch64-unknown-linux-gnu/Dockerfile diff --git a/ci/actions-templates/README.md b/ci/actions-templates/README.md index a52dcf9c70..7f211b800d 100644 --- a/ci/actions-templates/README.md +++ b/ci/actions-templates/README.md @@ -62,6 +62,7 @@ system. | i686-linux-android | Yes | Two | No | No | | x86_64-linux-android | Yes | Two | No | No | | riscv64gc-unknown-linux-gnu | Yes | --- | No | No | +| loongarch64-unknown-linux-gnu | Yes | Two | No | No | | ----------------------------- | ---------- | ----- | ------ | ---------- | | aarch64-apple-darwin | Yes | Two | Yes | Yes | | x86_64-apple-darwin | No | One | Yes | Yes | diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 8799eb3655..40d00182c0 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -53,6 +53,7 @@ jobs: - i686-linux-android # skip-pr skip-master - x86_64-linux-android # skip-pr skip-master - riscv64gc-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-gnu # skip-pr skip-master skip-stable include: - target: x86_64-unknown-linux-gnu run_tests: YES diff --git a/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile b/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile new file mode 100644 index 0000000000..d385430dcd --- /dev/null +++ b/ci/docker/loongarch64-unknown-linux-gnu/Dockerfile @@ -0,0 +1,4 @@ +FROM rust-loongarch64-unknown-linux-gnu + +ENV CC_loongarch64_unknown_linux_gnu=loongarch64-unknown-linux-gnu-gcc \ + CARGO_TARGET_LOONGARCH64_UNKNOWN_LINUX_GNU_LINKER=loongarch64-unknown-linux-gnu-gcc diff --git a/ci/fetch-rust-docker.bash b/ci/fetch-rust-docker.bash index 0c5122aeb2..d889073388 100644 --- a/ci/fetch-rust-docker.bash +++ b/ci/fetch-rust-docker.bash @@ -36,6 +36,7 @@ case "$TARGET" in x86_64-unknown-linux-gnu) image=dist-x86_64-linux ;; x86_64-unknown-netbsd) image=dist-x86_64-netbsd ;; riscv64gc-unknown-linux-gnu) image=dist-riscv64-linux ;; + loongarch64-unknown-linux-gnu) image=dist-loongarch64-linux ;; *) exit ;; esac diff --git a/ci/run.bash b/ci/run.bash index 41eda29eda..1de503a5ab 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -20,6 +20,7 @@ case "$TARGET" in mips* ) ;; riscv* ) ;; s390x* ) ;; + loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) FEATURES+=('--features' 'reqwest-rustls-tls') ;; @@ -46,6 +47,7 @@ download_pkg_test() { mips* ) ;; riscv* ) ;; s390x* ) ;; + loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) features+=('--features' 'reqwest-rustls-tls') ;; From 86b1ef3b3143f48500dc89b4800b54741f8d7192 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 29 May 2023 08:20:23 +0800 Subject: [PATCH 023/229] Improve error message for adding unknown target Signed-off-by: hi-rustin --- src/errors.rs | 18 +++++++++++++++++- src/toolchain/distributable.rs | 18 ++++++++++++++++-- tests/suite/cli_v2.rs | 6 +++--- 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 3fd2fe961a..b87881f009 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -10,7 +10,10 @@ use std::path::PathBuf; use thiserror::Error as ThisError; use url::Url; -use crate::{currentprocess::process, dist::dist::ToolchainDesc}; +use crate::{ + currentprocess::process, + dist::dist::{TargetTriple, ToolchainDesc}, +}; use crate::{ dist::manifest::{Component, Manifest}, toolchain::names::{PathBasedToolchainName, ToolchainName}, @@ -114,6 +117,19 @@ pub(crate) enum RustupError { component: String, suggestion: Option, }, + #[error("toolchain '{}' does not support target '{}'{}\n\ + note: you can see a list of supported targets with `rustc --print=target-list`\n\ + note: if you are adding support for a new target to rustc itself, see https://rustc-dev-guide.rust-lang.org/building/new-target.html", .desc, .target, + if let Some(suggestion) = .suggestion { + format!("; did you mean '{suggestion}'?") + } else { + "".to_string() + })] + UnknownTarget { + desc: ToolchainDesc, + target: TargetTriple, + suggestion: Option, + }, #[error("unknown metadata version: '{0}'")] UnknownMetadataVersion(String), #[error("manifest version '{0}' is not supported")] diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 479ef12b1b..936ad9f4d7 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -70,11 +70,25 @@ impl<'a> DistributableToolchain<'a> { component = wildcard_component; } else { let config = manifestation.read_config()?.unwrap_or_default(); + let suggestion = + self.get_component_suggestion(&component, &config, &manifest, false); + // Check if the target is supported. + if !targ_pkg + .components + .iter() + .any(|c| c.target() == component.target()) + { + return Err(RustupError::UnknownTarget { + desc: self.desc.clone(), + target: component.target.expect("component target should be known"), + suggestion, + } + .into()); + } return Err(RustupError::UnknownComponent { desc: self.desc.clone(), component: component.description(&manifest), - suggestion: self - .get_component_suggestion(&component, &config, &manifest, false), + suggestion, } .into()); } diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index f796368029..a1060f22fb 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -752,9 +752,9 @@ fn add_target_bogus() { config.expect_ok(&["rustup", "default", "nightly"]); config.expect_err( &["rustup", "target", "add", "bogus"], - "does not contain component 'rust-std' for target 'bogus'\n\ - note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html\n\ - help: consider using `cargo build -Z build-std` instead", + "does not support target 'bogus'\n\ + note: you can see a list of supported targets with `rustc --print=target-list`\n\ + note: if you are adding support for a new target to rustc itself, see https://rustc-dev-guide.rust-lang.org/building/new-target.html", ); }); } From ee8a5df817f9e2e92b3957de3097ef9547a9323d Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 29 May 2023 08:23:28 +0800 Subject: [PATCH 024/229] Improve error message for removing uninstalled target Signed-off-by: hi-rustin --- src/errors.rs | 11 +++++++++++ src/toolchain/distributable.rs | 17 ++++++++++++++++- tests/suite/cli_v2.rs | 6 +++--- 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index b87881f009..4548462a7e 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -130,6 +130,17 @@ pub(crate) enum RustupError { target: TargetTriple, suggestion: Option, }, + #[error("toolchain '{}' does not have target '{}' installed{}\n", .desc, .target, + if let Some(suggestion) = .suggestion { + format!("; did you mean '{suggestion}'?") + } else { + "".to_string() + })] + TargetNotInstalled { + desc: ToolchainDesc, + target: TargetTriple, + suggestion: Option, + }, #[error("unknown metadata version: '{0}'")] UnknownMetadataVersion(String), #[error("manifest version '{0}' is not supported")] diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 936ad9f4d7..7635e6234d 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -462,10 +462,25 @@ impl<'a> DistributableToolchain<'a> { if config.components.contains(&wildcard_component) { component = wildcard_component; } else { + let suggestion = + self.get_component_suggestion(&component, &config, &manifest, true); + // Check if the target is installed. + if !config + .components + .iter() + .any(|c| c.target() == component.target()) + { + return Err(RustupError::TargetNotInstalled { + desc: self.desc.clone(), + target: component.target.expect("component target should be known"), + suggestion, + } + .into()); + } return Err(RustupError::UnknownComponent { desc: self.desc.clone(), component: component.description(&manifest), - suggestion: self.get_component_suggestion(&component, &config, &manifest, true), + suggestion, } .into()); } diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index a1060f22fb..4240298058 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -866,7 +866,7 @@ fn remove_target_not_installed() { config.expect_err( &["rustup", "target", "remove", clitools::CROSS_ARCH1], &format!( - "toolchain 'nightly-{}' does not contain component 'rust-std' for target '{}'", + "toolchain 'nightly-{}' does not have target '{}' installed", this_host_triple(), clitools::CROSS_ARCH1 ), @@ -896,7 +896,7 @@ fn remove_target_bogus() { config.expect_ok(&["rustup", "default", "nightly"]); config.expect_err( &["rustup", "target", "remove", "bogus"], - "does not contain component 'rust-std' for target 'bogus'", + "does not have target 'bogus' installed", ); }); } @@ -941,7 +941,7 @@ fn remove_target_again() { config.expect_err( &["rustup", "target", "remove", clitools::CROSS_ARCH1], &format!( - "toolchain 'nightly-{}' does not contain component 'rust-std' for target '{}'", + "toolchain 'nightly-{}' does not have target '{}' installed", this_host_triple(), clitools::CROSS_ARCH1 ), From 4de14bdb1d0479cec1e0e26a5216af6142f4110b Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Mon, 29 May 2023 17:03:42 +0200 Subject: [PATCH 025/229] Tweak docs --- src/currentprocess.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/currentprocess.rs b/src/currentprocess.rs index 6d3509a8bb..3e9ac3040a 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -32,7 +32,11 @@ use cwdsource::*; use filesource::*; use varsource::*; -/// An abstraction for the current process +/// An abstraction for the current process. +/// +/// This acts as a clonable proxy to the global state provided by some key OS +/// interfaces - it is a zero cost abstraction. For the test variant it manages +/// a mutex and takes out locks to ensure consistency. /// /// This provides replacements env::arg*, env::var*, and the standard files /// io::std* with traits that are customisable for tests. As a result any macros From f7579b70d99f2af01e9630bd42dc16ffe6a9ac61 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 8 May 2023 09:44:05 +0800 Subject: [PATCH 026/229] replace term with termcolor - moves terminal into currentprocess abstraction, because termcolor doesn't accept a file handle, rather it takes an enum indirectly referencing the global state of stdout/stderr. - provides write/fg/bg/locked etc as before - abstracts over TestWriter, or termcolor's own concrete types - still permits completely terminal-free operation where desired (e.g. future JSON RPC on stdin/stdout) Signed-off-by: hi-rustin Signed-off-by: Robert Collins --- Cargo.lock | 12 +- Cargo.toml | 3 +- src/cli.rs | 1 - src/cli/common.rs | 119 +++++++------ src/cli/download_tracker.rs | 25 +-- src/cli/log.rs | 65 ++++---- src/cli/markdown.rs | 31 ++-- src/cli/rustup_mode.rs | 132 ++++++++------- src/cli/self_update.rs | 36 ++-- src/cli/self_update/windows.rs | 28 ++-- src/cli/term2.rs | 240 --------------------------- src/currentprocess.rs | 25 ++- src/currentprocess/filesource.rs | 100 +++++++---- src/currentprocess/terminalsource.rs | 222 +++++++++++++++++++++++++ src/dist/component/package.rs | 2 +- src/utils/tty.rs | 2 +- 16 files changed, 546 insertions(+), 497 deletions(-) delete mode 100644 src/cli/term2.rs create mode 100644 src/currentprocess/terminalsource.rs diff --git a/Cargo.lock b/Cargo.lock index db03999e5b..fa85b8cf3e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2101,7 +2101,7 @@ dependencies = [ "strsim", "tar", "tempfile", - "term", + "termcolor", "thiserror", "threadpool", "tokio", @@ -2461,16 +2461,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "term" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e6b677dd1e8214ea1ef4297f85dbcbed8e8cdddb561040cc998ca2551c37561" -dependencies = [ - "byteorder", - "winapi", -] - [[package]] name = "termcolor" version = "1.2.0" diff --git a/Cargo.toml b/Cargo.toml index a4566fb9ef..3d2f0a8489 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -80,7 +80,7 @@ sharded-slab = "0.1.1" strsim = "0.10" tar = "0.4.26" tempfile.workspace = true -term = "=0.5.1" # FIXME(issue #1818, #1826, and friends) +termcolor.workspace = true thiserror.workspace = true threadpool = "1" tokio = { workspace = true, optional = true } @@ -184,6 +184,7 @@ opentelemetry-otlp = { version = "0.11.0" } proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.5" +termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = [ "rt-multi-thread", diff --git a/src/cli.rs b/src/cli.rs index 7ac235724c..96f073e7f6 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -11,5 +11,4 @@ pub mod proxy_mode; pub mod rustup_mode; pub mod self_update; pub mod setup_mode; -mod term2; mod topical_doc; diff --git a/src/cli/common.rs b/src/cli/common.rs index 5df516e68d..ac8c337741 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -10,13 +10,12 @@ use std::{cmp, env}; use anyhow::{anyhow, Context, Result}; use git_testament::{git_testament, render_testament}; use lazy_static::lazy_static; -use term2::Terminal; use super::self_update; -use super::term2; -use crate::currentprocess::argsource::ArgSource; use crate::currentprocess::{ + argsource::ArgSource, filesource::{StdinSource, StdoutSource}, + terminalsource, varsource::VarSource, }; use crate::utils::notifications as util_notifications; @@ -32,7 +31,7 @@ use crate::{Cfg, Notification}; pub(crate) const WARN_COMPLETE_PROFILE: &str = "downloading with complete profile isn't recommended unless you are a developer of the rust language"; pub(crate) fn confirm(question: &str, default: bool) -> Result { - write!(process().stdout(), "{question} ")?; + write!(process().stdout().lock(), "{question} ")?; let _ = std::io::stdout().flush(); let input = read_line()?; @@ -43,7 +42,7 @@ pub(crate) fn confirm(question: &str, default: bool) -> Result { _ => false, }; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; Ok(r) } @@ -55,11 +54,14 @@ pub(crate) enum Confirm { } pub(crate) fn confirm_advanced() -> Result { - writeln!(process().stdout())?; - writeln!(process().stdout(), "1) Proceed with installation (default)")?; - writeln!(process().stdout(), "2) Customize installation")?; - writeln!(process().stdout(), "3) Cancel installation")?; - write!(process().stdout(), ">")?; + writeln!(process().stdout().lock())?; + writeln!( + process().stdout().lock(), + "1) Proceed with installation (default)" + )?; + writeln!(process().stdout().lock(), "2) Customize installation")?; + writeln!(process().stdout().lock(), "3) Cancel installation")?; + write!(process().stdout().lock(), ">")?; let _ = std::io::stdout().flush(); let input = read_line()?; @@ -70,17 +72,17 @@ pub(crate) fn confirm_advanced() -> Result { _ => Confirm::No, }; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; Ok(r) } pub(crate) fn question_str(question: &str, default: &str) -> Result { - writeln!(process().stdout(), "{question} [{default}]")?; + writeln!(process().stdout().lock(), "{question} [{default}]")?; let _ = std::io::stdout().flush(); let input = read_line()?; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; if input.is_empty() { Ok(default.to_string()) @@ -91,12 +93,12 @@ pub(crate) fn question_str(question: &str, default: &str) -> Result { pub(crate) fn question_bool(question: &str, default: bool) -> Result { let default_text = if default { "(Y/n)" } else { "(y/N)" }; - writeln!(process().stdout(), "{question} {default_text}")?; + writeln!(process().stdout().lock(), "{question} {default_text}")?; let _ = std::io::stdout().flush(); let input = read_line()?; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; if input.is_empty() { Ok(default) @@ -212,10 +214,10 @@ fn show_channel_updates( ) -> Result<()> { let data = updates.into_iter().map(|(pkg, result)| { let (banner, color) = match &result { - Ok(UpdateStatus::Installed) => ("installed", Some(term2::color::GREEN)), - Ok(UpdateStatus::Updated(_)) => ("updated", Some(term2::color::GREEN)), + Ok(UpdateStatus::Installed) => ("installed", Some(terminalsource::Color::Green)), + Ok(UpdateStatus::Updated(_)) => ("updated", Some(terminalsource::Color::Green)), Ok(UpdateStatus::Unchanged) => ("unchanged", None), - Err(_) => ("update failed", Some(term2::color::RED)), + Err(_) => ("update failed", Some(terminalsource::Color::Red)), }; let (previous_version, version) = match &pkg { @@ -253,7 +255,7 @@ fn show_channel_updates( Ok((pkg, banner, width, color, version, previous_version)) }); - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); let data: Vec<_> = data.collect::>()?; let max_width = data @@ -263,20 +265,20 @@ fn show_channel_updates( for (pkg, banner, width, color, version, previous_version) in data { let padding = max_width - width; let padding: String = " ".repeat(padding); - let _ = write!(t, " {padding}"); - let _ = t.attr(term2::Attr::Bold); + let _ = write!(t.lock(), " {padding}"); + let _ = t.attr(terminalsource::Attr::Bold); if let Some(color) = color { let _ = t.fg(color); } - let _ = write!(t, "{pkg} {banner}"); + let _ = write!(t.lock(), "{pkg} {banner}"); let _ = t.reset(); - let _ = write!(t, " - {version}"); + let _ = write!(t.lock(), " - {version}"); if let Some(previous_version) = previous_version { - let _ = write!(t, " (from {previous_version})"); + let _ = write!(t.lock(), " (from {previous_version})"); } - let _ = writeln!(t); + let _ = writeln!(t.lock()); } - let _ = writeln!(t); + let _ = writeln!(t.lock()); Ok(()) } @@ -294,7 +296,7 @@ pub(crate) fn update_all_channels( let show_channel_updates = || { if !toolchains.is_empty() { - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; let t = toolchains .into_iter() @@ -374,7 +376,7 @@ where } pub(crate) fn list_targets(distributable: DistributableToolchain<'_>) -> Result { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); let manifestation = distributable.get_manifestation()?; let config = manifestation.read_config()?.unwrap_or_default(); let manifest = distributable.get_manifest()?; @@ -387,11 +389,11 @@ pub(crate) fn list_targets(distributable: DistributableToolchain<'_>) -> Result< .as_ref() .expect("rust-std should have a target"); if component.installed { - let _ = t.attr(term2::Attr::Bold); - let _ = writeln!(t, "{target} (installed)"); + let _ = t.attr(terminalsource::Attr::Bold); + let _ = writeln!(t.lock(), "{target} (installed)"); let _ = t.reset(); } else if component.available { - let _ = writeln!(t, "{target}"); + let _ = writeln!(t.lock(), "{target}"); } } } @@ -402,7 +404,7 @@ pub(crate) fn list_targets(distributable: DistributableToolchain<'_>) -> Result< pub(crate) fn list_installed_targets( distributable: DistributableToolchain<'_>, ) -> Result { - let mut t = term2::stdout(); + let t = process().stdout(); let manifestation = distributable.get_manifestation()?; let config = manifestation.read_config()?.unwrap_or_default(); let manifest = distributable.get_manifest()?; @@ -415,7 +417,7 @@ pub(crate) fn list_installed_targets( .as_ref() .expect("rust-std should have a target"); if component.installed { - writeln!(t, "{target}")?; + writeln!(t.lock(), "{target}")?; } } } @@ -425,7 +427,8 @@ pub(crate) fn list_installed_targets( pub(crate) fn list_components( distributable: DistributableToolchain<'_>, ) -> Result { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); + let manifestation = distributable.get_manifestation()?; let config = manifestation.read_config()?.unwrap_or_default(); let manifest = distributable.get_manifest()?; @@ -433,11 +436,11 @@ pub(crate) fn list_components( for component in components { let name = component.name; if component.installed { - t.attr(term2::Attr::Bold)?; - writeln!(t, "{name} (installed)")?; + t.attr(terminalsource::Attr::Bold)?; + writeln!(t.lock(), "{name} (installed)")?; t.reset()?; } else if component.available { - writeln!(t, "{name}")?; + writeln!(t.lock(), "{name}")?; } } @@ -445,7 +448,7 @@ pub(crate) fn list_components( } pub(crate) fn list_installed_components(distributable: DistributableToolchain<'_>) -> Result<()> { - let mut t = term2::stdout(); + let t = process().stdout(); let manifestation = distributable.get_manifestation()?; let config = manifestation.read_config()?.unwrap_or_default(); let manifest = distributable.get_manifest()?; @@ -453,7 +456,7 @@ pub(crate) fn list_installed_components(distributable: DistributableToolchain<'_ for component in components { if component.installed { - writeln!(t, "{}", component.name)?; + writeln!(t.lock(), "{}", component.name)?; } } Ok(()) @@ -478,7 +481,7 @@ fn print_toolchain_path( String::new() }; writeln!( - process().stdout(), + process().stdout().lock(), "{}{}{}{}", &toolchain, if_default, @@ -496,7 +499,7 @@ pub(crate) fn list_toolchains(cfg: &Cfg, verbose: bool) -> Result>(); if toolchains.is_empty() { - writeln!(process().stdout(), "no installed toolchains")?; + writeln!(process().stdout().lock(), "no installed toolchains")?; } else { let def_toolchain_name = cfg.get_default()?.map(|t| (&t).into()); let cwd = utils::current_dir()?; @@ -534,7 +537,7 @@ pub(crate) fn list_overrides(cfg: &Cfg) -> Result { let overrides = cfg.settings_file.with(|s| Ok(s.overrides.clone()))?; if overrides.is_empty() { - writeln!(process().stdout(), "no overrides")?; + writeln!(process().stdout().lock(), "no overrides")?; } else { let mut any_not_exist = false; for (k, v) in overrides { @@ -543,7 +546,7 @@ pub(crate) fn list_overrides(cfg: &Cfg) -> Result { any_not_exist = true; } writeln!( - process().stdout(), + process().stdout().lock(), "{:<40}\t{:<20}", utils::format_path_for_display(&k) + if dir_exists { "" } else { " (not a directory)" }, @@ -551,7 +554,7 @@ pub(crate) fn list_overrides(cfg: &Cfg) -> Result { )? } if any_not_exist { - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; info!( "you may remove overrides for non-existent directories with `rustup override unset --nonexistent`" @@ -576,43 +579,51 @@ pub(crate) fn version() -> &'static str { pub(crate) fn dump_testament() -> Result { use git_testament::GitModification::*; writeln!( - process().stdout(), + process().stdout().lock(), "Rustup version renders as: {}", version() )?; writeln!( - process().stdout(), + process().stdout().lock(), "Current crate version: {}", env!("CARGO_PKG_VERSION") )?; if TESTAMENT.branch_name.is_some() { writeln!( - process().stdout(), + process().stdout().lock(), "Built from branch: {}", TESTAMENT.branch_name.unwrap() )?; } else { - writeln!(process().stdout(), "Branch information missing")?; + writeln!(process().stdout().lock(), "Branch information missing")?; } - writeln!(process().stdout(), "Commit info: {}", TESTAMENT.commit)?; + writeln!( + process().stdout().lock(), + "Commit info: {}", + TESTAMENT.commit + )?; if TESTAMENT.modifications.is_empty() { - writeln!(process().stdout(), "Working tree is clean")?; + writeln!(process().stdout().lock(), "Working tree is clean")?; } else { for fmod in TESTAMENT.modifications { match fmod { - Added(f) => writeln!(process().stdout(), "Added: {}", String::from_utf8_lossy(f))?, + Added(f) => writeln!( + process().stdout().lock(), + "Added: {}", + String::from_utf8_lossy(f) + )?, Removed(f) => writeln!( - process().stdout(), + process().stdout().lock(), "Removed: {}", String::from_utf8_lossy(f) )?, Modified(f) => writeln!( - process().stdout(), + process().stdout().lock(), "Modified: {}", String::from_utf8_lossy(f) )?, Untracked(f) => writeln!( - process().stdout(), + process().stdout().lock(), "Untracked: {}", String::from_utf8_lossy(f) )?, diff --git a/src/cli/download_tracker.rs b/src/cli/download_tracker.rs index 7db1373c7a..a25686a033 100644 --- a/src/cli/download_tracker.rs +++ b/src/cli/download_tracker.rs @@ -3,11 +3,8 @@ use std::fmt; use std::io::Write; use std::time::{Duration, Instant}; -use term::Terminal; - -use super::term2; +use crate::currentprocess::{filesource::StdoutSource, process, terminalsource}; use crate::dist::Notification as In; -use crate::utils::tty; use crate::utils::units::{Size, Unit, UnitMode}; use crate::utils::Notification as Un; use crate::Notification; @@ -31,11 +28,7 @@ pub(crate) struct DownloadTracker { last_sec: Option, /// Time stamp of the start of the download start_sec: Option, - /// The terminal we write the information to. - /// XXX: Could be a term trait, but with #1818 on the horizon that - /// is a pointless change to make - better to let that transition - /// happen and take stock after that. - term: term2::StdoutTerminal, + term: terminalsource::ColorableTerminal, /// Whether we displayed progress for the download or not. /// /// If the download is quick enough, we don't have time to @@ -61,7 +54,7 @@ impl DownloadTracker { downloaded_last_few_secs: VecDeque::with_capacity(DOWNLOAD_TRACK_COUNT), start_sec: None, last_sec: None, - term: term2::stdout(), + term: process().stdout().terminal(), displayed_charcount: None, units: vec![Unit::B], display_progress: true, @@ -81,7 +74,7 @@ impl DownloadTracker { true } Notification::Install(In::Utils(Un::DownloadDataReceived(data))) => { - if tty::stdout_isatty() { + if process().stdout().is_a_tty() { self.data_received(data.len()); } true @@ -139,7 +132,7 @@ impl DownloadTracker { if self.displayed_charcount.is_some() { // Display the finished state self.display(); - let _ = writeln!(self.term); + let _ = writeln!(self.term.lock()); } self.prepare_for_new_download(); } @@ -178,8 +171,8 @@ impl DownloadTracker { // This is not ideal as very narrow terminals might mess up, // but it is more likely to succeed until term's windows console // fixes whatever's up with delete_line(). - let _ = write!(self.term, "{}", " ".repeat(n)); - let _ = self.term.flush(); + let _ = write!(self.term.lock(), "{}", " ".repeat(n)); + let _ = self.term.lock().flush(); let _ = self.term.carriage_return(); } @@ -211,9 +204,9 @@ impl DownloadTracker { ), }; - let _ = write!(self.term, "{output}"); + let _ = write!(self.term.lock(), "{output}"); // Since stdout is typically line-buffered and we don't print a newline, we manually flush. - let _ = self.term.flush(); + let _ = self.term.lock().flush(); self.displayed_charcount = Some(output.chars().count()); } } diff --git a/src/cli/log.rs b/src/cli/log.rs index 66af98f248..6741101696 100644 --- a/src/cli/log.rs +++ b/src/cli/log.rs @@ -1,10 +1,9 @@ use std::fmt; use std::io::Write; -use term2::Terminal; -use super::term2; -use crate::currentprocess::varsource::VarSource; -use crate::process; +use crate::currentprocess::{ + filesource::StderrSource, process, terminalsource, varsource::VarSource, +}; macro_rules! warn { ( $ ( $ arg : tt ) * ) => ( $crate::cli::log::warn_fmt ( format_args ! ( $ ( $ arg ) * ) ) ) @@ -25,52 +24,52 @@ macro_rules! debug { } pub(crate) fn warn_fmt(args: fmt::Arguments<'_>) { - let mut t = term2::stderr(); - let _ = t.fg(term2::color::YELLOW); - let _ = t.attr(term2::Attr::Bold); - let _ = write!(t, "warning: "); + let mut t = process().stderr().terminal(); + let _ = t.fg(terminalsource::Color::Yellow); + let _ = t.attr(terminalsource::Attr::Bold); + let _ = write!(t.lock(), "warning: "); let _ = t.reset(); - let _ = t.write_fmt(args); - let _ = writeln!(t); + let _ = t.lock().write_fmt(args); + let _ = writeln!(t.lock()); } pub(crate) fn err_fmt(args: fmt::Arguments<'_>) { - let mut t = term2::stderr(); - let _ = t.fg(term2::color::RED); - let _ = t.attr(term2::Attr::Bold); - let _ = write!(t, "error: "); + let mut t = process().stderr().terminal(); + let _ = t.fg(terminalsource::Color::Red); + let _ = t.attr(terminalsource::Attr::Bold); + let _ = write!(t.lock(), "error: "); let _ = t.reset(); - let _ = t.write_fmt(args); - let _ = writeln!(t); + let _ = t.lock().write_fmt(args); + let _ = writeln!(t.lock()); } pub(crate) fn info_fmt(args: fmt::Arguments<'_>) { - let mut t = term2::stderr(); - let _ = t.attr(term2::Attr::Bold); - let _ = write!(t, "info: "); + let mut t = process().stderr().terminal(); + let _ = t.attr(terminalsource::Attr::Bold); + let _ = write!(t.lock(), "info: "); let _ = t.reset(); - let _ = t.write_fmt(args); - let _ = writeln!(t); + let _ = t.lock().write_fmt(args); + let _ = writeln!(t.lock()); } pub(crate) fn verbose_fmt(args: fmt::Arguments<'_>) { - let mut t = term2::stderr(); - let _ = t.fg(term2::color::MAGENTA); - let _ = t.attr(term2::Attr::Bold); - let _ = write!(t, "verbose: "); + let mut t = process().stderr().terminal(); + let _ = t.fg(terminalsource::Color::Magenta); + let _ = t.attr(terminalsource::Attr::Bold); + let _ = write!(t.lock(), "verbose: "); let _ = t.reset(); - let _ = t.write_fmt(args); - let _ = writeln!(t); + let _ = t.lock().write_fmt(args); + let _ = writeln!(t.lock()); } pub(crate) fn debug_fmt(args: fmt::Arguments<'_>) { if process().var("RUSTUP_DEBUG").is_ok() { - let mut t = term2::stderr(); - let _ = t.fg(term2::color::BLUE); - let _ = t.attr(term2::Attr::Bold); - let _ = write!(t, "debug: "); + let mut t = process().stderr().terminal(); + let _ = t.fg(terminalsource::Color::Blue); + let _ = t.attr(terminalsource::Attr::Bold); + let _ = write!(t.lock(), "debug: "); let _ = t.reset(); - let _ = t.write_fmt(args); - let _ = writeln!(t); + let _ = t.lock().write_fmt(args); + let _ = writeln!(t.lock()); } } diff --git a/src/cli/markdown.rs b/src/cli/markdown.rs index af4fef1361..3f46132b3d 100644 --- a/src/cli/markdown.rs +++ b/src/cli/markdown.rs @@ -1,23 +1,22 @@ // Write Markdown to the terminal - -use std::io; +use std::io::Write; use pulldown_cmark::{Event, Tag}; -use super::term2::{color, Attr, Terminal}; +use crate::currentprocess::terminalsource::{Attr, Color, ColorableTerminal}; // Handles the wrapping of text written to the console -struct LineWrapper<'a, T: Terminal> { +struct LineWrapper<'a> { indent: u32, margin: u32, pos: u32, - w: &'a mut T, + w: &'a mut ColorableTerminal, } -impl<'a, T: Terminal + 'a> LineWrapper<'a, T> { +impl<'a> LineWrapper<'a> { // Just write a newline fn write_line(&mut self) { - let _ = writeln!(self.w); + let _ = writeln!(self.w.lock()); // Reset column position to start of line self.pos = 0; } @@ -26,7 +25,7 @@ impl<'a, T: Terminal + 'a> LineWrapper<'a, T> { if self.pos == 0 { // Write a space for each level of indent for _ in 0..self.indent { - let _ = write!(self.w, " "); + let _ = write!(self.w.lock(), " "); } self.pos = self.indent; } @@ -48,7 +47,7 @@ impl<'a, T: Terminal + 'a> LineWrapper<'a, T> { } // Write the word - let _ = write!(self.w, "{word}"); + let _ = write!(self.w.lock(), "{word}"); self.pos += word_len; } fn write_space(&mut self) { @@ -81,7 +80,7 @@ impl<'a, T: Terminal + 'a> LineWrapper<'a, T> { } } // Constructor - fn new(w: &'a mut T, indent: u32, margin: u32) -> Self { + fn new(w: &'a mut ColorableTerminal, indent: u32, margin: u32) -> Self { LineWrapper { indent, margin, @@ -92,14 +91,14 @@ impl<'a, T: Terminal + 'a> LineWrapper<'a, T> { } // Handles the formatting of text -struct LineFormatter<'a, T: Terminal + io::Write> { +struct LineFormatter<'a> { is_code_block: bool, - wrapper: LineWrapper<'a, T>, + wrapper: LineWrapper<'a>, attrs: Vec, } -impl<'a, T: Terminal + io::Write + 'a> LineFormatter<'a, T> { - fn new(w: &'a mut T, indent: u32, margin: u32) -> Self { +impl<'a> LineFormatter<'a> { + fn new(w: &'a mut ColorableTerminal, indent: u32, margin: u32) -> Self { LineFormatter { is_code_block: false, wrapper: LineWrapper::new(w, indent, margin), @@ -145,7 +144,7 @@ impl<'a, T: Terminal + io::Write + 'a> LineFormatter<'a, T> { self.wrapper.write_line(); } Tag::Emphasis => { - self.push_attr(Attr::ForegroundColor(color::RED)); + self.push_attr(Attr::ForegroundColor(Color::Red)); } Tag::Strong => {} Tag::Strikethrough => {} @@ -221,7 +220,7 @@ impl<'a, T: Terminal + io::Write + 'a> LineFormatter<'a, T> { } } -pub(crate) fn md<'a, S: AsRef, T: Terminal + io::Write + 'a>(t: &'a mut T, content: S) { +pub(crate) fn md>(t: &mut ColorableTerminal, content: S) { let mut f = LineFormatter::new(t, 0, 79); let parser = pulldown_cmark::Parser::new(content.as_ref()); for event in parser { diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 040dd0d6e0..8dd6577750 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -17,7 +17,6 @@ use crate::{ errors::CLIError, help::*, self_update::{self, check_rustup_update, SelfUpdateMode}, - term2::{self, Terminal}, topical_doc, }, command, @@ -33,6 +32,7 @@ use crate::{ errors::RustupError, install::UpdateStatus, process, + terminalsource::{self, ColorableTerminal}, toolchain::{ distributable::DistributableToolchain, names::{ @@ -856,7 +856,7 @@ fn default_(cfg: &Cfg, m: &ArgMatches) -> Result { cfg.set_default(Some(&(&desc).into()))?; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; common::show_channel_update(cfg, PackageUpdate::Toolchain(desc), Ok(status))?; } @@ -870,44 +870,44 @@ fn default_(cfg: &Cfg, m: &ArgMatches) -> Result { let default_toolchain = cfg .get_default()? .ok_or_else(|| anyhow!("no default toolchain configured"))?; - writeln!(process().stdout(), "{default_toolchain} (default)")?; + writeln!(process().stdout().lock(), "{default_toolchain} (default)")?; } Ok(utils::ExitCode(0)) } fn check_updates(cfg: &Cfg) -> Result { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); let channels = cfg.list_channels()?; for channel in channels { let (name, distributable) = channel; let current_version = distributable.show_version()?; let dist_version = distributable.show_dist_version()?; - let _ = t.attr(term2::Attr::Bold); - write!(t, "{name} - ")?; + let _ = t.attr(terminalsource::Attr::Bold); + write!(t.lock(), "{name} - ")?; match (current_version, dist_version) { (None, None) => { - let _ = t.fg(term2::color::RED); - writeln!(t, "Cannot identify installed or update versions")?; + let _ = t.fg(terminalsource::Color::Red); + writeln!(t.lock(), "Cannot identify installed or update versions")?; } (Some(cv), None) => { - let _ = t.fg(term2::color::GREEN); - write!(t, "Up to date")?; + let _ = t.fg(terminalsource::Color::Green); + write!(t.lock(), "Up to date")?; let _ = t.reset(); - writeln!(t, " : {cv}")?; + writeln!(t.lock(), " : {cv}")?; } (Some(cv), Some(dv)) => { - let _ = t.fg(term2::color::YELLOW); - write!(t, "Update available")?; + let _ = t.fg(terminalsource::Color::Yellow); + write!(t.lock(), "Update available")?; let _ = t.reset(); - writeln!(t, " : {cv} -> {dv}")?; + writeln!(t.lock(), " : {cv} -> {dv}")?; } (None, Some(dv)) => { - let _ = t.fg(term2::color::YELLOW); - write!(t, "Update available")?; + let _ = t.fg(terminalsource::Color::Yellow); + write!(t.lock(), "Update available")?; let _ = t.reset(); - writeln!(t, " : (Unknown version) -> {dv}")?; + writeln!(t.lock(), " : (Unknown version) -> {dv}")?; } } } @@ -989,7 +989,7 @@ fn update(cfg: &mut Cfg, m: &ArgMatches) -> Result { Err(e) => Err(e)?, }; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; common::show_channel_update( cfg, PackageUpdate::Toolchain(desc.clone()), @@ -1045,7 +1045,7 @@ fn which(cfg: &Cfg, m: &ArgMatches) -> Result { utils::assert_is_file(&binary_path)?; - writeln!(process().stdout(), "{}", binary_path.display())?; + writeln!(process().stdout().lock(), "{}", binary_path.display())?; Ok(utils::ExitCode(0)) } @@ -1055,21 +1055,21 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { // Print host triple { - let mut t = term2::stdout(); - t.attr(term2::Attr::Bold)?; - write!(t, "Default host: ")?; + let mut t = process().stdout().terminal(); + t.attr(terminalsource::Attr::Bold)?; + write!(t.lock(), "Default host: ")?; t.reset()?; - writeln!(t, "{}", cfg.get_default_host_triple()?)?; + writeln!(t.lock(), "{}", cfg.get_default_host_triple()?)?; } // Print rustup home directory { - let mut t = term2::stdout(); - t.attr(term2::Attr::Bold)?; - write!(t, "rustup home: ")?; + let mut t = process().stdout().terminal(); + t.attr(terminalsource::Attr::Bold)?; + write!(t.lock(), "rustup home: ")?; t.reset()?; - writeln!(t, "{}", cfg.rustup_dir.display())?; - writeln!(t)?; + writeln!(t.lock(), "{}", cfg.rustup_dir.display())?; + writeln!(t.lock())?; } let cwd = utils::current_dir()?; @@ -1119,7 +1119,8 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { > 1; if show_installed_toolchains { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); + if show_headers { print_header::(&mut t, "installed toolchains")?; } @@ -1128,31 +1129,32 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { .ok_or_else(|| anyhow!("no default toolchain configured"))?; for it in installed_toolchains { if default_name == it { - writeln!(t, "{it} (default)")?; + writeln!(t.lock(), "{it} (default)")?; } else { - writeln!(t, "{it}")?; + writeln!(t.lock(), "{it}")?; } if verbose { let toolchain = Toolchain::new(cfg, it.into())?; - writeln!(process().stdout(), "{}", toolchain.rustc_version())?; + writeln!(process().stdout().lock(), "{}", toolchain.rustc_version())?; // To make it easy to see what rustc that belongs to what // toolchain we separate each pair with an extra newline - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; } } if show_headers { - writeln!(t)? + writeln!(t.lock())? }; } if show_active_targets { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); + if show_headers { print_header::(&mut t, "installed targets for active toolchain")?; } for at in active_targets { writeln!( - t, + t.lock(), "{}", at.component .target @@ -1161,12 +1163,13 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { )?; } if show_headers { - writeln!(t)?; + writeln!(t.lock())?; }; } if show_active_toolchain { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); + if show_headers { print_header::(&mut t, "active toolchain")?; } @@ -1174,12 +1177,12 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { match active_toolchain { Ok(atc) => match atc { (ref toolchain, Some(ref reason)) => { - writeln!(t, "{} ({})", toolchain.name(), reason)?; - writeln!(t, "{}", toolchain.rustc_version())?; + writeln!(t.lock(), "{} ({})", toolchain.name(), reason)?; + writeln!(t.lock(), "{}", toolchain.rustc_version())?; } (ref toolchain, None) => { - writeln!(t, "{} (default)", toolchain.name())?; - writeln!(t, "{}", toolchain.rustc_version())?; + writeln!(t.lock(), "{} (default)", toolchain.name())?; + writeln!(t.lock(), "{}", toolchain.rustc_version())?; } }, Err(err) => { @@ -1187,28 +1190,28 @@ fn show(cfg: &Cfg, m: &ArgMatches) -> Result { if let Some(RustupError::ToolchainNotSelected) = root_cause.downcast_ref::() { - writeln!(t, "no active toolchain")?; + writeln!(t.lock(), "no active toolchain")?; } else if let Some(cause) = err.source() { - writeln!(t, "(error: {err}, {cause})")?; + writeln!(t.lock(), "(error: {err}, {cause})")?; } else { - writeln!(t, "(error: {err})")?; + writeln!(t.lock(), "(error: {err})")?; } } } if show_headers { - writeln!(t)? + writeln!(t.lock())? } } - fn print_header(t: &mut term2::StdoutTerminal, s: &str) -> std::result::Result<(), E> + fn print_header(t: &mut ColorableTerminal, s: &str) -> std::result::Result<(), E> where - E: From + From, + E: From, { - t.attr(term2::Attr::Bold)?; - writeln!(t, "{s}")?; - writeln!(t, "{}", "-".repeat(s.len()))?; - writeln!(t)?; + t.attr(terminalsource::Attr::Bold)?; + writeln!(t.lock(), "{s}")?; + writeln!(t.lock(), "{}", "-".repeat(s.len()))?; + writeln!(t.lock())?; t.reset()?; Ok(()) } @@ -1232,12 +1235,17 @@ fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result { } Ok((toolchain, reason)) => { if let Some(reason) = reason { - writeln!(process().stdout(), "{} ({})", toolchain.name(), reason)?; + writeln!( + process().stdout().lock(), + "{} ({})", + toolchain.name(), + reason + )?; } else { - writeln!(process().stdout(), "{} (default)", toolchain.name())?; + writeln!(process().stdout().lock(), "{} (default)", toolchain.name())?; } if verbose { - writeln!(process().stdout(), "{}", toolchain.rustc_version())?; + writeln!(process().stdout().lock(), "{}", toolchain.rustc_version())?; } } } @@ -1246,7 +1254,7 @@ fn show_active_toolchain(cfg: &Cfg, m: &ArgMatches) -> Result { #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn show_rustup_home(cfg: &Cfg) -> Result { - writeln!(process().stdout(), "{}", cfg.rustup_dir.display())?; + writeln!(process().stdout().lock(), "{}", cfg.rustup_dir.display())?; Ok(utils::ExitCode(0)) } @@ -1465,7 +1473,7 @@ fn override_add(cfg: &Cfg, m: &ArgMatches) -> Result { false, )? .0; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; common::show_channel_update( cfg, PackageUpdate::Toolchain(desc.clone()), @@ -1590,7 +1598,7 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { if m.get_flag("path") { let doc_path = toolchain.doc_path(doc_url)?; - writeln!(process().stdout(), "{}", doc_path.display())?; + writeln!(process().stdout().lock(), "{}", doc_path.display())?; Ok(utils::ExitCode(0)) } else { toolchain.open_docs(doc_url)?; @@ -1652,7 +1660,7 @@ fn set_auto_self_update(cfg: &mut Cfg, m: &ArgMatches) -> Result Result { - writeln!(process().stdout(), "{}", cfg.get_profile()?)?; + writeln!(process().stdout().lock(), "{}", cfg.get_profile()?)?; Ok(utils::ExitCode(0)) } @@ -1687,11 +1695,11 @@ impl fmt::Display for CompletionCommand { fn output_completion_script(shell: Shell, command: CompletionCommand) -> Result { match command { CompletionCommand::Rustup => { - clap_complete::generate(shell, &mut cli(), "rustup", &mut term2::stdout()); + clap_complete::generate(shell, &mut cli(), "rustup", &mut process().stdout().lock()); } CompletionCommand::Cargo => { if let Shell::Zsh = shell { - writeln!(term2::stdout(), "#compdef cargo")?; + writeln!(process().stdout().lock(), "#compdef cargo")?; } let script = match shell { @@ -1707,7 +1715,7 @@ fn output_completion_script(shell: Shell, command: CompletionCommand) -> Result< }; writeln!( - term2::stdout(), + process().stdout().lock(), "if command -v rustc >/dev/null 2>&1; then\n\ \tsource \"$(rustc --print sysroot)\"{script}\n\ fi", diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 6be74e8df5..3399943f0c 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -58,12 +58,12 @@ use anyhow::{anyhow, Context, Result}; use cfg_if::cfg_if; use same_file::Handle; +use crate::currentprocess::terminalsource; use crate::{ cli::{ common::{self, ignorable_error, report_error, Confirm, PackageUpdate}, errors::*, markdown::md, - term2::{self, Terminal}, }, currentprocess::{filesource::StdoutSource, varsource::VarSource}, dist::dist::{self, PartialToolchainDesc, Profile, TargetTriple, ToolchainDesc}, @@ -368,7 +368,7 @@ pub(crate) fn install( #[cfg(unix)] do_anti_sudo_check(no_prompt)?; - let mut term = term2::stdout(); + let mut term = process().stdout().terminal(); #[cfg(windows)] if let Some(plan) = do_msvc_check(&opts) { @@ -684,12 +684,12 @@ fn current_install_opts(opts: &InstallOpts<'_>) -> String { // Interactive editing of the install options fn customize_install(mut opts: InstallOpts<'_>) -> Result> { writeln!( - process().stdout(), + process().stdout().lock(), "I'm going to ask you the value of each of these installation options.\n\ You may simply press the Enter key to leave unchanged." )?; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; opts.default_host_triple = Some(common::question_str( "Default host triple?", @@ -859,7 +859,7 @@ fn maybe_install_rust( }; cfg.set_default(Some(&desc.into()))?; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; common::show_channel_update(&cfg, PackageUpdate::Toolchain(desc.clone()), Ok(status))?; } Ok(()) @@ -911,7 +911,7 @@ fn _install_selection( targets.join(", ") ); } - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; None } else if user_specified_something || (update_existing_toolchain && cfg.find_default()?.is_none()) @@ -938,7 +938,7 @@ fn _install_selection( } } else { info!("updating existing rustup installation - leaving toolchains alone"); - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; None }, ) @@ -958,9 +958,9 @@ pub(crate) fn uninstall(no_prompt: bool) -> Result { } if !no_prompt { - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; let msg = format!(pre_uninstall_msg!(), cargo_home = canonical_cargo_home()?); - md(&mut term2::stdout(), msg); + md(&mut process().stdout().terminal(), msg); if !common::confirm("\nContinue? (y/N)", false)? { info!("aborting uninstallation"); return Ok(utils::ExitCode(0)); @@ -1234,26 +1234,26 @@ pub(crate) fn get_available_rustup_version() -> Result { } pub(crate) fn check_rustup_update() -> Result<()> { - let mut t = term2::stdout(); + let mut t = process().stdout().terminal(); // Get current rustup version let current_version = env!("CARGO_PKG_VERSION"); // Get available rustup version let available_version = get_available_rustup_version()?; - let _ = t.attr(term2::Attr::Bold); - write!(t, "rustup - ")?; + let _ = t.attr(terminalsource::Attr::Bold); + write!(t.lock(), "rustup - ")?; if current_version != available_version { - let _ = t.fg(term2::color::YELLOW); - write!(t, "Update available")?; + let _ = t.fg(terminalsource::Color::Yellow); + write!(t.lock(), "Update available")?; let _ = t.reset(); - writeln!(t, " : {current_version} -> {available_version}")?; + writeln!(t.lock(), " : {current_version} -> {available_version}")?; } else { - let _ = t.fg(term2::color::GREEN); - write!(t, "Up to date")?; + let _ = t.fg(terminalsource::Color::Green); + write!(t.lock(), "Up to date")?; let _ = t.reset(); - writeln!(t, " : {current_version}")?; + writeln!(t.lock(), " : {current_version}")?; } Ok(()) diff --git a/src/cli/self_update/windows.rs b/src/cli/self_update/windows.rs index 7c84478b67..6120baa801 100644 --- a/src/cli/self_update/windows.rs +++ b/src/cli/self_update/windows.rs @@ -23,14 +23,17 @@ use winreg::enums::{RegType, HKEY_CURRENT_USER, KEY_READ, KEY_WRITE}; use winreg::{RegKey, RegValue}; pub(crate) fn ensure_prompt() -> Result<()> { - writeln!(process().stdout(),)?; - writeln!(process().stdout(), "Press the Enter key to continue.")?; + writeln!(process().stdout().lock(),)?; + writeln!( + process().stdout().lock(), + "Press the Enter key to continue." + )?; common::read_line()?; Ok(()) } fn choice(max: u8) -> Result> { - write!(process().stdout(), ">")?; + write!(process().stdout().lock(), ">")?; let _ = std::io::stdout().flush(); let input = common::read_line()?; @@ -40,30 +43,33 @@ fn choice(max: u8) -> Result> { _ => None, }; - writeln!(process().stdout())?; + writeln!(process().stdout().lock())?; Ok(r) } pub(crate) fn choose_vs_install() -> Result> { writeln!( - process().stdout(), + process().stdout().lock(), "\n1) Quick install via the Visual Studio Community installer" )?; writeln!( - process().stdout(), + process().stdout().lock(), " (free for individuals, academic uses, and open source)." )?; writeln!( - process().stdout(), + process().stdout().lock(), "\n2) Manually install the prerequisites" )?; writeln!( - process().stdout(), + process().stdout().lock(), " (for enterprise and advanced users)." )?; - writeln!(process().stdout(), "\n3) Don't install the prerequisites")?; writeln!( - process().stdout(), + process().stdout().lock(), + "\n3) Don't install the prerequisites" + )?; + writeln!( + process().stdout().lock(), " (if you're targeting the GNU ABI).\n" )?; @@ -71,7 +77,7 @@ pub(crate) fn choose_vs_install() -> Result> { if let Some(n) = choice(3)? { break n; } - writeln!(process().stdout(), "Select option 1, 2 or 3")?; + writeln!(process().stdout().lock(), "Select option 1, 2 or 3")?; }; let plan = match choice { 1 => Some(VsInstallPlan::Automatic), diff --git a/src/cli/term2.rs b/src/cli/term2.rs deleted file mode 100644 index dab860cab0..0000000000 --- a/src/cli/term2.rs +++ /dev/null @@ -1,240 +0,0 @@ -//! This provides wrappers around the `StdoutTerminal` and `StderrTerminal` types -//! that does not fail if `StdoutTerminal` etc can't be constructed, which happens -//! if TERM isn't defined. - -use std::io; -use std::ops::Deref; -use std::sync::Mutex; - -use lazy_static::lazy_static; -pub(crate) use term::color; -pub(crate) use term::Attr; -pub(crate) use term::Terminal; - -use crate::currentprocess::filesource::{Isatty, StderrSource, StdoutSource, Writer}; -use crate::process; - -mod termhack { - // Things we should submit to term as improvements: here temporarily. - use std::collections::HashMap; - use std::io; - - use term::terminfo::TermInfo; - use term::{StderrTerminal, StdoutTerminal, Terminal, TerminfoTerminal}; - - /// Return a Terminal object for T on this platform. - /// If there is no terminfo and the platform requires terminfo, then None is returned. - fn make_terminal( - terminfo: Option, - source: F, - ) -> Option + Send>> - where - T: 'static + io::Write + Send, - // Works around stdio instances being unclonable. - F: Fn() -> T + Copy, - { - let result = terminfo - .map(move |ti| TerminfoTerminal::new_with_terminfo(source(), ti)) - .map(|t| Box::new(t) as Box + Send>); - #[cfg(windows)] - { - result.or_else(|| { - term::WinConsole::new(source()) - .ok() - .map(|t| Box::new(t) as Box + Send>) - }) - } - #[cfg(not(windows))] - { - result - } - } - - pub(crate) fn make_terminal_with_fallback( - terminfo: Option, - source: F, - ) -> Box + Send> - where - T: 'static + io::Write + Send, - // Works around stdio instances being unclonable. - F: Fn() -> T + Copy, - { - make_terminal(terminfo, source) - .or_else(|| { - let ti = TermInfo { - names: vec![], - bools: HashMap::new(), - numbers: HashMap::new(), - strings: HashMap::new(), - }; - let t = TerminfoTerminal::new_with_terminfo(source(), ti); - Some(Box::new(t) as Box + Send>) - }) - .unwrap() - } - /// Return a Terminal wrapping stdout, or None if a terminal couldn't be - /// opened. - #[allow(unused)] - pub(crate) fn stdout(terminfo: Option) -> Option> { - make_terminal(terminfo, io::stdout) - } - - /// Return a Terminal wrapping stderr, or None if a terminal couldn't be - /// opened. - #[allow(unused)] - pub(crate) fn stderr(terminfo: Option) -> Option> { - make_terminal(terminfo, io::stderr) - } - - /// Return a Terminal wrapping stdout. - #[allow(unused)] - pub(crate) fn stdout_with_fallback(terminfo: Option) -> Box { - make_terminal_with_fallback(terminfo, io::stdout) - } - - /// Return a Terminal wrapping stderr. - #[allow(unused)] - pub(crate) fn stderr_with_fallback(terminfo: Option) -> Box { - make_terminal_with_fallback(terminfo, io::stderr) - } -} - -// Decorator to: -// - Disable all terminal controls on non-tty's -// - Swallow errors when we try to use features a terminal doesn't have -// such as setting colours when no TermInfo DB is present -pub(crate) struct AutomationFriendlyTerminal(Box + Send>) -where - T: Isatty + io::Write; -pub(crate) type StdoutTerminal = AutomationFriendlyTerminal>; -pub(crate) type StderrTerminal = AutomationFriendlyTerminal>; - -macro_rules! swallow_unsupported { - ( $call:expr ) => {{ - use term::Error::*; - match $call { - Ok(()) | Err(ColorOutOfRange) | Err(NotSupported) => Ok(()), - Err(e) => Err(e), - } - }}; -} - -impl Isatty for Box { - fn isatty(&self) -> bool { - self.deref().isatty() - } -} - -impl term::Terminal for AutomationFriendlyTerminal -where - T: io::Write + Isatty, -{ - type Output = T; - - fn fg(&mut self, color: color::Color) -> term::Result<()> { - if !self.get_ref().isatty() { - return Ok(()); - } - swallow_unsupported!(self.0.fg(color)) - } - - fn bg(&mut self, color: color::Color) -> term::Result<()> { - if !self.get_ref().isatty() { - return Ok(()); - } - swallow_unsupported!(self.0.bg(color)) - } - - fn attr(&mut self, attr: Attr) -> term::Result<()> { - if !self.get_ref().isatty() { - return Ok(()); - } - swallow_unsupported!(self.0.attr(attr)) - } - - fn supports_attr(&self, attr: Attr) -> bool { - self.0.supports_attr(attr) - } - - fn reset(&mut self) -> term::Result<()> { - if !self.get_ref().isatty() { - return Ok(()); - } - swallow_unsupported!(self.0.reset()) - } - - /// Returns true if reset is supported. - fn supports_reset(&self) -> bool { - self.0.supports_reset() - } - - fn supports_color(&self) -> bool { - self.0.supports_color() - } - - fn cursor_up(&mut self) -> term::Result<()> { - if !self.get_ref().isatty() { - return Ok(()); - } - swallow_unsupported!(self.0.cursor_up()) - } - - fn delete_line(&mut self) -> term::Result<()> { - swallow_unsupported!(self.0.delete_line()) - } - - fn carriage_return(&mut self) -> term::Result<()> { - // This might leak control chars in !isatty? needs checking. - swallow_unsupported!(self.0.carriage_return()) - } - - fn get_ref(&self) -> &Self::Output { - self.0.get_ref() - } - - fn get_mut(&mut self) -> &mut Self::Output { - self.0.get_mut() - } - - /// Returns the contained stream, destroying the `Terminal` - fn into_inner(self) -> Self::Output - where - Self: Sized, - { - unimplemented!() - // self.0.into_inner().into_inner() - } -} - -impl io::Write for AutomationFriendlyTerminal { - fn write(&mut self, buf: &[u8]) -> Result { - self.0.write(buf) - } - - fn flush(&mut self) -> Result<(), io::Error> { - self.0.flush() - } -} - -lazy_static! { - // Cache the terminfo database for performance. - // Caching the actual terminals may be better, as on Windows terminal - // detection is per-fd, but this at least avoids the IO subsystem and - // caching the stdout instances is more complex - static ref TERMINFO: Mutex> = - Mutex::new(term::terminfo::TermInfo::from_env().ok()); -} - -pub(crate) fn stdout() -> StdoutTerminal { - let info_result = TERMINFO.lock().unwrap().clone(); - AutomationFriendlyTerminal(termhack::make_terminal_with_fallback(info_result, || { - process().stdout() - })) -} - -pub(crate) fn stderr() -> StderrTerminal { - let info_result = TERMINFO.lock().unwrap().clone(); - AutomationFriendlyTerminal(termhack::make_terminal_with_fallback(info_result, || { - process().stderr() - })) -} diff --git a/src/currentprocess.rs b/src/currentprocess.rs index 3e9ac3040a..3ae708750c 100644 --- a/src/currentprocess.rs +++ b/src/currentprocess.rs @@ -25,6 +25,7 @@ pub mod argsource; pub mod cwdsource; pub mod filesource; mod homethunk; +pub mod terminalsource; pub mod varsource; use argsource::*; @@ -32,6 +33,8 @@ use cwdsource::*; use filesource::*; use varsource::*; +use crate::utils::tty::{stderr_isatty, stdout_isatty}; + /// An abstraction for the current process. /// /// This acts as a clonable proxy to the global state provided by some key OS @@ -176,8 +179,26 @@ pub trait ProcessSource { // ----------- real process ----------------- -#[derive(Clone, Debug, Default)] -pub struct OSProcess {} +#[derive(Clone, Debug)] +pub struct OSProcess { + pub(self) stderr_is_a_tty: bool, + pub(self) stdout_is_a_tty: bool, +} + +impl OSProcess { + pub fn new() -> Self { + OSProcess { + stderr_is_a_tty: stderr_isatty(), + stdout_is_a_tty: stdout_isatty(), + } + } +} + +impl Default for OSProcess { + fn default() -> Self { + OSProcess::new() + } +} impl ProcessSource for OSProcess { fn id(&self) -> u64 { diff --git a/src/currentprocess/filesource.rs b/src/currentprocess/filesource.rs index 9fe4640abd..36aa508b63 100644 --- a/src/currentprocess/filesource.rs +++ b/src/currentprocess/filesource.rs @@ -3,7 +3,9 @@ use std::sync::{Arc, Mutex, MutexGuard}; use enum_dispatch::enum_dispatch; -use crate::utils::tty; +use crate::currentprocess::process; + +use super::terminalsource::{ColorableTerminal, StreamSelector}; /// Stand-in for std::io::Stdin pub trait Stdin { @@ -21,12 +23,14 @@ pub trait StdinSource { } // ----------------- OS support for stdin ----------------- + impl StdinLock for io::StdinLock<'_> {} impl Stdin for io::Stdin { fn lock(&self) -> Box { Box::new(io::Stdin::lock(self)) } + fn read_line(&self, buf: &mut String) -> Result { io::Stdin::read_line(self, buf) } @@ -85,19 +89,27 @@ impl StdinSource for super::TestProcess { // -------------- stdout ------------------------------- -pub trait Isatty { - fn isatty(&self) -> bool; -} - -/// Stand-in for std::io::StdoutLock +/// This is a stand-in for [`std::io::StdoutLock`] and [`std::io::StderrLock`]. pub trait WriterLock: Write {} -/// Stand-in for std::io::Stdout -pub trait Writer: Write + Isatty + Send { +/// This is a stand-in for [`std::io::Stdout`] or [`std::io::Stderr`]. +/// TODO: remove Sync. +pub trait Writer: Write + Send + Sync { + /// This is a stand-in for [`std::io::Stdout::lock`] or [`std::io::Stderr::lock`]. fn lock(&self) -> Box; + + /// Query whether a TTY is present. Used in download_tracker - we may want + /// to remove this entirely with a better progress bar system (in favour of + /// filtering in the Terminal layer?) + fn is_a_tty(&self) -> bool; + + /// Construct a terminal on this writer. + fn terminal(&self) -> ColorableTerminal; } -/// Stand-in for std::io::stdout +// -------------- stdout ------------------------------- + +/// Stand-in for [`std::io::stdout`]. #[enum_dispatch] pub trait StdoutSource { fn stdout(&self) -> Box; @@ -105,7 +117,7 @@ pub trait StdoutSource { // -------------- stderr ------------------------------- -/// Stand-in for std::io::stderr +/// Stand-in for std::io::stderr. #[enum_dispatch] pub trait StderrSource { fn stderr(&self) -> Box; @@ -116,14 +128,20 @@ pub trait StderrSource { impl WriterLock for io::StdoutLock<'_> {} impl Writer for io::Stdout { + fn is_a_tty(&self) -> bool { + match process() { + crate::currentprocess::Process::OSProcess(p) => p.stdout_is_a_tty, + #[cfg(feature = "test")] + crate::currentprocess::Process::TestProcess(_) => unreachable!(), + } + } + fn lock(&self) -> Box { Box::new(io::Stdout::lock(self)) } -} -impl Isatty for io::Stdout { - fn isatty(&self) -> bool { - tty::stdout_isatty() + fn terminal(&self) -> ColorableTerminal { + ColorableTerminal::new(StreamSelector::Stdout) } } @@ -136,14 +154,20 @@ impl StdoutSource for super::OSProcess { impl WriterLock for io::StderrLock<'_> {} impl Writer for io::Stderr { + fn is_a_tty(&self) -> bool { + match process() { + crate::currentprocess::Process::OSProcess(p) => p.stderr_is_a_tty, + #[cfg(feature = "test")] + crate::currentprocess::Process::TestProcess(_) => unreachable!(), + } + } + fn lock(&self) -> Box { Box::new(io::Stderr::lock(self)) } -} -impl Isatty for io::Stderr { - fn isatty(&self) -> bool { - tty::stderr_isatty() + fn terminal(&self) -> ColorableTerminal { + ColorableTerminal::new(StreamSelector::Stderr) } } @@ -155,7 +179,7 @@ impl StderrSource for super::OSProcess { // ----------------------- test support for writers ------------------ -struct TestWriterLock<'a> { +pub(super) struct TestWriterLock<'a> { inner: MutexGuard<'a, Vec>, } @@ -171,18 +195,40 @@ impl Write for TestWriterLock<'_> { } } -pub(crate) type TestWriterInner = Arc>>; +#[cfg(feature = "test")] +pub(super) type TestWriterInner = Arc>>; +/// A thread-safe test file handle that pretends to be e.g. stdout. +#[derive(Clone)] +#[cfg(feature = "test")] +pub(super) struct TestWriter(TestWriterInner); -struct TestWriter(TestWriterInner); +#[cfg(feature = "test")] +impl TestWriter { + pub(super) fn lock(&self) -> TestWriterLock<'_> { + // The stream can be locked even if a test thread paniced: its state + // will be ok + TestWriterLock { + inner: self.0.lock().unwrap_or_else(|e| e.into_inner()), + } + } +} +#[cfg(feature = "test")] impl Writer for TestWriter { + fn is_a_tty(&self) -> bool { + false + } + fn lock(&self) -> Box { - Box::new(TestWriterLock { - inner: self.0.lock().unwrap_or_else(|e| e.into_inner()), - }) + Box::new(self.lock()) + } + + fn terminal(&self) -> ColorableTerminal { + ColorableTerminal::new(StreamSelector::TestWriter(self.clone())) } } +#[cfg(feature = "test")] impl Write for TestWriter { fn write(&mut self, buf: &[u8]) -> Result { self.lock().write(buf) @@ -193,12 +239,6 @@ impl Write for TestWriter { } } -impl Isatty for TestWriter { - fn isatty(&self) -> bool { - false - } -} - #[cfg(feature = "test")] impl StdoutSource for super::TestProcess { fn stdout(&self) -> Box { diff --git a/src/currentprocess/terminalsource.rs b/src/currentprocess/terminalsource.rs new file mode 100644 index 0000000000..2a6e28b97b --- /dev/null +++ b/src/currentprocess/terminalsource.rs @@ -0,0 +1,222 @@ +use std::{ + io::{self, Write}, + mem::MaybeUninit, + ops::DerefMut, + ptr::addr_of_mut, + sync::{Arc, Mutex, MutexGuard}, +}; + +pub(crate) use termcolor::Color; +use termcolor::{ColorChoice, ColorSpec, StandardStream, StandardStreamLock, WriteColor}; + +#[cfg(feature = "test")] +use super::filesource::{TestWriter, TestWriterLock}; +use super::process; + +/// Select what stream to make a terminal on +pub(super) enum StreamSelector { + Stdout, + Stderr, + #[cfg(feature = "test")] + TestWriter(TestWriter), +} + +impl StreamSelector { + fn is_a_tty(&self) -> bool { + match self { + StreamSelector::Stdout => match process() { + super::Process::OSProcess(p) => p.stdout_is_a_tty, + #[cfg(feature = "test")] + super::Process::TestProcess(_) => unreachable!(), + }, + StreamSelector::Stderr => match process() { + super::Process::OSProcess(p) => p.stderr_is_a_tty, + #[cfg(feature = "test")] + super::Process::TestProcess(_) => unreachable!(), + }, + #[cfg(feature = "test")] + StreamSelector::TestWriter(_) => false, + } + } +} + +/// A colorable terminal that can be written to +pub struct ColorableTerminal { + // TermColor uses a lifetime on locked variants, but the API we want to + // emulate from std::io uses a static lifetime for locked variants: so we + // emulate it. For Test workloads this results in a double-layering of + // Arc which isn't great, but OTOH it is test code. Locking the + // source is important because otherwise parallel constructed terminals + // would not be locked out. + inner: Arc>, +} + +/// Internal state for ColorableTerminal +enum TerminalInner { + StandardStream(StandardStream, ColorSpec), + #[cfg(feature = "test")] + TestWriter(TestWriter), +} + +pub struct ColorableTerminalLocked { + // Must drop the lock before the guard, as the guard borrows from inner. + locked: TerminalInnerLocked, + // must drop the guard before inner as the guard borrows from inner. + guard: MutexGuard<'static, TerminalInner>, + inner: Arc>, +} + +enum TerminalInnerLocked { + StandardStream(StandardStreamLock<'static>), + #[cfg(feature = "test")] + TestWriter(TestWriterLock<'static>), +} + +impl ColorableTerminal { + /// Construct a terminal for the selected stream. Colors written to the + /// terminal will be discarded if the stream is not a tty. + pub(super) fn new(stream: StreamSelector) -> Self { + let is_a_tty = stream.is_a_tty(); + let choice = if is_a_tty { + ColorChoice::Auto + } else { + ColorChoice::Never + }; + let inner = match stream { + StreamSelector::Stdout => { + TerminalInner::StandardStream(StandardStream::stdout(choice), ColorSpec::new()) + } + StreamSelector::Stderr => { + TerminalInner::StandardStream(StandardStream::stderr(choice), ColorSpec::new()) + } + #[cfg(feature = "test")] + StreamSelector::TestWriter(w) => TerminalInner::TestWriter(w), + }; + ColorableTerminal { + inner: Arc::new(Mutex::new(inner)), + } + } + + pub fn lock(&self) -> ColorableTerminalLocked { + let mut uninit = MaybeUninit::::uninit(); + let ptr = uninit.as_mut_ptr(); + + // Safety: panics during this will leak an arc reference, or an arc + // reference and a mutex guard, or an arc reference, mutex guard and a + // stream lock. Drop proceeds in field order after initialization, + // so the stream lock is dropped before the mutex guard, which is dropped + // before the arc. + unsafe { + // let inner: Arc> = self.inner.clone(); + addr_of_mut!((*ptr).inner).write(self.inner.clone()); + // let guard = inner.lock().unwrap(); + addr_of_mut!((*ptr).guard).write((*ptr).inner.lock().unwrap()); + // let locked = match *guard {....} + addr_of_mut!((*ptr).locked).write(match (*ptr).guard.deref_mut() { + TerminalInner::StandardStream(s, _) => { + let locked = s.lock(); + TerminalInnerLocked::StandardStream(locked) + } + #[cfg(feature = "test")] + TerminalInner::TestWriter(w) => TerminalInnerLocked::TestWriter(w.lock()), + }); + // ColorableTerminalLocked { inner, guard, locked } + uninit.assume_init() + } + } + + pub fn fg(&mut self, color: Color) -> io::Result<()> { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, spec) => { + spec.set_fg(Some(color)); + s.set_color(spec) + } + #[cfg(feature = "test")] + TerminalInner::TestWriter(_) => Ok(()), + } + } + + pub fn bg(&mut self, color: Color) -> io::Result<()> { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, spec) => { + spec.set_bg(Some(color)); + s.set_color(spec) + } + #[cfg(feature = "test")] + TerminalInner::TestWriter(_) => Ok(()), + } + } + + pub fn attr(&mut self, attr: Attr) -> io::Result<()> { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, spec) => { + match attr { + Attr::Bold => spec.set_bold(true), + Attr::ForegroundColor(color) => spec.set_fg(Some(color)), + }; + s.set_color(spec) + } + #[cfg(feature = "test")] + TerminalInner::TestWriter(_) => Ok(()), + } + } + + pub fn reset(&mut self) -> io::Result<()> { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, _color) => s.reset(), + #[cfg(feature = "test")] + TerminalInner::TestWriter(_) => Ok(()), + } + } + + pub fn carriage_return(&mut self) -> io::Result<()> { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, _color) => s.write(b"\r")?, + #[cfg(feature = "test")] + TerminalInner::TestWriter(w) => w.write(b"\r")?, + }; + Ok(()) + } +} + +#[derive(Copy, Clone, Debug)] +pub enum Attr { + Bold, + ForegroundColor(Color), +} + +impl io::Write for ColorableTerminal { + fn write(&mut self, buf: &[u8]) -> std::result::Result { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, _) => s.write(buf), + #[cfg(feature = "test")] + TerminalInner::TestWriter(w) => w.write(buf), + } + } + + fn flush(&mut self) -> std::result::Result<(), io::Error> { + match self.inner.lock().unwrap().deref_mut() { + TerminalInner::StandardStream(s, _) => s.flush(), + #[cfg(feature = "test")] + TerminalInner::TestWriter(w) => w.flush(), + } + } +} + +impl io::Write for ColorableTerminalLocked { + fn write(&mut self, buf: &[u8]) -> io::Result { + match &mut self.locked { + TerminalInnerLocked::StandardStream(s) => s.write(buf), + #[cfg(feature = "test")] + TerminalInnerLocked::TestWriter(w) => w.write(buf), + } + } + + fn flush(&mut self) -> io::Result<()> { + match &mut self.locked { + TerminalInnerLocked::StandardStream(s) => s.flush(), + #[cfg(feature = "test")] + TerminalInnerLocked::TestWriter(w) => w.flush(), + } + } +} diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs index 5d48c7d05b..686136826e 100644 --- a/src/dist/component/package.rs +++ b/src/dist/component/package.rs @@ -457,7 +457,7 @@ fn unpack_without_first_dir( // Tar has item before containing directory // Complain about this so we can see if these exist. writeln!( - process().stderr(), + process().stderr().lock(), "Unexpected: missing parent '{}' for '{}'", parent.display(), entry.path()?.display() diff --git a/src/utils/tty.rs b/src/utils/tty.rs index c7ae1c9451..3a634f9b64 100644 --- a/src/utils/tty.rs +++ b/src/utils/tty.rs @@ -1,4 +1,4 @@ -// Copied from rustc. isatty crate did not work as expected +// Copied from rustc. isatty crate did not work as expected. #[cfg(unix)] pub(crate) fn stderr_isatty() -> bool { isatty(libc::STDERR_FILENO) From 5b52dfe7d1e3d5ccafb37e090cf0779647feac41 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Wed, 31 May 2023 09:36:55 +0800 Subject: [PATCH 027/229] Add suggest_message helper for errors Signed-off-by: hi-rustin --- src/errors.rs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/errors.rs b/src/errors.rs index 4548462a7e..e6014cdb3f 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -103,11 +103,7 @@ pub(crate) enum RustupError { "help: run 'rustup default stable' to download the latest stable release of Rust and set it as your default toolchain." )] ToolchainNotSelected, - #[error("toolchain '{}' does not contain component {}{}{}", .desc, .component, if let Some(suggestion) = .suggestion { - format!("; did you mean '{suggestion}'?") - } else { - "".to_string() - }, if .component.contains("rust-std") { + #[error("toolchain '{}' does not contain component {}{}{}", .desc, .component, suggest_message(.suggestion), if .component.contains("rust-std") { format!("\nnote: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html{}", if desc.channel == "nightly" { "\nhelp: consider using `cargo build -Z build-std` instead" } else { "" } ) @@ -120,22 +116,14 @@ pub(crate) enum RustupError { #[error("toolchain '{}' does not support target '{}'{}\n\ note: you can see a list of supported targets with `rustc --print=target-list`\n\ note: if you are adding support for a new target to rustc itself, see https://rustc-dev-guide.rust-lang.org/building/new-target.html", .desc, .target, - if let Some(suggestion) = .suggestion { - format!("; did you mean '{suggestion}'?") - } else { - "".to_string() - })] + suggest_message(.suggestion))] UnknownTarget { desc: ToolchainDesc, target: TargetTriple, suggestion: Option, }, #[error("toolchain '{}' does not have target '{}' installed{}\n", .desc, .target, - if let Some(suggestion) = .suggestion { - format!("; did you mean '{suggestion}'?") - } else { - "".to_string() - })] + suggest_message(.suggestion))] TargetNotInstalled { desc: ToolchainDesc, target: TargetTriple, @@ -151,6 +139,14 @@ pub(crate) enum RustupError { IOError(#[from] std::io::Error), } +fn suggest_message(suggestion: &Option) -> String { + if let Some(suggestion) = suggestion { + format!("; did you mean '{}'?", suggestion) + } else { + String::new() + } +} + fn remove_component_msg(cs: &Component, manifest: &Manifest, toolchain: &str) -> String { if cs.short_name_in_manifest() == "rust-std" { // We special-case rust-std as it's the stdlib so really you want to do From f5e2a9e4ca6dec81c3f7df499134347ae52e2187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8C=E6=89=8B=E6=8E=89=E5=8C=85=E5=B7=A5=E7=A8=8B?= =?UTF-8?q?=E5=B8=88?= Date: Sat, 3 Jun 2023 09:41:18 +0000 Subject: [PATCH 028/229] Enable broken color in MSYS2 shells MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 二手掉包工程师 --- src/utils/tty.rs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/utils/tty.rs b/src/utils/tty.rs index 3a634f9b64..9f185ad4dc 100644 --- a/src/utils/tty.rs +++ b/src/utils/tty.rs @@ -28,11 +28,6 @@ fn isatty(fd: libc::c_int) -> bool { #[inline] #[cfg(windows)] fn isatty(fd: winapi::shared::minwindef::DWORD) -> bool { - if std::env::var("MSYSTEM").is_ok() { - // FIXME: No color is better than broken color codes in MSYS shells - // https://github.com/rust-lang/rustup/issues/2292 - return false; - } use winapi::um::{consoleapi::GetConsoleMode, processenv::GetStdHandle}; unsafe { let handle = GetStdHandle(fd); From 3edaada4da4f374c7c7010aec5c1d8538f3f8f6d Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 30 May 2023 23:30:53 +0200 Subject: [PATCH 029/229] Make download_tracker thread safe. Not however concurrency safe. This is sufficient to permit introducing an async runtime throughout rustup, but not sufficient for us to start tracking many concurrent downloads. --- src/cli/common.rs | 10 ++++------ src/cli/download_tracker.rs | 17 ++++++++--------- src/cli/self_update/windows.rs | 8 ++++---- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index ac8c337741..36b3d7eeba 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -1,5 +1,6 @@ //! Just a dumping ground for cli stuff +use std::cell::RefCell; use std::fmt::Display; use std::fs; use std::io::{BufRead, ErrorKind, Write}; @@ -12,6 +13,7 @@ use git_testament::{git_testament, render_testament}; use lazy_static::lazy_static; use super::self_update; +use crate::cli::download_tracker::DownloadTracker; use crate::currentprocess::{ argsource::ArgSource, filesource::{StdinSource, StdoutSource}, @@ -168,18 +170,14 @@ impl NotifyOnConsole { #[cfg_attr(feature = "otel", tracing::instrument)] pub(crate) fn set_globals(verbose: bool, quiet: bool) -> Result { - use std::cell::RefCell; - - use super::download_tracker::DownloadTracker; - - let download_tracker = RefCell::new(DownloadTracker::new().with_display_progress(!quiet)); + let download_tracker = DownloadTracker::new_with_display_progress(!quiet); let console_notifier = RefCell::new(NotifyOnConsole { verbose, ..Default::default() }); Cfg::from_env(Arc::new(move |n: Notification<'_>| { - if download_tracker.borrow_mut().handle_notification(&n) { + if download_tracker.lock().unwrap().handle_notification(&n) { return; } console_notifier.borrow_mut().handle(n); diff --git a/src/cli/download_tracker.rs b/src/cli/download_tracker.rs index a25686a033..0842dc77e5 100644 --- a/src/cli/download_tracker.rs +++ b/src/cli/download_tracker.rs @@ -1,6 +1,7 @@ use std::collections::VecDeque; use std::fmt; use std::io::Write; +use std::sync::{Arc, Mutex}; use std::time::{Duration, Instant}; use crate::currentprocess::{filesource::StdoutSource, process, terminalsource}; @@ -13,6 +14,9 @@ use crate::Notification; const DOWNLOAD_TRACK_COUNT: usize = 5; /// Tracks download progress and displays information about it to a terminal. +/// +/// *not* safe for tracking concurrent downloads yet - it is basically undefined +/// what will happen. pub(crate) struct DownloadTracker { /// Content-Length of the to-be downloaded object. content_len: Option, @@ -46,8 +50,8 @@ pub(crate) struct DownloadTracker { impl DownloadTracker { /// Creates a new DownloadTracker. - pub(crate) fn new() -> Self { - Self { + pub(crate) fn new_with_display_progress(display_progress: bool) -> Arc> { + Arc::new(Mutex::new(Self { content_len: None, total_downloaded: 0, downloaded_this_sec: 0, @@ -57,13 +61,8 @@ impl DownloadTracker { term: process().stdout().terminal(), displayed_charcount: None, units: vec![Unit::B], - display_progress: true, - } - } - - pub(crate) fn with_display_progress(mut self, display_progress: bool) -> Self { - self.display_progress = display_progress; - self + display_progress: display_progress, + })) } pub(crate) fn handle_notification(&mut self, n: &Notification<'_>) -> bool { diff --git a/src/cli/self_update/windows.rs b/src/cli/self_update/windows.rs index 6120baa801..3e3cd3ca97 100644 --- a/src/cli/self_update/windows.rs +++ b/src/cli/self_update/windows.rs @@ -1,4 +1,3 @@ -use std::cell::RefCell; use std::env::{consts::EXE_SUFFIX, split_paths}; use std::ffi::{OsStr, OsString}; use std::fmt; @@ -181,13 +180,14 @@ pub(crate) fn try_install_msvc(opts: &InstallOpts<'_>) -> Result Date: Sun, 4 Jun 2023 17:23:35 +0000 Subject: [PATCH 030/229] Update Rust crate once_cell to 1.18.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fa85b8cf3e..487e10caec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1433,9 +1433,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opener" diff --git a/Cargo.toml b/Cargo.toml index 3d2f0a8489..3952c9c28e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -178,7 +178,7 @@ derivative = "2.2.0" enum_dispatch = "0.3.11" fs_at = "0.1.6" lazy_static = "1" -once_cell = "1.17.1" +once_cell = "1.18.0" opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.11.0" } proptest = "1.1.0" From d50a8847fdd4382f17085bac9cc80ac877e6524b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 5 Jun 2023 13:31:28 +0000 Subject: [PATCH 031/229] Update Rust crate url to 2.4 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 487e10caec..9ce4283f3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -751,9 +751,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -1113,9 +1113,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1619,9 +1619,9 @@ dependencies = [ [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "petgraph" @@ -2952,9 +2952,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", diff --git a/Cargo.toml b/Cargo.toml index 3952c9c28e..a114a48134 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -192,7 +192,7 @@ tokio = { version = "1.26.0", default-features = false, features = [ tracing = "0.1" tracing-opentelemetry = { version = "0.18.0" } tracing-subscriber = "0.3.16" -url = "2.3" +url = "2.4" walkdir = "2" [lib] From 4d01d8ed4d326f578617a742d4c4b3d8bf34021e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 6 Jun 2023 22:43:09 +0000 Subject: [PATCH 032/229] Update Rust crate tempfile to 3.6 --- Cargo.lock | 7 ++++--- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ce4283f3b..6cc26cf86c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2450,15 +2450,16 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a114a48134..89f2617cee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -183,7 +183,7 @@ opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.11.0" } proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } -tempfile = "3.5" +tempfile = "3.6" termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = [ From a9ba40bf048fca3ccfe8fa86cab9592214d0ede4 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 6 Jun 2023 09:59:06 +0800 Subject: [PATCH 033/229] Disable the "oldtime" feature of chrono Signed-off-by: hi-rustin --- Cargo.lock | 161 +++-------------------------------------------------- Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 153 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ce4283f3b..72fbe34ab4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -27,13 +27,10 @@ dependencies = [ ] [[package]] -name = "android_system_properties" -version = "0.1.5" +name = "android-tzdata" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" [[package]] name = "anstream" @@ -302,17 +299,12 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ - "iana-time-zone", - "js-sys", - "num-integer", + "android-tzdata", "num-traits", - "time 0.1.45", - "wasm-bindgen", - "winapi", ] [[package]] @@ -349,16 +341,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "colorchoice" version = "1.0.0" @@ -500,50 +482,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.15", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "dashmap" version = "5.4.0" @@ -879,7 +817,7 @@ checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -902,7 +840,7 @@ dependencies = [ "proc-macro2", "quote", "syn 1.0.109", - "time 0.3.20", + "time", ] [[package]] @@ -1087,30 +1025,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "iana-time-zone" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - [[package]] name = "idna" version = "0.4.0" @@ -1232,15 +1146,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -1330,7 +1235,7 @@ checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi", "windows-sys 0.45.0", ] @@ -1401,16 +1306,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -2179,12 +2074,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "sct" version = "0.7.0" @@ -2528,17 +2417,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi", -] - [[package]] name = "time" version = "0.3.20" @@ -2938,12 +2816,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "untrusted" version = "0.7.1" @@ -3014,12 +2886,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - [[package]] name = "wasi" version = "0.11.0+wasi-snapshot-preview1" @@ -3154,15 +3020,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets 0.48.0", -] - [[package]] name = "windows-sys" version = "0.42.0" diff --git a/Cargo.toml b/Cargo.toml index a114a48134..b4d069a68d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,7 @@ test = ["dep:once_cell", "dep:walkdir"] [dependencies] anyhow.workspace = true cfg-if = "1.0" -chrono = "0.4" +chrono = { version = "0.4", default-features = false, features = ["std"] } clap = { version = "3", features = ["wrap_help"] } clap_complete = "3" derivative.workspace = true From 6ab4ffc520a8a026683dbfea229d176035d74239 Mon Sep 17 00:00:00 2001 From: Yerkebulan Tulibergenov Date: Sat, 17 Jun 2023 16:45:38 -0700 Subject: [PATCH 034/229] update installation methods to use TLS v1.2 --- doc/src/installation/other.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/src/installation/other.md b/doc/src/installation/other.md index 37c7f98457..a514e92740 100644 --- a/doc/src/installation/other.md +++ b/doc/src/installation/other.md @@ -11,7 +11,7 @@ by platform: toolchains by default this can be modified at install time, either interactively, with the `--default-host` flag, or after installation via `rustup set default-host`. -* On Unix, run `curl https://sh.rustup.rs -sSf | sh` in your shell. This +* On Unix, run `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` in your shell. This downloads and runs [`rustup-init.sh`], which in turn downloads and runs the correct version of the `rustup-init` executable for your platform. @@ -22,11 +22,11 @@ by platform: Some examples: ```console -$ curl https://sh.rustup.rs -sSf | sh -s -- --help -$ curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path -$ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly -$ curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain none -$ curl https://sh.rustup.rs -sSf | sh -s -- --profile minimal --default-toolchain nightly +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --help +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --no-modify-path +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain nightly +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain none +$ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain nightly ``` If you prefer you can directly download `rustup-init` for the platform of your From dad920f432b594635aeb06860f67465aebd97dec Mon Sep 17 00:00:00 2001 From: Anthony Perkins Date: Mon, 26 Jun 2023 16:03:17 +0100 Subject: [PATCH 035/229] Fix typo: prerequistes -> prerequisites --- doc/src/installation/windows-msvc.md | 2 +- www/index.html | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/src/installation/windows-msvc.md b/doc/src/installation/windows-msvc.md index ef2307f52d..b732540232 100644 --- a/doc/src/installation/windows-msvc.md +++ b/doc/src/installation/windows-msvc.md @@ -1,4 +1,4 @@ -# MSVC prerequistes +# MSVC prerequisites To compile programs into an exe file, Rust requires a linker, libraries and Windows API import libraries. For `msvc` targets these can be acquired through Visual Studio. diff --git a/www/index.html b/www/index.html index 025f310771..f20de2536e 100644 --- a/www/index.html +++ b/www/index.html @@ -47,7 +47,7 @@ rustup‑init.exe then follow the onscreen instructions.

-

You may also need the Visual Studio prerequistes.

+

You may also need the Visual Studio prerequisites.

If you're a Windows Subsystem for Linux user run the following in your terminal, then follow the onscreen instructions to install Rust.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
@@ -69,7 +69,7 @@ rustup‑init.exe then follow the onscreen instructions.

-

You may also need the Visual Studio prerequistes.

+

You may also need the Visual Studio prerequisites.

If you're a Windows Subsystem for Linux user run the following in your terminal, then follow the onscreen instructions to install Rust.

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
From e975a4374f5e23aa32b84efe08cf2d3973692258 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Fri, 30 Jun 2023 08:54:30 +0800 Subject: [PATCH 036/229] Bump the openssl v0.10.52 -> v0.10.55 Signed-off-by: hi-rustin --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6d49790619..5804abfdd0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1345,9 +1345,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.52" +version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01b8574602df80f7b85fdfc5392fa884a4e3b3f4f35402c070ab34c3d3f78d56" +checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ "bitflags", "cfg-if 1.0.0", @@ -1386,9 +1386,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.87" +version = "0.9.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e17f59264b2809d77ae94f0e1ebabc434773f370d6ca667bd223ea10e06cc7e" +checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" dependencies = [ "cc", "libc", From 46a52ae44721f462c96204d1c79d6d8200849a73 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Fri, 30 Jun 2023 08:55:10 +0800 Subject: [PATCH 037/229] Bump proc-macro2 v1.0.51 -> v1.0.63 Signed-off-by: hi-rustin --- Cargo.lock | 4 ++-- rustup-macros/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5804abfdd0..07823d10ae 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1584,9 +1584,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] diff --git a/rustup-macros/Cargo.toml b/rustup-macros/Cargo.toml index 45c8efdce7..455832a865 100644 --- a/rustup-macros/Cargo.toml +++ b/rustup-macros/Cargo.toml @@ -8,7 +8,7 @@ version = "0.1.0" proc-macro = true [dependencies] -proc-macro2 = "1.0.51" +proc-macro2 = "1.0.63" quote = "1.0.23" regex = "1.7.1" sha2 = "0.10.6" From 831bf1e0528e6f4887c7bb718fb5c0e444f343c4 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Thu, 8 Jun 2023 09:34:29 +0800 Subject: [PATCH 038/229] Address `#[warn(clippy::redundant_field_names)]` Signed-off-by: hi-rustin --- src/cli/download_tracker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/download_tracker.rs b/src/cli/download_tracker.rs index 0842dc77e5..0c5023fc2f 100644 --- a/src/cli/download_tracker.rs +++ b/src/cli/download_tracker.rs @@ -61,7 +61,7 @@ impl DownloadTracker { term: process().stdout().terminal(), displayed_charcount: None, units: vec![Unit::B], - display_progress: display_progress, + display_progress, })) } From 9acc0dc307f5ff6718268daf9a05deeecef6542a Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 17 Jul 2023 08:39:06 +0800 Subject: [PATCH 039/229] Address `#[warn(clippy::redundant_pattern_matching)]` Signed-off-by: hi-rustin --- src/cli/self_update/shell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index 205b6b614c..22b754681c 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -175,7 +175,7 @@ impl UnixShell for Zsh { fn does_exist(&self) -> bool { // zsh has to either be the shell or be callable for zsh setup. matches!(process().var("SHELL"), Ok(sh) if sh.contains("zsh")) - || matches!(utils::find_cmd(&["zsh"]), Some(_)) + || utils::find_cmd(&["zsh"]).is_some() } fn rcfiles(&self) -> Vec { From d63b6e5f7608369934a4774611af9a83104d3a78 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 17 Jul 2023 08:40:36 +0800 Subject: [PATCH 040/229] Address `#[warn(clippy::useless_conversion)]` Signed-off-by: hi-rustin --- src/cli/self_update/shell.rs | 2 +- src/test/mock/clitools.rs | 13 +++++-------- src/test/mock/dist.rs | 2 +- 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index 22b754681c..195dbea2bd 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -195,7 +195,7 @@ impl UnixShell for Zsh { self.rcfiles() .into_iter() .filter(|env| env.is_file()) - .chain(self.rcfiles().into_iter()) + .chain(self.rcfiles()) .take(1) .collect() } diff --git a/src/test/mock/clitools.rs b/src/test/mock/clitools.rs index 1c9aa76ede..fe5f834844 100644 --- a/src/test/mock/clitools.rs +++ b/src/test/mock/clitools.rs @@ -1194,14 +1194,11 @@ fn build_mock_channel( // Convert the mock installers to mock package definitions for the // mock dist server let mut all = MockChannelContent::default(); - all.std.extend( - vec![ - (std, host_triple.clone()), - (cross_std1, CROSS_ARCH1.to_string()), - (cross_std2, CROSS_ARCH2.to_string()), - ] - .into_iter(), - ); + all.std.extend(vec![ + (std, host_triple.clone()), + (cross_std1, CROSS_ARCH1.to_string()), + (cross_std2, CROSS_ARCH2.to_string()), + ]); all.rustc.push((rustc, host_triple.clone())); all.cargo.push((cargo, host_triple.clone())); diff --git a/src/test/mock/dist.rs b/src/test/mock/dist.rs index 0b42a9ceb6..04268abacf 100644 --- a/src/test/mock/dist.rs +++ b/src/test/mock/dist.rs @@ -131,7 +131,7 @@ impl MockDistServer { let mut hashes = HashMap::new(); for package in &channel.packages { let new_hashes = self.build_package(channel, package, enable_xz, enable_zst); - hashes.extend(new_hashes.into_iter()); + hashes.extend(new_hashes); } for v in vs { match *v { From 9b1ec7729d4670c731865b02e6883f45bd09e3ec Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 17 Jul 2023 08:53:45 +0800 Subject: [PATCH 041/229] Address `#[warn(clippy::needless_borrow)]` Signed-off-by: hi-rustin --- tests/suite/cli_rustup.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/suite/cli_rustup.rs b/tests/suite/cli_rustup.rs index 304ff48bfd..9a6adde7a4 100644 --- a/tests/suite/cli_rustup.rs +++ b/tests/suite/cli_rustup.rs @@ -2178,7 +2178,7 @@ fn non_utf8_arg() { config.expect_ok(&["rustup", "default", "nightly"]); let out = config.run( "rustc", - &[ + [ OsStr::new("--echo-args"), OsStr::new("echoed non-utf8 arg:"), OsStr::from_bytes(b"\xc3\x28"), @@ -2224,7 +2224,7 @@ fn non_utf8_toolchain() { config.expect_ok(&["rustup", "default", "nightly"]); let out = config.run( "rustc", - &[OsStr::from_bytes(b"+\xc3\x28")], + [OsStr::from_bytes(b"+\xc3\x28")], &[("RUST_BACKTRACE", "1")], ); assert!(out.stderr.contains("toolchain '�(' is not installable")); From a3b67ded4877fd250378d54f3add9cadd36af503 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 17 Jul 2023 08:54:37 +0800 Subject: [PATCH 042/229] Address `#[warn(clippy::useless_vec)]` Signed-off-by: hi-rustin --- src/env_var.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/env_var.rs b/src/env_var.rs index 7397e12ac6..78d81c07b1 100644 --- a/src/env_var.rs +++ b/src/env_var.rs @@ -52,7 +52,7 @@ mod tests { let mut vars = HashMap::new(); vars.env( "PATH", - env::join_paths(vec!["/home/a/.cargo/bin", "/home/b/.cargo/bin"].iter()).unwrap(), + env::join_paths(["/home/a/.cargo/bin", "/home/b/.cargo/bin"].iter()).unwrap(), ); let tp = currentprocess::TestProcess { vars, @@ -84,7 +84,7 @@ mod tests { OsStr::new("PATH"), Some( env::join_paths( - vec![ + [ "/home/z/.cargo/bin", "/home/a/.cargo/bin", "/home/b/.cargo/bin" From 0c76ab36e57b44dd00594dcd21ed6f1cf4ba2fc4 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Tue, 18 Jul 2023 08:31:49 +0800 Subject: [PATCH 043/229] allow `clippy::arc_with_non_send_sync` Signed-off-by: hi-rustin --- src/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 2305183470..af9875c969 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,8 +4,9 @@ clippy::type_complexity, clippy::upper_case_acronyms, // see https://github.com/rust-lang/rust-clippy/issues/6974 clippy::vec_init_then_push, // uses two different styles of initialization - clippy::box_default, // its ugly and outside of inner loops irrelevant + clippy::box_default, // its ugly and outside of inner loops irrelevant clippy::result_large_err, // 288 bytes is our 'large' variant today, which is unlikely to be a performance problem + clippy::arc_with_non_send_sync, // will get resolved as we move further into async )] #![recursion_limit = "1024"] From b52b902558c3c94725e839e3900469871d3d3a4b Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Thu, 13 Jul 2023 22:21:51 +0800 Subject: [PATCH 044/229] Enable loongarch64-linux-gnu builds on stable --- .github/workflows/linux-builds-on-stable.yaml | 1 + ci/actions-templates/linux-builds-template.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml index df8b435e1c..a6cf6f68d0 100644 --- a/.github/workflows/linux-builds-on-stable.yaml +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -44,6 +44,7 @@ jobs: - i686-linux-android # skip-pr skip-master - x86_64-linux-android # skip-pr skip-master - riscv64gc-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-gnu # skip-pr skip-master include: - target: x86_64-unknown-linux-gnu run_tests: YES diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 40d00182c0..9992d72569 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -53,7 +53,7 @@ jobs: - i686-linux-android # skip-pr skip-master - x86_64-linux-android # skip-pr skip-master - riscv64gc-unknown-linux-gnu # skip-pr skip-master - - loongarch64-unknown-linux-gnu # skip-pr skip-master skip-stable + - loongarch64-unknown-linux-gnu # skip-pr skip-master include: - target: x86_64-unknown-linux-gnu run_tests: YES From db4b177e20a0836cca2d95882a835681fac6b50e Mon Sep 17 00:00:00 2001 From: WANG Xuerui Date: Wed, 12 Jul 2023 21:35:58 +0800 Subject: [PATCH 045/229] rustup-init.sh: Check for kernel UAPI compatibility on LoongArch And provide friendly diagnostics if a certain widely-deployed but incompatible UAPI flavor (a.k.a. the "old-world" UAPI that's used by several early and/or commercial LoongArch Linux distributions) is detected. The minimalistic probe was crafted by myself, checking for one of the most prominent incompatibilities between the two UAPI flavors: `sizeof(sigset_t)`. The probe binary is small enough to fit in 3 lines of Base64, which is decoded into a temp file and executed for result. The `base64(1)` command is ubiquitous (being provided by coreutils, busybox and probably many others), and only necessary on LoongArch, so we effectively don't lose portability. Other irrelevant errors (e.g. /tmp being noexec) are made non-fatal, because without the check the installer binary will instantly die anyway on an incompatible system. A warning message is printed in case such an error occurs. (The installer binary, being dynamically linked, will die on a system using the other incompatible UAPI, with a confusing error saying the program being executed itself is not found: the actual non-existent path is the ELF interpreter i.e. `ld.so`. Having some error messages in case of this would hopefully reduce the technical support burden for many.) --- rustup-init.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/rustup-init.sh b/rustup-init.sh index ddc99f2472..58e66df8b2 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -240,6 +240,67 @@ get_endianness() { fi } +# Detect the Linux/LoongArch UAPI flavor, with all errors being non-fatal. +# Returns 0 or 234 in case of successful detection, 1 otherwise (/tmp being +# noexec, or other causes). +check_loongarch_uapi() { + need_cmd base64 + + local _tmp + if ! _tmp="$(ensure mktemp)"; then + return 1 + fi + + # Minimal Linux/LoongArch UAPI detection, exiting with 0 in case of + # upstream ("new world") UAPI, and 234 (-EINVAL truncated) in case of + # old-world (as deployed on several early commercial Linux distributions + # for LoongArch). + # + # See https://gist.github.com/xen0n/5ee04aaa6cecc5c7794b9a0c3b65fc7f for + # source to this helper binary. + ignore base64 -d > "$_tmp" <&2 + echo 'Your Linux kernel does not provide the ABI required by this Rust' >&2 + echo 'distribution. Please check with your OS provider for how to obtain a' >&2 + echo 'compatible Rust package for your system.' >&2 + echo >&2 + exit 1 + ;; + *) + echo "Warning: Cannot determine current system's ABI flavor, continuing anyway." >&2 + echo >&2 + echo 'Note that the official Rust distribution only works with the upstream' >&2 + echo 'kernel ABI. Installation will fail if your running kernel happens to be' >&2 + echo 'incompatible.' >&2 + ;; + esac +} + get_architecture() { local _ostype _cputype _bitness _arch _clibtype _ostype="$(uname -s)" @@ -393,6 +454,7 @@ get_architecture() { ;; loongarch64) _cputype=loongarch64 + ensure_loongarch_uapi ;; *) err "unknown CPU type: $_cputype" From 4d4e79334e2ca8843bfebdb52e47d826f79be863 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Sat, 1 Jul 2023 17:34:17 +0800 Subject: [PATCH 046/229] Use available_parallelism replace the `num_cpus`crate Signed-off-by: hi-rustin --- Cargo.lock | 1 - Cargo.toml | 1 - src/diskio/mod.rs | 3 ++- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 07823d10ae..5d6241ecfb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1973,7 +1973,6 @@ dependencies = [ "home", "lazy_static", "libc", - "num_cpus", "once_cell", "opener", "openssl", diff --git a/Cargo.toml b/Cargo.toml index 650163ce01..ef22908a4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -62,7 +62,6 @@ git-testament = "0.2" home = "0.5.4" lazy_static.workspace = true libc = "0.2" -num_cpus = "1.15" once_cell = { workspace = true, optional = true } opener = "0.6.0" opentelemetry = { workspace = true, optional = true } diff --git a/src/diskio/mod.rs b/src/diskio/mod.rs index 33c790032a..ce2eec5b7a 100644 --- a/src/diskio/mod.rs +++ b/src/diskio/mod.rs @@ -60,6 +60,7 @@ use std::io::{self, Write}; use std::ops::{Deref, DerefMut}; use std::path::{Path, PathBuf}; use std::sync::mpsc::Receiver; +use std::thread::available_parallelism; use std::time::{Duration, Instant}; use std::{fmt::Debug, fs::OpenOptions}; @@ -452,7 +453,7 @@ pub(crate) fn get_executor<'a>( ) -> Result> { // If this gets lots of use, consider exposing via the config file. let thread_count = match process().var("RUSTUP_IO_THREADS") { - Err(_) => num_cpus::get(), + Err(_) => available_parallelism().map(|p| p.get()).unwrap_or(1), Ok(n) => n .parse::() .context("invalid value in RUSTUP_IO_THREADS. Must be a natural number")?, From 07d1947f84a2f8928f91e27168f491d1783207f8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 7 Aug 2023 00:11:19 +0000 Subject: [PATCH 047/229] Update Rust crate tempfile to 3.7 --- Cargo.lock | 78 +++++++++++++++++++++++++++++++----------------------- Cargo.toml | 2 +- 2 files changed, 46 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d6241ecfb..fc75e64228 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -167,7 +167,7 @@ checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39" dependencies = [ "async-trait", "axum-core", - "bitflags", + "bitflags 1.3.2", "bytes", "futures-util", "http", @@ -237,6 +237,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" + [[package]] name = "block-buffer" version = "0.10.4" @@ -314,7 +320,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", - "bitflags", + "bitflags 1.3.2", "clap_lex", "indexmap", "strsim", @@ -631,12 +637,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.9.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] +checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "filetime" @@ -1045,15 +1048,6 @@ dependencies = [ "hashbrown", ] -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if 1.0.0", -] - [[package]] name = "io-lifetimes" version = "1.0.10" @@ -1079,7 +1073,7 @@ checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", - "rustix", + "rustix 0.37.18", "windows-sys 0.48.0", ] @@ -1124,9 +1118,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.144" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libm" @@ -1152,6 +1146,12 @@ version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" +[[package]] +name = "linux-raw-sys" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" + [[package]] name = "lock_api" version = "0.4.9" @@ -1269,7 +1269,7 @@ version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "libc", "static_assertions", @@ -1349,7 +1349,7 @@ version = "0.10.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" dependencies = [ - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "foreign-types", "libc", @@ -1598,7 +1598,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" dependencies = [ "bit-set", - "bitflags", + "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", @@ -1672,7 +1672,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" dependencies = [ - "bitflags", + "bitflags 1.3.2", "memchr", "unicase", ] @@ -1765,7 +1765,7 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1774,7 +1774,7 @@ version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" dependencies = [ - "bitflags", + "bitflags 1.3.2", ] [[package]] @@ -1911,11 +1911,24 @@ version = "0.37.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", - "linux-raw-sys", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" +dependencies = [ + "bitflags 2.3.3", + "errno", + "libc", + "linux-raw-sys 0.4.5", "windows-sys 0.48.0", ] @@ -2089,7 +2102,7 @@ version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ - "bitflags", + "bitflags 1.3.2", "core-foundation", "core-foundation-sys", "libc", @@ -2338,15 +2351,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.6.0" +version = "3.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" +checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" dependencies = [ - "autocfg", "cfg-if 1.0.0", "fastrand", "redox_syscall 0.3.5", - "rustix", + "rustix 0.38.7", "windows-sys 0.48.0", ] @@ -2365,7 +2377,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix", + "rustix 0.37.18", "windows-sys 0.48.0", ] diff --git a/Cargo.toml b/Cargo.toml index ef22908a4c..f219e640bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,7 +182,7 @@ opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.11.0" } proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } -tempfile = "3.6" +tempfile = "3.7" termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = [ From 7ea679e2a630349f14dc8479111dc1967d4922f1 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 13 Aug 2023 20:10:45 +0200 Subject: [PATCH 048/229] Move the user guide from doc to doc/user-guide --- .github/workflows/deploy-docs.yaml | 10 +++++++++- doc/{ => user-guide}/.gitignore | 0 doc/{ => user-guide}/README.md | 0 doc/{ => user-guide}/book.toml | 6 +++--- doc/{ => user-guide}/src/SUMMARY.md | 0 doc/{ => user-guide}/src/basics.md | 0 doc/{ => user-guide}/src/concepts/channels.md | 0 doc/{ => user-guide}/src/concepts/components.md | 0 doc/{ => user-guide}/src/concepts/index.md | 0 doc/{ => user-guide}/src/concepts/profiles.md | 0 doc/{ => user-guide}/src/concepts/proxies.md | 0 doc/{ => user-guide}/src/concepts/toolchains.md | 0 doc/{ => user-guide}/src/configuration.md | 0 doc/{ => user-guide}/src/cross-compilation.md | 0 doc/{ => user-guide}/src/environment-variables.md | 0 doc/{ => user-guide}/src/examples.md | 0 doc/{ => user-guide}/src/faq.md | 0 doc/{ => user-guide}/src/index.md | 0 .../src/installation/images/component-msvc.png | Bin .../src/installation/images/component-sdk.png | Bin .../src/installation/images/step1.png | Bin .../src/installation/images/step2.png | Bin .../src/installation/images/step3.png | Bin .../src/installation/images/step4.png | Bin .../src/installation/images/step5.png | Bin doc/{ => user-guide}/src/installation/index.md | 0 doc/{ => user-guide}/src/installation/other.md | 0 .../src/installation/package-managers.md | 0 .../src/installation/windows-msvc.md | 0 doc/{ => user-guide}/src/installation/windows.md | 0 doc/{ => user-guide}/src/network-proxies.md | 0 doc/{ => user-guide}/src/overrides.md | 0 doc/{ => user-guide}/src/security.md | 0 33 files changed, 12 insertions(+), 4 deletions(-) rename doc/{ => user-guide}/.gitignore (100%) rename doc/{ => user-guide}/README.md (100%) rename doc/{ => user-guide}/book.toml (84%) rename doc/{ => user-guide}/src/SUMMARY.md (100%) rename doc/{ => user-guide}/src/basics.md (100%) rename doc/{ => user-guide}/src/concepts/channels.md (100%) rename doc/{ => user-guide}/src/concepts/components.md (100%) rename doc/{ => user-guide}/src/concepts/index.md (100%) rename doc/{ => user-guide}/src/concepts/profiles.md (100%) rename doc/{ => user-guide}/src/concepts/proxies.md (100%) rename doc/{ => user-guide}/src/concepts/toolchains.md (100%) rename doc/{ => user-guide}/src/configuration.md (100%) rename doc/{ => user-guide}/src/cross-compilation.md (100%) rename doc/{ => user-guide}/src/environment-variables.md (100%) rename doc/{ => user-guide}/src/examples.md (100%) rename doc/{ => user-guide}/src/faq.md (100%) rename doc/{ => user-guide}/src/index.md (100%) rename doc/{ => user-guide}/src/installation/images/component-msvc.png (100%) rename doc/{ => user-guide}/src/installation/images/component-sdk.png (100%) rename doc/{ => user-guide}/src/installation/images/step1.png (100%) rename doc/{ => user-guide}/src/installation/images/step2.png (100%) rename doc/{ => user-guide}/src/installation/images/step3.png (100%) rename doc/{ => user-guide}/src/installation/images/step4.png (100%) rename doc/{ => user-guide}/src/installation/images/step5.png (100%) rename doc/{ => user-guide}/src/installation/index.md (100%) rename doc/{ => user-guide}/src/installation/other.md (100%) rename doc/{ => user-guide}/src/installation/package-managers.md (100%) rename doc/{ => user-guide}/src/installation/windows-msvc.md (100%) rename doc/{ => user-guide}/src/installation/windows.md (100%) rename doc/{ => user-guide}/src/network-proxies.md (100%) rename doc/{ => user-guide}/src/overrides.md (100%) rename doc/{ => user-guide}/src/security.md (100%) diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index 426e066eab..01bfdf0132 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -6,6 +6,9 @@ on: - stable - master +# Builds docs for both stable and master branches. +# stable is placed in the root of the gh-pages branch, while master is placed at /devel + jobs: doc: name: Documentation @@ -21,11 +24,16 @@ jobs: echo "`pwd`/mdbook" >> $GITHUB_PATH - name: Build book run: | + # Build for stable git checkout stable - cd doc + # Support both old and new directory structure during the transition + cd doc/user-guide || cd doc mdbook build mv book ${{ runner.temp }} + # Build for master + cd $(git rev-parse --show-toplevel) git checkout master + cd doc/user-guide mdbook build mv book ${{ runner.temp }}/book/devel - name: Deploy to GitHub diff --git a/doc/.gitignore b/doc/user-guide/.gitignore similarity index 100% rename from doc/.gitignore rename to doc/user-guide/.gitignore diff --git a/doc/README.md b/doc/user-guide/README.md similarity index 100% rename from doc/README.md rename to doc/user-guide/README.md diff --git a/doc/book.toml b/doc/user-guide/book.toml similarity index 84% rename from doc/book.toml rename to doc/user-guide/book.toml index bda8bf7738..03889b5baf 100644 --- a/doc/book.toml +++ b/doc/user-guide/book.toml @@ -1,8 +1,8 @@ [book] -title = "The rustup book" authors = ["The Rust Project Developers"] +title = "The rustup book" [output.html] -git-repository-url = "https://github.com/rust-lang/rustup/tree/master/doc" +edit-url-template = "https://github.com/rust-lang/rustup/edit/master/doc/user-guide/{path}" +git-repository-url = "https://github.com/rust-lang/rustup/tree/master/doc/user-guide" site-url = "https://rust-lang.github.io/rustup/" -edit-url-template = "https://github.com/rust-lang/rustup/edit/master/doc/{path}" diff --git a/doc/src/SUMMARY.md b/doc/user-guide/src/SUMMARY.md similarity index 100% rename from doc/src/SUMMARY.md rename to doc/user-guide/src/SUMMARY.md diff --git a/doc/src/basics.md b/doc/user-guide/src/basics.md similarity index 100% rename from doc/src/basics.md rename to doc/user-guide/src/basics.md diff --git a/doc/src/concepts/channels.md b/doc/user-guide/src/concepts/channels.md similarity index 100% rename from doc/src/concepts/channels.md rename to doc/user-guide/src/concepts/channels.md diff --git a/doc/src/concepts/components.md b/doc/user-guide/src/concepts/components.md similarity index 100% rename from doc/src/concepts/components.md rename to doc/user-guide/src/concepts/components.md diff --git a/doc/src/concepts/index.md b/doc/user-guide/src/concepts/index.md similarity index 100% rename from doc/src/concepts/index.md rename to doc/user-guide/src/concepts/index.md diff --git a/doc/src/concepts/profiles.md b/doc/user-guide/src/concepts/profiles.md similarity index 100% rename from doc/src/concepts/profiles.md rename to doc/user-guide/src/concepts/profiles.md diff --git a/doc/src/concepts/proxies.md b/doc/user-guide/src/concepts/proxies.md similarity index 100% rename from doc/src/concepts/proxies.md rename to doc/user-guide/src/concepts/proxies.md diff --git a/doc/src/concepts/toolchains.md b/doc/user-guide/src/concepts/toolchains.md similarity index 100% rename from doc/src/concepts/toolchains.md rename to doc/user-guide/src/concepts/toolchains.md diff --git a/doc/src/configuration.md b/doc/user-guide/src/configuration.md similarity index 100% rename from doc/src/configuration.md rename to doc/user-guide/src/configuration.md diff --git a/doc/src/cross-compilation.md b/doc/user-guide/src/cross-compilation.md similarity index 100% rename from doc/src/cross-compilation.md rename to doc/user-guide/src/cross-compilation.md diff --git a/doc/src/environment-variables.md b/doc/user-guide/src/environment-variables.md similarity index 100% rename from doc/src/environment-variables.md rename to doc/user-guide/src/environment-variables.md diff --git a/doc/src/examples.md b/doc/user-guide/src/examples.md similarity index 100% rename from doc/src/examples.md rename to doc/user-guide/src/examples.md diff --git a/doc/src/faq.md b/doc/user-guide/src/faq.md similarity index 100% rename from doc/src/faq.md rename to doc/user-guide/src/faq.md diff --git a/doc/src/index.md b/doc/user-guide/src/index.md similarity index 100% rename from doc/src/index.md rename to doc/user-guide/src/index.md diff --git a/doc/src/installation/images/component-msvc.png b/doc/user-guide/src/installation/images/component-msvc.png similarity index 100% rename from doc/src/installation/images/component-msvc.png rename to doc/user-guide/src/installation/images/component-msvc.png diff --git a/doc/src/installation/images/component-sdk.png b/doc/user-guide/src/installation/images/component-sdk.png similarity index 100% rename from doc/src/installation/images/component-sdk.png rename to doc/user-guide/src/installation/images/component-sdk.png diff --git a/doc/src/installation/images/step1.png b/doc/user-guide/src/installation/images/step1.png similarity index 100% rename from doc/src/installation/images/step1.png rename to doc/user-guide/src/installation/images/step1.png diff --git a/doc/src/installation/images/step2.png b/doc/user-guide/src/installation/images/step2.png similarity index 100% rename from doc/src/installation/images/step2.png rename to doc/user-guide/src/installation/images/step2.png diff --git a/doc/src/installation/images/step3.png b/doc/user-guide/src/installation/images/step3.png similarity index 100% rename from doc/src/installation/images/step3.png rename to doc/user-guide/src/installation/images/step3.png diff --git a/doc/src/installation/images/step4.png b/doc/user-guide/src/installation/images/step4.png similarity index 100% rename from doc/src/installation/images/step4.png rename to doc/user-guide/src/installation/images/step4.png diff --git a/doc/src/installation/images/step5.png b/doc/user-guide/src/installation/images/step5.png similarity index 100% rename from doc/src/installation/images/step5.png rename to doc/user-guide/src/installation/images/step5.png diff --git a/doc/src/installation/index.md b/doc/user-guide/src/installation/index.md similarity index 100% rename from doc/src/installation/index.md rename to doc/user-guide/src/installation/index.md diff --git a/doc/src/installation/other.md b/doc/user-guide/src/installation/other.md similarity index 100% rename from doc/src/installation/other.md rename to doc/user-guide/src/installation/other.md diff --git a/doc/src/installation/package-managers.md b/doc/user-guide/src/installation/package-managers.md similarity index 100% rename from doc/src/installation/package-managers.md rename to doc/user-guide/src/installation/package-managers.md diff --git a/doc/src/installation/windows-msvc.md b/doc/user-guide/src/installation/windows-msvc.md similarity index 100% rename from doc/src/installation/windows-msvc.md rename to doc/user-guide/src/installation/windows-msvc.md diff --git a/doc/src/installation/windows.md b/doc/user-guide/src/installation/windows.md similarity index 100% rename from doc/src/installation/windows.md rename to doc/user-guide/src/installation/windows.md diff --git a/doc/src/network-proxies.md b/doc/user-guide/src/network-proxies.md similarity index 100% rename from doc/src/network-proxies.md rename to doc/user-guide/src/network-proxies.md diff --git a/doc/src/overrides.md b/doc/user-guide/src/overrides.md similarity index 100% rename from doc/src/overrides.md rename to doc/user-guide/src/overrides.md diff --git a/doc/src/security.md b/doc/user-guide/src/security.md similarity index 100% rename from doc/src/security.md rename to doc/user-guide/src/security.md From 285929f50e441a0f258022efaf764eac6477eb63 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 13 Aug 2023 20:13:06 +0200 Subject: [PATCH 049/229] Build docs during CI --- .github/workflows/test-docs.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/test-docs.yaml diff --git a/.github/workflows/test-docs.yaml b/.github/workflows/test-docs.yaml new file mode 100644 index 0000000000..08c3fa9dd7 --- /dev/null +++ b/.github/workflows/test-docs.yaml @@ -0,0 +1,27 @@ +name: Test build docs on PR + +on: + pull_request: + branches: + - "*" + +# Builds docs for both stable and master branches. +# stable is placed in the root of the gh-pages branch, while master is placed at /devel + +jobs: + doc: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Install mdbook + run: | + mkdir mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.6/mdbook-v0.4.6-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo "`pwd`/mdbook" >> $GITHUB_PATH + - name: Build book + run: | + cd doc/user-guide + mdbook build \ No newline at end of file From 04b72ff07d30936aee32c656f668e82015a1e56e Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Sun, 13 Aug 2023 20:38:47 +0200 Subject: [PATCH 050/229] Migrate CONTRIBUTING.md to an mdbook We had a suggestion that the dev docs would be easier to read if there was a table of contents. Rather than making one by hand I thought using mdbook would be better. --- .github/workflows/deploy-docs.yaml | 11 +- .github/workflows/test-docs.yaml | 6 +- CONTRIBUTING.md | 351 -------------------------- README.md | 2 +- doc/dev-guide/.gitignore | 1 + doc/dev-guide/README.md | 28 ++ doc/dev-guide/book.toml | 11 + doc/dev-guide/src/SUMMARY.md | 8 + doc/dev-guide/src/coding-standards.md | 64 +++++ doc/dev-guide/src/index.md | 41 +++ doc/dev-guide/src/release-process.md | 35 +++ doc/dev-guide/src/tips-and-tricks.md | 94 +++++++ doc/dev-guide/src/tracing.md | 81 ++++++ doc/dev-guide/src/version-numbers.md | 46 ++++ 14 files changed, 424 insertions(+), 355 deletions(-) delete mode 100644 CONTRIBUTING.md create mode 100644 doc/dev-guide/.gitignore create mode 100644 doc/dev-guide/README.md create mode 100644 doc/dev-guide/book.toml create mode 100644 doc/dev-guide/src/SUMMARY.md create mode 100644 doc/dev-guide/src/coding-standards.md create mode 100644 doc/dev-guide/src/index.md create mode 100644 doc/dev-guide/src/release-process.md create mode 100644 doc/dev-guide/src/tips-and-tricks.md create mode 100644 doc/dev-guide/src/tracing.md create mode 100644 doc/dev-guide/src/version-numbers.md diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index 01bfdf0132..56910768ac 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -6,8 +6,11 @@ on: - stable - master -# Builds docs for both stable and master branches. -# stable is placed in the root of the gh-pages branch, while master is placed at /devel +# Builds all docs for both stable and master branches. +# In the gh-pages branch, we place: +# stable user-guide at / +# master user-guide at /devel +# master dev-guide at /dev-guide jobs: doc: @@ -36,6 +39,10 @@ jobs: cd doc/user-guide mdbook build mv book ${{ runner.temp }}/book/devel + # Build dev-guide for master + cd ../dev-guide + mdbook build + mv book ${{ runner.temp }}/book/dev-guide - name: Deploy to GitHub run: | cd ${{ runner.temp }}/book diff --git a/.github/workflows/test-docs.yaml b/.github/workflows/test-docs.yaml index 08c3fa9dd7..3173b8a485 100644 --- a/.github/workflows/test-docs.yaml +++ b/.github/workflows/test-docs.yaml @@ -21,7 +21,11 @@ jobs: mkdir mdbook curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.6/mdbook-v0.4.6-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook echo "`pwd`/mdbook" >> $GITHUB_PATH - - name: Build book + - name: Build user-guide run: | cd doc/user-guide + mdbook build + - name: Build dev-guide + run: | + cd doc/dev-guide mdbook build \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 6e9f70f886..0000000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,351 +0,0 @@ -# Contributing to rustup - -1. Fork it! -2. Create your feature branch: `git checkout -b my-new-feature` -3. Test it: `cargo test --features=test` -4. Lint it: `cargo +beta clippy --all --all-targets -- -D warnings` -> We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. However, not all lints provided by `cargo clippy` are relevant or applicable to our project. -> We may choose to ignore some lints if they are unstable, experimental, or specific to our project. -> If you are unsure about a lint, please ask us in the [rustup Discord channel](https://discord.com/channels/442252698964721669/463480252723888159). -5. Commit your changes: `git commit -am 'Add some feature'` -6. Push to the branch: `git push origin my-new-feature` -7. Submit a pull request :D - -For developing on `rustup` itself, you may want to install into a temporary -directory, with a series of commands similar to this: - -```bash -cargo build -mkdir home -RUSTUP_HOME=home CARGO_HOME=home target/debug/rustup-init --no-modify-path -y -``` - -You can then try out `rustup` with your changes by running `home/bin/rustup`, without -affecting any existing installation. Remember to keep those two environment variables -set when running your compiled `rustup-init` or the toolchains it installs, but _unset_ -when rebuilding `rustup` itself. - -If you wish to install your new build to try out longer term in your home directory -then you can run `cargo dev-install` which is an alias in `.cargo/config` which -runs `cargo run -- --no-modify-path -y` to install your build into your homedir. - -We use `rustfmt` to keep our codebase consistently formatted. Please ensure that -you have correctly formatted your code (most editors will do this automatically -when saving) or it may not pass the CI tests. - -Unless you explicitly state otherwise, any contribution intentionally -submitted for inclusion in the work by you, as defined in the -Apache-2.0 license, shall be dual licensed as in the README, without any -additional terms or conditions. - -## Non-machine-enforced coding standards - -These are requirements we have that we have not yet lifted to the level of -automatic enforcement. - -### Import grouping - -In each file the imports should be grouped into at most 4 groups in the -following order: - -1. stdlib -2. non-repository local crates -3. repository local other crates -4. this crate - -Separate each group with a blank line, and rustfmt will sort into a canonical -order. Any file that is not grouped like this can be rearranged whenever the -file is touched - we're not precious about having it done in a separate commit, -though that is helpful. - -### No direct use of process state outside rustup::currentprocess - -The `rustup::currentprocess` module abstracts the global state that is -`std::env::args`, `std::env::vars`, `std::io::std*`, `std::process::id`, -`std::env::current_dir` and `std::process::exit` permitting threaded tests of -the CLI logic; use `process()` rather than those APIs directly. - -### Clippy lints - -We do not enforce lint status in the checks done by GitHub Actions, because -clippy is a moving target that can make it hard to merge for little benefit. - -We do ask that contributors keep the clippy status clean themselves. - -Minimally, run `cargo +beta clippy --all --all-targets -- -D warnings` before -submitting code. - -If possible, adding `--all-features` to the command is useful, but will require -additional dependencies like `libcurl-dev`. - -Regular contributors or contributors to particularly OS-specific code should -also make sure that their clippy checking is done on at least Linux and Windows, -as OS-conditional code is a common source of unused imports and other small -lints, which can build up over time. - -For developers using BSD/Linux/Mac OS, there are Windows VM's suitable for such -development tasks for use with virtualbox and other hypervisors are downloadable -from -[Microsoft](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/). -Similarly, there are many Linux and Unix operating systems images available for -developers whose usual operating system is Windows. Currently Rustup has no Mac -OS specific code, so there should be no need to worry about Mac VM images. - -Clippy is also run in GitHub Actions, in the `General Checks / Checks` build -task, but not currently run per-platform, which means there is no way to find -out the status of clippy per platform without running it on that platform as a -developer. - -### import rustup-macros::{integration,unit}_test into test modules - -These test helpers add pre-and-post logic to tests to enable the use of tracing -inside tests, which can be helpful for tracking down behaviours in larger tests. - -## Version numbers - -If you ever see a released version of rustup which has `::` in its version string -then something went wrong with the CI and that needs to be addressed. - -We use `git-testament` to construct our version strings. This records, as a -struct, details of the git commit, tag description, and also an indication -of modifications to the working tree present when the binary was compiled. - -During normal development you may get information from invoking `rustup --version` -which looks like `rustup-init 1.18.3+15 (a54051502 2019-05-26)` or even -`rustup-init 1.18.3+15 (a54051502 2019-05-26) dirty 1 modification`. - -The first part is always the binary name as per `clap`'s normal operation. The -version number is a combination of the most recent tag in the git repo, and the -number of commits since that tag. The parenthesised information is, naturally, -the SHA of the most recent commit and the date of that commit. If the indication -of a dirty tree is present, the number of changes is indicated. This combines -adds, deletes, modifies, and unknown entries. - -You can request further information of a `rustup` binary with the -`rustup dump-testament` hidden command. It produces output of the form: - -```shell -$ rustup dump-testament -Rustup version renders as: 1.18.3+15 (a54051502 2019-05-26) dirty 1 modification -Current crate version: 1.18.3 -Built from branch: kinnison/version-strings -Commit info: 1.18.3+15 (a54051502 2019-05-26) -Modified: CONTRIBUTING.md -``` - -This can be handy when you are testing development versions on your PC -and cannot remember exactly which version you had installed, or if you have given -a development copy (or instruction to build such) to a user, and wish to have them -confirm _exactly_ what they are using. - -Finally, we tell `git-testament` that we trust the `stable` branch to carry -releases. If the build is being performed when not on the `stable` branch, and -the tag and `CARGO_PKG_VERSION` differ, then the short version string will include -both, in the form `rustup-init 1.18.3 :: 1.18.2+99 (a54051502 2019-05-26)` which -indicates the crate version before the rest of the commit. -On the other hand, if the build was on the `stable` branch then regardless -of the tag information, providing the commit was clean, the version is -always replaced by the crate version. The `dump-testament` hidden command can -reveal the truth however. - -## Making a release - -Before making a release, ensure that `rustup-init.sh` is behaving correctly, -and that you're satisfied that nothing in the ecosystem is breaking because -of the update. A useful set of things to check includes verifying that -real-world toolchains install okay, and that `rls-vscode` isn't broken by -the release. While it's not our responsibility if they depend on non-stable -APIs, we should behave well if we can. - -Producing the final release artifacts is a bit involved because of the way -Rustup is distributed. The steps for a release are: - -1. Update `Cargo.toml` and `download/Cargo.toml`to have the same new version - (optionally make a commit) -2. Run `cargo build` and review `Cargo.lock` changes - if all looks well, make a commit -3. Update `rustup-init.sh` version to match the commit - details for `Cargo.lock` -4. Push this to the `stable` branch (git push origin HEAD:stable) -5. While you wait for green CI, double-check the `rustup-init.sh` functionality - and `rustup-init` just in case. -6. Ensure all of CI is green on the `stable` branch. - Once it is, check through a representative proportion of the builds looking - for the reported version statements to ensure that we definitely built something - cleanly which reports as the right version number when run `--version`. -7. Ping someone in the release team to perform the actual release. - They can find instructions in `ci/sync-dist.py` - Note: Some manual testing occurs here, so hopefully they'll catch - anything egregious in which case abort the change and roll back. -8. Once the official release has happened, prepare and push a tag - of that commit, and also push the content to master - - `git tag -as $VER_NUM -m $VER_NUM` (optionally without -s if not GPG - signing the tag) - - `git push origin HEAD:master` - - `git push origin $VER_NUM` - -## Developer tips and tricks - -### `RUSTUP_FORCE_ARG0` - -The environment variable `RUSTUP_FORCE_ARG0` can be used to get rustup to think -it's a particular binary, rather than e.g. copying it, symlinking it or other -tricks with exec. This is handy when testing particular code paths from cargo -run. - -```shell -RUSTUP_FORCE_ARG0=rustup cargo run -- uninstall nightly -``` - -### `RUSTUP_BACKTRACK_LIMIT` - -If it's necessary to alter the backtracking limit from the default of half -a release cycle for some reason, you can set the `RUSTUP_BACKTRACK_LIMIT` -environment variable. If this is unparseable as an `i32` or if it's absent -then the default of 21 days (half a cycle) is used. If it parses and is less -than 1, it is clamped to 1 at minimum. - -This is not meant for use by users, but can be suggested in diagnosing an issue -should one arise with the backtrack limits. - -### `RUSTUP_MAX_RETRIES` - -When downloading a file, rustup will retry the download a number of times. The -default is 3 times, but if this variable is set to a valid usize then it is the -max retry count. A value of `0` means no retries, thus the default of `3` will -mean a download is tried a total of four times before failing out. - -### `RUSTUP_BACKTRACE` - -By default while running tests, we unset some environment variables that will -break our testing (like `RUSTUP_TOOLCHAIN`, `SHELL`, `ZDOTDIR`, `RUST_BACKTRACE`). -But if you want to debug locally, you may need backtrace. `RUSTUP_BACKTRACE` -is used like `RUST_BACKTRACE` to enable backtraces of failed tests. - -**NOTE**: This is a backtrace for the test, not for any subprocess invocation of -rustup process running in the test - -```bash -$ RUSTUP_BACKTRACE=1 cargo test --release --test cli-v1 -- remove_toolchain_then_add_again - Finished release [optimized] target(s) in 0.38s - Running target\release\deps\cli_v1-1f29f824792f6dc1.exe - -running 1 test -test remove_toolchain_then_add_again ... FAILED - -failures: - ----- remove_toolchain_then_add_again stdout ---- -thread 'remove_toolchain_then_add_again' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 1142, kind: Other, message: "An attempt was made to create more links on a file than the file system supports." }', src\libcore\result.rs:999:5 -stack backtrace: - 0: backtrace::backtrace::trace_unsynchronized - at C:\Users\appveyor\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.29\src\backtrace\mod.rs:66 - 1: std::sys_common::backtrace::_print - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\sys_common\backtrace.rs:47 - 2: std::sys_common::backtrace::print - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\sys_common\backtrace.rs:36 - 3: std::panicking::default_hook::{{closure}} - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:198 - 4: std::panicking::default_hook - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:209 - 5: std::panicking::rust_panic_with_hook - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:475 - 6: std::panicking::continue_panic_fmt - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:382 - 7: std::panicking::rust_begin_panic - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:309 - 8: core::panicking::panic_fmt - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libcore\panicking.rs:85 - 9: core::result::unwrap_failed - 10: cli_v1::mock::clitools::test - 11: alloc::boxed::{{impl}}::call_once<(),FnOnce<()>> - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\src\liballoc\boxed.rs:746 - 12: panic_unwind::__rust_maybe_catch_panic - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libpanic_unwind\lib.rs:82 - 13: std::panicking::try - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\src\libstd\panicking.rs:273 - 14: std::panic::catch_unwind - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\src\libstd\panic.rs:388 - 15: test::run_test::run_test_inner::{{closure}} - at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libtest\lib.rs:1466 -note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. - - -failures: - remove_toolchain_then_add_again - -test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 26 filtered out - -error: test failed, to rerun pass '--test cli-v1' -``` - -## Tracing - -The feature "otel" can be used when building rustup to turn on Opentelemetry -tracing with an OLTP GRPC exporter. This requires protoc installed, which can be -downloaded from GitHub or installed via package manager. - -The normal [OTLP environment -variables](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md) -can be used to customise its behaviour, but often the simplest thing is to just -run a Jaeger docker container on the same host: - -```sh -docker run -d --name jaeger -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -e COLLECTOR_OTLP_ENABLED=true -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 14250:14250 -p 14268:14268 -p 14269:14269 -p 9411:9411 jaegertracing/all-in-one:latest -``` - -Then build rustup-init with tracing: - -```sh -cargo build --features=otel -``` - -Run the operation you want to analyze: - -```sh -RUSTUP_FORCE_ARG0="rustup" ./target/debug/rustup-init show -``` - -And [look in Jaeger for a trace](http://localhost:16686/search?service=rustup). - -### Tracing and tests - -The custom macro `rustup_macros::test` adds a prelude and suffix to each test to -ensure that there is a tracing context setup, that the test function is a span, -and that the spans from the test are flushed. Build with features=otel,test to -use this feature. - -### Adding instrumentation - -The `otel` feature uses conditional compilation to only add function instrument -when enabled. Instrumenting a currently uninstrumented function is mostly simply -done like so: - -```rust -#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] -``` - -`skip_all` is not required, but some core structs don't implement Debug yet, and -others have a lot of output in Debug : tracing adds some overheads, so keeping -spans lightweight can help avoid frequency bias in the results - where -parameters with large debug in frequently called functions show up as much -slower than they are. - -Some good general heuristics: - -- Do instrument slow blocking functions -- Do instrument functions with many callers or that call many different things, - as these tend to help figure the puzzle of what-is-happening -- Default to not instrumenting thin shim functions (or at least, only instrument - them temporarily while figuring out the shape of a problem) -- Be way of debug build timing - release optimisations make a huge difference, - though debug is a lot faster to iterate on. If something isn't a problem in - release don't pay it too much heed in debug. - -### Caveats - -Cross-thread propogation isn't connected yet. This will cause instrumentation in -a thread to make a new root span until it is fixed. If any Tokio runtime-related -code gets added in those threads this will also cause a panic. We have a couple -of threadpools in use today; if you need to instrument within that context, use -a thunk to propogate the tokio runtime into those threads. \ No newline at end of file diff --git a/README.md b/README.md index cc0af45583..8dc90b87a1 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ documentation on installing and using Rustup. ## Contributing -See [CONTRIBUTING.md](CONTRIBUTING.md) for information on contributing to Rustup. +See [**The Rustup dev guide**](https://rust-lang.github.io/rustup/dev-guide) for information on contributing to Rustup. ## License diff --git a/doc/dev-guide/.gitignore b/doc/dev-guide/.gitignore new file mode 100644 index 0000000000..7585238efe --- /dev/null +++ b/doc/dev-guide/.gitignore @@ -0,0 +1 @@ +book diff --git a/doc/dev-guide/README.md b/doc/dev-guide/README.md new file mode 100644 index 0000000000..c711803f27 --- /dev/null +++ b/doc/dev-guide/README.md @@ -0,0 +1,28 @@ +# rustup documentation + +This directory contains rustup's developer / contributing documentation. + +## Building the book + +Building the book requires [mdBook](https://github.com/rust-lang/mdBook). To get it: + +```console +$ cargo install mdbook +``` + +To build the book: + +```console +$ mdbook build +``` + +`mdbook` provides a variety of different commands and options to help you work +on the book: + +* `mdbook build --open`: Build the book and open it in a web browser. +* `mdbook serve`: Launches a web server on localhost. It also automatically + rebuilds the book whenever any file changes and automatically reloads your + web browser. + +The book contents are driven by the [`SUMMARY.md`](src/SUMMARY.md) file, and +every file must be linked there. diff --git a/doc/dev-guide/book.toml b/doc/dev-guide/book.toml new file mode 100644 index 0000000000..4d44b2ea48 --- /dev/null +++ b/doc/dev-guide/book.toml @@ -0,0 +1,11 @@ +[book] +authors = ["The Rust Project Developers"] +language = "en" +multilingual = false +src = "src" +title = "The Rustup developer guide" + +[output.html] +edit-url-template = "https://github.com/rust-lang/rustup/edit/master/doc/dev-guide/{path}" +git-repository-url = "https://github.com/rust-lang/rustup/tree/master/doc/dev-guide" +site-url = "https://rust-lang.github.io/rustup/dev-guide" diff --git a/doc/dev-guide/src/SUMMARY.md b/doc/dev-guide/src/SUMMARY.md new file mode 100644 index 0000000000..02f139ff3c --- /dev/null +++ b/doc/dev-guide/src/SUMMARY.md @@ -0,0 +1,8 @@ +# Summary + +- [Introduction](index.md) +- [Coding standards](coding-standards.md) +- [Version numbers](version-numbers.md) +- [Release process](release-process.md) +- [Tips and tricks](tips-and-tricks.md) +- [Tracing](tracing.md) \ No newline at end of file diff --git a/doc/dev-guide/src/coding-standards.md b/doc/dev-guide/src/coding-standards.md new file mode 100644 index 0000000000..63fb618e9c --- /dev/null +++ b/doc/dev-guide/src/coding-standards.md @@ -0,0 +1,64 @@ + +# Coding standards + +Generally we just follow good sensible Rust practices, clippy and so forth. +However there are some practices we've agreed on that are not machine-enforced; +meeting those requirements in a PR will make it easier to merge. + +## Import grouping + +In each file the imports should be grouped into at most 4 groups in the +following order: + +1. stdlib +2. non-repository local crates +3. repository local other crates +4. this crate + +Separate each group with a blank line, and rustfmt will sort into a canonical +order. Any file that is not grouped like this can be rearranged whenever the +file is touched - we're not precious about having it done in a separate commit, +though that is helpful. + +## No direct use of process state outside rustup::currentprocess + +The `rustup::currentprocess` module abstracts the global state that is +`std::env::args`, `std::env::vars`, `std::io::std*`, `std::process::id`, +`std::env::current_dir` and `std::process::exit` permitting threaded tests of +the CLI logic; use `process()` rather than those APIs directly. + +## Clippy lints + +We do not enforce lint status in the checks done by GitHub Actions, because +clippy is a moving target that can make it hard to merge for little benefit. + +We do ask that contributors keep the clippy status clean themselves. + +Minimally, run `cargo +beta clippy --all --all-targets -- -D warnings` before +submitting code. + +If possible, adding `--all-features` to the command is useful, but will require +additional dependencies like `libcurl-dev`. + +Regular contributors or contributors to particularly OS-specific code should +also make sure that their clippy checking is done on at least Linux and Windows, +as OS-conditional code is a common source of unused imports and other small +lints, which can build up over time. + +For developers using BSD/Linux/Mac OS, there are Windows VM's suitable for such +development tasks for use with virtualbox and other hypervisors are downloadable +from +[Microsoft](https://developer.microsoft.com/en-us/windows/downloads/virtual-machines/). +Similarly, there are many Linux and Unix operating systems images available for +developers whose usual operating system is Windows. Currently Rustup has no Mac +OS specific code, so there should be no need to worry about Mac VM images. + +Clippy is also run in GitHub Actions, in the `General Checks / Checks` build +task, but not currently run per-platform, which means there is no way to find +out the status of clippy per platform without running it on that platform as a +developer. + +### import rustup-macros::{integration,unit}_test into test modules + +These test helpers add pre-and-post logic to tests to enable the use of tracing +inside tests, which can be helpful for tracking down behaviours in larger tests. diff --git a/doc/dev-guide/src/index.md b/doc/dev-guide/src/index.md new file mode 100644 index 0000000000..9c252113e5 --- /dev/null +++ b/doc/dev-guide/src/index.md @@ -0,0 +1,41 @@ +# Contributing to rustup + +1. Fork it! +2. Create your feature branch: `git checkout -b my-new-feature` +3. Test it: `cargo test --features=test` +4. Lint it: `cargo +beta clippy --all --all-targets -- -D warnings` + +> We use `cargo clippy` to ensure high-quality code and to enforce a set of best practices for Rust programming. However, not all lints provided by `cargo clippy` are relevant or applicable to our project. +> We may choose to ignore some lints if they are unstable, experimental, or specific to our project. +> If you are unsure about a lint, please ask us in the [rustup Discord channel](https://discord.com/channels/442252698964721669/463480252723888159). + +5. Commit your changes: `git commit -am 'Add some feature'` +6. Push to the branch: `git push origin my-new-feature` +7. Submit a pull request :D + +For developing on `rustup` itself, you may want to install into a temporary +directory, with a series of commands similar to this: + +```bash +cargo build +mkdir home +RUSTUP_HOME=home CARGO_HOME=home target/debug/rustup-init --no-modify-path -y +``` + +You can then try out `rustup` with your changes by running `home/bin/rustup`, without +affecting any existing installation. Remember to keep those two environment variables +set when running your compiled `rustup-init` or the toolchains it installs, but _unset_ +when rebuilding `rustup` itself. + +If you wish to install your new build to try out longer term in your home directory +then you can run `cargo dev-install` which is an alias in `.cargo/config` which +runs `cargo run -- --no-modify-path -y` to install your build into your homedir. + +We use `rustfmt` to keep our codebase consistently formatted. Please ensure that +you have correctly formatted your code (most editors will do this automatically +when saving) or it may not pass the CI tests. + +Unless you explicitly state otherwise, any contribution intentionally +submitted for inclusion in the work by you, as defined in the +Apache-2.0 license, shall be dual licensed as in the README, without any +additional terms or conditions. diff --git a/doc/dev-guide/src/release-process.md b/doc/dev-guide/src/release-process.md new file mode 100644 index 0000000000..360a90a4bd --- /dev/null +++ b/doc/dev-guide/src/release-process.md @@ -0,0 +1,35 @@ +# Making a release + +Before making a release, ensure that `rustup-init.sh` is behaving correctly, +and that you're satisfied that nothing in the ecosystem is breaking because +of the update. A useful set of things to check includes verifying that +real-world toolchains install okay, and that `rls-vscode` isn't broken by +the release. While it's not our responsibility if they depend on non-stable +APIs, we should behave well if we can. + +Producing the final release artifacts is a bit involved because of the way +Rustup is distributed. The steps for a release are: + +1. Update `Cargo.toml` and `download/Cargo.toml`to have the same new version + (optionally make a commit) +2. Run `cargo build` and review `Cargo.lock` changes + if all looks well, make a commit +3. Update `rustup-init.sh` version to match the commit + details for `Cargo.lock` +4. Push this to the `stable` branch (git push origin HEAD:stable) +5. While you wait for green CI, double-check the `rustup-init.sh` functionality + and `rustup-init` just in case. +6. Ensure all of CI is green on the `stable` branch. + Once it is, check through a representative proportion of the builds looking + for the reported version statements to ensure that we definitely built something + cleanly which reports as the right version number when run `--version`. +7. Ping someone in the release team to perform the actual release. + They can find instructions in `ci/sync-dist.py` + Note: Some manual testing occurs here, so hopefully they'll catch + anything egregious in which case abort the change and roll back. +8. Once the official release has happened, prepare and push a tag + of that commit, and also push the content to master + - `git tag -as $VER_NUM -m $VER_NUM` (optionally without -s if not GPG + signing the tag) + - `git push origin HEAD:master` + - `git push origin $VER_NUM` diff --git a/doc/dev-guide/src/tips-and-tricks.md b/doc/dev-guide/src/tips-and-tricks.md new file mode 100644 index 0000000000..3fc33bc27b --- /dev/null +++ b/doc/dev-guide/src/tips-and-tricks.md @@ -0,0 +1,94 @@ +# Developer tips and tricks + +## `RUSTUP_FORCE_ARG0` + +The environment variable `RUSTUP_FORCE_ARG0` can be used to get rustup to think +it's a particular binary, rather than e.g. copying it, symlinking it or other +tricks with exec. This is handy when testing particular code paths from cargo +run. + +```shell +RUSTUP_FORCE_ARG0=rustup cargo run -- uninstall nightly +``` + +## `RUSTUP_BACKTRACK_LIMIT` + +If it's necessary to alter the backtracking limit from the default of half +a release cycle for some reason, you can set the `RUSTUP_BACKTRACK_LIMIT` +environment variable. If this is unparseable as an `i32` or if it's absent +then the default of 21 days (half a cycle) is used. If it parses and is less +than 1, it is clamped to 1 at minimum. + +This is not meant for use by users, but can be suggested in diagnosing an issue +should one arise with the backtrack limits. + +## `RUSTUP_MAX_RETRIES` + +When downloading a file, rustup will retry the download a number of times. The +default is 3 times, but if this variable is set to a valid usize then it is the +max retry count. A value of `0` means no retries, thus the default of `3` will +mean a download is tried a total of four times before failing out. + +## `RUSTUP_BACKTRACE` + +By default while running tests, we unset some environment variables that will +break our testing (like `RUSTUP_TOOLCHAIN`, `SHELL`, `ZDOTDIR`, `RUST_BACKTRACE`). +But if you want to debug locally, you may need backtrace. `RUSTUP_BACKTRACE` +is used like `RUST_BACKTRACE` to enable backtraces of failed tests. + +**NOTE**: This is a backtrace for the test, not for any subprocess invocation of +rustup process running in the test + +```bash +$ RUSTUP_BACKTRACE=1 cargo test --release --test cli-v1 -- remove_toolchain_then_add_again + Finished release [optimized] target(s) in 0.38s + Running target\release\deps\cli_v1-1f29f824792f6dc1.exe + +running 1 test +test remove_toolchain_then_add_again ... FAILED + +failures: + +---- remove_toolchain_then_add_again stdout ---- +thread 'remove_toolchain_then_add_again' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 1142, kind: Other, message: "An attempt was made to create more links on a file than the file system supports." }', src\libcore\result.rs:999:5 +stack backtrace: + 0: backtrace::backtrace::trace_unsynchronized + at C:\Users\appveyor\.cargo\registry\src\github.com-1ecc6299db9ec823\backtrace-0.3.29\src\backtrace\mod.rs:66 + 1: std::sys_common::backtrace::_print + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\sys_common\backtrace.rs:47 + 2: std::sys_common::backtrace::print + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\sys_common\backtrace.rs:36 + 3: std::panicking::default_hook::{{closure}} + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:198 + 4: std::panicking::default_hook + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:209 + 5: std::panicking::rust_panic_with_hook + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:475 + 6: std::panicking::continue_panic_fmt + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:382 + 7: std::panicking::rust_begin_panic + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libstd\panicking.rs:309 + 8: core::panicking::panic_fmt + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libcore\panicking.rs:85 + 9: core::result::unwrap_failed + 10: cli_v1::mock::clitools::test + 11: alloc::boxed::{{impl}}::call_once<(),FnOnce<()>> + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\src\liballoc\boxed.rs:746 + 12: panic_unwind::__rust_maybe_catch_panic + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libpanic_unwind\lib.rs:82 + 13: std::panicking::try + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\src\libstd\panicking.rs:273 + 14: std::panic::catch_unwind + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\src\libstd\panic.rs:388 + 15: test::run_test::run_test_inner::{{closure}} + at /rustc/de02101e6d949c4a9040211e9ce8c488a997497e\/src\libtest\lib.rs:1466 +note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace. + + +failures: + remove_toolchain_then_add_again + +test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 26 filtered out + +error: test failed, to rerun pass '--test cli-v1' +``` diff --git a/doc/dev-guide/src/tracing.md b/doc/dev-guide/src/tracing.md new file mode 100644 index 0000000000..9afc2bec6f --- /dev/null +++ b/doc/dev-guide/src/tracing.md @@ -0,0 +1,81 @@ +# Tracing + +The feature "otel" can be used when building rustup to turn on Opentelemetry +tracing with an OLTP GRPC exporter. + +This can be very useful for diagnosing performance or correctness issues in more +complicated scenarios. + +## Prerequisites + +`protoc` must be installed, which can be downloaded from GitHub or installed via package manager. + +## Usage + +The normal [OTLP environment +variables](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md) +can be used to customise its behaviour, but often the simplest thing is to just +run a Jaeger docker container on the same host: + +```sh +docker run -d --name jaeger -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 -e COLLECTOR_OTLP_ENABLED=true -p 6831:6831/udp -p 6832:6832/udp -p 5778:5778 -p 16686:16686 -p 4317:4317 -p 4318:4318 -p 14250:14250 -p 14268:14268 -p 14269:14269 -p 9411:9411 jaegertracing/all-in-one:latest +``` + +Then build rustup-init with tracing: + +```sh +cargo build --features=otel +``` + +Run the operation you want to analyze: + +```sh +RUSTUP_FORCE_ARG0="rustup" ./target/debug/rustup-init show +``` + +And [look in Jaeger for a trace](http://localhost:16686/search?service=rustup). + +## Tracing and tests + +Tracing can also be used in tests to get a trace of the operations taken during the test. + +The custom macro `rustup_macros::test` adds a prelude and suffix to each test to +ensure that there is a tracing context setup, that the test function is a span, +and that the spans from the test are flushed. + +Build with features=otel,test to use this feature. + +## Adding instrumentation + +The `otel` feature uses conditional compilation to only add function instrument +when enabled. Instrumenting a currently uninstrumented function is mostly simply +done like so: + +```rust +#[cfg_attr(feature = "otel", tracing::instrument(err, skip_all))] +``` + +`skip_all` is not required, but some core structs don't implement Debug yet, and +others have a lot of output in Debug : tracing adds some overheads, so keeping +spans lightweight can help avoid frequency bias in the results - where +parameters with large debug in frequently called functions show up as much +slower than they are. + +Some good general heuristics: + +- Do instrument slow blocking functions +- Do instrument functions with many callers or that call many different things, + as these tend to help figure the puzzle of what-is-happening +- Default to not instrumenting thin shim functions (or at least, only instrument + them temporarily while figuring out the shape of a problem) +- Be way of debug build timing - release optimisations make a huge difference, + though debug is a lot faster to iterate on. If something isn't a problem in + release don't pay it too much heed in debug. + +## Caveats + +Cross-thread propogation isn't connected yet. This will cause instrumentation in +a thread to make a new root span until it is fixed. If any Tokio runtime-related +code gets added in those threads this will also cause a panic. We have a couple +of threadpools in use today; if you need to instrument within that context, use +a thunk to propogate the tokio runtime into those threads. diff --git a/doc/dev-guide/src/version-numbers.md b/doc/dev-guide/src/version-numbers.md new file mode 100644 index 0000000000..2c23370416 --- /dev/null +++ b/doc/dev-guide/src/version-numbers.md @@ -0,0 +1,46 @@ +# Version numbers + +If you ever see a released version of rustup which has `::` in its version string +then something went wrong with the CI and that needs to be addressed. + +We use `git-testament` to construct our version strings. This records, as a +struct, details of the git commit, tag description, and also an indication +of modifications to the working tree present when the binary was compiled. + +During normal development you may get information from invoking `rustup --version` +which looks like `rustup-init 1.18.3+15 (a54051502 2019-05-26)` or even +`rustup-init 1.18.3+15 (a54051502 2019-05-26) dirty 1 modification`. + +The first part is always the binary name as per `clap`'s normal operation. The +version number is a combination of the most recent tag in the git repo, and the +number of commits since that tag. The parenthesised information is, naturally, +the SHA of the most recent commit and the date of that commit. If the indication +of a dirty tree is present, the number of changes is indicated. This combines +adds, deletes, modifies, and unknown entries. + +You can request further information of a `rustup` binary with the +`rustup dump-testament` hidden command. It produces output of the form: + +```shell +$ rustup dump-testament +Rustup version renders as: 1.18.3+15 (a54051502 2019-05-26) dirty 1 modification +Current crate version: 1.18.3 +Built from branch: kinnison/version-strings +Commit info: 1.18.3+15 (a54051502 2019-05-26) +Modified: CONTRIBUTING.md +``` + +This can be handy when you are testing development versions on your PC +and cannot remember exactly which version you had installed, or if you have given +a development copy (or instruction to build such) to a user, and wish to have them +confirm _exactly_ what they are using. + +Finally, we tell `git-testament` that we trust the `stable` branch to carry +releases. If the build is being performed when not on the `stable` branch, and +the tag and `CARGO_PKG_VERSION` differ, then the short version string will include +both, in the form `rustup-init 1.18.3 :: 1.18.2+99 (a54051502 2019-05-26)` which +indicates the crate version before the rest of the commit. +On the other hand, if the build was on the `stable` branch then regardless +of the tag information, providing the commit was clean, the version is +always replaced by the crate version. The `dump-testament` hidden command can +reveal the truth however. From 4dfe254edcafeb755ae6c37d1f9c00d8e2f2b2b3 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 14 Aug 2023 11:54:40 +0800 Subject: [PATCH 051/229] macOS `uname -m` can lie due to Rosetta shenanigans Fix originally provided in https://github.com/JuliaLang/juliaup/pull/701 --- rustup-init.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index ddc99f2472..7e8de44ea5 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -255,10 +255,19 @@ get_architecture() { fi fi - if [ "$_ostype" = Darwin ] && [ "$_cputype" = i386 ]; then - # Darwin `uname -m` lies - if sysctl hw.optional.x86_64 | grep -q ': 1'; then - _cputype=x86_64 + if [ "$_ostype" = Darwin ]; then + # Darwin `uname -m` can lie due to Rosetta shenanigans. If you manage to + # invoke a native shell binary and then a native uname binary, you can + # get the real answer, but that's hard to ensure, so instead we use + # `sysctl` (which doesn't lie) to check for the actual architecture. + if [ "$_cputype" = i386 ]; then + if sysctl hw.optional.x86_64 | grep -q ': 1'; then + _cputype=x86_64 + fi + elif [ "$_cputype" = x86_64 ]; then + if sysctl hw.optional.arm64 | grep -q ': 1'; then + _cputype=arm64 + fi fi fi From d955bdeac897227f495ebadb8fb4b258e49ffccd Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 15 Aug 2023 09:50:51 +0800 Subject: [PATCH 052/229] Support `RUSTUP_TERM_COLOR` as an override environment variable --- doc/user-guide/src/environment-variables.md | 4 ++++ src/currentprocess/terminalsource.rs | 20 ++++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/doc/user-guide/src/environment-variables.md b/doc/user-guide/src/environment-variables.md index 8ef3351945..97b876c508 100644 --- a/doc/user-guide/src/environment-variables.md +++ b/doc/user-guide/src/environment-variables.md @@ -29,6 +29,10 @@ determines the directory that traces will be written too. Traces are of the form PID.trace. Traces can be read by the Catapult project [tracing viewer]. +- `RUSTUP_TERM_COLOR` (default: `auto`) Controls whether colored output is used in the terminal. + Set to `auto` to use colors only in tty streams, to `always` to always enable colors, + or to `never` to disable colors. + - `RUSTUP_UNPACK_RAM` *unstable* (default free memory or 500MiB if unable to tell, min 210MiB) Caps the amount of RAM `rustup` will use for IO tasks while unpacking. diff --git a/src/currentprocess/terminalsource.rs b/src/currentprocess/terminalsource.rs index 2a6e28b97b..3f07557271 100644 --- a/src/currentprocess/terminalsource.rs +++ b/src/currentprocess/terminalsource.rs @@ -11,7 +11,7 @@ use termcolor::{ColorChoice, ColorSpec, StandardStream, StandardStreamLock, Writ #[cfg(feature = "test")] use super::filesource::{TestWriter, TestWriterLock}; -use super::process; +use super::{process, varsource::VarSource}; /// Select what stream to make a terminal on pub(super) enum StreamSelector { @@ -73,14 +73,18 @@ enum TerminalInnerLocked { } impl ColorableTerminal { - /// Construct a terminal for the selected stream. Colors written to the - /// terminal will be discarded if the stream is not a tty. + /// A terminal that supports colorisation of a stream. + /// If `RUSTUP_TERM_COLOR` is set to `always`, or if the stream is a tty and + /// `RUSTUP_TERM_COLOR` either unset or set to `auto`, + /// then color commands will be sent to the stream. + /// Otherwise color commands are discarded. pub(super) fn new(stream: StreamSelector) -> Self { - let is_a_tty = stream.is_a_tty(); - let choice = if is_a_tty { - ColorChoice::Auto - } else { - ColorChoice::Never + let env_override = process().var("RUSTUP_TERM_COLOR"); + let choice = match env_override.as_deref() { + Ok("always") => ColorChoice::Always, + Ok("never") => ColorChoice::Never, + _ if stream.is_a_tty() => ColorChoice::Auto, + _ => ColorChoice::Never, }; let inner = match stream { StreamSelector::Stdout => { From 106b9c344727fe9e1cf91939eeb955b4e96dc818 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 15 Aug 2023 09:50:51 +0800 Subject: [PATCH 053/229] Add unit tests for `RUSTUP_TERM_COLOR` --- src/currentprocess/filesource.rs | 2 +- src/currentprocess/terminalsource.rs | 79 ++++++++++++++++++++++++---- 2 files changed, 70 insertions(+), 11 deletions(-) diff --git a/src/currentprocess/filesource.rs b/src/currentprocess/filesource.rs index 36aa508b63..0f021fb212 100644 --- a/src/currentprocess/filesource.rs +++ b/src/currentprocess/filesource.rs @@ -198,7 +198,7 @@ impl Write for TestWriterLock<'_> { #[cfg(feature = "test")] pub(super) type TestWriterInner = Arc>>; /// A thread-safe test file handle that pretends to be e.g. stdout. -#[derive(Clone)] +#[derive(Clone, Default)] #[cfg(feature = "test")] pub(super) struct TestWriter(TestWriterInner); diff --git a/src/currentprocess/terminalsource.rs b/src/currentprocess/terminalsource.rs index 3f07557271..2c189dc372 100644 --- a/src/currentprocess/terminalsource.rs +++ b/src/currentprocess/terminalsource.rs @@ -19,6 +19,8 @@ pub(super) enum StreamSelector { Stderr, #[cfg(feature = "test")] TestWriter(TestWriter), + #[cfg(feature = "test")] + TestTtyWriter(TestWriter), } impl StreamSelector { @@ -36,6 +38,8 @@ impl StreamSelector { }, #[cfg(feature = "test")] StreamSelector::TestWriter(_) => false, + #[cfg(feature = "test")] + StreamSelector::TestTtyWriter(_) => true, } } } @@ -55,7 +59,7 @@ pub struct ColorableTerminal { enum TerminalInner { StandardStream(StandardStream, ColorSpec), #[cfg(feature = "test")] - TestWriter(TestWriter), + TestWriter(TestWriter, ColorChoice), } pub struct ColorableTerminalLocked { @@ -94,7 +98,9 @@ impl ColorableTerminal { TerminalInner::StandardStream(StandardStream::stderr(choice), ColorSpec::new()) } #[cfg(feature = "test")] - StreamSelector::TestWriter(w) => TerminalInner::TestWriter(w), + StreamSelector::TestWriter(w) | StreamSelector::TestTtyWriter(w) => { + TerminalInner::TestWriter(w, choice) + } }; ColorableTerminal { inner: Arc::new(Mutex::new(inner)), @@ -122,7 +128,7 @@ impl ColorableTerminal { TerminalInnerLocked::StandardStream(locked) } #[cfg(feature = "test")] - TerminalInner::TestWriter(w) => TerminalInnerLocked::TestWriter(w.lock()), + TerminalInner::TestWriter(w, _) => TerminalInnerLocked::TestWriter(w.lock()), }); // ColorableTerminalLocked { inner, guard, locked } uninit.assume_init() @@ -136,7 +142,7 @@ impl ColorableTerminal { s.set_color(spec) } #[cfg(feature = "test")] - TerminalInner::TestWriter(_) => Ok(()), + TerminalInner::TestWriter(_, _) => Ok(()), } } @@ -147,7 +153,7 @@ impl ColorableTerminal { s.set_color(spec) } #[cfg(feature = "test")] - TerminalInner::TestWriter(_) => Ok(()), + TerminalInner::TestWriter(_, _) => Ok(()), } } @@ -161,7 +167,7 @@ impl ColorableTerminal { s.set_color(spec) } #[cfg(feature = "test")] - TerminalInner::TestWriter(_) => Ok(()), + TerminalInner::TestWriter(_, _) => Ok(()), } } @@ -169,7 +175,7 @@ impl ColorableTerminal { match self.inner.lock().unwrap().deref_mut() { TerminalInner::StandardStream(s, _color) => s.reset(), #[cfg(feature = "test")] - TerminalInner::TestWriter(_) => Ok(()), + TerminalInner::TestWriter(_, _) => Ok(()), } } @@ -177,7 +183,7 @@ impl ColorableTerminal { match self.inner.lock().unwrap().deref_mut() { TerminalInner::StandardStream(s, _color) => s.write(b"\r")?, #[cfg(feature = "test")] - TerminalInner::TestWriter(w) => w.write(b"\r")?, + TerminalInner::TestWriter(w, _) => w.write(b"\r")?, }; Ok(()) } @@ -194,7 +200,7 @@ impl io::Write for ColorableTerminal { match self.inner.lock().unwrap().deref_mut() { TerminalInner::StandardStream(s, _) => s.write(buf), #[cfg(feature = "test")] - TerminalInner::TestWriter(w) => w.write(buf), + TerminalInner::TestWriter(w, _) => w.write(buf), } } @@ -202,7 +208,7 @@ impl io::Write for ColorableTerminal { match self.inner.lock().unwrap().deref_mut() { TerminalInner::StandardStream(s, _) => s.flush(), #[cfg(feature = "test")] - TerminalInner::TestWriter(w) => w.flush(), + TerminalInner::TestWriter(w, _) => w.flush(), } } } @@ -224,3 +230,56 @@ impl io::Write for ColorableTerminalLocked { } } } + +#[cfg(test)] +mod tests { + use std::collections::HashMap; + + use rustup_macros::unit_test as test; + + use super::*; + use crate::{currentprocess, test::Env}; + + #[test] + fn term_color_choice() { + fn assert_color_choice(env_val: &str, stream: StreamSelector, color_choice: ColorChoice) { + let mut vars = HashMap::new(); + vars.env("RUSTUP_TERM_COLOR", env_val); + let tp = currentprocess::TestProcess { + vars, + ..Default::default() + }; + currentprocess::with(tp.into(), || { + let term = ColorableTerminal::new(stream); + let inner = term.inner.lock().unwrap(); + assert!(matches!( + &*inner, + &TerminalInner::TestWriter(_, choice) if choice == color_choice + )); + }); + } + + assert_color_choice( + "always", + StreamSelector::TestWriter(Default::default()), + ColorChoice::Always, + ); + assert_color_choice( + "never", + StreamSelector::TestWriter(Default::default()), + ColorChoice::Never, + ); + // tty + `auto` enables the colors. + assert_color_choice( + "auto", + StreamSelector::TestTtyWriter(Default::default()), + ColorChoice::Auto, + ); + // non-tty + `auto` does not enable the colors. + assert_color_choice( + "auto", + StreamSelector::TestWriter(Default::default()), + ColorChoice::Never, + ); + } +} From b6cf38019c33f61eca1c5bd38f3a12edab4599d7 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 15 Aug 2023 09:59:11 +0800 Subject: [PATCH 054/229] Make `RUSTUP_TERM_COLOR`'s value case insensitive --- src/currentprocess/terminalsource.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/currentprocess/terminalsource.rs b/src/currentprocess/terminalsource.rs index 2c189dc372..19658ce8c5 100644 --- a/src/currentprocess/terminalsource.rs +++ b/src/currentprocess/terminalsource.rs @@ -83,7 +83,9 @@ impl ColorableTerminal { /// then color commands will be sent to the stream. /// Otherwise color commands are discarded. pub(super) fn new(stream: StreamSelector) -> Self { - let env_override = process().var("RUSTUP_TERM_COLOR"); + let env_override = process() + .var("RUSTUP_TERM_COLOR") + .map(|it| it.to_lowercase()); let choice = match env_override.as_deref() { Ok("always") => ColorChoice::Always, Ok("never") => ColorChoice::Never, @@ -260,24 +262,24 @@ mod tests { } assert_color_choice( - "always", + "aLWayS", StreamSelector::TestWriter(Default::default()), ColorChoice::Always, ); assert_color_choice( - "never", + "neVer", StreamSelector::TestWriter(Default::default()), ColorChoice::Never, ); // tty + `auto` enables the colors. assert_color_choice( - "auto", + "AutO", StreamSelector::TestTtyWriter(Default::default()), ColorChoice::Auto, ); // non-tty + `auto` does not enable the colors. assert_color_choice( - "auto", + "aUTo", StreamSelector::TestWriter(Default::default()), ColorChoice::Never, ); From 9d5ffe753c6fe96ca9b58c31a2c5cfc521eebf50 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 15 Aug 2023 07:52:21 +0200 Subject: [PATCH 055/229] Fix renovate.json --- .github/renovate.json | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 0f3bee1ac0..700adabc38 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -17,14 +17,12 @@ "^ci\\/.*/[^/]+\\.ya?ml$" ] }, - { - "packageRules": [ - { - "matchPackagePatterns": [ - "opentelemetry" - ], - "groupName": "opentelemetry" - } - ] - } + "packageRules": [ + { + "matchPackagePatterns": [ + "opentelemetry" + ], + "groupName": "opentelemetry" + } + ] } \ No newline at end of file From f03ad07fac7715d9e103913edf362d9f409c3802 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Aug 2023 05:55:49 +0000 Subject: [PATCH 056/229] Update opentelemetry --- Cargo.lock | 293 ++++++++++++----------------------------------------- Cargo.toml | 6 +- 2 files changed, 68 insertions(+), 231 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fc75e64228..e5422d488c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,28 +109,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "async-stream" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" -dependencies = [ - "async-stream-impl", - "futures-core", - "pin-project-lite", -] - -[[package]] -name = "async-stream-impl" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "async-trait" version = "0.1.68" @@ -204,12 +182,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.0" @@ -488,19 +460,6 @@ dependencies = [ "cfg-if 1.0.0", ] -[[package]] -name = "dashmap" -version = "5.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907076dfda823b0b36d2a1bb5f90c96660a5bbcd7729e10727f07858f22c4edc" -dependencies = [ - "cfg-if 1.0.0", - "hashbrown", - "lock_api", - "once_cell", - "parking_lot_core", -] - [[package]] name = "derivative" version = "2.2.0" @@ -653,12 +612,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - [[package]] name = "flate2" version = "1.0.26" @@ -714,20 +667,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "futures" -version = "0.3.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.28" @@ -735,7 +674,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -790,7 +728,6 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -877,12 +814,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - [[package]] name = "hermit-abi" version = "0.1.19" @@ -1103,9 +1034,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1152,16 +1083,6 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" -[[package]] -name = "lock_api" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "435011366fe56583b16cf956f9df0095b405b82d76425bc8981c0e22e60ec4df" -dependencies = [ - "autocfg", - "scopeguard", -] - [[package]] name = "log" version = "0.4.17" @@ -1239,12 +1160,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "multimap" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" - [[package]] name = "native-tls" version = "0.2.11" @@ -1399,9 +1314,9 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69d6c3d7288a106c0a363e4b0e8d308058d56902adefb16f4936f417ffef086e" +checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54" dependencies = [ "opentelemetry_api", "opentelemetry_sdk", @@ -1409,16 +1324,17 @@ dependencies = [ [[package]] name = "opentelemetry-otlp" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c928609d087790fc936a1067bdc310ae702bdf3b090c3f281b713622c8bbde" +checksum = "7e5e5a5c4135864099f3faafbe939eb4d7f9b80ebf68a8448da961b32a7c1275" dependencies = [ "async-trait", - "futures", - "futures-util", + "futures-core", "http", - "opentelemetry", "opentelemetry-proto", + "opentelemetry-semantic-conventions", + "opentelemetry_api", + "opentelemetry_sdk", "prost", "thiserror", "tokio", @@ -1427,25 +1343,31 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.1.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61a2f56df5574508dd86aaca016c917489e589ece4141df1b5e349af8d66c28" +checksum = "b1e3f814aa9f8c905d0ee4bde026afd3b2577a97c10e1699912e3e44f0c4cbeb" dependencies = [ - "futures", - "futures-util", - "opentelemetry", + "opentelemetry_api", + "opentelemetry_sdk", "prost", "tonic", - "tonic-build", +] + +[[package]] +name = "opentelemetry-semantic-conventions" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269" +dependencies = [ + "opentelemetry", ] [[package]] name = "opentelemetry_api" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c24f96e21e7acc813c7a8394ee94978929db2bcc46cf6b5014fc612bf7760c22" +checksum = "8a81f725323db1b1206ca3da8bb19874bbd3f57c3bcd59471bfb04525b265b9b" dependencies = [ - "fnv", "futures-channel", "futures-util", "indexmap", @@ -1453,30 +1375,41 @@ dependencies = [ "once_cell", "pin-project-lite", "thiserror", + "urlencoding", ] [[package]] name = "opentelemetry_sdk" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca41c4933371b61c2a2f214bf16931499af4ec90543604ec828f7a625c09113" +checksum = "fa8e705a0612d48139799fcbaba0d4a90f06277153e43dd2bdc16c6f0edd8026" dependencies = [ "async-trait", "crossbeam-channel", - "dashmap", - "fnv", "futures-channel", "futures-executor", "futures-util", "once_cell", "opentelemetry_api", + "ordered-float", "percent-encoding", "rand", + "regex", + "serde_json", "thiserror", "tokio", "tokio-stream", ] +[[package]] +name = "ordered-float" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2fc2dbde8f8a79f2102cc474ceb0ad68e3b80b85289ea62389b60e66777e4213" +dependencies = [ + "num-traits", +] + [[package]] name = "os_pipe" version = "1.1.4" @@ -1499,35 +1432,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" -[[package]] -name = "parking_lot_core" -version = "0.9.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "redox_syscall 0.2.16", - "smallvec", - "windows-sys 0.45.0", -] - [[package]] name = "percent-encoding" version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" -[[package]] -name = "petgraph" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" -dependencies = [ - "fixedbitset", - "indexmap", -] - [[package]] name = "pin-project" version = "1.0.12" @@ -1572,16 +1482,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "prettyplease" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" -dependencies = [ - "proc-macro2", - "syn 1.0.109", -] - [[package]] name = "proc-macro2" version = "1.0.63" @@ -1622,28 +1522,6 @@ dependencies = [ "prost-derive", ] -[[package]] -name = "prost-build" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" -dependencies = [ - "bytes", - "heck", - "itertools", - "lazy_static", - "log", - "multimap", - "petgraph", - "prettyplease", - "prost", - "prost-types", - "regex", - "syn 1.0.109", - "tempfile", - "which", -] - [[package]] name = "prost-derive" version = "0.11.9" @@ -1657,15 +1535,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "prost-types" -version = "0.11.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" -dependencies = [ - "prost", -] - [[package]] name = "pulldown-cmark" version = "0.9.2" @@ -1833,7 +1702,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" dependencies = [ "async-compression", - "base64 0.21.0", + "base64", "bytes", "encoding_rs", "futures-core", @@ -1962,7 +1831,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.21.0", + "base64", ] [[package]] @@ -2603,14 +2472,13 @@ dependencies = [ [[package]] name = "tonic" -version = "0.8.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" +checksum = "3082666a3a6433f7f511c7192923fa1fe07c69332d3c6a2e6bb040b569199d5a" dependencies = [ - "async-stream", "async-trait", "axum", - "base64 0.13.1", + "base64", "bytes", "futures-core", "futures-util", @@ -2622,28 +2490,12 @@ dependencies = [ "percent-encoding", "pin-project", "prost", - "prost-derive", "tokio", "tokio-stream", - "tokio-util", "tower", "tower-layer", "tower-service", "tracing", - "tracing-futures", -] - -[[package]] -name = "tonic-build" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bf5e9b9c0f7e0a7c027dcfaba7b2c60816c7049171f679d99ee2ff65d0de8c4" -dependencies = [ - "prettyplease", - "proc-macro2", - "prost-build", - "quote", - "syn 1.0.109", ] [[package]] @@ -2711,16 +2563,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-futures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" -dependencies = [ - "pin-project", - "tracing", -] - [[package]] name = "tracing-log" version = "0.1.3" @@ -2734,9 +2576,9 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.18.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21ebb87a95ea13271332df069020513ab70bdb5637ca42d6e492dc3bbbad48de" +checksum = "fc09e402904a5261e42cf27aea09ccb7d5318c6717a9eec3d8e2e65c56b18f19" dependencies = [ "once_cell", "opentelemetry", @@ -2845,6 +2687,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.1" @@ -2906,9 +2754,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2916,16 +2764,16 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", "wasm-bindgen-shared", ] @@ -2943,9 +2791,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2953,22 +2801,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" @@ -2990,17 +2838,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "which" -version = "4.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" -dependencies = [ - "either", - "libc", - "once_cell", -] - [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index f219e640bc..016422bf25 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -178,8 +178,8 @@ enum_dispatch = "0.3.11" fs_at = "0.1.6" lazy_static = "1" once_cell = "1.18.0" -opentelemetry = { version = "0.18.0", features = ["rt-tokio"] } -opentelemetry-otlp = { version = "0.11.0" } +opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } +opentelemetry-otlp = { version = "0.13.0" } proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.7" @@ -189,7 +189,7 @@ tokio = { version = "1.26.0", default-features = false, features = [ "rt-multi-thread", ] } tracing = "0.1" -tracing-opentelemetry = { version = "0.18.0" } +tracing-opentelemetry = { version = "0.20.0" } tracing-subscriber = "0.3.16" url = "2.4" walkdir = "2" From af8977d975c4c93fe89b7e874e06147781d17d24 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 15 Aug 2023 09:01:41 +0200 Subject: [PATCH 057/229] Configure automerge in Renovate This should merge test-passing branches with the following policy: - Anything that is just a lockfile update - Minor version bumps of direct dependencies that are > version 1.0.0 - Patch version bumps of direct dependencies that are < version 1.0.0 --- .github/renovate.json | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index 700adabc38..c309fbb86d 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -7,7 +7,8 @@ "dependencies" ], "lockFileMaintenance": { - "enabled": true + "enabled": true, + "automerge": true }, "prCreation": "not-pending", "rangeStrategy": "replace", @@ -23,6 +24,21 @@ "opentelemetry" ], "groupName": "opentelemetry" + }, + { + "matchUpdateTypes": [ + "minor", + "patch" + ], + "matchCurrentVersion": "!/^0/", + "automerge": true + }, + { + "matchUpdateTypes": [ + "patch" + ], + "matchCurrentVersion": "/^0\\./", + "automerge": true } ] } \ No newline at end of file From e2c2cf8de62e4ce9001507236fb1d577b921662c Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 15 Aug 2023 09:45:10 +0800 Subject: [PATCH 058/229] Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code --- rustup-init.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index 7e8de44ea5..e783bcfa61 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -261,11 +261,22 @@ get_architecture() { # get the real answer, but that's hard to ensure, so instead we use # `sysctl` (which doesn't lie) to check for the actual architecture. if [ "$_cputype" = i386 ]; then - if sysctl hw.optional.x86_64 | grep -q ': 1'; then + # Handling i386 compatibility mode in older macOS versions (<10.15) + # running on x86_64-based Macs. + # Starting from 10.15, macOS explicitly bans all i386 binaries from running. + # See: + + # Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code. + if sysctl hw.optional.x86_64 2> /dev/null || true | grep -q ': 1'; then _cputype=x86_64 fi elif [ "$_cputype" = x86_64 ]; then - if sysctl hw.optional.arm64 | grep -q ': 1'; then + # Handling x86-64 compatibility mode (a.k.a. Rosetta 2) + # in newer macOS versions (>=11) running on arm64-based Macs. + # Rosetta 2 is built exclusively for x86-64 and cannot run i386 binaries. + + # Avoid `sysctl: unknown oid` stderr output and/or non-zero exit code. + if sysctl hw.optional.arm64 2> /dev/null || true | grep -q ': 1'; then _cputype=arm64 fi fi From d861ebac57ce68d6e3288ba645b0a62e8393dd20 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 16 Aug 2023 19:19:17 +0800 Subject: [PATCH 059/229] Refine suggestions of sourcing `$HOME/.cargo/env` --- src/cli/self_update.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 3399943f0c..9dcee209e9 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -224,8 +224,14 @@ To get started you may need to restart your current shell. This would reload your `PATH` environment variable to include Cargo's bin directory ({cargo_home}/bin). -To configure your current shell, run: +To configure your current shell, you need to source +the `env` file ({cargo_home}/env). + +This is usually done by running: source "{cargo_home}/env" + +The `source` command above might need to be replaced with `.` +on shells like `ash`, `dash` and `pdksh`. "# }; } @@ -251,8 +257,14 @@ macro_rules! post_install_msg_unix_no_modify_path { To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` environment variable. This has not been done automatically. -To configure your current shell, run: +To configure your current shell, you need to source +the `env` file ({cargo_home}/env). + +This is usually done by running: source "{cargo_home}/env" + +The `source` command above might need to be replaced with `.` +on shells like `ash`, `dash` and `pdksh`. "# }; } From c6b90ff346c465096c1757d0726419f23a7e92b0 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 16 Aug 2023 16:21:24 +0200 Subject: [PATCH 060/229] Avoid installing protoc for most CI workflows It seems like it should only be needed for the all-features workflow, which enables `otel` via `--all-features`. Because we get rate-limited by something inside the setup-protoc Action, this is a fairly frequent source of spurious CI failures. --- .github/workflows/centos-fmt-clippy-on-all.yaml | 4 ---- .github/workflows/linux-builds-on-master.yaml | 4 ---- .github/workflows/linux-builds-on-pr.yaml | 4 ---- .github/workflows/linux-builds-on-stable.yaml | 4 ---- ci/actions-templates/centos-fmt-clippy-template.yaml | 4 ---- ci/actions-templates/linux-builds-template.yaml | 4 ---- 6 files changed, 24 deletions(-) diff --git a/.github/workflows/centos-fmt-clippy-on-all.yaml b/.github/workflows/centos-fmt-clippy-on-all.yaml index 47f1ca8d06..23baf85778 100644 --- a/.github/workflows/centos-fmt-clippy-on-all.yaml +++ b/.github/workflows/centos-fmt-clippy-on-all.yaml @@ -72,10 +72,6 @@ jobs: run: | rustup component add rustfmt rustup component add clippy - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - name: Run the centos check within the docker image run: | docker run \ diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml index 1eab933359..c037f90fcc 100644 --- a/.github/workflows/linux-builds-on-master.yaml +++ b/.github/workflows/linux-builds-on-master.yaml @@ -98,10 +98,6 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml index da3da8c630..d5ee9e8cd2 100644 --- a/.github/workflows/linux-builds-on-pr.yaml +++ b/.github/workflows/linux-builds-on-pr.yaml @@ -92,10 +92,6 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml index a6cf6f68d0..a345983b0a 100644 --- a/.github/workflows/linux-builds-on-stable.yaml +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -122,10 +122,6 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index 47f1ca8d06..23baf85778 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -72,10 +72,6 @@ jobs: run: | rustup component add rustfmt rustup component add clippy - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - name: Run the centos check within the docker image run: | docker run \ diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 9992d72569..5740f01182 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -131,10 +131,6 @@ jobs: echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then From dab4516ea4d0765dc3409bbcd0b8ea1a9233660e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 17 Aug 2023 10:06:50 +0200 Subject: [PATCH 061/229] Authenticate when installing protoc In order to avoid getting rate limited. --- .github/workflows/all-features.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/all-features.yaml b/.github/workflows/all-features.yaml index beb62cece6..f3ea972461 100644 --- a/.github/workflows/all-features.yaml +++ b/.github/workflows/all-features.yaml @@ -30,6 +30,7 @@ jobs: uses: arduino/setup-protoc@v1 with: version: "3.x" + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Set environment variables appropriately for the build run: | echo "$HOME/.cargo/bin" >> $GITHUB_PATH From 6e54dcc75a9e0841483388adba18b8e1d0f330c8 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 15 Aug 2023 13:17:21 +0200 Subject: [PATCH 062/229] Refactor: Use download_cfg.notify_handler in update() All calls to update() were just passing it in already. --- src/dist/dist.rs | 1 - src/dist/manifestation.rs | 39 +++++++++++++++++++++------------ src/dist/manifestation/tests.rs | 1 - src/toolchain/distributable.rs | 2 -- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index cfbdc68fec..97093a21c1 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -927,7 +927,6 @@ fn try_update_from_dist_( changes, force_update, &download, - &download.notify_handler, &toolchain.manifest_name(), true, ) { diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index fa2e5c92b2..8b66ca47b0 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -106,7 +106,6 @@ impl Manifestation { changes: Changes, force_update: bool, download_cfg: &DownloadCfg<'_>, - notify_handler: &dyn Fn(Notification<'_>), toolchain_str: &str, implicit_modify: bool, ) -> Result { @@ -118,8 +117,13 @@ impl Manifestation { // Create the lists of components needed for installation let config = self.read_config()?; - let mut update = - Update::build_update(self, new_manifest, &changes, &config, notify_handler)?; + let mut update = Update::build_update( + self, + new_manifest, + &changes, + &config, + &download_cfg.notify_handler, + )?; if update.nothing_changes() { return Ok(UpdateStatus::Unchanged); @@ -134,9 +138,11 @@ impl Manifestation { e.downcast::() { for component in &components { - notify_handler(Notification::ForcingUnavailableComponent( - component.name(new_manifest).as_str(), - )); + (download_cfg.notify_handler)( + Notification::ForcingUnavailableComponent( + component.name(new_manifest).as_str(), + ), + ); } update.drop_components_to_install(&components); } @@ -161,7 +167,7 @@ impl Manifestation { .unwrap_or(DEFAULT_MAX_RETRIES); for (component, format, url, hash) in components { - notify_handler(Notification::DownloadingComponent( + (download_cfg.notify_handler)(Notification::DownloadingComponent( &component.short_name(new_manifest), &self.target_triple, component.target.as_ref(), @@ -180,11 +186,11 @@ impl Manifestation { Err(e) => { match e.downcast_ref::() { Some(RustupError::BrokenPartialFile) => { - notify_handler(Notification::RetryingDownload(&url)); + (download_cfg.notify_handler)(Notification::RetryingDownload(&url)); return OperationResult::Retry(OperationError(e)); } Some(RustupError::DownloadingFile { .. }) => { - notify_handler(Notification::RetryingDownload(&url)); + (download_cfg.notify_handler)(Notification::RetryingDownload(&url)); return OperationResult::Retry(OperationError(e)); } Some(_) => return OperationResult::Err(OperationError(e)), @@ -202,7 +208,7 @@ impl Manifestation { } // Begin transaction - let mut tx = Transaction::new(prefix.clone(), temp_cfg, notify_handler); + let mut tx = Transaction::new(prefix.clone(), temp_cfg, download_cfg.notify_handler); // If the previous installation was from a v1 manifest we need // to uninstall it first. @@ -215,13 +221,18 @@ impl Manifestation { } else { Notification::RemovingComponent }; - notify_handler(notification( + (download_cfg.notify_handler)(notification( &component.short_name(new_manifest), &self.target_triple, component.target.as_ref(), )); - tx = self.uninstall_component(component, new_manifest, tx, ¬ify_handler)?; + tx = self.uninstall_component( + component, + new_manifest, + tx, + &download_cfg.notify_handler, + )?; } // Install components @@ -234,14 +245,14 @@ impl Manifestation { let short_pkg_name = component.short_name_in_manifest(); let short_name = component.short_name(new_manifest); - notify_handler(Notification::InstallingComponent( + (download_cfg.notify_handler)(Notification::InstallingComponent( &short_name, &self.target_triple, component.target.as_ref(), )); let notification_converter = |notification: crate::utils::Notification<'_>| { - notify_handler(notification.into()); + (download_cfg.notify_handler)(notification.into()); }; let gz; let xz; diff --git a/src/dist/manifestation/tests.rs b/src/dist/manifestation/tests.rs index 9a9de1217b..7dd9180525 100644 --- a/src/dist/manifestation/tests.rs +++ b/src/dist/manifestation/tests.rs @@ -466,7 +466,6 @@ fn update_from_dist( changes, force, download_cfg, - download_cfg.notify_handler, &toolchain.manifest_name(), true, ) diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 7635e6234d..eae0750ce1 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -108,7 +108,6 @@ impl<'a> DistributableToolchain<'a> { changes, false, &download_cfg, - &download_cfg.notify_handler, &self.desc.manifest_name(), false, )?; @@ -500,7 +499,6 @@ impl<'a> DistributableToolchain<'a> { changes, false, &download_cfg, - &download_cfg.notify_handler, &self.desc.manifest_name(), false, )?; From f0bf690e9fd4a4c84f97eae7e90236d44c335db6 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Wed, 31 May 2023 22:44:15 +0200 Subject: [PATCH 063/229] Improve CI debugability The call count assertion is binary; the failure explanation could be varied --- download/tests/read-proxy-env.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/download/tests/read-proxy-env.rs b/download/tests/read-proxy-env.rs index 1f0893a659..c6b8c72074 100644 --- a/download/tests/read-proxy-env.rs +++ b/download/tests/read-proxy-env.rs @@ -72,8 +72,12 @@ fn socks_proxy_request() { if let Err(e) = res { let s = e.source().unwrap(); + assert!( + s.to_string().contains("socks connect error"), + "Expected socks connect error, got: {}", + s.to_string() + ); assert_eq!(CALL_COUNT.load(Ordering::SeqCst), 1); - assert!(s.to_string().contains("socks connect error")); } else { panic!("Socks proxy was ignored") } From 37ea4e10c34075c0aab223464098553775c662ce Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Wed, 16 Aug 2023 20:56:06 +0200 Subject: [PATCH 064/229] Fix handling of async tests The ident parsing was broken. --- rustup-macros/src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rustup-macros/src/lib.rs b/rustup-macros/src/lib.rs index 247f480c98..3e1531c7c1 100644 --- a/rustup-macros/src/lib.rs +++ b/rustup-macros/src/lib.rs @@ -2,7 +2,6 @@ use ::quote::quote; use proc_macro2::TokenStream; -use quote::format_ident; use syn::{parse_macro_input, parse_quote, Block, Expr, ItemFn, LitStr}; /// Custom wrapper macro around `#[test]` and `#[tokio::test]`. @@ -80,8 +79,10 @@ pub fn unit_test( fn test_inner(mod_path: String, mut input: ItemFn) -> syn::Result { if input.sig.asyncness.is_some() { - let before_ident = format_ident!("{}::before_test_async", mod_path); - let after_ident = format_ident!("{}::after_test_async", mod_path); + let before_ident = format!("{}::before_test_async", mod_path); + let before_ident = syn::parse_str::(&before_ident)?; + let after_ident = format!("{}::after_test_async", mod_path); + let after_ident = syn::parse_str::(&after_ident)?; let inner = input.block; let name = input.sig.ident.clone(); From eec97f3227eaaf1fb620ce5ff6277b963acfaf98 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Wed, 16 Aug 2023 19:32:19 +0200 Subject: [PATCH 065/229] Return the right lifetime from DistributableToolchain::install With Self this infers an lifetime of '_ rather than 'a, which leads to a compile error when the function is made async. --- src/toolchain/distributable.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 7635e6234d..de29b10e77 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -320,7 +320,7 @@ impl<'a> DistributableToolchain<'a> { targets: &[&str], profile: Profile, force: bool, - ) -> anyhow::Result<(UpdateStatus, Self)> { + ) -> anyhow::Result<(UpdateStatus, DistributableToolchain<'a>)> { let hash_path = cfg.get_hash_file(desc, true)?; let update_hash = Some(&hash_path as &Path); From 8979be2d273414a97689566cb3e1a877eff54afb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 00:35:59 +0000 Subject: [PATCH 066/229] Update Rust crate tempfile to 3.8 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e5422d488c..130fdd020f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2220,9 +2220,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.7.1" +version = "3.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" +checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if 1.0.0", "fastrand", diff --git a/Cargo.toml b/Cargo.toml index 016422bf25..6f7922393d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -182,7 +182,7 @@ opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.13.0" } proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } -tempfile = "3.7" +tempfile = "3.8" termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = [ From bbffdab6e76c608ae062dc29b8f68e404ae57ed2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 19 Aug 2023 18:59:37 +0000 Subject: [PATCH 067/229] Lock file maintenance --- Cargo.lock | 698 ++++++++++++++++++++++++++++------------------------- 1 file changed, 368 insertions(+), 330 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 130fdd020f..cf697e9f52 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,15 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -10,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.1" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67fc08ce920c31afb70f013dcce1bfc3a3195de6a228474e45e1f145b36f8d04" +checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" dependencies = [ "memchr", ] @@ -49,15 +58,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d" +checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" [[package]] name = "anstyle-parse" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee" +checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" dependencies = [ "utf8parse", ] @@ -73,9 +82,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -83,9 +92,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "as-slice" @@ -98,9 +107,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.3.15" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" +checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" dependencies = [ "flate2", "futures-core", @@ -111,13 +120,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.68" +version = "0.1.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" +checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] @@ -139,9 +148,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "axum" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8175979259124331c1d7bf6586ee7e0da434155e4b2d48ec2c8386281d8df39" +checksum = "3b829e4e32b91e643de6eafe82b1d90675f5874230191a4ffbc1b336dec4d6bf" dependencies = [ "async-trait", "axum-core", @@ -182,11 +191,26 @@ dependencies = [ "tower-service", ] +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if 1.0.0", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "bit-set" @@ -211,9 +235,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" +checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" [[package]] name = "block-buffer" @@ -226,21 +250,20 @@ dependencies = [ [[package]] name = "bstr" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d4260bcc2e8fc9df1eac4919a720effeb63a3f0952f5bf4944adfa18897f09" +checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" dependencies = [ "memchr", - "once_cell", - "regex-automata", + "regex-automata 0.3.6", "serde", ] [[package]] name = "bumpalo" -version = "3.12.1" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byteorder" @@ -256,11 +279,12 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.79" +version = "1.0.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" +checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" dependencies = [ "jobserver", + "libc", ] [[package]] @@ -294,7 +318,7 @@ dependencies = [ "atty", "bitflags 1.3.2", "clap_lex", - "indexmap", + "indexmap 1.9.3", "strsim", "termcolor", "terminal_size", @@ -352,9 +376,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.7" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" dependencies = [ "libc", ] @@ -391,9 +415,9 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.14" +version = "0.9.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46bd5f3f85273295a9d14aedfb86f6aadbff6d8f5295c4a9edb08e819dcf5695" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" dependencies = [ "autocfg", "cfg-if 1.0.0", @@ -404,9 +428,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.15" +version = "0.8.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" +checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" dependencies = [ "cfg-if 1.0.0", ] @@ -432,15 +456,15 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "socket2", + "socket2 0.4.9", "winapi", ] [[package]] name = "curl-sys" -version = "0.4.61+curl-8.0.1" +version = "0.4.65+curl-8.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14d05c10f541ae6f3bc5b3d923c20001f47db7d5f0b2bc6ad16490133842db79" +checksum = "961ba061c9ef2fe34bbd12b807152d96f0badd2bebe7b90ce6c8c8b7572a0986" dependencies = [ "cc", "libc", @@ -460,6 +484,12 @@ dependencies = [ "cfg-if 1.0.0", ] +[[package]] +name = "deranged" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" + [[package]] name = "derivative" version = "2.2.0" @@ -473,9 +503,9 @@ dependencies = [ [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", "crypto-common", @@ -518,9 +548,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.1" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encoding_rs" @@ -533,34 +563,34 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "988f0d17a0fa38291e5f41f71ea8d46a5d5497b9054d5a759fae2cbb819f2356" +checksum = "9705d8de4776df900a4a0b2384f8b0ab42f775e93b083b42f8ce71bdc32a47e3" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.11.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4da76b3b6116d758c7ba93f7ec6a35d2e2cf24feda76c6e38a375f4d5c59f2" +checksum = "ccb14d927583dd5c2eac0f2cf264fc4762aefe1ae14c47a8a20fc1939d3a5fc0" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] name = "enum_dispatch" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11f36e95862220b211a6e2aa5eca09b4fa391b13cd52ceb8035a24bf65a79de2" +checksum = "8f33313078bb8d4d05a2733a94ac4c2d8a0df9a2b84424ebf4f33bfc224a890e" dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] @@ -573,11 +603,17 @@ dependencies = [ "url", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" dependencies = [ "errno-dragonfly", "libc", @@ -602,21 +638,21 @@ checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" [[package]] name = "filetime" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" +checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.16", + "redox_syscall", "windows-sys 0.48.0", ] [[package]] name = "flate2" -version = "1.0.26" +version = "1.0.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b9429470923de8e8cbd4d2dc513535400b4b3fef0319fb5c4e1f520a7bef743" +checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" dependencies = [ "crc32fast", "miniz_oxide", @@ -654,16 +690,15 @@ dependencies = [ [[package]] name = "fs_at" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0504bab20f4487fdf1c20ed48e3e32c7951827a778cd3dfded1768f90b6abb0a" +checksum = "15550ecca96ea332ec143fb450701074143b70d358e50b32b1f847ccff2e1cf7" dependencies = [ "aligned", "cfg-if 1.0.0", "cvt", "libc", "nix", - "smart-default", "windows-sys 0.48.0", ] @@ -707,7 +742,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] @@ -751,15 +786,21 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if 1.0.0", "libc", "wasi", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "git-testament" version = "0.2.4" @@ -791,9 +832,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.18" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -801,7 +842,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -815,28 +856,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "hermit-abi" -version = "0.1.19" +name = "hashbrown" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.1.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" dependencies = [ "libc", ] [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" [[package]] name = "home" @@ -877,9 +915,9 @@ checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" [[package]] name = "httpdate" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "humantime" @@ -899,9 +937,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.26" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -914,7 +952,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2", + "socket2 0.4.9", "tokio", "tower-service", "tracing", @@ -923,10 +961,11 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" dependencies = [ + "futures-util", "http", "hyper", "rustls", @@ -976,35 +1015,44 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] name = "io-lifetimes" -version = "1.0.10" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.3.2", "libc", "windows-sys 0.48.0", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "is-terminal" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" +checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix 0.37.18", + "hermit-abi 0.3.2", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1019,9 +1067,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.6" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" +checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" @@ -1055,15 +1103,15 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libm" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "libz-sys" -version = "1.1.9" +version = "1.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" +checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" dependencies = [ "cc", "libc", @@ -1085,12 +1133,9 @@ checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" [[package]] name = "log" -version = "0.4.17" +version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "lzma-sys" @@ -1109,14 +1154,14 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ - "regex-automata", + "regex-automata 0.1.10", ] [[package]] name = "matchit" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b87248edafb776e59e6ee64a79086f65890d3510f2c656c000bf2a7e8a0aea40" +checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" [[package]] name = "memchr" @@ -1126,9 +1171,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "memoffset" -version = "0.8.0" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d61c719bcfbcf5d62b3a09efa6088de8c54bc0bfcd3ea7ae39fcc186108b8de1" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" dependencies = [ "autocfg", ] @@ -1150,14 +1195,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1223,9 +1267,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" +checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" dependencies = [ "autocfg", "libm", @@ -1233,14 +1277,23 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.2", "libc", ] +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" version = "1.18.0" @@ -1260,9 +1313,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.55" +version = "0.10.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "345df152bc43501c5eb9e4654ff05f794effb78d4efe3d53abc158baddc0703d" +checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", @@ -1281,7 +1334,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] @@ -1292,18 +1345,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.25.3+1.1.1t" +version = "111.27.0+1.1.1v" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "924757a6a226bf60da5f7dd0311a34d2b52283dd82ddeb103208ddc66362f80c" +checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.90" +version = "0.9.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" +checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" dependencies = [ "cc", "libc", @@ -1370,7 +1423,7 @@ checksum = "8a81f725323db1b1206ca3da8bb19874bbd3f57c3bcd59471bfb04525b265b9b" dependencies = [ "futures-channel", "futures-util", - "indexmap", + "indexmap 1.9.3", "js-sys", "once_cell", "pin-project-lite", @@ -1403,9 +1456,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.7.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fc2dbde8f8a79f2102cc474ceb0ad68e3b80b85289ea62389b60e66777e4213" +checksum = "126d3e6f3926bfb0fb24495b4f4da50626f547e54956594748e3d8882a0320b4" dependencies = [ "num-traits", ] @@ -1422,9 +1475,9 @@ dependencies = [ [[package]] name = "os_str_bytes" -version = "6.5.0" +version = "6.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ceedf44fb00f2d1984b0bc98102627ce622e083e49a5bacdb3e514fa4238e267" +checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" [[package]] name = "overload" @@ -1440,29 +1493,29 @@ checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.29", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" [[package]] name = "pin-utils" @@ -1484,25 +1537,24 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.63" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" +checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", - "quick-error 2.0.1", "rand", "rand_chacha", "rand_xorshift", @@ -1537,9 +1589,9 @@ dependencies = [ [[package]] name = "pulldown-cmark" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d9cc634bc78768157b5cbfe988ffcd1dcba95cd2b2f03a88316c08c6d00ed63" +checksum = "77a1a2f1f0a7ecff9c31abbe177637be0e97a0aef46cf8738ece09327985d998" dependencies = [ "bitflags 1.3.2", "memchr", @@ -1552,17 +1604,11 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quote" -version = "1.0.26" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" dependencies = [ "proc-macro2", ] @@ -1628,15 +1674,6 @@ dependencies = [ "num_cpus", ] -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.3.5" @@ -1648,13 +1685,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.8.1" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af83e617f331cc6ae2da5443c602dfa5af81e517212d9d611a5b3ba1777b5370" +checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.1", + "regex-automata 0.3.6", + "regex-syntax 0.7.4", ] [[package]] @@ -1666,6 +1704,17 @@ dependencies = [ "regex-syntax 0.6.29", ] +[[package]] +name = "regex-automata" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.7.4", +] + [[package]] name = "regex-syntax" version = "0.6.29" @@ -1674,9 +1723,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.1" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5996294f19bd3aae0453a862ad728f60e6600695733dd5df01da90c54363a3c" +checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" [[package]] name = "remove_dir_all" @@ -1697,9 +1746,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.17" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13293b639a097af28fc8a90f22add145a9c954e49d77da06263d58cf44d5fb91" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ "async-compression", "base64", @@ -1774,11 +1823,17 @@ dependencies = [ "serde_json", ] +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustix" -version = "0.37.18" +version = "0.37.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bbfc1d1c7c40c01715f47d71444744a81669ca84e8b63e25a55e169b1f86433" +checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" dependencies = [ "bitflags 1.3.2", "errno", @@ -1790,11 +1845,11 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.7" +version = "0.38.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172891ebdceb05aa0005f533a6cbfca599ddd7d966f6f5d4d9b2e70478e70399" +checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" dependencies = [ - "bitflags 2.3.3", + "bitflags 2.4.0", "errno", "libc", "linux-raw-sys 0.4.5", @@ -1803,21 +1858,21 @@ dependencies = [ [[package]] name = "rustls" -version = "0.20.8" +version = "0.21.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" dependencies = [ "log", "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] name = "rustls-native-certs" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0167bac7a9f490495f3c33013e7722b53cb087ecbe082fb0c6387c96f634ea50" +checksum = "a9aace74cb666635c918e9c12bc0d348266037aa8eb599b5cba565709a8dff00" dependencies = [ "openssl-probe", "rustls-pemfile", @@ -1827,13 +1882,23 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" dependencies = [ "base64", ] +[[package]] +name = "rustls-webpki" +version = "0.101.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +dependencies = [ + "ring", + "untrusted", +] + [[package]] name = "rustup" version = "1.26.0" @@ -1904,14 +1969,14 @@ dependencies = [ "quote", "regex", "sha2", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] name = "rustversion" -version = "1.0.12" +version = "1.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" +checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "rusty-fork" @@ -1920,16 +1985,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" dependencies = [ "fnv", - "quick-error 1.2.3", + "quick-error", "tempfile", "wait-timeout", ] [[package]] name = "ryu" -version = "1.0.13" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" +checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" [[package]] name = "same-file" @@ -1942,18 +2007,18 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.21" +version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" +checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" dependencies = [ - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] name = "scopeguard" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" @@ -1967,9 +2032,9 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.8.2" +version = "2.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" +checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" dependencies = [ "bitflags 1.3.2", "core-foundation", @@ -1980,9 +2045,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.8.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" +checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" dependencies = [ "core-foundation-sys", "libc", @@ -1990,35 +2055,35 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" +checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" dependencies = [ "itoa", "ryu", @@ -2027,9 +2092,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0efd8caf556a6cebd3b285caf480045fcc1ac04f6bd786b09a6f11af30c4fcf4" +checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" dependencies = [ "serde", ] @@ -2048,9 +2113,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -2089,20 +2154,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "smart-default" -version = "0.7.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eb01866308440fc64d6c44d9e86c5cc17adfe33c4d6eed55da9145044d0ffc1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] +checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "snapbox" @@ -2145,6 +2199,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "socket2" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "spin" version = "0.5.2" @@ -2182,9 +2246,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.15" +version = "2.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" dependencies = [ "proc-macro2", "quote", @@ -2209,9 +2273,9 @@ dependencies = [ [[package]] name = "tar" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b55807c0344e1e6c04d7c965f5289c39a8d94ae23ed5c0b57aabac549f871c6" +checksum = "b16afcea1f22891c49a00c751c7b63b2233284064f11a200fc624137c51e2ddb" dependencies = [ "filetime", "libc", @@ -2226,8 +2290,8 @@ checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" dependencies = [ "cfg-if 1.0.0", "fastrand", - "redox_syscall 0.3.5", - "rustix 0.38.7", + "redox_syscall", + "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -2246,7 +2310,7 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" dependencies = [ - "rustix 0.37.18", + "rustix 0.37.23", "windows-sys 0.48.0", ] @@ -2261,22 +2325,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.40" +version = "1.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] @@ -2300,10 +2364,11 @@ dependencies = [ [[package]] name = "time" -version = "0.3.20" +version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +checksum = "a79d09ac6b08c1ab3906a2f7cc2e81a0e27c7ae89c63812df75e52bef0751e07" dependencies = [ + "deranged", "itoa", "serde", "time-core", @@ -2312,15 +2377,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" +checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.8" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +checksum = "75c65469ed6b3a4809d987a41eb1dc918e9bc1d92211cbad7ae82931846f7451" dependencies = [ "time-core", ] @@ -2342,17 +2407,17 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.0" +version = "1.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" +checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", "mio", "num_cpus", "pin-project-lite", - "socket2", + "socket2 0.5.3", "tokio-macros", "windows-sys 0.48.0", ] @@ -2375,7 +2440,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] @@ -2390,13 +2455,12 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", "tokio", - "webpki", ] [[package]] @@ -2438,9 +2502,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.3" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b403acf6f2bb0859c93c7f0d967cb4a75a7ac552100f9322faf64dc047669b21" +checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" dependencies = [ "serde", "serde_spanned", @@ -2450,20 +2514,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" dependencies = [ - "indexmap", + "indexmap 2.0.0", "serde", "serde_spanned", "toml_datetime", @@ -2506,7 +2570,7 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap", + "indexmap 1.9.3", "pin-project", "pin-project-lite", "rand", @@ -2544,20 +2608,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f57e3ca2a01450b1a921183a9c9cbfda207fd822cef4ccb00a65402cbba7a74" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", "valuable", @@ -2657,9 +2721,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" [[package]] name = "unicode-normalization" @@ -2738,11 +2802,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -2773,15 +2836,15 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -2807,7 +2870,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.15", + "syn 2.0.29", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2820,24 +2883,14 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "winapi" version = "0.3.9" @@ -2869,21 +2922,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -2899,7 +2937,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -2919,17 +2957,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -2940,9 +2978,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -2952,9 +2990,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -2964,9 +3002,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -2976,9 +3014,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -2988,9 +3026,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -3000,9 +3038,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -3012,15 +3050,15 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.4.6" +version = "0.5.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61de7bac303dc551fe038e2b3cef0f571087a47571ea6e79a87692ac99b99699" +checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" dependencies = [ "memchr", ] @@ -3046,9 +3084,9 @@ dependencies = [ [[package]] name = "xattr" -version = "0.2.3" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc" +checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" dependencies = [ "libc", ] @@ -3064,18 +3102,18 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.3+zstd.1.5.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76eea132fb024e0e13fd9c2f5d5d595d8a967aa72382ac2f9d39fcc95afd0806" +checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.5+zstd.1.5.4" +version = "6.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d56d9e60b4b1758206c238a10165fbcae3ca37b01744e394c463463f6529d23b" +checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" dependencies = [ "libc", "zstd-sys", From 5d85278d099f84713ea383e5cc99c38b1edbe8a0 Mon Sep 17 00:00:00 2001 From: klensy Date: Wed, 23 Aug 2023 15:39:46 +0300 Subject: [PATCH 068/229] buf writes to components --- src/dist/component/components.rs | 3 ++- src/utils/utils.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dist/component/components.rs b/src/dist/component/components.rs index 2f5e1d4056..4e2f948fc3 100644 --- a/src/dist/component/components.rs +++ b/src/dist/component/components.rs @@ -2,6 +2,7 @@ //! `Components` and `DirectoryPackage` are the two sides of the //! installation / uninstallation process. +use std::io::BufWriter; use std::path::{Path, PathBuf}; use anyhow::{bail, Result}; @@ -122,7 +123,7 @@ impl<'a> ComponentBuilder<'a> { // Write component manifest let path = self.components.rel_component_manifest(&self.name); let abs_path = self.components.prefix.abs_path(&path); - let mut file = self.tx.add_file(&self.name, path)?; + let mut file = BufWriter::new(self.tx.add_file(&self.name, path)?); for part in self.parts { // FIXME: This writes relative paths to the component manifest, // but rust-installer writes absolute paths. diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 161d394685..36be5a19c7 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -64,7 +64,7 @@ pub(crate) fn append_file(name: &'static str, path: &Path, line: &str) -> Result pub(crate) fn write_line( name: &'static str, - file: &mut File, + mut file: impl Write, path: &Path, line: &str, ) -> Result<()> { From b9ef6537858c671fed7e5ed170bdccdaff727e93 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 17:13:58 +0000 Subject: [PATCH 069/229] Update Rust crate tracing-opentelemetry to 0.21.0 --- Cargo.lock | 6 ++++-- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf697e9f52..7d15f25845 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2640,12 +2640,14 @@ dependencies = [ [[package]] name = "tracing-opentelemetry" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc09e402904a5261e42cf27aea09ccb7d5318c6717a9eec3d8e2e65c56b18f19" +checksum = "75327c6b667828ddc28f5e3f169036cb793c3f588d83bf0f262a7f062ffed3c8" dependencies = [ "once_cell", "opentelemetry", + "opentelemetry_sdk", + "smallvec", "tracing", "tracing-core", "tracing-log", diff --git a/Cargo.toml b/Cargo.toml index 6f7922393d..3a43733e85 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -189,7 +189,7 @@ tokio = { version = "1.26.0", default-features = false, features = [ "rt-multi-thread", ] } tracing = "0.1" -tracing-opentelemetry = { version = "0.20.0" } +tracing-opentelemetry = { version = "0.21.0" } tracing-subscriber = "0.3.16" url = "2.4" walkdir = "2" From 4e301cc079dfdb4646de1801b071fb41914d1b11 Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 29 Aug 2023 22:19:12 +0200 Subject: [PATCH 070/229] Isolate trycmd tests from environment --- tests/suite/cli_ui.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/suite/cli_ui.rs b/tests/suite/cli_ui.rs index afa8d8831a..b619ecf113 100644 --- a/tests/suite/cli_ui.rs +++ b/tests/suite/cli_ui.rs @@ -5,12 +5,16 @@ use rustup_macros::integration_test as test; #[test] fn rustup_ui_doc_text_tests() { let t = trycmd::TestCases::new(); + let home = tempfile::TempDir::new().unwrap(); let rustup_init = trycmd::cargo::cargo_bin("rustup-init"); let rustup = trycmd::cargo::cargo_bin("rustup"); // Copy rustup-init to rustup so that the tests can run it. fs::copy(rustup_init, &rustup).unwrap(); t.register_bin("rustup", &rustup); t.case("tests/suite/cli-ui/rustup/*.toml"); + // once installed rustup asserts the presence of ~/.rustup/settings.toml if + // Config is instantiated. + t.env("HOME", home.path().to_string_lossy()); #[cfg(target_os = "windows")] { // On windows, we don't have man command, so skip the test. From 61f913315e5a711bf13fa0a563f9f55a98229fa5 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 15 Aug 2023 10:10:48 +0200 Subject: [PATCH 071/229] Avoid deprecated clap API --- Cargo.lock | 44 ++++++++++++++++++++++++++++++++++++++++++ Cargo.toml | 2 +- src/cli/rustup_mode.rs | 21 +++++++++++++------- 3 files changed, 59 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf697e9f52..f7176ea9e8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,6 +317,7 @@ checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" dependencies = [ "atty", "bitflags 1.3.2", + "clap_derive", "clap_lex", "indexmap 1.9.3", "strsim", @@ -334,6 +335,19 @@ dependencies = [ "clap", ] +[[package]] +name = "clap_derive" +version = "3.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" +dependencies = [ + "heck", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "clap_lex" version = "0.2.4" @@ -861,6 +875,12 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "hermit-abi" version = "0.1.19" @@ -1535,6 +1555,30 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" version = "1.0.66" diff --git a/Cargo.toml b/Cargo.toml index 6f7922393d..a6a5e237f5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,7 +49,7 @@ test = ["dep:once_cell", "dep:walkdir"] anyhow.workspace = true cfg-if = "1.0" chrono = { version = "0.4", default-features = false, features = ["std"] } -clap = { version = "3", features = ["wrap_help"] } +clap = { version = "3", features = ["deprecated", "wrap_help"] } clap_complete = "3" derivative.workspace = true download = { path = "download", default-features = false } diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 8dd6577750..77c8d66e27 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -253,7 +253,8 @@ pub(crate) fn cli() -> Command<'static> { .about("The Rust toolchain installer") .after_help(RUSTUP_HELP) .global_setting(AppSettings::DeriveDisplayOrder) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .arg( verbose_arg("Enable verbose output"), ) @@ -400,7 +401,8 @@ pub(crate) fn cli() -> Command<'static> { Command::new("toolchain") .about("Modify or query the installed toolchains") .after_help(TOOLCHAIN_HELP) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list") .about("List installed toolchains") @@ -508,7 +510,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("target") .about("Modify a toolchain's supported targets") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list") .about("List installed and available targets") @@ -571,7 +574,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("component") .about("Modify a toolchain's installed components") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list") .about("List installed and available components") @@ -630,7 +634,8 @@ pub(crate) fn cli() -> Command<'static> { Command::new("override") .about("Modify directory toolchain overrides") .after_help(OVERRIDE_HELP) - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("list").about("List directory toolchain overrides"), ) @@ -763,7 +768,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("self") .about("Modify the rustup installation") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand(Command::new("update").about("Download and install updates to rustup")) .subcommand( Command::new("uninstall") @@ -777,7 +783,8 @@ pub(crate) fn cli() -> Command<'static> { .subcommand( Command::new("set") .about("Alter rustup settings") - .setting(AppSettings::SubcommandRequiredElseHelp) + .subcommand_required(true) + .arg_required_else_help(true) .subcommand( Command::new("default-host") .about("The triple used to identify toolchains when not specified") From 618530addbfc3a3fc0e45624fe7d1c0503c5931d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 15 Aug 2023 10:24:36 +0200 Subject: [PATCH 072/229] Upgrade to clap 4 --- Cargo.lock | 116 +++--------------- Cargo.toml | 4 +- rustup-init.sh | 67 +++++----- src/cli/rustup_mode.rs | 96 +++++++-------- src/cli/setup_mode.rs | 18 ++- .../rustup-init_help_flag_stdout.toml | 67 +++++----- .../rustup-init_sh_help_flag_stdout.toml | 67 +++++----- .../rustup_check_cmd_help_flag_stdout.toml | 7 +- ...stup_completions_cmd_help_flag_stdout.toml | 15 ++- ...omponent_cmd_add_cmd_help_flag_stdout.toml | 17 ++- ...mponent_cmd_list_cmd_help_flag_stdout.toml | 13 +- ...onent_cmd_remove_cmd_help_flag_stdout.toml | 17 ++- .../rustup_default_cmd_help_flag_stdout.toml | 13 +- .../rustup_doc_cmd_help_flag_stdout.toml | 55 ++++----- .../cli-ui/rustup/rustup_help_cmd_stdout.toml | 52 ++++---- .../rustup/rustup_help_flag_stdout.toml | 52 ++++---- .../rustup_man_cmd_help_flag_stdout.toml | 15 ++- .../rustup/rustup_only_options_stdout.toml | 73 ++++++----- ...override_cmd_add_cmd_help_flag_stdout.toml | 15 ++- .../rustup_override_cmd_help_flag_stdout.toml | 17 ++- ...verride_cmd_list_cmd_help_flag_stdout.toml | 7 +- ...rride_cmd_remove_cmd_help_flag_stdout.toml | 11 +- ...override_cmd_set_cmd_help_flag_stdout.toml | 15 ++- ...erride_cmd_unset_cmd_help_flag_stdout.toml | 11 +- .../rustup_run_cmd_help_flag_stdout.toml | 17 ++- .../rustup_self_cmd_help_flag_stdout.toml | 17 ++- ...lf_cmd_uninstall_cmd_help_flag_stdout.toml | 9 +- ..._self_cmd_update_cmd_help_flag_stdout.toml | 7 +- ...md_upgrade-data _cmd_help_flag_stdout.toml | 7 +- ...auto-self-update_cmd_help_flag_stdout.toml | 11 +- ...cmd_default-host_cmd_help_flag_stdout.toml | 11 +- .../rustup_set_cmd_help_flag_stdout.toml | 17 ++- ..._set_cmd_profile_cmd_help_flag_stdout.toml | 11 +- ...active-toolchain_cmd_help_flag_stdout.toml | 9 +- .../rustup_show_cmd_help_flag_stdout.toml | 19 ++- ...up_show_cmd_home_cmd_help_flag_stdout.toml | 7 +- ...show_cmd_profile_cmd_help_flag_stdout.toml | 7 +- ...p_target_cmd_add_cmd_help_flag_stdout.toml | 15 ++- .../rustup_target_cmd_help_flag_stdout.toml | 17 ++- ..._target_cmd_list_cmd_help_flag_stdout.toml | 13 +- ...arget_cmd_remove_cmd_help_flag_stdout.toml | 15 ++- ...rustup_toolchain_cmd_help_flag_stdout.toml | 23 ++-- ...hain_cmd_install_cmd_help_flag_stdout.toml | 33 +++-- ...olchain_cmd_link_cmd_help_flag_stdout.toml | 13 +- ...olchain_cmd_list_cmd_help_flag_stdout.toml | 9 +- ...in_cmd_uninstall_cmd_help_flag_stdout.toml | 13 +- .../rustup/rustup_unknown_arg_stdout.toml | 4 +- .../rustup_up_cmd_help_flag_stdout.toml | 21 ++-- .../rustup_update_cmd_help_flag_stdout.toml | 21 ++-- .../rustup_upgrade_cmd_help_flag_stdout.toml | 21 ++-- .../rustup_which_cmd_help_flag_stdout.toml | 15 ++- tests/suite/cli_misc.rs | 14 +-- tests/suite/cli_self_upd.rs | 2 +- tests/suite/cli_ui.rs | 5 +- tests/suite/cli_v2.rs | 2 +- 55 files changed, 549 insertions(+), 696 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7176ea9e8..5b3e04389d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,17 +129,6 @@ dependencies = [ "syn 2.0.29", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -311,51 +300,40 @@ dependencies = [ [[package]] name = "clap" -version = "3.2.25" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ea181bf566f71cb9a5d17a59e1871af638180a18fb0035c92ae62b705207123" +checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" dependencies = [ - "atty", - "bitflags 1.3.2", - "clap_derive", - "clap_lex", - "indexmap 1.9.3", - "strsim", - "termcolor", - "terminal_size", - "textwrap", + "clap_builder", ] [[package]] -name = "clap_complete" -version = "3.2.5" +name = "clap_builder" +version = "4.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f7a2e0a962c45ce25afce14220bc24f9dade0a1787f185cecf96bfba7847cd8" +checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" dependencies = [ - "clap", + "anstream", + "anstyle", + "clap_lex", + "strsim", + "terminal_size", ] [[package]] -name = "clap_derive" -version = "3.2.25" +name = "clap_complete" +version = "4.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae6371b8bdc8b7d3959e9cf7b22d4435ef3e79e138688421ec654acf8c81b008" +checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce" dependencies = [ - "heck", - "proc-macro-error", - "proc-macro2", - "quote", - "syn 1.0.109", + "clap", ] [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] +checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" [[package]] name = "colorchoice" @@ -875,21 +853,6 @@ version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.2" @@ -1054,7 +1017,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", "windows-sys 0.48.0", ] @@ -1071,7 +1034,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "rustix 0.38.8", "windows-sys 0.48.0", ] @@ -1301,7 +1264,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.3.2", + "hermit-abi", "libc", ] @@ -1493,12 +1456,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "os_str_bytes" -version = "6.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d5d9eb14b174ee9aa2ef96dc2b94637a2d4b6e7cb873c7e171f0c20c6cf3eac" - [[package]] name = "overload" version = "0.1.1" @@ -1555,30 +1512,6 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" version = "1.0.66" @@ -2358,15 +2291,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" -dependencies = [ - "terminal_size", -] - [[package]] name = "thiserror" version = "1.0.47" diff --git a/Cargo.toml b/Cargo.toml index a6a5e237f5..feab52ff22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,8 +49,8 @@ test = ["dep:once_cell", "dep:walkdir"] anyhow.workspace = true cfg-if = "1.0" chrono = { version = "0.4", default-features = false, features = ["std"] } -clap = { version = "3", features = ["deprecated", "wrap_help"] } -clap_complete = "3" +clap = { version = "4", features = ["wrap_help"] } +clap_complete = "4" derivative.workspace = true download = { path = "download", default-features = false } effective-limits = "0.5.5" diff --git a/rustup-init.sh b/rustup-init.sh index a822c5e30d..a7701c5336 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -26,47 +26,36 @@ RUSTUP_UPDATE_ROOT="${RUSTUP_UPDATE_ROOT:-https://static.rust-lang.org/rustup}" usage() { cat < - Choose a default host triple - - --default-toolchain - Choose a default toolchain to install. Use 'none' to not install any toolchains at all - --profile - [default: default] [possible values: minimal, default, complete] - - -c, --component ... - Component name to also install - - -t, --target ... - Target name to also install - - --no-update-default-toolchain - Don't update any existing default toolchain after install - - --no-modify-path - Don't configure the PATH environment variable - - -h, --help - Print help information +The installer for rustup - -V, --version - Print version information +Usage: rustup-init[EXE] [OPTIONS] + +Options: + -v, --verbose + Enable verbose output + -q, --quiet + Disable progress output + -y + Disable confirmation prompt. + --default-host + Choose a default host triple + --default-toolchain + Choose a default toolchain to install. Use 'none' to not install any toolchains at all + --profile + [default: default] [possible values: minimal, default, complete] + -c, --component ... + Component name to also install + -t, --target ... + Target name to also install + --no-update-default-toolchain + Don't update any existing default toolchain after install + --no-modify-path + Don't configure the PATH environment variable + -h, --help + Print help + -V, --version + Print version EOF } diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 77c8d66e27..71f86581d9 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -6,8 +6,8 @@ use std::str::FromStr; use anyhow::{anyhow, Error, Result}; use clap::{ - builder::{EnumValueParser, PossibleValuesParser}, - AppSettings, Arg, ArgAction, ArgEnum, ArgGroup, ArgMatches, Command, PossibleValue, + builder::{EnumValueParser, PossibleValue, PossibleValuesParser}, + Arg, ArgAction, ArgGroup, ArgMatches, Command, ValueEnum, }; use clap_complete::Shell; @@ -89,7 +89,7 @@ where pub fn main() -> Result { self_update::cleanup_self_updater()?; - use clap::ErrorKind::*; + use clap::error::ErrorKind::*; let matches = match cli().try_get_matches_from(process().args_os()) { Ok(matches) => Ok(matches), Err(err) if err.kind() == DisplayHelp => { @@ -243,18 +243,20 @@ pub fn main() -> Result { } _ => unreachable!(), }, - None => unreachable!(), + None => { + eprintln!("{}", cli().render_long_help()); + utils::ExitCode(1) + } }) } -pub(crate) fn cli() -> Command<'static> { +pub(crate) fn cli() -> Command { let mut app = Command::new("rustup") .version(common::version()) .about("The Rust toolchain installer") + .before_help(format!("rustup {}", common::version())) .after_help(RUSTUP_HELP) - .global_setting(AppSettings::DeriveDisplayOrder) - .subcommand_required(true) - .arg_required_else_help(true) + .subcommand_required(false) .arg( verbose_arg("Enable verbose output"), ) @@ -270,10 +272,11 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("+toolchain") .help("release channel (e.g. +stable) or custom toolchain to set override") .value_parser(|s: &str| { + use clap::{Error, error::ErrorKind}; if let Some(stripped) = s.strip_prefix('+') { - ResolvableToolchainName::try_from(stripped).map_err(|e| clap::Error::raw(clap::ErrorKind::InvalidValue, e)) + ResolvableToolchainName::try_from(stripped).map_err(|e| Error::raw(ErrorKind::InvalidValue, e)) } else { - Err(clap::Error::raw(clap::ErrorKind::InvalidSubcommand, format!("\"{s}\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. {TOOLCHAIN_OVERRIDE_ERROR}"))) + Err(Error::raw(ErrorKind::InvalidSubcommand, format!("\"{s}\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. {TOOLCHAIN_OVERRIDE_ERROR}"))) } }), ) @@ -313,14 +316,13 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(true) .value_parser(partial_toolchain_desc_parser) - .takes_value(true) - .multiple_values(true) + .num_args(1..) ) .arg( Arg::new("profile") .long("profile") .value_parser(PossibleValuesParser::new(Profile::names())) - .takes_value(true), + .num_args(1), ) .arg( Arg::new("no-self-update") @@ -349,8 +351,7 @@ pub(crate) fn cli() -> Command<'static> { .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) .value_parser(resolvable_toolchainame_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ), ) .subcommand( @@ -363,8 +364,7 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(false) .value_parser(partial_toolchain_desc_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ) .arg( Arg::new("no-self-update") @@ -419,22 +419,20 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .required(true) .value_parser( partial_toolchain_desc_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ) .arg( Arg::new("profile") .long("profile") .value_parser(PossibleValuesParser::new(Profile::names())) - .takes_value(true), + .num_args(1), ) .arg( Arg::new("components") .help("Add specific components on installation") .long("component") .short('c') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -443,8 +441,7 @@ pub(crate) fn cli() -> Command<'static> { .help("Add specific targets on installation") .long("target") .short('t') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -455,7 +452,6 @@ pub(crate) fn cli() -> Command<'static> { `rustup toolchain install` command", ) .long("no-self-update") - .takes_value(true) .action(ArgAction::SetTrue) ) .arg( @@ -486,8 +482,7 @@ pub(crate) fn cli() -> Command<'static> { .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) .value_parser(resolvable_toolchainame_parser) - .takes_value(true) - .multiple_values(true), + .num_args(1..) ), ) .subcommand( @@ -520,7 +515,7 @@ pub(crate) fn cli() -> Command<'static> { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") .value_parser(partial_toolchain_desc_parser) - .takes_value(true), + .num_args(1), ) .arg( Arg::new("installed") @@ -536,8 +531,7 @@ pub(crate) fn cli() -> Command<'static> { .arg( Arg::new("target") .required(true) - .takes_value(true) - .multiple_values(true) + .num_args(1..) .help( "List of targets to install; \ \"all\" installs all available targets" @@ -547,7 +541,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ), ) @@ -559,14 +553,13 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("target") .help("List of targets to uninstall") .required(true) - .takes_value(true) - .multiple_values(true) + .num_args(1..) ) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ), ), @@ -583,7 +576,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ) .arg( @@ -597,36 +590,36 @@ pub(crate) fn cli() -> Command<'static> { Command::new("add") .about("Add a component to a Rust toolchain") .arg(Arg::new("component").required(true) - .takes_value(true).multiple_values(true)) + .num_args(1..)) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser( partial_toolchain_desc_parser), ) .arg( Arg::new("target") .long("target") - .takes_value(true) + .num_args(1) ), ) .subcommand( Command::new("remove") .about("Remove a component from a Rust toolchain") .arg(Arg::new("component").required(true) - .takes_value(true).multiple_values(true)) + .num_args(1..)) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser( partial_toolchain_desc_parser), ) .arg( Arg::new("target") .long("target") - .takes_value(true) + .num_args(1) ), ), ) @@ -647,13 +640,13 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .required(true) - .takes_value(true) + .num_args(1) .value_parser(resolvable_toolchainame_parser), ) .arg( Arg::new("path") .long("path") - .takes_value(true) + .num_args(1) .help("Path to the directory"), ), ) @@ -665,7 +658,7 @@ pub(crate) fn cli() -> Command<'static> { .arg( Arg::new("path") .long("path") - .takes_value(true) + .num_args(1) .help("Path to the directory"), ) .arg( @@ -685,14 +678,13 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(RESOLVABLE_LOCAL_TOOLCHAIN_ARG_HELP) .required(true) - .takes_value(true) + .num_args(1) .value_parser(resolvable_local_toolchainame_parser), ) .arg( Arg::new("command") .required(true) - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(false), ) .arg( @@ -710,7 +702,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(RESOLVABLE_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(resolvable_toolchainame_parser), ), ) @@ -729,7 +721,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ) .arg(Arg::new("topic").help(TOPIC_ARG_HELP)) @@ -758,7 +750,7 @@ pub(crate) fn cli() -> Command<'static> { Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") - .takes_value(true) + .num_args(1) .value_parser(partial_toolchain_desc_parser), ), ); @@ -826,7 +818,7 @@ pub(crate) fn cli() -> Command<'static> { ) } -fn verbose_arg(help: &str) -> Arg<'_> { +fn verbose_arg(help: &'static str) -> Arg { Arg::new("verbose") .help(help) .short('v') @@ -1682,7 +1674,7 @@ impl clap::ValueEnum for CompletionCommand { &[Self::Rustup, Self::Cargo] } - fn to_possible_value<'a>(&self) -> Option> { + fn to_possible_value<'a>(&self) -> Option { Some(match self { CompletionCommand::Rustup => PossibleValue::new("rustup"), CompletionCommand::Cargo => PossibleValue::new("cargo"), diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 5f22db8e17..39a1368774 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use clap::{builder::PossibleValuesParser, AppSettings, Arg, ArgAction, Command}; +use clap::{builder::PossibleValuesParser, Arg, ArgAction, Command}; use crate::{ cli::{ @@ -32,8 +32,8 @@ pub fn main() -> Result { // NOTICE: If you change anything here, please make the same changes in rustup-init.sh let cli = Command::new("rustup-init") .version(common::version()) + .before_help(format!("rustup-init {}", common::version())) .about("The installer for rustup") - .setting(AppSettings::DeriveDisplayOrder) .arg( Arg::new("verbose") .short('v') @@ -58,13 +58,13 @@ pub fn main() -> Result { .arg( Arg::new("default-host") .long("default-host") - .takes_value(true) + .num_args(1) .help("Choose a default host triple"), ) .arg( Arg::new("default-toolchain") .long("default-toolchain") - .takes_value(true) + .num_args(1) .help("Choose a default toolchain to install. Use 'none' to not install any toolchains at all") .value_parser(maybe_official_toolchainame_parser) ) @@ -79,8 +79,7 @@ pub fn main() -> Result { .help("Component name to also install") .long("component") .short('c') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -89,8 +88,7 @@ pub fn main() -> Result { .help("Target name to also install") .long("target") .short('t') - .takes_value(true) - .multiple_values(true) + .num_args(1..) .use_value_delimiter(true) .action(ArgAction::Append), ) @@ -110,8 +108,8 @@ pub fn main() -> Result { let matches = match cli.try_get_matches_from(process().args_os()) { Ok(matches) => matches, Err(e) - if e.kind() == clap::ErrorKind::DisplayHelp - || e.kind() == clap::ErrorKind::DisplayVersion => + if e.kind() == clap::error::ErrorKind::DisplayHelp + || e.kind() == clap::error::ErrorKind::DisplayVersion => { write!(process().stdout().lock(), "{e}")?; return Ok(utils::ExitCode(0)); diff --git a/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml b/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml index 3aec80655d..6439bc795f 100644 --- a/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup-init/rustup-init_help_flag_stdout.toml @@ -3,46 +3,35 @@ args = ["--help"] status.code = 0 stdout = """ rustup-init [..] -The installer for rustup - -USAGE: - rustup-init[EXE] [OPTIONS] - -OPTIONS: - -v, --verbose - Enable verbose output - - -q, --quiet - Disable progress output - - -y - Disable confirmation prompt. - - --default-host - Choose a default host triple - - --default-toolchain - Choose a default toolchain to install. Use 'none' to not install any toolchains at all - --profile - [default: default] [possible values: minimal, default, complete] - - -c, --component ... - Component name to also install - - -t, --target ... - Target name to also install - - --no-update-default-toolchain - Don't update any existing default toolchain after install - - --no-modify-path - Don't configure the PATH environment variable - - -h, --help - Print help information +The installer for rustup - -V, --version - Print version information +Usage: rustup-init[EXE] [OPTIONS] + +Options: + -v, --verbose + Enable verbose output + -q, --quiet + Disable progress output + -y + Disable confirmation prompt. + --default-host + Choose a default host triple + --default-toolchain + Choose a default toolchain to install. Use 'none' to not install any toolchains at all + --profile + [default: default] [possible values: minimal, default, complete] + -c, --component ... + Component name to also install + -t, --target ... + Target name to also install + --no-update-default-toolchain + Don't update any existing default toolchain after install + --no-modify-path + Don't configure the PATH environment variable + -h, --help + Print help + -V, --version + Print version """ stderr = "" diff --git a/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml b/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml index 706f9ec3c6..bddf924bb5 100644 --- a/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup-init/rustup-init_sh_help_flag_stdout.toml @@ -3,46 +3,35 @@ args = ["--help"] status.code = 0 stdout = """ rustup-init [..] -The installer for rustup - -USAGE: - rustup-init[EXE] [OPTIONS] - -OPTIONS: - -v, --verbose - Enable verbose output - - -q, --quiet - Disable progress output - - -y - Disable confirmation prompt. - - --default-host - Choose a default host triple - - --default-toolchain - Choose a default toolchain to install. Use 'none' to not install any toolchains at all - --profile - [default: default] [possible values: minimal, default, complete] - - -c, --component ... - Component name to also install - - -t, --target ... - Target name to also install - - --no-update-default-toolchain - Don't update any existing default toolchain after install - - --no-modify-path - Don't configure the PATH environment variable - - -h, --help - Print help information +The installer for rustup - -V, --version - Print version information +Usage: rustup-init[EXE] [OPTIONS] + +Options: + -v, --verbose + Enable verbose output + -q, --quiet + Disable progress output + -y + Disable confirmation prompt. + --default-host + Choose a default host triple + --default-toolchain + Choose a default toolchain to install. Use 'none' to not install any toolchains at all + --profile + [default: default] [possible values: minimal, default, complete] + -c, --component ... + Component name to also install + -t, --target ... + Target name to also install + --no-update-default-toolchain + Don't update any existing default toolchain after install + --no-modify-path + Don't configure the PATH environment variable + -h, --help + Print help + -V, --version + Print version """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml index 793768eb60..86cc59070b 100644 --- a/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_check_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Check for updates to Rust toolchains and rustup -USAGE: - rustup[EXE] check +Usage: rustup[EXE] check -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml index 309ed062fe..6d2a135bc8 100644 --- a/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Generate tab-completion scripts for your shell -USAGE: - rustup[EXE] completions [ARGS] +Usage: rustup[EXE] completions [shell] [command] -ARGS: - [possible values: bash, elvish, fish, powershell, zsh] - [possible values: rustup, cargo] +Arguments: + [shell] [possible values: bash, elvish, fish, powershell, zsh] + [command] [possible values: rustup, cargo] -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help DISCUSSION: Enable tab completion for Bash, Fish, Zsh, or PowerShell @@ -118,7 +117,7 @@ DISCUSSION: completions into our profile simply use PS C:/> rustup completions powershell >> -${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 + ${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 CARGO: diff --git a/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml index 2dbd6b2192..e7c25e2bac 100644 --- a/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_component_cmd_add_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Add a component to a Rust toolchain -USAGE: - rustup[EXE] component add [OPTIONS] ... +Usage: rustup[EXE] component add [OPTIONS] ... -ARGS: - ... +Arguments: + ... -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --target - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --target + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml index 221c90dcfa..b4f5d20398 100644 --- a/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_component_cmd_list_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... List installed and available components -USAGE: - rustup[EXE] component list [OPTIONS] +Usage: rustup[EXE] component list [OPTIONS] -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --installed List only installed components - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --installed List only installed components + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml index 917b72b041..226db0a7ea 100644 --- a/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_component_cmd_remove_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Remove a component from a Rust toolchain -USAGE: - rustup[EXE] component remove [OPTIONS] ... +Usage: rustup[EXE] component remove [OPTIONS] ... -ARGS: - ... +Arguments: + ... -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --target - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --target + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml index cd47e4f43c..a3871bde73 100644 --- a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Set the default toolchain -USAGE: - rustup[EXE] default [toolchain] +Usage: rustup[EXE] default [toolchain] -ARGS: - 'none', a toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom - toolchain name. For more information see `rustup help toolchain` +Arguments: + [toolchain] 'none', a toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain + name. For more information see `rustup help toolchain` -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help DISCUSSION: Sets the default toolchain to the one specified. If the toolchain diff --git a/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml index ec12561e41..9b54471676 100644 --- a/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml @@ -4,36 +4,35 @@ stdout = """ ... Open the documentation for the current toolchain -USAGE: - rustup[EXE] doc [OPTIONS] [topic] +Usage: rustup[EXE] doc [OPTIONS] [topic] -ARGS: - Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', - 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', - 'std::io::error::Result' etc... +Arguments: + [topic] Topic such as 'core', 'fn', 'usize', 'eprintln!', 'core::arch', 'alloc::format!', + 'std::fs', 'std::fs::read_dir', 'std::io::Bytes', 'std::iter::Sum', + 'std::io::error::Result' etc... -OPTIONS: - --path Only print the path to the documentation - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --alloc The Rust core allocation and collections library - --book The Rust Programming Language book - --cargo The Cargo Book - --core The Rust Core Library - --edition-guide The Rust Edition Guide - --nomicon The Dark Arts of Advanced and Unsafe Rust Programming - --proc_macro A support library for macro authors when defining new macros - --reference The Rust Reference - --rust-by-example A collection of runnable examples that illustrate various Rust - concepts and standard libraries - --rustc The compiler for the Rust programming language - --rustdoc Documentation generator for Rust projects - --std Standard library API documentation - --test Support code for rustc's built in unit-test and - micro-benchmarking framework - --unstable-book The Unstable Book - --embedded-book The Embedded Rust Book - -h, --help Print help information +Options: + --path Only print the path to the documentation + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --alloc The Rust core allocation and collections library + --book The Rust Programming Language book + --cargo The Cargo Book + --core The Rust Core Library + --edition-guide The Rust Edition Guide + --nomicon The Dark Arts of Advanced and Unsafe Rust Programming + --proc_macro A support library for macro authors when defining new macros + --reference The Rust Reference + --rust-by-example A collection of runnable examples that illustrate various Rust + concepts and standard libraries + --rustc The compiler for the Rust programming language + --rustdoc Documentation generator for Rust projects + --std Standard library API documentation + --test Support code for rustc's built in unit-test and micro-benchmarking + framework + --unstable-book The Unstable Book + --embedded-book The Embedded Rust Book + -h, --help Print help DISCUSSION: Opens the documentation for the currently active toolchain with diff --git a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml index 68caeb20d7..d9b4c33dce 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml @@ -3,37 +3,37 @@ args = ["help"] status.code = 0 stdout = """ rustup [..] + The Rust toolchain installer -USAGE: - rustup[EXE] [OPTIONS] [+toolchain] +Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] -ARGS: - <+toolchain> release channel (e.g. +stable) or custom toolchain to set override +Commands: + show Show the active and installed toolchains or profiles + update Update Rust toolchains and rustup + check Check for updates to Rust toolchains and rustup + default Set the default toolchain + toolchain Modify or query the installed toolchains + target Modify a toolchain's supported targets + component Modify a toolchain's installed components + override Modify directory toolchain overrides + run Run a command with an environment configured for a given toolchain + which Display which binary will be run for a given command + doc Open the documentation for the current toolchain +... + self Modify the rustup installation + set Alter rustup settings + completions Generate tab-completion scripts for your shell + help Print this message or the help of the given subcommand(s) -OPTIONS: - -v, --verbose Enable verbose output - -q, --quiet Disable progress output - -h, --help Print help information - -V, --version Print version information +Arguments: + [+toolchain] release channel (e.g. +stable) or custom toolchain to set override -SUBCOMMANDS: - show Show the active and installed toolchains or profiles - update Update Rust toolchains and rustup - check Check for updates to Rust toolchains and rustup - default Set the default toolchain - toolchain Modify or query the installed toolchains - target Modify a toolchain's supported targets - component Modify a toolchain's installed components - override Modify directory toolchain overrides - run Run a command with an environment configured for a given toolchain - which Display which binary will be run for a given command - doc Open the documentation for the current toolchain -... - self Modify the rustup installation - set Alter rustup settings - completions Generate tab-completion scripts for your shell - help Print this message or the help of the given subcommand(s) +Options: + -v, --verbose Enable verbose output + -q, --quiet Disable progress output + -h, --help Print help + -V, --version Print version DISCUSSION: Rustup installs The Rust Programming Language from the official diff --git a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml index c0f051e22a..d5c2e095c0 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml @@ -3,37 +3,37 @@ args = ["--help"] status.code = 0 stdout = """ rustup [..] + The Rust toolchain installer -USAGE: - rustup[EXE] [OPTIONS] [+toolchain] +Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] -ARGS: - <+toolchain> release channel (e.g. +stable) or custom toolchain to set override +Commands: + show Show the active and installed toolchains or profiles + update Update Rust toolchains and rustup + check Check for updates to Rust toolchains and rustup + default Set the default toolchain + toolchain Modify or query the installed toolchains + target Modify a toolchain's supported targets + component Modify a toolchain's installed components + override Modify directory toolchain overrides + run Run a command with an environment configured for a given toolchain + which Display which binary will be run for a given command + doc Open the documentation for the current toolchain +... + self Modify the rustup installation + set Alter rustup settings + completions Generate tab-completion scripts for your shell + help Print this message or the help of the given subcommand(s) -OPTIONS: - -v, --verbose Enable verbose output - -q, --quiet Disable progress output - -h, --help Print help information - -V, --version Print version information +Arguments: + [+toolchain] release channel (e.g. +stable) or custom toolchain to set override -SUBCOMMANDS: - show Show the active and installed toolchains or profiles - update Update Rust toolchains and rustup - check Check for updates to Rust toolchains and rustup - default Set the default toolchain - toolchain Modify or query the installed toolchains - target Modify a toolchain's supported targets - component Modify a toolchain's installed components - override Modify directory toolchain overrides - run Run a command with an environment configured for a given toolchain - which Display which binary will be run for a given command - doc Open the documentation for the current toolchain -... - self Modify the rustup installation - set Alter rustup settings - completions Generate tab-completion scripts for your shell - help Print this message or the help of the given subcommand(s) +Options: + -v, --verbose Enable verbose output + -q, --quiet Disable progress output + -h, --help Print help + -V, --version Print version DISCUSSION: Rustup installs The Rust Programming Language from the official diff --git a/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml index 6ec2336396..5c94c51058 100644 --- a/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_man_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... View the man page for a given command -USAGE: - rustup[EXE] man [OPTIONS] +Usage: rustup[EXE] man [OPTIONS] -ARGS: - +Arguments: + -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml index e7d2600424..f02bc5a015 100644 --- a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml @@ -1,41 +1,50 @@ bin.name = "rustup" -args = ["-v"] +args = ["-q"] status.code = 1 -stdout = """ +stdout = "" +stderr = """ rustup [..] + The Rust toolchain installer -USAGE: - rustup[EXE] [OPTIONS] [+toolchain] - -ARGS: - <+toolchain> release channel (e.g. +stable) or custom toolchain to set override - -OPTIONS: - -v, --verbose Enable verbose output - -q, --quiet Disable progress output - -h, --help Print help information - -V, --version Print version information - -SUBCOMMANDS: - show Show the active and installed toolchains or profiles - update Update Rust toolchains and rustup - check Check for updates to Rust toolchains and rustup - default Set the default toolchain - toolchain Modify or query the installed toolchains - target Modify a toolchain's supported targets - component Modify a toolchain's installed components - override Modify directory toolchain overrides - run Run a command with an environment configured for a given toolchain - which Display which binary will be run for a given command - doc Open the documentation for the current toolchain +Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] + +Commands: + show Show the active and installed toolchains or profiles + update Update Rust toolchains and rustup + check Check for updates to Rust toolchains and rustup + default Set the default toolchain + toolchain Modify or query the installed toolchains + target Modify a toolchain's supported targets + component Modify a toolchain's installed components + override Modify directory toolchain overrides + run Run a command with an environment configured for a given toolchain + which Display which binary will be run for a given command + doc Open the documentation for the current toolchain ... - self Modify the rustup installation - set Alter rustup settings - completions Generate tab-completion scripts for your shell - help Print this message or the help of the given subcommand(s) + self Modify the rustup installation + set Alter rustup settings + completions Generate tab-completion scripts for your shell + help Print this message or the help of the given subcommand(s) + +Arguments: + [+toolchain] + release channel (e.g. +stable) or custom toolchain to set override + +Options: + -v, --verbose + Enable verbose output -DISCUSSION: + -q, --quiet + Disable progress output + + -h, --help + Print help + + -V, --version + Print version + +Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes @@ -44,5 +53,5 @@ DISCUSSION: If you are new to Rust consider running `rustup doc --book` to learn Rust. + """ -stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml index 95a2e7da31..bf4b218daa 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_add_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Set the override toolchain for a directory -USAGE: - rustup[EXE] override set [OPTIONS] +Usage: rustup[EXE] override set [OPTIONS] -ARGS: - Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain - name. For more information see `rustup help toolchain` +Arguments: + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. For + more information see `rustup help toolchain` -OPTIONS: - --path Path to the directory - -h, --help Print help information +Options: + --path Path to the directory + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml index 08b2daecbd..2bb8473caa 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml @@ -4,17 +4,16 @@ stdout = """ ... Modify directory toolchain overrides -USAGE: - rustup[EXE] override +Usage: rustup[EXE] override -OPTIONS: - -h, --help Print help information +Commands: + list List directory toolchain overrides + set Set the override toolchain for a directory + unset Remove the override toolchain for a directory + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - list List directory toolchain overrides - set Set the override toolchain for a directory - unset Remove the override toolchain for a directory - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help DISCUSSION: Overrides configure Rustup to use a specific toolchain when diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml index 8116d71751..8d90aca23e 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_list_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... List directory toolchain overrides -USAGE: - rustup[EXE] override list +Usage: rustup[EXE] override list -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml index 2bc53d6720..f86fbf61f6 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... Remove the override toolchain for a directory -USAGE: - rustup[EXE] override unset [OPTIONS] +Usage: rustup[EXE] override unset [OPTIONS] -OPTIONS: - --path Path to the directory - --nonexistent Remove override toolchain for all nonexistent directories - -h, --help Print help information +Options: + --path Path to the directory + --nonexistent Remove override toolchain for all nonexistent directories + -h, --help Print help DISCUSSION: If `--path` argument is present, removes the override toolchain diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml index e8c9ead5c0..462d4a3d46 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_set_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Set the override toolchain for a directory -USAGE: - rustup[EXE] override set [OPTIONS] +Usage: rustup[EXE] override set [OPTIONS] -ARGS: - Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain - name. For more information see `rustup help toolchain` +Arguments: + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. For + more information see `rustup help toolchain` -OPTIONS: - --path Path to the directory - -h, --help Print help information +Options: + --path Path to the directory + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml index 2bc53d6720..f86fbf61f6 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... Remove the override toolchain for a directory -USAGE: - rustup[EXE] override unset [OPTIONS] +Usage: rustup[EXE] override unset [OPTIONS] -OPTIONS: - --path Path to the directory - --nonexistent Remove override toolchain for all nonexistent directories - -h, --help Print help information +Options: + --path Path to the directory + --nonexistent Remove override toolchain for all nonexistent directories + -h, --help Print help DISCUSSION: If `--path` argument is present, removes the override toolchain diff --git a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml index 0760ac3465..a176180786 100644 --- a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml @@ -5,17 +5,16 @@ stdout = """ ... Run a command with an environment configured for a given toolchain -USAGE: - rustup[EXE] run [OPTIONS] ... +Usage: rustup[EXE] run [OPTIONS] ... -ARGS: - Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain - name, or an absolute path. For more information see `rustup help toolchain` - ... +Arguments: + Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name, or + an absolute path. For more information see `rustup help toolchain` + ... -OPTIONS: - --install Install the requested toolchain if needed - -h, --help Print help information +Options: + --install Install the requested toolchain if needed + -h, --help Print help DISCUSSION: Configures an environment to use the given toolchain and then runs diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml index 9c0ff9d9c3..966d1c1917 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Modify the rustup installation -USAGE: - rustup[EXE] self +Usage: rustup[EXE] self -OPTIONS: - -h, --help Print help information +Commands: + update Download and install updates to rustup + uninstall Uninstall rustup. + upgrade-data Upgrade the internal data format. + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - update Download and install updates to rustup - uninstall Uninstall rustup. - upgrade-data Upgrade the internal data format. - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml index 28628dcd3a..d8bbc2ad57 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_uninstall_cmd_help_flag_stdout.toml @@ -4,11 +4,10 @@ stdout = """ ... Uninstall rustup. -USAGE: - rustup[EXE] self uninstall [OPTIONS] +Usage: rustup[EXE] self uninstall [OPTIONS] -OPTIONS: - -y - -h, --help Print help information +Options: + -y + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml index cbd215987a..e5472f2783 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_update_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Download and install updates to rustup -USAGE: - rustup[EXE] self update +Usage: rustup[EXE] self update -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml index c06b9a03f9..01f1c4bdd8 100644 --- a/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_self_cmd_upgrade-data _cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Upgrade the internal data format. -USAGE: - rustup[EXE] self upgrade-data +Usage: rustup[EXE] self upgrade-data -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml index 0bcce67e6f..854c81ad69 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_auto-self-update_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... The rustup auto self update mode -USAGE: - rustup[EXE] set auto-self-update +Usage: rustup[EXE] set auto-self-update -ARGS: - [default: enable] [possible values: enable, disable, check-only] +Arguments: + [default: enable] [possible values: enable, disable, check-only] -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml index 3b5a9421ad..bdab25cd07 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_default-host_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... The triple used to identify toolchains when not specified -USAGE: - rustup[EXE] set default-host +Usage: rustup[EXE] set default-host -ARGS: - +Arguments: + -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml index 8522656129..04ce4aaa5a 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Alter rustup settings -USAGE: - rustup[EXE] set +Usage: rustup[EXE] set -OPTIONS: - -h, --help Print help information +Commands: + default-host The triple used to identify toolchains when not specified + profile The default components installed + auto-self-update The rustup auto self update mode + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - default-host The triple used to identify toolchains when not specified - profile The default components installed - auto-self-update The rustup auto self update mode - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml index 7013e21433..d92d750e17 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... The default components installed -USAGE: - rustup[EXE] set profile +Usage: rustup[EXE] set profile -ARGS: - [default: default] [possible values: minimal, default, complete] +Arguments: + [default: default] [possible values: minimal, default, complete] -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml index 0bd8de5fe5..98a6d54175 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml @@ -4,12 +4,11 @@ stdout = """ ... Show the active toolchain -USAGE: - rustup[EXE] show active-toolchain [OPTIONS] +Usage: rustup[EXE] show active-toolchain [OPTIONS] -OPTIONS: - -v, --verbose Enable verbose output with rustc information - -h, --help Print help information +Options: + -v, --verbose Enable verbose output with rustc information + -h, --help Print help DISCUSSION: Shows the name of the active toolchain. diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml index fa05eee33a..7bbef9ee2a 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml @@ -4,18 +4,17 @@ stdout = """ ... Show the active and installed toolchains or profiles -USAGE: - rustup[EXE] show [OPTIONS] [SUBCOMMAND] +Usage: rustup[EXE] show [OPTIONS] [COMMAND] -OPTIONS: - -v, --verbose Enable verbose output with rustc information for all installed toolchains - -h, --help Print help information +Commands: + active-toolchain Show the active toolchain + home Display the computed value of RUSTUP_HOME + profile Show the current profile + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - active-toolchain Show the active toolchain - home Display the computed value of RUSTUP_HOME - profile Show the current profile - help Print this message or the help of the given subcommand(s) +Options: + -v, --verbose Enable verbose output with rustc information for all installed toolchains + -h, --help Print help DISCUSSION: Shows the name of the active toolchain and the version of `rustc`. diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml index a852be1033..b98cb165c3 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_home_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Display the computed value of RUSTUP_HOME -USAGE: - rustup[EXE] show home +Usage: rustup[EXE] show home -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml index 32ec3e8347..af20a30cbc 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml @@ -4,10 +4,9 @@ stdout = """ ... Show the current profile -USAGE: - rustup[EXE] show profile +Usage: rustup[EXE] show profile -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml index 688b6f428e..c7b55dc104 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_add_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Add a target to a Rust toolchain -USAGE: - rustup[EXE] target add [OPTIONS] ... +Usage: rustup[EXE] target add [OPTIONS] ... -ARGS: - ... List of targets to install; \"all\" installs all available targets +Arguments: + ... List of targets to install; \"all\" installs all available targets -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml index 4872b92191..a1b723e37c 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_help_flag_stdout.toml @@ -4,16 +4,15 @@ stdout = """ ... Modify a toolchain's supported targets -USAGE: - rustup[EXE] target +Usage: rustup[EXE] target -OPTIONS: - -h, --help Print help information +Commands: + list List installed and available targets + add Add a target to a Rust toolchain + remove Remove a target from a Rust toolchain + help Print this message or the help of the given subcommand(s) -SUBCOMMANDS: - list List installed and available targets - add Add a target to a Rust toolchain - remove Remove a target from a Rust toolchain - help Print this message or the help of the given subcommand(s) +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml index 07691abfc5..6457da2ae7 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_list_cmd_help_flag_stdout.toml @@ -4,13 +4,12 @@ stdout = """ ... List installed and available targets -USAGE: - rustup[EXE] target list [OPTIONS] +Usage: rustup[EXE] target list [OPTIONS] -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - --installed List only installed targets - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + --installed List only installed targets + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml index 60abfefede..990f21ba8e 100644 --- a/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_target_cmd_remove_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Remove a target from a Rust toolchain -USAGE: - rustup[EXE] target remove [OPTIONS] ... +Usage: rustup[EXE] target remove [OPTIONS] ... -ARGS: - ... List of targets to uninstall +Arguments: + ... List of targets to uninstall -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more + information see `rustup help toolchain` + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml index a555542b27..5d5adc5f81 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml @@ -4,18 +4,17 @@ stdout = """ ... Modify or query the installed toolchains -USAGE: - rustup[EXE] toolchain - -OPTIONS: - -h, --help Print help information - -SUBCOMMANDS: - list List installed toolchains - install Install or update a given toolchain - uninstall Uninstall a toolchain - link Create a custom toolchain by symlinking to a directory - help Print this message or the help of the given subcommand(s) +Usage: rustup[EXE] toolchain + +Commands: + list List installed toolchains + install Install or update a given toolchain + uninstall Uninstall a toolchain + link Create a custom toolchain by symlinking to a directory + help Print this message or the help of the given subcommand(s) + +Options: + -h, --help Print help DISCUSSION: Many `rustup` commands deal with *toolchains*, a single diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml index b3769d1b48..e02a1e4bd7 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_install_cmd_help_flag_stdout.toml @@ -4,24 +4,23 @@ stdout = """ ... Install or update a given toolchain -USAGE: - rustup[EXE] toolchain install [OPTIONS] ... +Usage: rustup[EXE] toolchain install [OPTIONS] ... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --profile [possible values: minimal, default, complete] - -c, --component ... Add specific components on installation - -t, --target ... Add specific targets on installation - --no-self-update Don't perform self update when running the`rustup toolchain - install` command - --force Force an update, even if some components are missing - --allow-downgrade Allow rustup to downgrade the toolchain to satisfy your - component choice - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --profile [possible values: minimal, default, complete] + -c, --component ... Add specific components on installation + -t, --target ... Add specific targets on installation + --no-self-update Don't perform self update when running the`rustup toolchain + install` command + --force Force an update, even if some components are missing + --allow-downgrade Allow rustup to downgrade the toolchain to satisfy your component + choice + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml index e931c63ae3..862e28ee37 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml @@ -4,15 +4,14 @@ stdout = """ ... Create a custom toolchain by symlinking to a directory -USAGE: - rustup[EXE] toolchain link +Usage: rustup[EXE] toolchain link -ARGS: - Custom toolchain name - Path to the directory +Arguments: + Custom toolchain name + Path to the directory -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help DISCUSSION: 'toolchain' is the custom name to be assigned to the new toolchain. diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml index d2592440e9..bca9d63246 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_list_cmd_help_flag_stdout.toml @@ -4,11 +4,10 @@ stdout = """ ... List installed toolchains -USAGE: - rustup[EXE] toolchain list [OPTIONS] +Usage: rustup[EXE] toolchain list [OPTIONS] -OPTIONS: - -v, --verbose Enable verbose output with toolchain information - -h, --help Print help information +Options: + -v, --verbose Enable verbose output with toolchain information + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml index 08aa5aac0a..9776b801ff 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_uninstall_cmd_help_flag_stdout.toml @@ -4,14 +4,13 @@ stdout = """ ... Uninstall a toolchain -USAGE: - rustup[EXE] toolchain uninstall ... +Usage: rustup[EXE] toolchain uninstall ... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom - toolchain name. For more information see `rustup help toolchain` +Arguments: + ... Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom toolchain name. + For more information see `rustup help toolchain` -OPTIONS: - -h, --help Print help information +Options: + -h, --help Print help """ stderr = "" diff --git a/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml b/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml index f6e15c1276..aaa0365373 100644 --- a/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_unknown_arg_stdout.toml @@ -3,7 +3,7 @@ args = ["random"] status.code = 1 stdout = "" stderr = """ -error: Invalid value \"random\" for '<+toolchain>': error: \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' +error: invalid value 'random' for '[+toolchain]': error: \"random\" is not a valid subcommand, so it was interpreted as a toolchain name, but it is also invalid. To override the toolchain using the 'rustup +toolchain' syntax, make sure to prefix the toolchain override with a '+' -For more information try --help +For more information, try '--help'. """ diff --git a/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml index e60aced4fd..aa2ae5c51c 100644 --- a/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml @@ -4,19 +4,18 @@ stdout = """ ... Update Rust toolchains and rustup -USAGE: - rustup[EXE] update [OPTIONS] [toolchain]... +Usage: rustup[EXE] update [OPTIONS] [toolchain]... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + [toolchain]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --no-self-update Don't perform self update when running the `rustup update` command - --force Force an update, even if some components are missing - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --no-self-update Don't perform self update when running the `rustup update` command + --force Force an update, even if some components are missing + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help DISCUSSION: With no toolchain specified, the `update` command updates each of diff --git a/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml index 40ffc935f7..e441357965 100644 --- a/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml @@ -4,19 +4,18 @@ stdout = """ ... Update Rust toolchains and rustup -USAGE: - rustup[EXE] update [OPTIONS] [toolchain]... +Usage: rustup[EXE] update [OPTIONS] [toolchain]... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + [toolchain]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --no-self-update Don't perform self update when running the `rustup update` command - --force Force an update, even if some components are missing - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --no-self-update Don't perform self update when running the `rustup update` command + --force Force an update, even if some components are missing + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help DISCUSSION: With no toolchain specified, the `update` command updates each of diff --git a/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml index 2153d7ecbf..e51def1ac2 100644 --- a/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml @@ -4,19 +4,18 @@ stdout = """ ... Update Rust toolchains and rustup -USAGE: - rustup[EXE] update [OPTIONS] [toolchain]... +Usage: rustup[EXE] update [OPTIONS] [toolchain]... -ARGS: - ... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more - information see `rustup help toolchain` +Arguments: + [toolchain]... Toolchain name, such as 'stable', 'nightly', or '1.8.0'. For more information see + `rustup help toolchain` -OPTIONS: - --no-self-update Don't perform self update when running the `rustup update` command - --force Force an update, even if some components are missing - --force-non-host Install toolchains that require an emulator. See - https://github.com/rust-lang/rustup/wiki/Non-host-toolchains - -h, --help Print help information +Options: + --no-self-update Don't perform self update when running the `rustup update` command + --force Force an update, even if some components are missing + --force-non-host Install toolchains that require an emulator. See + https://github.com/rust-lang/rustup/wiki/Non-host-toolchains + -h, --help Print help DISCUSSION: With no toolchain specified, the `update` command updates each of diff --git a/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml index 799e5ae9af..4810dcbe27 100644 --- a/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_which_cmd_help_flag_stdout.toml @@ -5,14 +5,13 @@ stdout = """ ... Display which binary will be run for a given command -USAGE: - rustup[EXE] which [OPTIONS] +Usage: rustup[EXE] which [OPTIONS] -ARGS: - +Arguments: + -OPTIONS: - --toolchain Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom - toolchain name. For more information see `rustup help toolchain` - -h, --help Print help information +Options: + --toolchain Toolchain name, such as 'stable', 'nightly', '1.8.0', or a custom + toolchain name. For more information see `rustup help toolchain` + -h, --help Print help """ diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index 27f5f86152..4aaf5f76be 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -146,7 +146,7 @@ fn subcommand_required_for_target() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -160,7 +160,7 @@ fn subcommand_required_for_toolchain() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -174,7 +174,7 @@ fn subcommand_required_for_override() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -188,7 +188,7 @@ fn subcommand_required_for_self() { let out = cmd.output().unwrap(); assert!(!out.status.success()); assert_eq!(out.status.code().unwrap(), 1); - assert!(str::from_utf8(&out.stdout).unwrap().contains("USAGE")); + assert!(str::from_utf8(&out.stdout).unwrap().contains("Usage")); }); } @@ -806,11 +806,11 @@ fn completion_bad_shell() { setup(&|config| { config.expect_err( &["rustup", "completions", "fake"], - r#"error: "fake" isn't a valid value for ''"#, + r#"error: invalid value 'fake' for '[shell]'"#, ); config.expect_err( &["rustup", "completions", "fake", "cargo"], - r#"error: "fake" isn't a valid value for ''"#, + r#"error: invalid value 'fake' for '[shell]'"#, ); }); } @@ -820,7 +820,7 @@ fn completion_bad_tool() { setup(&|config| { config.expect_err( &["rustup", "completions", "bash", "fake"], - r#"error: "fake" isn't a valid value for ''"#, + r#"error: invalid value 'fake' for '[command]'"#, ); }); } diff --git a/tests/suite/cli_self_upd.rs b/tests/suite/cli_self_upd.rs index c21c99abc8..d67046c183 100644 --- a/tests/suite/cli_self_upd.rs +++ b/tests/suite/cli_self_upd.rs @@ -359,7 +359,7 @@ fn update_bogus_version() { config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]); config.expect_err( &["rustup", "update", "1.0.0-alpha"], - "Invalid value \"1.0.0-alpha\" for '...': invalid toolchain name: '1.0.0-alpha'", + "invalid value '1.0.0-alpha' for '[toolchain]...': invalid toolchain name: '1.0.0-alpha'", ); }); } diff --git a/tests/suite/cli_ui.rs b/tests/suite/cli_ui.rs index b619ecf113..c5f66359d2 100644 --- a/tests/suite/cli_ui.rs +++ b/tests/suite/cli_ui.rs @@ -59,6 +59,9 @@ fn rustup_init_ui_doc_text_tests() { .unwrap(); // Make sure that the help output of rustup-init and rustup-init.sh are the same. - assert_eq!(rustup_init_help_std_out, rustup_init_sh_help_std_out) + assert_eq!( + rustup_init_help_std_out.stdout.unwrap(), + rustup_init_sh_help_std_out.stdout.unwrap() + ) } } diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index 4240298058..e892ac8048 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -797,7 +797,7 @@ fn cannot_add_empty_named_custom_toolchain() { let path = path.to_string_lossy(); config.expect_err( &["rustup", "toolchain", "link", "", &path], - "Invalid value \"\" for '': invalid toolchain name ''", + "invalid value '' for '': invalid toolchain name ''", ); }); } From ab8835bde0b0362405862723008b15a2c181471c Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Wed, 16 Aug 2023 15:59:49 +0200 Subject: [PATCH 073/229] Bring additional help section style in line with clap 4 --- src/cli/help.rs | 44 +++++++++---------- ...stup_completions_cmd_help_flag_stdout.toml | 20 ++++----- .../rustup_default_cmd_help_flag_stdout.toml | 2 +- .../rustup_doc_cmd_help_flag_stdout.toml | 2 +- .../cli-ui/rustup/rustup_help_cmd_stdout.toml | 2 +- .../rustup/rustup_help_flag_stdout.toml | 2 +- .../rustup_override_cmd_help_flag_stdout.toml | 2 +- ...rride_cmd_remove_cmd_help_flag_stdout.toml | 2 +- ...erride_cmd_unset_cmd_help_flag_stdout.toml | 2 +- .../rustup_run_cmd_help_flag_stdout.toml | 2 +- ...active-toolchain_cmd_help_flag_stdout.toml | 2 +- .../rustup_show_cmd_help_flag_stdout.toml | 2 +- ...rustup_toolchain_cmd_help_flag_stdout.toml | 2 +- ...olchain_cmd_link_cmd_help_flag_stdout.toml | 2 +- .../rustup_up_cmd_help_flag_stdout.toml | 2 +- .../rustup_update_cmd_help_flag_stdout.toml | 2 +- .../rustup_upgrade_cmd_help_flag_stdout.toml | 2 +- 17 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/cli/help.rs b/src/cli/help.rs index 40591b9b6b..683249629c 100644 --- a/src/cli/help.rs +++ b/src/cli/help.rs @@ -1,4 +1,4 @@ -pub(crate) static RUSTUP_HELP: &str = r"DISCUSSION: +pub(crate) static RUSTUP_HELP: &str = r"Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes @@ -8,7 +8,7 @@ pub(crate) static RUSTUP_HELP: &str = r"DISCUSSION: If you are new to Rust consider running `rustup doc --book` to learn Rust."; -pub(crate) static SHOW_HELP: &str = r"DISCUSSION: +pub(crate) static SHOW_HELP: &str = r"Discussion: Shows the name of the active toolchain and the version of `rustc`. If the active toolchain has installed support for additional @@ -17,7 +17,7 @@ pub(crate) static SHOW_HELP: &str = r"DISCUSSION: If there are multiple toolchains installed then all installed toolchains are listed as well."; -pub(crate) static SHOW_ACTIVE_TOOLCHAIN_HELP: &str = r"DISCUSSION: +pub(crate) static SHOW_ACTIVE_TOOLCHAIN_HELP: &str = r"Discussion: Shows the name of the active toolchain. This is useful for figuring out the active tool chain from @@ -26,7 +26,7 @@ pub(crate) static SHOW_ACTIVE_TOOLCHAIN_HELP: &str = r"DISCUSSION: You should use `rustc --print sysroot` to get the sysroot, or `rustc --version` to get the toolchain version."; -pub(crate) static UPDATE_HELP: &str = r"DISCUSSION: +pub(crate) static UPDATE_HELP: &str = r"Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. @@ -34,16 +34,16 @@ pub(crate) static UPDATE_HELP: &str = r"DISCUSSION: If given a toolchain argument then `update` updates that toolchain, the same as `rustup toolchain install`."; -pub(crate) static INSTALL_HELP: &str = r"DISCUSSION: +pub(crate) static INSTALL_HELP: &str = r"Discussion: Installs a specific rust toolchain. The 'install' command is an alias for 'rustup update '."; -pub(crate) static DEFAULT_HELP: &str = r"DISCUSSION: +pub(crate) static DEFAULT_HELP: &str = r"Discussion: Sets the default toolchain to the one specified. If the toolchain is not already installed then it is installed first."; -pub(crate) static TOOLCHAIN_HELP: &str = r"DISCUSSION: +pub(crate) static TOOLCHAIN_HELP: &str = r"Discussion: Many `rustup` commands deal with *toolchains*, a single installation of the Rust compiler. `rustup` supports multiple types of toolchains. The most basic track the official release @@ -85,7 +85,7 @@ pub(crate) static TOOLCHAIN_HELP: &str = r"DISCUSSION: often used for developing Rust itself. For more information see `rustup toolchain help link`."; -pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"DISCUSSION: +pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"Discussion: 'toolchain' is the custom name to be assigned to the new toolchain. Any name is permitted as long as: - it does not include '/' or '\' except as the last character @@ -106,7 +106,7 @@ pub(crate) static TOOLCHAIN_LINK_HELP: &str = r"DISCUSSION: If you now compile a crate in the current directory, the custom toolchain 'latest-stage1' will be used."; -pub(crate) static OVERRIDE_HELP: &str = r"DISCUSSION: +pub(crate) static OVERRIDE_HELP: &str = r"Discussion: Overrides configure Rustup to use a specific toolchain when running in a specific directory. @@ -127,14 +127,14 @@ pub(crate) static OVERRIDE_HELP: &str = r"DISCUSSION: override and use the default toolchain again, `rustup override unset`."; -pub(crate) static OVERRIDE_UNSET_HELP: &str = r"DISCUSSION: +pub(crate) static OVERRIDE_UNSET_HELP: &str = r"Discussion: If `--path` argument is present, removes the override toolchain for the specified directory. If `--nonexistent` argument is present, removes the override toolchain for all nonexistent directories. Otherwise, removes the override toolchain for the current directory."; -pub(crate) static RUN_HELP: &str = r"DISCUSSION: +pub(crate) static RUN_HELP: &str = r"Discussion: Configures an environment to use the given toolchain and then runs the specified program. The command may be any program, not just rustc or cargo. This can be used for testing arbitrary toolchains @@ -149,14 +149,14 @@ pub(crate) static RUN_HELP: &str = r"DISCUSSION: $ rustup run nightly cargo build"; -pub(crate) static DOC_HELP: &str = r"DISCUSSION: +pub(crate) static DOC_HELP: &str = r"Discussion: Opens the documentation for the currently active toolchain with the default browser. By default, it opens the documentation index. Use the various flags to open specific pieces of documentation."; -pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: +pub(crate) static COMPLETIONS_HELP: &str = r"Discussion: Enable tab completion for Bash, Fish, Zsh, or PowerShell The script is output on `stdout`, allowing one to re-direct the output to the file of their choosing. Where you place the file @@ -167,7 +167,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: Here are some common set ups for the three supported shells under Unix and similar operating systems (such as GNU/Linux). - BASH: + Bash: Completion files are commonly stored in `/etc/bash_completion.d/` for system-wide commands, but can be stored in @@ -180,7 +180,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - BASH (macOS/Homebrew): + Bash (macOS/Homebrew): Homebrew stores bash completion files within the Homebrew directory. With the `bash-completion` brew formula installed, run the command: @@ -188,7 +188,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: $ mkdir -p $(brew --prefix)/etc/bash_completion.d $ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion - FISH: + Fish: Fish completion files are commonly stored in `$HOME/.config/fish/completions`. Run the command: @@ -199,7 +199,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - ZSH: + Zsh: ZSH completions are commonly stored in any directory listed in your `$fpath` variable. To use these completions, you must either @@ -229,7 +229,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: for the new completions to take effect. - CUSTOM LOCATIONS: + Custom locations: Alternatively, you could save these files to the place of your choosing, such as a custom directory inside your $HOME. Doing so @@ -237,7 +237,7 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: inside your login script. Consult your shells documentation for how to add such directives. - POWERSHELL: + PowerShell: The powershell completion scripts require PowerShell v5.0+ (which comes with Windows 10, but can be downloaded separately for windows 7 @@ -261,18 +261,18 @@ pub(crate) static COMPLETIONS_HELP: &str = r"DISCUSSION: PS C:\> rustup completions powershell >> ${env:USERPROFILE}\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1 - CARGO: + Cargo: Rustup can also generate a completion script for `cargo`. The script output by `rustup` will source the completion script distributed with your default toolchain. Not all shells are currently supported. Here are examples for the currently supported shells. - BASH: + Bash: $ rustup completions bash cargo >> ~/.local/share/bash-completion/completions/cargo - ZSH: + Zsh: $ rustup completions zsh cargo > ~/.zfunc/_cargo"; diff --git a/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml index 6d2a135bc8..63ac522164 100644 --- a/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_completions_cmd_help_flag_stdout.toml @@ -13,7 +13,7 @@ Arguments: Options: -h, --help Print help -DISCUSSION: +Discussion: Enable tab completion for Bash, Fish, Zsh, or PowerShell The script is output on `stdout`, allowing one to re-direct the output to the file of their choosing. Where you place the file @@ -24,7 +24,7 @@ DISCUSSION: Here are some common set ups for the three supported shells under Unix and similar operating systems (such as GNU/Linux). - BASH: + Bash: Completion files are commonly stored in `/etc/bash_completion.d/` for system-wide commands, but can be stored in @@ -37,7 +37,7 @@ DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - BASH (macOS/Homebrew): + Bash (macOS/Homebrew): Homebrew stores bash completion files within the Homebrew directory. With the `bash-completion` brew formula installed, run the command: @@ -45,7 +45,7 @@ DISCUSSION: $ mkdir -p $(brew --prefix)/etc/bash_completion.d $ rustup completions bash > $(brew --prefix)/etc/bash_completion.d/rustup.bash-completion - FISH: + Fish: Fish completion files are commonly stored in `$HOME/.config/fish/completions`. Run the command: @@ -56,7 +56,7 @@ DISCUSSION: This installs the completion script. You may have to log out and log back in to your shell session for the changes to take effect. - ZSH: + Zsh: ZSH completions are commonly stored in any directory listed in your `$fpath` variable. To use these completions, you must either @@ -86,7 +86,7 @@ DISCUSSION: for the new completions to take effect. - CUSTOM LOCATIONS: + Custom locations: Alternatively, you could save these files to the place of your choosing, such as a custom directory inside your $HOME. Doing so @@ -94,7 +94,7 @@ DISCUSSION: inside your login script. Consult your shells documentation for how to add such directives. - POWERSHELL: + PowerShell: The powershell completion scripts require PowerShell v5.0+ (which comes with Windows 10, but can be downloaded separately for windows 7 @@ -119,18 +119,18 @@ DISCUSSION: PS C:/> rustup completions powershell >> ${env:USERPROFILE}/Documents/WindowsPowerShell/Microsoft.PowerShell_profile.ps1 - CARGO: + Cargo: Rustup can also generate a completion script for `cargo`. The script output by `rustup` will source the completion script distributed with your default toolchain. Not all shells are currently supported. Here are examples for the currently supported shells. - BASH: + Bash: $ rustup completions bash cargo >> ~/.local/share/bash-completion/completions/cargo - ZSH: + Zsh: $ rustup completions zsh cargo > ~/.zfunc/_cargo """ diff --git a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml index a3871bde73..cd85c265b7 100644 --- a/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_default_cmd_help_flag_stdout.toml @@ -13,7 +13,7 @@ Arguments: Options: -h, --help Print help -DISCUSSION: +Discussion: Sets the default toolchain to the one specified. If the toolchain is not already installed then it is installed first. """ diff --git a/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml index 9b54471676..d9698f2820 100644 --- a/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_doc_cmd_help_flag_stdout.toml @@ -34,7 +34,7 @@ Options: --embedded-book The Embedded Rust Book -h, --help Print help -DISCUSSION: +Discussion: Opens the documentation for the currently active toolchain with the default browser. diff --git a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml index d9b4c33dce..791eb0fcf3 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml @@ -35,7 +35,7 @@ Options: -h, --help Print help -V, --version Print version -DISCUSSION: +Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes diff --git a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml index d5c2e095c0..b93ab136ec 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml @@ -35,7 +35,7 @@ Options: -h, --help Print help -V, --version Print version -DISCUSSION: +Discussion: Rustup installs The Rust Programming Language from the official release channels, enabling you to easily switch between stable, beta, and nightly compilers and keep them updated. It makes diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml index 2bb8473caa..a9ae2a9f58 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml @@ -15,7 +15,7 @@ Commands: Options: -h, --help Print help -DISCUSSION: +Discussion: Overrides configure Rustup to use a specific toolchain when running in a specific directory. diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml index f86fbf61f6..6af8bfc960 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_remove_cmd_help_flag_stdout.toml @@ -11,7 +11,7 @@ Options: --nonexistent Remove override toolchain for all nonexistent directories -h, --help Print help -DISCUSSION: +Discussion: If `--path` argument is present, removes the override toolchain for the specified directory. If `--nonexistent` argument is present, removes the override toolchain for all nonexistent diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml index f86fbf61f6..6af8bfc960 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_unset_cmd_help_flag_stdout.toml @@ -11,7 +11,7 @@ Options: --nonexistent Remove override toolchain for all nonexistent directories -h, --help Print help -DISCUSSION: +Discussion: If `--path` argument is present, removes the override toolchain for the specified directory. If `--nonexistent` argument is present, removes the override toolchain for all nonexistent diff --git a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml index a176180786..649ec2db53 100644 --- a/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_run_cmd_help_flag_stdout.toml @@ -16,7 +16,7 @@ Options: --install Install the requested toolchain if needed -h, --help Print help -DISCUSSION: +Discussion: Configures an environment to use the given toolchain and then runs the specified program. The command may be any program, not just rustc or cargo. This can be used for testing arbitrary toolchains diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml index 98a6d54175..006f8e3f7f 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_active-toolchain_cmd_help_flag_stdout.toml @@ -10,7 +10,7 @@ Options: -v, --verbose Enable verbose output with rustc information -h, --help Print help -DISCUSSION: +Discussion: Shows the name of the active toolchain. This is useful for figuring out the active tool chain from diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml index 7bbef9ee2a..b69b13990d 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml @@ -16,7 +16,7 @@ Options: -v, --verbose Enable verbose output with rustc information for all installed toolchains -h, --help Print help -DISCUSSION: +Discussion: Shows the name of the active toolchain and the version of `rustc`. If the active toolchain has installed support for additional diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml index 5d5adc5f81..87bcb893b6 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_help_flag_stdout.toml @@ -16,7 +16,7 @@ Commands: Options: -h, --help Print help -DISCUSSION: +Discussion: Many `rustup` commands deal with *toolchains*, a single installation of the Rust compiler. `rustup` supports multiple types of toolchains. The most basic track the official release diff --git a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml index 862e28ee37..77433e818e 100644 --- a/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_toolchain_cmd_link_cmd_help_flag_stdout.toml @@ -13,7 +13,7 @@ Arguments: Options: -h, --help Print help -DISCUSSION: +Discussion: 'toolchain' is the custom name to be assigned to the new toolchain. Any name is permitted as long as: - it does not include '/' or '/' except as the last character diff --git a/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml index aa2ae5c51c..cfe1cdb5f7 100644 --- a/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_up_cmd_help_flag_stdout.toml @@ -17,7 +17,7 @@ Options: https://github.com/rust-lang/rustup/wiki/Non-host-toolchains -h, --help Print help -DISCUSSION: +Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. diff --git a/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml index e441357965..cdebda35ca 100644 --- a/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_update_cmd_help_flag_stdout.toml @@ -17,7 +17,7 @@ Options: https://github.com/rust-lang/rustup/wiki/Non-host-toolchains -h, --help Print help -DISCUSSION: +Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. diff --git a/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml index e51def1ac2..11559534b4 100644 --- a/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_upgrade_cmd_help_flag_stdout.toml @@ -17,7 +17,7 @@ Options: https://github.com/rust-lang/rustup/wiki/Non-host-toolchains -h, --help Print help -DISCUSSION: +Discussion: With no toolchain specified, the `update` command updates each of the installed toolchains from the official release channels, then updates rustup itself. From 6954674840d2bb1ab737d43db75ab2b40fde686f Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 29 Aug 2023 19:33:04 +0200 Subject: [PATCH 074/229] Fix rustup_only_options_stdout The overridden binary name means that the [EXE] override is not required in the usage output. --- tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml index f02bc5a015..1b24ddd30a 100644 --- a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml @@ -1,13 +1,12 @@ -bin.name = "rustup" args = ["-q"] +bin.name = "rustup" status.code = 1 -stdout = "" stderr = """ rustup [..] The Rust toolchain installer -Usage: rustup[EXE] [OPTIONS] [+toolchain] [COMMAND] +Usage: rustup [OPTIONS] [+toolchain] [COMMAND] Commands: show Show the active and installed toolchains or profiles @@ -55,3 +54,4 @@ Discussion: learn Rust. """ +stdout = "" From e97f3dcf81fa4d582cdc16cf282bd0498edfdd27 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 29 Aug 2023 21:16:09 +0000 Subject: [PATCH 075/229] Lock file maintenance --- Cargo.lock | 237 +++++++++++++++++++++++------------------------------ 1 file changed, 101 insertions(+), 136 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b3e04389d..81777a708c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" dependencies = [ "gimli", ] @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.4" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6748e8def348ed4d14996fa801f4122cd763fff530258cdc03f64b25f89d3a5a" +checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" dependencies = [ "memchr", ] @@ -35,32 +35,25 @@ dependencies = [ "as-slice", ] -[[package]] -name = "android-tzdata" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" - [[package]] name = "anstream" -version = "0.3.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a30da5c5f2d5e72842e00bcb57657162cdabef0931f40e2deb9b4140440cecd" +checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" [[package]] name = "anstyle-parse" @@ -82,9 +75,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c677ab05e09154296dd37acecd46420c17b9713e8366facafa8fc0885167cf4c" +checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -107,9 +100,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b74f44609f0f91493e3082d3734d98497e094777144380ea4db9f9905dd5b6" +checksum = "d495b6dc0184693324491a5ac05f559acc97bf937ab31d7a1c33dd0016be6d2b" dependencies = [ "flate2", "futures-core", @@ -182,9 +175,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.68" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" dependencies = [ "addr2line", "cc", @@ -197,9 +190,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.2" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "bit-set" @@ -239,12 +232,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6798148dccfbff0fae41c7574d2fa8f1ef3492fba0face179de5d8d447d67b05" +checksum = "8042c26c77e5bd6897a7358e0abb3ec412ed126d826988135653fc669263899d" dependencies = [ "memchr", - "regex-automata 0.3.6", + "regex-automata 0.3.7", "serde", ] @@ -268,9 +261,9 @@ checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "cc" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "305fe645edc1442a0fa8b6726ba61d422798d37a52e12eaecf4b022ebbb88f01" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "jobserver", "libc", @@ -290,28 +283,27 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" +checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8" dependencies = [ - "android-tzdata", "num-traits", ] [[package]] name = "clap" -version = "4.3.21" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27cdf28c0f604ba3f512b0c9a409f8de8513e4816705deb0498b627e7c3a3fd" +checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.3.21" +version = "4.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08a9f1ab5e9f01a9b81f202e8562eb9a10de70abf9eaeac1be465c28b75aa4aa" +checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" dependencies = [ "anstream", "anstyle", @@ -322,18 +314,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.3.2" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc443334c81a804575546c5a8a79b4913b50e28d69232903604cada1de817ce" +checksum = "586a385f7ef2f8b4d86bddaa0c094794e7ccbfe5ffef1f434fe928143fc783a5" dependencies = [ "clap", ] [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" [[package]] name = "colorchoice" @@ -478,9 +470,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7684a49fb1af197853ef7b2ee694bc1f5b4179556f1e5710e1760c5db6f5e929" +checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" [[package]] name = "derivative" @@ -546,9 +538,9 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" [[package]] name = "encoding_rs" -version = "0.8.32" +version = "0.8.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" +checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" dependencies = [ "cfg-if 1.0.0", ] @@ -603,9 +595,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b30f669a7961ef1631673d2766cc92f52d64f7ef354d4fe0ddfd30ed52f0f4f" +checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" dependencies = [ "errno-dragonfly", "libc", @@ -682,9 +674,9 @@ dependencies = [ [[package]] name = "fs_at" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15550ecca96ea332ec143fb450701074143b70d358e50b32b1f847ccff2e1cf7" +checksum = "13865faf9bae9729a623b591520adb9c5b1b0ecbec8a48394f47f6801a458f9f" dependencies = [ "aligned", "cfg-if 1.0.0", @@ -789,9 +781,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.3" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" +checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git-testament" @@ -824,9 +816,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.20" +version = "0.3.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" +checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" dependencies = [ "bytes", "fnv", @@ -1028,17 +1020,6 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" -[[package]] -name = "is-terminal" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" -dependencies = [ - "hermit-abi", - "rustix 0.38.8", - "windows-sys 0.48.0", -] - [[package]] name = "itertools" version = "0.10.5" @@ -1148,9 +1129,9 @@ checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" [[package]] name = "memchr" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" [[package]] name = "memoffset" @@ -1207,14 +1188,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.26.2" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdda3d196821d6af13126e40375cdf7da646a96114af134d5f417a9a1dc8e1a" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", "cfg-if 1.0.0", "libc", - "static_assertions", ] [[package]] @@ -1270,9 +1250,9 @@ dependencies = [ [[package]] name = "object" -version = "0.31.1" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" dependencies = [ "memchr", ] @@ -1296,11 +1276,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.56" +version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "729b745ad4a5575dd06a3e1af1414bd330ee561c01b3899eb584baeaa8def17e" +checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.4.0", "cfg-if 1.0.0", "foreign-types", "libc", @@ -1337,9 +1317,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.91" +version = "0.9.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "866b5f16f90776b9bb8dc1e1802ac6f0513de3a7a7465867bfbc563dc737faac" +checksum = "db7e971c2c2bba161b2d2fdf37080177eff520b3bc044787c7f1f5f9e78d869b" dependencies = [ "cc", "libc", @@ -1439,9 +1419,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.9.0" +version = "3.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "126d3e6f3926bfb0fb24495b4f4da50626f547e54956594748e3d8882a0320b4" +checksum = "2a54938017eacd63036332b4ae5c8a49fc8c0c1d6d629893057e4f13609edd06" dependencies = [ "num-traits", ] @@ -1490,9 +1470,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cc1b0bf1727a77a54b6654e7b5f1af8604923edc8b81885f8ec92f9e3f0a05" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -1662,14 +1642,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.3" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81bc1d4caf89fac26a70747fe603c130093b53c773888797a6329091246d651a" +checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.6", - "regex-syntax 0.7.4", + "regex-automata 0.3.7", + "regex-syntax 0.7.5", ] [[package]] @@ -1683,13 +1663,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed1ceff11a1dddaee50c9dc8e4938bd106e9d89ae372f192311e7da498e3b69" +checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.4", + "regex-syntax 0.7.5", ] [[package]] @@ -1700,9 +1680,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5ea92a5b6195c6ef2a0295ea818b312502c6fc94dde986c5553242e18fd4ce2" +checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "remove_dir_all" @@ -1723,9 +1703,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.18" +version = "0.11.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" +checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" dependencies = [ "async-compression", "base64", @@ -1763,7 +1743,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.10.1", + "winreg", ] [[package]] @@ -1822,9 +1802,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.8" +version = "0.38.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19ed4fa021d81c8392ce04db050a3da9a60299050b7ae1cf482d862b54a7218f" +checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964" dependencies = [ "bitflags 2.4.0", "errno", @@ -1835,9 +1815,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.6" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1feddffcfcc0b33f5c6ce9a29e341e4cd59c3f78e7ee45f4a40c038b1d6cbb" +checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" dependencies = [ "log", "ring", @@ -1868,9 +1848,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.3" +version = "0.101.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "261e9e0888cba427c3316e6322805653c9425240b6fd96cee7cb671ab70ab8d0" +checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" dependencies = [ "ring", "untrusted", @@ -1933,7 +1913,7 @@ dependencies = [ "walkdir", "winapi", "windows-sys 0.48.0", - "winreg 0.50.0", + "winreg", "xz2", "zstd", ] @@ -2038,18 +2018,18 @@ checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" [[package]] name = "serde" -version = "1.0.171" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e27d1e4fd7659406c492fd6cfaf2066ba8773de45ca75e855590f856dc34a9" +checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.171" +version = "1.0.188" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389894603bd18c46fa56231694f8d827779c0951a667087194cf9de94ed24682" +checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", @@ -2122,9 +2102,9 @@ checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" [[package]] name = "slab" -version = "0.4.8" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" dependencies = [ "autocfg", ] @@ -2137,9 +2117,9 @@ checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" [[package]] name = "snapbox" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6bccd62078347f89a914e3004d94582e13824d4e3d8a816317862884c423835" +checksum = "ad90eb3a2e3a8031d636d45bd4832751aefd58a291b553f7305a2bacae21aff3" dependencies = [ "anstream", "anstyle", @@ -2154,14 +2134,14 @@ dependencies = [ "tempfile", "wait-timeout", "walkdir", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "snapbox-macros" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaaf09df9f0eeae82be96290918520214530e738a7fe5a351b0f24cf77c0ca31" +checksum = "95f4ffd811b87da98d0e48285134b7847954bd76e843bb794a893b47ca3ee325" dependencies = [ "anstream", ] @@ -2198,12 +2178,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - [[package]] name = "strsim" version = "0.10.0" @@ -2268,7 +2242,7 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall", - "rustix 0.38.8", + "rustix 0.38.10", "windows-sys 0.48.0", ] @@ -2332,9 +2306,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a79d09ac6b08c1ab3906a2f7cc2e81a0e27c7ae89c63812df75e52bef0751e07" +checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" dependencies = [ "deranged", "itoa", @@ -2351,9 +2325,9 @@ checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" [[package]] name = "time-macros" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c65469ed6b3a4809d987a41eb1dc918e9bc1d92211cbad7ae82931846f7451" +checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" dependencies = [ "time-core", ] @@ -2646,9 +2620,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trycmd" -version = "0.14.16" +version = "0.14.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2925e71868a12b173c1eb166018c2d2f9dfaedfcaec747bdb6ea2246785d258e" +checksum = "bc6a42f89ccf3c6ee115608a68e256c172734d525a4ac36d4a17a6d4a8108149" dependencies = [ "glob", "humantime", @@ -2674,9 +2648,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicase" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6" +checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" dependencies = [ "version_check", ] @@ -2710,9 +2684,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" +checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" dependencies = [ "form_urlencoded", "idna", @@ -3024,22 +2998,13 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.14" +version = "0.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d09770118a7eb1ccaf4a594a221334119a44a814fcb0d31c5b85e83e97227a97" +checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" dependencies = [ "memchr", ] -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - [[package]] name = "winreg" version = "0.50.0" From 794e5968c42fc91a4137604842d35d6c6cbe59a4 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Thu, 5 Oct 2023 13:17:38 +0800 Subject: [PATCH 076/229] Fix some typos Signed-off-by: cui fliter --- ci/run.bash | 2 +- doc/dev-guide/src/tracing.md | 4 ++-- src/cli/common.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ci/run.bash b/ci/run.bash index 1de503a5ab..670ebbc196 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -58,7 +58,7 @@ download_pkg_test() { # Machines have 7GB of RAM, and our target/ contents is large enough that # thrashing will occur if we build-run-build-run rather than -# build-build-build-run-run-run. Since this is used soley for non-release +# build-build-build-run-run-run. Since this is used solely for non-release # artifacts, we try to keep features consistent across the builds, whether for # docs/test/runs etc. build_test() { diff --git a/doc/dev-guide/src/tracing.md b/doc/dev-guide/src/tracing.md index 9afc2bec6f..0a26be1b4c 100644 --- a/doc/dev-guide/src/tracing.md +++ b/doc/dev-guide/src/tracing.md @@ -74,8 +74,8 @@ Some good general heuristics: ## Caveats -Cross-thread propogation isn't connected yet. This will cause instrumentation in +Cross-thread propagation isn't connected yet. This will cause instrumentation in a thread to make a new root span until it is fixed. If any Tokio runtime-related code gets added in those threads this will also cause a panic. We have a couple of threadpools in use today; if you need to instrument within that context, use -a thunk to propogate the tokio runtime into those threads. +a thunk to propagate the tokio runtime into those threads. diff --git a/src/cli/common.rs b/src/cli/common.rs index 36b3d7eeba..e9f3d700dd 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -490,7 +490,7 @@ fn print_toolchain_path( } pub(crate) fn list_toolchains(cfg: &Cfg, verbose: bool) -> Result { - // Work with LocalToolchainName to accomdate path based overrides + // Work with LocalToolchainName to accommodate path based overrides let toolchains = cfg .list_toolchains()? .iter() From dc65020655fd03e5113867c4d6b22fab5b74b7d6 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 5 Oct 2023 10:25:22 +0200 Subject: [PATCH 077/229] Apply clippy suggestions from Rust 1.74 (#3497) --- src/cli/rustup_mode.rs | 6 +++--- src/cli/self_update.rs | 4 ++-- src/currentprocess/homethunk.rs | 6 ++---- src/diskio/test.rs | 24 +++++++++++------------- tests/suite/cli_v1.rs | 2 +- tests/suite/cli_v2.rs | 2 +- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 71f86581d9..e29c189754 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -357,7 +357,7 @@ pub(crate) fn cli() -> Command { .subcommand( Command::new("update") .about("Update Rust toolchains and rustup") - .aliases(&["upgrade", "up"]) + .aliases(["upgrade", "up"]) .after_help(UPDATE_HELP) .arg( Arg::new("toolchain") @@ -413,7 +413,7 @@ pub(crate) fn cli() -> Command { .subcommand( Command::new("install") .about("Install or update a given toolchain") - .aliases(&["update", "add"]) + .aliases(["update", "add"]) .arg( Arg::new("toolchain") .help(OFFICIAL_TOOLCHAIN_ARG_HELP) @@ -727,7 +727,7 @@ pub(crate) fn cli() -> Command { .arg(Arg::new("topic").help(TOPIC_ARG_HELP)) .group( ArgGroup::new("page").args( - &DOCS_DATA + DOCS_DATA .iter() .map(|(name, _, _)| *name) .collect::>(), diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 9dcee209e9..e3823980af 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -750,7 +750,7 @@ fn install_bins() -> Result<()> { pub(crate) fn install_proxies() -> Result<()> { let bin_path = utils::cargo_home()?.join("bin"); - let rustup_path = bin_path.join(&format!("rustup{EXE_SUFFIX}")); + let rustup_path = bin_path.join(format!("rustup{EXE_SUFFIX}")); let rustup = Handle::from_path(&rustup_path)?; @@ -965,7 +965,7 @@ pub(crate) fn uninstall(no_prompt: bool) -> Result { let cargo_home = utils::cargo_home()?; - if !cargo_home.join(&format!("bin/rustup{EXE_SUFFIX}")).exists() { + if !cargo_home.join(format!("bin/rustup{EXE_SUFFIX}")).exists() { return Err(CLIError::NotSelfInstalled { p: cargo_home }.into()); } diff --git a/src/currentprocess/homethunk.rs b/src/currentprocess/homethunk.rs index 65f2d59e7b..065a28960e 100644 --- a/src/currentprocess/homethunk.rs +++ b/src/currentprocess/homethunk.rs @@ -1,8 +1,6 @@ /// Adapts currentprocess to the trait home::Env use std::ffi::OsString; use std::io; -#[cfg(feature = "test")] -use std::ops::Deref; use std::path::PathBuf; use home::env as home; @@ -42,10 +40,10 @@ impl home::Env for TestProcess { self.var("HOME").ok().map(|v| v.into()) } fn current_dir(&self) -> Result { - CurrentDirSource::current_dir(self.deref()) + CurrentDirSource::current_dir(self) } fn var_os(&self, key: &str) -> Option { - VarSource::var_os(self.deref(), key) + VarSource::var_os(self, key) } } diff --git a/src/diskio/test.rs b/src/diskio/test.rs index 8130213858..14c5fcb3bc 100644 --- a/src/diskio/test.rs +++ b/src/diskio/test.rs @@ -36,10 +36,10 @@ fn test_incremental_file(io_threads: &str) -> Result<()> { 0o666, io_executor.incremental_file_state(), )?; - for _ in io_executor.execute(item).collect::>() { - // The file should be open and incomplete, and no completed chunks - unreachable!(); - } + + // The file should be open and incomplete, and no completed chunks + assert!(io_executor.execute(item).collect::>().is_empty()); + let mut chunk = io_executor.get_buffer(super::IO_CHUNK_SIZE); chunk.extend(b"0123456789"); chunk = chunk.finished(); @@ -76,13 +76,12 @@ fn test_incremental_file(io_threads: &str) -> Result<()> { break; } } - assert!(file_finished); - for _ in io_executor.join().collect::>() { - // no more work should be outstanding - unreachable!(); - } + // no more work should be outstanding + assert!(file_finished); + assert!(io_executor.join().collect::>().is_empty()); assert_eq!(io_executor.buffer_used(), 0); + Ok(()) })?; // We should be able to read back the file @@ -143,10 +142,9 @@ fn test_complete_file(io_threads: &str) -> Result<()> { } } assert!(items > 0); - for _ in io_executor.join().collect::>() { - // no more work should be outstanding - unreachable!(); - } + // no more work should be outstanding + assert!(io_executor.join().collect::>().is_empty()); + Ok(()) })?; // We should be able to read back the file with correct content diff --git a/tests/suite/cli_v1.rs b/tests/suite/cli_v1.rs index 4a3d617423..331b2747f6 100644 --- a/tests/suite/cli_v1.rs +++ b/tests/suite/cli_v1.rs @@ -176,7 +176,7 @@ fn bad_sha_on_manifest() { fn bad_sha_on_installer() { setup(&|config| { let dir = config.distdir.as_ref().unwrap().join("dist"); - for file in fs::read_dir(&dir).unwrap() { + for file in fs::read_dir(dir).unwrap() { let file = file.unwrap(); let path = file.path(); let filename = path.to_string_lossy(); diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index e892ac8048..f94f3da91a 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -304,7 +304,7 @@ fn bad_sha_on_installer() { setup(&|config| { // Since the v2 sha's are contained in the manifest, corrupt the installer let dir = config.distdir.as_ref().unwrap().join("dist/2015-01-02"); - for file in fs::read_dir(&dir).unwrap() { + for file in fs::read_dir(dir).unwrap() { let file = file.unwrap(); let path = file.path(); let filename = path.to_string_lossy(); From e23a019b752880d046782d1ef0a6085e7c3f3520 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 30 Aug 2023 18:15:40 +0800 Subject: [PATCH 078/229] Update Rust crate winreg to 0.51 --- Cargo.lock | 14 ++++++++++++-- Cargo.toml | 2 +- tests/suite/cli_paths.rs | 2 +- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87175a19ee..3cdc703248 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1743,7 +1743,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg", + "winreg 0.50.0", ] [[package]] @@ -1913,7 +1913,7 @@ dependencies = [ "walkdir", "winapi", "windows-sys 0.48.0", - "winreg", + "winreg 0.51.0", "xz2", "zstd", ] @@ -3017,6 +3017,16 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "winreg" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" +dependencies = [ + "cfg-if 1.0.0", + "windows-sys 0.48.0", +] + [[package]] name = "xattr" version = "1.0.1" diff --git a/Cargo.toml b/Cargo.toml index 35378535de..71ea76d64b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -113,7 +113,7 @@ version = "1.1.0" [target."cfg(windows)".dependencies] cc = "1" -winreg = "0.50" +winreg = "0.51" [target."cfg(windows)".dependencies.winapi] features = [ diff --git a/tests/suite/cli_paths.rs b/tests/suite/cli_paths.rs index 762af45d21..7403b96fc9 100644 --- a/tests/suite/cli_paths.rs +++ b/tests/suite/cli_paths.rs @@ -362,7 +362,7 @@ mod windows { fn install_uninstall_affect_path() { clitools::test(Scenario::Empty, &|config| { with_saved_path(&mut || { - let path = format!("{:?}", config.cargodir.join("bin").to_string_lossy()); + let path = config.cargodir.join("bin").display().to_string(); config.expect_ok(&INIT_NONE); assert!( From b16e0597e68e7dd519a41e38055af24a1d110690 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 30 Aug 2023 18:15:40 +0800 Subject: [PATCH 079/229] Refactor test case `install_uninstall_affect_path` --- tests/suite/cli_paths.rs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tests/suite/cli_paths.rs b/tests/suite/cli_paths.rs index 7403b96fc9..f6078b7578 100644 --- a/tests/suite/cli_paths.rs +++ b/tests/suite/cli_paths.rs @@ -362,22 +362,19 @@ mod windows { fn install_uninstall_affect_path() { clitools::test(Scenario::Empty, &|config| { with_saved_path(&mut || { - let path = config.cargodir.join("bin").display().to_string(); + let cfg_path = config.cargodir.join("bin").display().to_string(); + let get_path_ = || get_path().unwrap().unwrap().to_string(); config.expect_ok(&INIT_NONE); assert!( - get_path() - .unwrap() - .unwrap() - .to_string() - .contains(path.trim_matches('"')), + get_path_().contains(cfg_path.trim_matches('"')), "`{}` not in `{}`", - path, - get_path().unwrap().unwrap() + cfg_path, + get_path_() ); config.expect_ok(&["rustup", "self", "uninstall", "-y"]); - assert!(!get_path().unwrap().unwrap().to_string().contains(&path)); + assert!(!get_path_().contains(&cfg_path)); }) }); } From 3ec15a10a979f3f6be2b40043dc4e4463d611217 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 24 Sep 2023 22:12:43 +0800 Subject: [PATCH 080/229] 1.26.0 should not be unreleased in the changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a6680dbed..27268961a6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [1.26.0] - unreleased +## [1.26.0] - 2023-04-05 This version of Rustup involves a significant number of internal refactors, both in terms of the Rustup code and its tests. @@ -48,6 +48,7 @@ please review the repository. - Fix RUSTUP_PERMIT_COPY_RENAME condition so it is actually used [pr#3292] - Bump a lot of dependencies to their latest versions [pr#renovate-bot] +[1.26.0]: https://github.com/rust-lang/rustup/releases/tag/1.26.0 [rust-analyzer]: https://github.com/rust-lang/rust-analyzer [proxy]: https://rust-lang.github.io/rustup/concepts/proxies.html [clap]: https://crates.io/crates/clap From cc9b4f00c5be88c1f534a1a55dbfe148ec8a1f30 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 24 Sep 2023 22:13:07 +0800 Subject: [PATCH 081/229] fix invalid link for 1.25.2 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 27268961a6..408a0038f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -126,7 +126,7 @@ Thanks go to: - Pietro Albini - Daniel Silverstone -[1.25.2]: https://github.com/rust-lang/rustup/release/tag/1.25.2 +[1.25.2]: https://github.com/rust-lang/rustup/releases/tag/1.25.2 ## [1.25.1] - 2022-07-12 From a6dfda74ee2f3a5cbbc849df9f51a58a0dd7fa3b Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Thu, 5 Oct 2023 10:52:57 +0200 Subject: [PATCH 082/229] Avoid warning for unused variant --- src/currentprocess/terminalsource.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/currentprocess/terminalsource.rs b/src/currentprocess/terminalsource.rs index 19658ce8c5..950710e9ff 100644 --- a/src/currentprocess/terminalsource.rs +++ b/src/currentprocess/terminalsource.rs @@ -19,7 +19,7 @@ pub(super) enum StreamSelector { Stderr, #[cfg(feature = "test")] TestWriter(TestWriter), - #[cfg(feature = "test")] + #[cfg(all(test, feature = "test"))] TestTtyWriter(TestWriter), } @@ -38,7 +38,7 @@ impl StreamSelector { }, #[cfg(feature = "test")] StreamSelector::TestWriter(_) => false, - #[cfg(feature = "test")] + #[cfg(all(test, feature = "test"))] StreamSelector::TestTtyWriter(_) => true, } } @@ -100,9 +100,9 @@ impl ColorableTerminal { TerminalInner::StandardStream(StandardStream::stderr(choice), ColorSpec::new()) } #[cfg(feature = "test")] - StreamSelector::TestWriter(w) | StreamSelector::TestTtyWriter(w) => { - TerminalInner::TestWriter(w, choice) - } + StreamSelector::TestWriter(w) => TerminalInner::TestWriter(w, choice), + #[cfg(all(test, feature = "test"))] + StreamSelector::TestTtyWriter(w) => TerminalInner::TestWriter(w, choice), }; ColorableTerminal { inner: Arc::new(Mutex::new(inner)), From 0ab89bd01108e3ed0bf3930df78729edfb1f7e76 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 09:41:15 +0000 Subject: [PATCH 083/229] Update actions/checkout action to v4 --- .github/workflows/all-features.yaml | 2 +- .github/workflows/centos-fmt-clippy-on-all.yaml | 2 +- .github/workflows/deploy-docs.yaml | 2 +- .github/workflows/linux-builds-on-master.yaml | 2 +- .github/workflows/linux-builds-on-pr.yaml | 2 +- .github/workflows/linux-builds-on-stable.yaml | 2 +- .github/workflows/macos-builds-on-all.yaml | 2 +- .github/workflows/test-docs.yaml | 2 +- .github/workflows/windows-builds-on-master.yaml | 2 +- .github/workflows/windows-builds-on-pr.yaml | 2 +- .github/workflows/windows-builds-on-stable.yaml | 2 +- ci/actions-templates/centos-fmt-clippy-template.yaml | 2 +- ci/actions-templates/linux-builds-template.yaml | 2 +- ci/actions-templates/macos-builds-template.yaml | 2 +- ci/actions-templates/windows-builds-template.yaml | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/all-features.yaml b/.github/workflows/all-features.yaml index f3ea972461..a596654806 100644 --- a/.github/workflows/all-features.yaml +++ b/.github/workflows/all-features.yaml @@ -23,7 +23,7 @@ jobs: - x86_64-unknown-linux-gnu steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install rustup stable run: rustup toolchain install stable --profile minimal - name: Install Protoc diff --git a/.github/workflows/centos-fmt-clippy-on-all.yaml b/.github/workflows/centos-fmt-clippy-on-all.yaml index 23baf85778..f75f37151a 100644 --- a/.github/workflows/centos-fmt-clippy-on-all.yaml +++ b/.github/workflows/centos-fmt-clippy-on-all.yaml @@ -23,7 +23,7 @@ jobs: fail-fast: false steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/.github/workflows/deploy-docs.yaml b/.github/workflows/deploy-docs.yaml index 56910768ac..0b191eea96 100644 --- a/.github/workflows/deploy-docs.yaml +++ b/.github/workflows/deploy-docs.yaml @@ -17,7 +17,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install mdbook diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml index c037f90fcc..fce217e686 100644 --- a/.github/workflows/linux-builds-on-master.yaml +++ b/.github/workflows/linux-builds-on-master.yaml @@ -37,7 +37,7 @@ jobs: #snap_arch: armhf steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml index d5ee9e8cd2..b6b2fc525e 100644 --- a/.github/workflows/linux-builds-on-pr.yaml +++ b/.github/workflows/linux-builds-on-pr.yaml @@ -31,7 +31,7 @@ jobs: #snap_arch: armhf steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml index a345983b0a..8f51296026 100644 --- a/.github/workflows/linux-builds-on-stable.yaml +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -61,7 +61,7 @@ jobs: #snap_arch: s390x # skip-pr skip-master steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/.github/workflows/macos-builds-on-all.yaml b/.github/workflows/macos-builds-on-all.yaml index 4e5dbe6021..7dd3381d70 100644 --- a/.github/workflows/macos-builds-on-all.yaml +++ b/.github/workflows/macos-builds-on-all.yaml @@ -30,7 +30,7 @@ jobs: - target: x86_64-apple-darwin run_tests: YES steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/.github/workflows/test-docs.yaml b/.github/workflows/test-docs.yaml index 3173b8a485..2c4e5bd56d 100644 --- a/.github/workflows/test-docs.yaml +++ b/.github/workflows/test-docs.yaml @@ -13,7 +13,7 @@ jobs: name: Documentation runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Install mdbook diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml index 186bfc210d..105d1b7ef0 100644 --- a/.github/workflows/windows-builds-on-master.yaml +++ b/.github/workflows/windows-builds-on-master.yaml @@ -33,7 +33,7 @@ jobs: mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr mingwdir: mingw64 # skip-pr steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag with: fetch-depth: 0 diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml index 206151b8b8..af7d61b133 100644 --- a/.github/workflows/windows-builds-on-pr.yaml +++ b/.github/workflows/windows-builds-on-pr.yaml @@ -27,7 +27,7 @@ jobs: - target: x86_64-pc-windows-msvc run_tests: YES steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag with: fetch-depth: 0 diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml index d8cc830853..a199b94c6c 100644 --- a/.github/workflows/windows-builds-on-stable.yaml +++ b/.github/workflows/windows-builds-on-stable.yaml @@ -36,7 +36,7 @@ jobs: mingwdir: mingw32 # skip-pr skip-master mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag with: fetch-depth: 0 diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index 23baf85778..f75f37151a 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -23,7 +23,7 @@ jobs: fail-fast: false steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 5740f01182..0de8a46cee 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -70,7 +70,7 @@ jobs: #snap_arch: s390x # skip-pr skip-master steps: - name: Clone repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml index 4e5dbe6021..7dd3381d70 100644 --- a/ci/actions-templates/macos-builds-template.yaml +++ b/ci/actions-templates/macos-builds-template.yaml @@ -30,7 +30,7 @@ jobs: - target: x86_64-apple-darwin run_tests: YES steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 3e102b7c14..84749550a9 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -45,7 +45,7 @@ jobs: mingwdir: mingw32 # skip-pr skip-master mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag with: fetch-depth: 0 From bc96a2ab609ea4e15af245d79571fd5a6a27c41c Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 25 Aug 2023 10:57:35 +0800 Subject: [PATCH 084/229] Adjust section titles in the user guide I found `package-managers` ambiguous since it could mean installing `rustup` using a package manager, or installing `rustup` while already using externally-managed `rust` toolchains. Hopefully this change will make that ambiguity disappear. --- doc/user-guide/book.toml | 3 +++ doc/user-guide/src/SUMMARY.md | 4 ++-- .../{package-managers.md => already-installed-rust.md} | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) rename doc/user-guide/src/installation/{package-managers.md => already-installed-rust.md} (98%) diff --git a/doc/user-guide/book.toml b/doc/user-guide/book.toml index 03889b5baf..ab6b76ff3d 100644 --- a/doc/user-guide/book.toml +++ b/doc/user-guide/book.toml @@ -6,3 +6,6 @@ title = "The rustup book" edit-url-template = "https://github.com/rust-lang/rustup/edit/master/doc/user-guide/{path}" git-repository-url = "https://github.com/rust-lang/rustup/tree/master/doc/user-guide" site-url = "https://rust-lang.github.io/rustup/" + +[output.html.redirect] +"/installation/package-managers.html" = "already-installed-rust.html" diff --git a/doc/user-guide/src/SUMMARY.md b/doc/user-guide/src/SUMMARY.md index 583f95f988..1b761d6d16 100644 --- a/doc/user-guide/src/SUMMARY.md +++ b/doc/user-guide/src/SUMMARY.md @@ -3,9 +3,9 @@ [Introduction](index.md) - [Installation](installation/index.md) - [Windows](installation/windows.md) - - [MSVC Prerequistes](installation/windows-msvc.md) + - [MSVC prerequisites](installation/windows-msvc.md) - [Other installation methods](installation/other.md) - - [Package managers](installation/package-managers.md) + - [Already installed Rust?](installation/already-installed-rust.md) - [Concepts](concepts/index.md) - [Channels](concepts/channels.md) - [Toolchains](concepts/toolchains.md) diff --git a/doc/user-guide/src/installation/package-managers.md b/doc/user-guide/src/installation/already-installed-rust.md similarity index 98% rename from doc/user-guide/src/installation/package-managers.md rename to doc/user-guide/src/installation/already-installed-rust.md index b897bb4150..7e13a8eca6 100644 --- a/doc/user-guide/src/installation/package-managers.md +++ b/doc/user-guide/src/installation/already-installed-rust.md @@ -1,4 +1,4 @@ -# Package managers +# Already installed Rust? Several Linux distributions package Rust, and you may wish to use the packaged toolchain, such as for distribution package development. You may also wish to From 7e224261fea0df2c15273a46fef147df7d34601f Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 25 Aug 2023 11:12:09 +0800 Subject: [PATCH 085/229] Mention `brew install rustup-init` in the user guide --- doc/user-guide/src/installation/other.md | 28 ++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/doc/user-guide/src/installation/other.md b/doc/user-guide/src/installation/other.md index a514e92740..61106f8f19 100644 --- a/doc/user-guide/src/installation/other.md +++ b/doc/user-guide/src/installation/other.md @@ -29,6 +29,32 @@ $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default $ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --profile minimal --default-toolchain nightly ``` + +## Using a package manager + +> Please note that the rustup project is not maintaining any package mentioned in this section. +> If you have encountered any problems installing `rustup` with a package manager, +> please contact the package maintainer(s) for further information. + +### Homebrew + +You can use `brew` to install `rustup-init`[^not-rust]: + +```sh +$ brew install rustup-init +``` + +Then execute `rustup-init` to proceed with the installation. + +When the installation is complete, +make sure that `$HOME/.cargo/bin` is in your `$PATH`, +and you should be able to use `rustup` normally. + +[^not-rust]: This is not to be confused with the `rust` package, +which is a `brew`-managed `rust` toolchain installation. + +## Manual installation + If you prefer you can directly download `rustup-init` for the platform of your choice: @@ -106,6 +132,8 @@ choice: You can fetch an older version from `https://static.rust-lang.org/rustup/archive/{rustup-version}/{target-triple}/rustup-init[.exe]` +## Self-compiled installation + To install `rustup` from source, check out the git repository from and run `cargo run --release`. Note that after installation the `rustup` toolchains will supersede any pre-existing From de7b1a5bb732830f56e53b0eece67059688dedf2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 5 Oct 2023 10:45:48 +0000 Subject: [PATCH 086/229] Update Rust crate toml to 0.8 --- Cargo.lock | 21 +++++++++++++++++---- Cargo.toml | 2 +- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3cdc703248..44e21a96cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2444,14 +2444,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.7.6" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c17e963a819c331dcacd7ab957d80bc2b9a9c1e71c804826d2f283dd65306542" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.20.2", ] [[package]] @@ -2476,6 +2476,19 @@ dependencies = [ "winnow", ] +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap 2.0.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tonic" version = "0.9.2" @@ -2633,7 +2646,7 @@ dependencies = [ "serde", "shlex", "snapbox", - "toml_edit", + "toml_edit 0.19.14", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 71ea76d64b..d144c003a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -83,7 +83,7 @@ termcolor.workspace = true thiserror.workspace = true threadpool = "1" tokio = { workspace = true, optional = true } -toml = "0.7" +toml = "0.8" tracing-opentelemetry = { workspace = true, optional = true } tracing-subscriber = { workspace = true, optional = true, features = [ "env-filter", From 303c6f990bb0aaa10935c47d2fe971417c1044df Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Fri, 22 Sep 2023 19:31:42 -0400 Subject: [PATCH 087/229] Do not fallback to "arm" in rustup-init.sh on aarch64 with 32-bit userland On aarch64, neon will not be present in /proc/cpuinfo, instead asimd is there. Previously, we'd fall back to arm when running with a 32-bit userland, even though armv7 is perfectly appropriate in this case. This would then run into the issue described in https://github.com/rust-lang/rust/issues/58414 with "CP15 barrier emulation". This PR fixes that. --- rustup-init.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index a7701c5336..6e0ef4b03d 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -517,8 +517,8 @@ get_architecture() { # and fall back to arm. # See https://github.com/rust-lang/rustup.rs/issues/587. if [ "$_ostype" = "unknown-linux-gnueabihf" ] && [ "$_cputype" = armv7 ]; then - if ensure grep '^Features' /proc/cpuinfo | grep -q -v neon; then - # At least one processor does not have NEON. + if ensure grep '^Features' /proc/cpuinfo | grep -E -q -v 'neon|simd'; then + # At least one processor does not have NEON (which is asimd on armv8+). _cputype=arm fi fi From 745473d6a7c9810b03df36fbf9c764bd63bb9fb1 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 23 Sep 2023 11:34:25 -0400 Subject: [PATCH 088/229] When running a 32-bit rustup on an aarch64 CPU, select a 32-bit toolchain this mirrors a similar check that exists in rustup-init.sh fixes #3307 --- src/dist/dist.rs | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 97093a21c1..ceceae331e 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -1,7 +1,8 @@ use std::collections::HashSet; use std::env; use std::fmt; -use std::io::Write; +use std::fs; +use std::io::{self, Read, Write}; use std::ops::Deref; use std::path::Path; use std::str::FromStr; @@ -219,6 +220,26 @@ impl Deref for TargetTriple { } } +fn is_32bit_userspace() -> bool { + // Check if /bin/sh is a 32-bit binary. If it doesn't exist, fall back to + // checking if _we_ are a 32-bit binary. + // rustup-init.sh also relies on checking /bin/sh for bitness. + + // inner function is to simplify error handling. + fn inner() -> io::Result { + let mut f = fs::File::open("/bin/sh")?; + let mut buf = [0; 5]; + f.read_exact(&mut buf)?; + + // ELF files start out "\x7fELF", and the following byte is + // 0x01 for 32-bit and + // 0x02 for 64-bit. + Ok(&buf == b"\x7fELF\x01") + } + + inner().unwrap_or(cfg!(target_pointer_width = "32")) +} + impl TargetTriple { pub fn new(name: &str) -> Self { Self(name.to_string()) @@ -346,7 +367,11 @@ impl TargetTriple { (b"Linux", b"arm") => Some("arm-unknown-linux-gnueabi"), (b"Linux", b"armv7l") => Some("armv7-unknown-linux-gnueabihf"), (b"Linux", b"armv8l") => Some("armv7-unknown-linux-gnueabihf"), - (b"Linux", b"aarch64") => Some(TRIPLE_AARCH64_UNKNOWN_LINUX), + (b"Linux", b"aarch64") => Some(if is_32bit_userspace() { + "armv7-unknown-linux-gnueabihf" + } else { + TRIPLE_AARCH64_UNKNOWN_LINUX + }), (b"Darwin", b"x86_64") => Some("x86_64-apple-darwin"), (b"Darwin", b"i686") => Some("i686-apple-darwin"), (b"FreeBSD", b"x86_64") => Some("x86_64-unknown-freebsd"), From be2c44cba99dd2f44aca83751093c50379bd5b60 Mon Sep 17 00:00:00 2001 From: Chris Denton Date: Sun, 13 Aug 2023 11:11:25 +0100 Subject: [PATCH 089/229] Windows: Load DLLs from system32 --- build.rs | 40 ++++++++++++++++++++++++++++++++++++++++ src/bin/rustup-init.rs | 21 +++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/build.rs b/build.rs index fae0a48931..407545c869 100644 --- a/build.rs +++ b/build.rs @@ -27,4 +27,44 @@ fn main() { } let target = env::var("TARGET").unwrap(); println!("cargo:rustc-env=TARGET={target}"); + + // Set linker options specific to Windows MSVC. + let target_os = env::var("CARGO_CFG_TARGET_OS"); + let target_env = env::var("CARGO_CFG_TARGET_ENV"); + if !(target_os.as_deref() == Ok("windows") && target_env.as_deref() == Ok("msvc")) { + return; + } + + // # Only search system32 for DLLs + // + // This applies to DLLs loaded at load time. However, this setting is ignored + // before Windows 10 RS1 (aka 1601). + // https://learn.microsoft.com/en-us/cpp/build/reference/dependentloadflag?view=msvc-170 + println!("cargo:cargo:rustc-link-arg-bin=rustup-init=/DEPENDENTLOADFLAG:0x800"); + + // # Delay load + // + // Delay load dlls that are not "known DLLs"[1]. + // Known DLLs are always loaded from the system directory whereas other DLLs + // are loaded from the application directory. By delay loading the latter + // we can ensure they are instead loaded from the system directory. + // [1]: https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order#factors-that-affect-searching + // + // This will work on all supported Windows versions but it relies on + // us using `SetDefaultDllDirectories` before any libraries are loaded. + // See also: src/bin/rustup-init.rs + let delay_load_dlls = ["bcrypt", "powrprof", "secur32"]; + for dll in delay_load_dlls { + println!("cargo:rustc-link-arg-bin=rustup-init=/delayload:{dll}.dll"); + } + // When using delayload, it's necessary to also link delayimp.lib + // https://learn.microsoft.com/en-us/cpp/build/reference/dependentloadflag?view=msvc-170 + println!("cargo:rustc-link-arg-bin=rustup-init=delayimp.lib"); + + // # Turn linker warnings into errors + // + // Rust hides linker warnings meaning mistakes may go unnoticed. + // Turning them into errors forces them to be displayed (and the build to fail). + // If we do want to ignore specific warnings then `/IGNORE:` should be used. + println!("cargo:cargo:rustc-link-arg-bin=rustup-init=/WX"); } diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index e486ff6fcf..19c8dd99e9 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -29,6 +29,9 @@ use rustup::is_proxyable_tools; use rustup::utils::utils; fn main() { + #[cfg(windows)] + pre_rustup_main_init(); + let process = OSProcess::default(); with(process.into(), || match maybe_trace_rustup() { Err(e) => { @@ -163,3 +166,21 @@ fn do_recursion_guard() -> Result<()> { Ok(()) } + +/// Windows pre-main security mitigations. +/// +/// This attempts to defend against malicious DLLs that may sit alongside +/// rustup-init in the user's download folder. +#[cfg(windows)] +pub fn pre_rustup_main_init() { + use winapi::um::libloaderapi::{SetDefaultDllDirectories, LOAD_LIBRARY_SEARCH_SYSTEM32}; + // Default to loading delay loaded DLLs from the system directory. + // For DLLs loaded at load time, this relies on the `delayload` linker flag. + // This is only necessary prior to Windows 10 RS1. See build.rs for details. + unsafe { + let result = SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_SYSTEM32); + // SetDefaultDllDirectories should never fail if given valid arguments. + // But just to be safe and to catch mistakes, assert that it succeeded. + assert_ne!(result, 0); + } +} From 865d699588df1413786b392033b6cce019fbeca5 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sat, 7 Oct 2023 03:36:05 +0800 Subject: [PATCH 090/229] Adjust instructions for manual installation (#3502) --- doc/user-guide/src/installation/other.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/doc/user-guide/src/installation/other.md b/doc/user-guide/src/installation/other.md index 61106f8f19..f5f6ec82b6 100644 --- a/doc/user-guide/src/installation/other.md +++ b/doc/user-guide/src/installation/other.md @@ -55,8 +55,11 @@ which is a `brew`-managed `rust` toolchain installation. ## Manual installation -If you prefer you can directly download `rustup-init` for the platform of your -choice: +You can manually download `rustup-init` for a given target from +`https://static.rust-lang.org/rustup/dist/{target-triple}/rustup-init[.exe]`[^msvc]. + +
+Direct links - [aarch64-apple-darwin](https://static.rust-lang.org/rustup/dist/aarch64-apple-darwin/rustup-init) - [sha256 file](https://static.rust-lang.org/rustup/dist/aarch64-apple-darwin/rustup-init.sha256) @@ -121,6 +124,13 @@ choice: - [x86_64-unknown-netbsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-netbsd/rustup-init) - [sha256 file](https://static.rust-lang.org/rustup/dist/x86_64-unknown-netbsd/rustup-init.sha256) +
+ +To get a previous version, use +`https://static.rust-lang.org/rustup/archive/{rustup-version}/{target-triple}/rustup-init[.exe]`. + +SHA-256 checksums are also available by appending `.sha256` to the link. + [^msvc]: MSVC builds of `rustup` additionally require an [installation of Visual Studio 2019 or the Visual C++ Build Tools 2019][vs]. For Visual Studio, make sure to check the "C++ tools" and "Windows 10 SDK" option. No @@ -129,9 +139,6 @@ choice: [vs]: https://visualstudio.microsoft.com/downloads/ -You can fetch an older version from -`https://static.rust-lang.org/rustup/archive/{rustup-version}/{target-triple}/rustup-init[.exe]` - ## Self-compiled installation To install `rustup` from source, check out the git repository from From cd3a10fba80e10f176985d8afd8d20a9be3ec0c4 Mon Sep 17 00:00:00 2001 From: Chih Wang Date: Sat, 7 Oct 2023 03:40:38 +0800 Subject: [PATCH 091/229] Capturing IO error in download_file_with_resume (#3421) --- src/utils/utils.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 36be5a19c7..373a72d8a4 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -151,6 +151,9 @@ pub(crate) fn download_file_with_resume( match download_file_(url, path, hasher, resume_from_partial, notify_handler) { Ok(_) => Ok(()), Err(e) => { + if let Some(_) = e.downcast_ref::() { + return Err(e); + } let is_client_error = match e.downcast_ref::() { // Specifically treat the bad partial range error as not our // fault in case it was something odd which happened. From 004000145aec2c5b231a172c93a261fe39304f4f Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 8 Oct 2023 20:47:48 +0800 Subject: [PATCH 092/229] Apply more `clippy` suggestions --- download/tests/read-proxy-env.rs | 3 +-- src/utils/utils.rs | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/download/tests/read-proxy-env.rs b/download/tests/read-proxy-env.rs index c6b8c72074..5b3e88ea0a 100644 --- a/download/tests/read-proxy-env.rs +++ b/download/tests/read-proxy-env.rs @@ -74,8 +74,7 @@ fn socks_proxy_request() { let s = e.source().unwrap(); assert!( s.to_string().contains("socks connect error"), - "Expected socks connect error, got: {}", - s.to_string() + "Expected socks connect error, got: {s}", ); assert_eq!(CALL_COUNT.load(Ordering::SeqCst), 1); } else { diff --git a/src/utils/utils.rs b/src/utils/utils.rs index 373a72d8a4..e4d7e9adb9 100644 --- a/src/utils/utils.rs +++ b/src/utils/utils.rs @@ -151,7 +151,7 @@ pub(crate) fn download_file_with_resume( match download_file_(url, path, hasher, resume_from_partial, notify_handler) { Ok(_) => Ok(()), Err(e) => { - if let Some(_) = e.downcast_ref::() { + if e.downcast_ref::().is_some() { return Err(e); } let is_client_error = match e.downcast_ref::() { From 3ee50cc643ddee89c9189e48fe935064f0a27ccc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 8 Oct 2023 02:02:06 +0000 Subject: [PATCH 093/229] Lock file maintenance --- Cargo.lock | 409 ++++++++---------- ci/docker/x86_64-unknown-linux-gnu/Dockerfile | 5 + 2 files changed, 191 insertions(+), 223 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44e21a96cf..b7b928d405 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.0.5" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c378d78423fdad8089616f827526ee33c19f2fddbd5de1629152c9593ba4783" +checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" dependencies = [ "memchr", ] @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.5.0" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", @@ -51,15 +51,15 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.2" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c4c2c83f81532e5845a733998b6971faca23490340a418e9b72a3ec9de12ea" +checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "938874ff5980b03a87c5524b3ae5b59cf99b1d6bc836848df7bc5ada9643c333" +checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" dependencies = [ "utf8parse", ] @@ -75,9 +75,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "2.1.0" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d495b6dc0184693324491a5ac05f559acc97bf937ab31d7a1c33dd0016be6d2b" +checksum = "bb42b2197bf15ccb092b62c74515dbd8b86d0effd934795f6687c93b6e679a2c" dependencies = [ "flate2", "futures-core", @@ -119,7 +119,7 @@ checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" +checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" [[package]] name = "bit-set" @@ -232,32 +232,26 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.1" +version = "1.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8042c26c77e5bd6897a7358e0abb3ec412ed126d826988135653fc669263899d" +checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" dependencies = [ "memchr", - "regex-automata 0.3.7", + "regex-automata 0.3.9", "serde", ] [[package]] name = "bumpalo" -version = "3.13.0" +version = "3.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" +checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" [[package]] name = "bytes" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" +checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" [[package]] name = "cc" @@ -283,27 +277,27 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.27" +version = "0.4.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f56b4c72906975ca04becb8a30e102dfecddd0c06181e3e95ddc444be28881f8" +checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" dependencies = [ "num-traits", ] [[package]] name = "clap" -version = "4.4.1" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c8d502cbaec4595d2e7d5f61e318f05417bd2b66fdc3809498f0d3fdf0bea27" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.1" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5891c7bc0edb3e1c2204fc5e94009affabeb1821c9e5fdc3959536c5c0bb984d" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", @@ -314,9 +308,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.0" +version = "4.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "586a385f7ef2f8b4d86bddaa0c094794e7ccbfe5ffef1f434fe928143fc783a5" +checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" dependencies = [ "clap", ] @@ -446,9 +440,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.65+curl-8.2.1" +version = "0.4.66+curl-8.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "961ba061c9ef2fe34bbd12b807152d96f0badd2bebe7b90ce6c8c8b7572a0986" +checksum = "70c44a72e830f0e40ad90dda8a6ab6ed6314d39776599a58a2e5e37fbc6db5b9" dependencies = [ "cc", "libc", @@ -456,7 +450,7 @@ dependencies = [ "openssl-sys", "pkg-config", "vcpkg", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -547,22 +541,22 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.6.1" +version = "2.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9705d8de4776df900a4a0b2384f8b0ab42f775e93b083b42f8ce71bdc32a47e3" +checksum = "c188012f8542dee7b3996e44dd89461d64aa471b0a7c71a1ae2f595d259e96e5" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb14d927583dd5c2eac0f2cf264fc4762aefe1ae14c47a8a20fc1939d3a5fc0" +checksum = "04d0b288e3bb1d861c4403c1774a6f7a798781dfc519b3647df2a3dd4ae95f25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -574,7 +568,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -595,9 +589,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "136526188508e25c6fef639d7927dfb3e0e3084488bf202267829cf7fc23dbdd" +checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" dependencies = [ "errno-dragonfly", "libc", @@ -616,9 +610,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "filetime" @@ -674,9 +668,9 @@ dependencies = [ [[package]] name = "fs_at" -version = "0.1.9" +version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13865faf9bae9729a623b591520adb9c5b1b0ecbec8a48394f47f6801a458f9f" +checksum = "982f82cc75107eef84f417ad6c53ae89bf65b561937ca4a3b3b0fd04d0aa2425" dependencies = [ "aligned", "cfg-if 1.0.0", @@ -726,7 +720,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -787,24 +781,23 @@ checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" [[package]] name = "git-testament" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "986bf57c808270f3a0a0652c3bfce0f5d667aa5f5b465616dc697c7f390834b1" +checksum = "710c78d2b68e46e62f5ba63ba0a7a2986640f37f9ecc07903b9ad4e7b2dbfc8e" dependencies = [ "git-testament-derive", - "no-std-compat", ] [[package]] name = "git-testament-derive" -version = "0.1.14" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a782db5866c7ab75f3552dda4cbf34e3e257cc64c963c6ed5af1e12818e8ae6" +checksum = "9b31494efbbe1a6730f6943759c21b92c8dc431cb4df177e6f2a6429c3c96842" dependencies = [ "log", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.38", "time", ] @@ -841,15 +834,15 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" +checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" [[package]] name = "hermit-abi" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "home" @@ -995,23 +988,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.0" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.0", -] - -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi", - "libc", - "windows-sys 0.48.0", + "hashbrown 0.14.1", ] [[package]] @@ -1061,15 +1043,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.147" +version = "0.2.149" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" [[package]] name = "libm" -version = "0.2.7" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libz-sys" @@ -1085,15 +1067,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.3.8" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - -[[package]] -name = "linux-raw-sys" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57bcfdad1b858c2db7c38303a6d2ad4dfaf5eb53dfeb0910128b2c26d6158503" +checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" [[package]] name = "log" @@ -1123,15 +1099,15 @@ dependencies = [ [[package]] name = "matchit" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1202b2a6f884ae56f04cff409ab315c5ce26b5e58d7412e484f01fd52f52ef" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.1" +version = "2.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f478948fd84d9f8e86967bf432640e46adfb5a4bd4f14ef7e864ab38220534ae" +checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" [[package]] name = "memoffset" @@ -1197,12 +1173,6 @@ dependencies = [ "libc", ] -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" - [[package]] name = "normalize-line-endings" version = "0.3.0" @@ -1230,9 +1200,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.16" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f30b0abd723be7e2ffca1272140fac1a2f084c77ec3e123c192b66af1ee9e6c2" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" dependencies = [ "autocfg", "libm", @@ -1250,9 +1220,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.0" +version = "0.32.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ac5bbd07aea88c60a577a1ce218075ffd59208b2d7ca97adf9bfc5aeb21ebe" +checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" dependencies = [ "memchr", ] @@ -1297,7 +1267,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1308,18 +1278,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "111.27.0+1.1.1v" +version = "300.1.5+3.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06e8f197c82d7511c5b014030c9b1efeda40d7d5f99d23b4ceed3524a5e63f02" +checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.92" +version = "0.9.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db7e971c2c2bba161b2d2fdf37080177eff520b3bc044787c7f1f5f9e78d869b" +checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" dependencies = [ "cc", "libc", @@ -1465,7 +1435,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -1494,28 +1464,28 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.2.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" +checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ "bit-set", - "bitflags 1.3.2", - "byteorder", + "bit-vec", + "bitflags 2.4.0", "lazy_static", "num-traits", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.6.29", + "regex-syntax 0.7.5", "rusty-fork", "tempfile", "unarray", @@ -1611,9 +1581,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -1621,14 +1591,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -1642,13 +1610,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.4" +version = "1.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.7", + "regex-automata 0.3.9", "regex-syntax 0.7.5", ] @@ -1663,9 +1631,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" dependencies = [ "aho-corasick", "memchr", @@ -1703,9 +1671,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.20" +version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e9ad3fe7488d7e34558a2033d45a0c90b72d97b4f80705666fea71472e2e6a1" +checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ "async-compression", "base64", @@ -1733,6 +1701,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", + "system-configuration", "tokio", "tokio-native-tls", "tokio-rustls", @@ -1788,28 +1757,14 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.37.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d69718bf81c6127a49dc64e44a742e8bb9213c0ff8869a22c308f84c1d4ab06" -dependencies = [ - "bitflags 1.3.2", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys 0.3.8", - "windows-sys 0.48.0", -] - -[[package]] -name = "rustix" -version = "0.38.10" +version = "0.38.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6248e1caa625eb708e266e06159f135e8c26f2bb7ceb72dc4b2766d0340964" +checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" dependencies = [ "bitflags 2.4.0", "errno", "libc", - "linux-raw-sys 0.4.5", + "linux-raw-sys", "windows-sys 0.48.0", ] @@ -1848,9 +1803,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.4" +version = "0.101.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d93931baf2d282fff8d3a532bbfd7653f734643161b87e3e01e59a04439bf0d" +checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" dependencies = [ "ring", "untrusted", @@ -1926,7 +1881,7 @@ dependencies = [ "quote", "regex", "sha2", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2012,9 +1967,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.18" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0293b4b29daaf487284529cc2f5675b8e57c61f70167ba415a463651fd6a918" +checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" [[package]] name = "serde" @@ -2033,14 +1988,14 @@ checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] name = "serde_json" -version = "1.0.105" +version = "1.0.107" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693151e1ac27563d6dbcec9dee9fbd5da8539b20fa14ad3752b2e6d363ace360" +checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" dependencies = [ "itoa", "ryu", @@ -2070,9 +2025,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -2081,24 +2036,24 @@ dependencies = [ [[package]] name = "sharded-slab" -version = "0.1.4" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" dependencies = [ "lazy_static", ] [[package]] name = "shlex" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" +checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" [[package]] name = "similar" -version = "2.2.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" +checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" [[package]] name = "slab" @@ -2111,15 +2066,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb4feee49fdd9f707ef802e22365a35de4b7b299de4763d44bfea899442ff9" +checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" [[package]] name = "snapbox" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad90eb3a2e3a8031d636d45bd4832751aefd58a291b553f7305a2bacae21aff3" +checksum = "4b377c0b6e4715c116473d8e40d51e3fa5b0a2297ca9b2a931ba800667b259ed" dependencies = [ "anstream", "anstyle", @@ -2139,9 +2094,9 @@ dependencies = [ [[package]] name = "snapbox-macros" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95f4ffd811b87da98d0e48285134b7847954bd76e843bb794a893b47ca3ee325" +checksum = "ed1559baff8a696add3322b9be3e940d433e7bb4e38d79017205fd37ff28b28e" dependencies = [ "anstream", ] @@ -2158,9 +2113,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877" +checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2197,9 +2152,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2222,6 +2177,27 @@ dependencies = [ "libc", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tar" version = "0.4.40" @@ -2242,47 +2218,47 @@ dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall", - "rustix 0.38.10", + "rustix", "windows-sys 0.48.0", ] [[package]] name = "termcolor" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" +checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" dependencies = [ "winapi-util", ] [[package]] name = "terminal_size" -version = "0.2.6" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" dependencies = [ - "rustix 0.37.23", + "rustix", "windows-sys 0.48.0", ] [[package]] name = "thiserror" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f" +checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.47" +version = "1.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b" +checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2306,9 +2282,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6bb557fd245c28e6411aa56b6403c689ad95061f50e4be16c274e70a17e48" +checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" dependencies = [ "deranged", "itoa", @@ -2319,15 +2295,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7300fbefb4dadc1af235a9cef3737cea692a9d97e1b9cbcd4ebdae6f8868e6fb" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a942f44339478ef67935ab2bbaec2fb0322496cf3cbe84b261e06ac3814c572" +checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" dependencies = [ "time-core", ] @@ -2359,7 +2335,7 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.3", + "socket2 0.5.4", "tokio-macros", "windows-sys 0.48.0", ] @@ -2382,7 +2358,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2430,9 +2406,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" +checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" dependencies = [ "bytes", "futures-core", @@ -2451,7 +2427,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit", ] [[package]] @@ -2463,26 +2439,13 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.19.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8123f27e969974a3dfba720fdb560be359f57b44302d280ba72e76a74480e8a" -dependencies = [ - "indexmap 2.0.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.0.0", + "indexmap 2.0.2", "serde", "serde_spanned", "toml_datetime", @@ -2569,7 +2532,7 @@ checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", ] [[package]] @@ -2635,9 +2598,9 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "trycmd" -version = "0.14.17" +version = "0.14.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6a42f89ccf3c6ee115608a68e256c172734d525a4ac36d4a17a6d4a8108149" +checksum = "ed009372a42fb103e6f8767b9222925485e03cca032b700d203e2c5b67bee4fb" dependencies = [ "glob", "humantime", @@ -2646,14 +2609,14 @@ dependencies = [ "serde", "shlex", "snapbox", - "toml_edit 0.19.14", + "toml_edit", ] [[package]] name = "typenum" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "unarray" @@ -2678,9 +2641,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "301abaae475aa91687eb82514b328ab47a211a533026cb25fc3e519b86adfc3c" +checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" @@ -2749,9 +2712,9 @@ dependencies = [ [[package]] name = "walkdir" -version = "2.3.3" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" +checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" dependencies = [ "same-file", "winapi-util", @@ -2793,7 +2756,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -2827,7 +2790,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -2866,9 +2829,9 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" +checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" dependencies = [ "winapi", ] @@ -3013,9 +2976,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.15" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2e3184b9c4e92ad5167ca73039d0c42476302ab603e2fec4487511f38ccefc" +checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" dependencies = [ "memchr", ] diff --git a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile b/ci/docker/x86_64-unknown-linux-gnu/Dockerfile index 6b7d2e730a..f49b646787 100644 --- a/ci/docker/x86_64-unknown-linux-gnu/Dockerfile +++ b/ci/docker/x86_64-unknown-linux-gnu/Dockerfile @@ -1 +1,6 @@ FROM rust-x86_64-unknown-linux-gnu + +# Install `perl-IPC-Cmd` to make OpenSSL v3 happy. +# See: +RUN yum upgrade -y && \ + yum install -y perl-IPC-Cmd From 5bf3448c4a10f972eebd38c103040d5ba0347d36 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 8 Oct 2023 20:31:44 +0800 Subject: [PATCH 094/229] Clarify the origin of `rust-$TARGET` CI Docker images --- .github/workflows/linux-builds-on-master.yaml | 2 +- .github/workflows/linux-builds-on-pr.yaml | 2 +- .github/workflows/linux-builds-on-stable.yaml | 2 +- ci/actions-templates/linux-builds-template.yaml | 2 +- ci/fetch-rust-docker.bash | 9 +++++++-- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml index fce217e686..e30a03a75a 100644 --- a/.github/workflows/linux-builds-on-master.yaml +++ b/.github/workflows/linux-builds-on-master.yaml @@ -96,7 +96,7 @@ jobs: *) DOCKER="$TARGET" ;; esac echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the docker + - name: Fetch the base docker images from rust-lang/rust run: bash ci/fetch-rust-docker.bash "${TARGET}" - name: Maybe build a docker from there run: | diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml index b6b2fc525e..a8549040e4 100644 --- a/.github/workflows/linux-builds-on-pr.yaml +++ b/.github/workflows/linux-builds-on-pr.yaml @@ -90,7 +90,7 @@ jobs: *) DOCKER="$TARGET" ;; esac echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the docker + - name: Fetch the base docker images from rust-lang/rust run: bash ci/fetch-rust-docker.bash "${TARGET}" - name: Maybe build a docker from there run: | diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml index 8f51296026..36f31944ce 100644 --- a/.github/workflows/linux-builds-on-stable.yaml +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -120,7 +120,7 @@ jobs: *) DOCKER="$TARGET" ;; esac echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the docker + - name: Fetch the base docker images from rust-lang/rust run: bash ci/fetch-rust-docker.bash "${TARGET}" - name: Maybe build a docker from there run: | diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 0de8a46cee..3375bae2e1 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -129,7 +129,7 @@ jobs: *) DOCKER="$TARGET" ;; esac echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the docker + - name: Fetch the base docker images from rust-lang/rust run: bash ci/fetch-rust-docker.bash "${TARGET}" - name: Maybe build a docker from there run: | diff --git a/ci/fetch-rust-docker.bash b/ci/fetch-rust-docker.bash index d889073388..120385a4dc 100644 --- a/ci/fetch-rust-docker.bash +++ b/ci/fetch-rust-docker.bash @@ -12,9 +12,14 @@ TARGET="$1" RUST_REPO="https://github.com/rust-lang/rust" ARTIFACTS_BASE_URL="https://ci-artifacts.rust-lang.org/rustc-builds" -LOCAL_DOCKER_TAG="rust-$TARGET" -# Use images from rustc master +# A `Dockerfile` under `rustup`'s `ci/docker` directory may start with `FROM rust-$TARGET`. +# This means it is using an S3-cached Docker image provided by `rustc`'s CI. +LOCAL_DOCKER_TAG="rust-$TARGET" +# The following is a mapping from `$TARGET`s to cached Docker images built from `Dockerfile`s under +# , +# e.g. `FROM rust-aarch64-unknown-linux-musl` means the base `Dockerfile` to look at is located under +# . case "$TARGET" in aarch64-unknown-linux-gnu) image=dist-aarch64-linux ;; aarch64-unknown-linux-musl) image=dist-arm-linux ;; From 68355a5fc3dfd65f097fc719178e78d788c5d1da Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Fri, 11 Nov 2022 18:36:09 +0400 Subject: [PATCH 095/229] Try to add support for fish shell --- src/cli/self_update/shell.rs | 47 +++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index 195dbea2bd..19ac6a08bc 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -71,7 +71,12 @@ pub(crate) fn cargo_home_str() -> Result> { // TODO?: Make a decision on Ion Shell, Power Shell, Nushell // Cross-platform non-POSIX shells have not been assessed for integration yet fn enumerate_shells() -> Vec { - vec![Box::new(Posix), Box::new(Bash), Box::new(Zsh)] + vec![ + Box::new(Posix), + Box::new(Bash), + Box::new(Zsh), + Box::new(Fish), + ] } pub(crate) fn get_available_shells() -> impl Iterator { @@ -201,6 +206,46 @@ impl UnixShell for Zsh { } } +struct Fish; + +impl UnixShell for Fish { + fn does_exist(&self) -> bool { + // fish has to either be the shell or be callable for fish setup. + matches!(process().var("SHELL"), Ok(sh) if sh.contains("fish")) + || matches!(utils::find_cmd(&["fish"]), Some(_)) + } + + // > "$XDG_CONFIG_HOME/fish/conf.d" (or "~/.config/fish/conf.d" if that variable is unset) for the user + // from + fn rcfiles(&self) -> Vec { + let p0 = process().var("XDG_CONFIG_HOME").ok().map(|p| { + let mut path = PathBuf::from(p); + path.push("fish/config.d/rustup.fish"); + path + }); + + let p1 = utils::home_dir().map(|mut path| { + path.push(".config/fish/config.d/rustup.fish"); + path + }); + + p0.into_iter().chain(p1).collect() + } + + fn update_rcs(&self) -> Vec { + if let Ok(home) = process().var("XDG_CONFIG_HOME") { + let mut path = PathBuf::from(home); + path.push("fish/config.d/rustup.fish"); + vec![path] + } else if let Some(mut path) = utils::home_dir() { + path.push(".config/fish/config.d/rustup.fish"); + vec![path] + } else { + Vec::new() + } + } +} + pub(crate) fn legacy_paths() -> impl Iterator { let zprofiles = Zsh::zdotdir() .into_iter() From 471bbadd70d68b328646c320bb958d1065e26807 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 7 Mar 2023 18:04:40 +0400 Subject: [PATCH 096/229] Update all rc fish scripts --- src/cli/self_update/shell.rs | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index 19ac6a08bc..e85363dad2 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -233,16 +233,7 @@ impl UnixShell for Fish { } fn update_rcs(&self) -> Vec { - if let Ok(home) = process().var("XDG_CONFIG_HOME") { - let mut path = PathBuf::from(home); - path.push("fish/config.d/rustup.fish"); - vec![path] - } else if let Some(mut path) = utils::home_dir() { - path.push(".config/fish/config.d/rustup.fish"); - vec![path] - } else { - Vec::new() - } + self.rcfiles() } } From 6838d76a708d63814a408ad4594b84d9731a1875 Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 7 Mar 2023 18:06:04 +0400 Subject: [PATCH 097/229] Fix fish config dir paths --- src/cli/self_update/shell.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index e85363dad2..b754888876 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -220,12 +220,12 @@ impl UnixShell for Fish { fn rcfiles(&self) -> Vec { let p0 = process().var("XDG_CONFIG_HOME").ok().map(|p| { let mut path = PathBuf::from(p); - path.push("fish/config.d/rustup.fish"); + path.push("fish/conf.d/rustup.fish"); path }); let p1 = utils::home_dir().map(|mut path| { - path.push(".config/fish/config.d/rustup.fish"); + path.push(".config/fish/conf.d/rustup.fish"); path }); From 0cc274e42d6534c42172e1f495bf0abf75a9653e Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Tue, 7 Mar 2023 18:06:32 +0400 Subject: [PATCH 098/229] Write a custom env script for fish --- src/cli/self_update/env.fish | 5 +++++ src/cli/self_update/shell.rs | 11 +++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/cli/self_update/env.fish diff --git a/src/cli/self_update/env.fish b/src/cli/self_update/env.fish new file mode 100644 index 0000000000..b6549f504d --- /dev/null +++ b/src/cli/self_update/env.fish @@ -0,0 +1,5 @@ +# rustup shell setup +if not contains "{cargo_bin}" $PATH + # Prepending path in case a system-installed rustc needs to be overridden + set -x PATH "{cargo_bin}" $PATH +end diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index b754888876..4983a5dd4a 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -235,6 +235,17 @@ impl UnixShell for Fish { fn update_rcs(&self) -> Vec { self.rcfiles() } + + fn env_script(&self) -> ShellScript { + ShellScript { + name: "env.fish", + content: include_str!("env.fish"), + } + } + + fn source_string(&self) -> Result { + Ok(format!(r#". "{}/env.fish""#, cargo_home_str()?)) + } } pub(crate) fn legacy_paths() -> impl Iterator { From af6726d553ee96e147c6d93cf97b257fb1a28c75 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 9 Oct 2023 22:23:54 +0000 Subject: [PATCH 099/229] Update Rust crate regex to 1.10.0 --- Cargo.lock | 22 +++++++++++++++++----- rustup-macros/Cargo.toml | 2 +- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b7b928d405..748cb1316b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1610,14 +1610,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.6" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" +checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.3.9", - "regex-syntax 0.7.5", + "regex-automata 0.4.1", + "regex-syntax 0.8.0", ] [[package]] @@ -1634,10 +1634,16 @@ name = "regex-automata" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" + +[[package]] +name = "regex-automata" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.7.5", + "regex-syntax 0.8.0", ] [[package]] @@ -1652,6 +1658,12 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +[[package]] +name = "regex-syntax" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3cbb081b9784b07cceb8824c8583f86db4814d172ab043f3c23f7dc600bf83d" + [[package]] name = "remove_dir_all" version = "0.8.2" diff --git a/rustup-macros/Cargo.toml b/rustup-macros/Cargo.toml index 455832a865..c9f8572b0d 100644 --- a/rustup-macros/Cargo.toml +++ b/rustup-macros/Cargo.toml @@ -10,6 +10,6 @@ proc-macro = true [dependencies] proc-macro2 = "1.0.63" quote = "1.0.23" -regex = "1.7.1" +regex = "1.10.0" sha2 = "0.10.6" syn = { version = "2.0.13", features = ["full"] } From 27808814d36d3fc4e29457cc8c36cb82caff0dd7 Mon Sep 17 00:00:00 2001 From: ongchi Date: Wed, 23 Aug 2023 20:31:09 +0800 Subject: [PATCH 100/229] Remove redundant message if an error occurs during package extraction --- src/dist/component/package.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dist/component/package.rs b/src/dist/component/package.rs index 686136826e..73edf22200 100644 --- a/src/dist/component/package.rs +++ b/src/dist/component/package.rs @@ -151,7 +151,7 @@ impl<'a> TarPackage<'a> { // $pkgname-$version-$target. Skip that directory when // unpacking. unpack_without_first_dir(&mut archive, &temp_dir, notify_handler) - .context("failed to extract package (perhaps you ran out of disk space?)")?; + .context("failed to extract package")?; Ok(TarPackage( DirectoryPackage::new(temp_dir.to_owned(), false)?, From 900d3d63ead304af4ca2c96575e81c69027a44cb Mon Sep 17 00:00:00 2001 From: Alex Hudspith Date: Fri, 8 Sep 2023 14:28:42 +0100 Subject: [PATCH 101/229] Add ksh compatibility for latest illumos and others --- rustup-init.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index 6e0ef4b03d..2d324e08a0 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -1,5 +1,6 @@ #!/bin/sh # shellcheck shell=dash +# shellcheck disable=SC2039 # local is non-POSIX # This is just a little script that can be downloaded from the internet to # install rustup. It just does platform detection, downloads the installer @@ -8,13 +9,15 @@ # It runs on Unix shells like {a,ba,da,k,z}sh. It uses the common `local` # extension. Note: Most shells limit `local` to 1 var per line, contra bash. -if [ "$KSH_VERSION" = 'Version JM 93t+ 2010-03-05' ]; then - # The version of ksh93 that ships with many illumos systems does not - # support the "local" extension. Print a message rather than fail in - # subtle ways later on: - echo 'rustup does not work with this ksh93 version; please try bash!' >&2 - exit 1 -fi +# Some versions of ksh have no `local` keyword. Alias it to `typeset`, but +# beware this makes variables global with f()-style function syntax in ksh93. +# mksh has this alias by default. +has_local() { + # shellcheck disable=SC2034 # deliberately unused + local _has_local +} + +has_local 2>/dev/null || alias local=typeset set -u From 3d6f8ea170d5661b6a127d46d161f53c8b956d0e Mon Sep 17 00:00:00 2001 From: Alex Hudspith Date: Fri, 8 Sep 2023 14:29:29 +0100 Subject: [PATCH 102/229] Fix zsh word splitting for curl "--retry 3" --- rustup-init.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rustup-init.sh b/rustup-init.sh index 2d324e08a0..f7d13eef44 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -19,6 +19,10 @@ has_local() { has_local 2>/dev/null || alias local=typeset +# zsh does not split words by default, Required for curl retry arguments below. +if [ -n "$ZSH_VERSION" ]; then + setopt shwordsplit +fi set -u From a7a54b01f2850a2deebca3df813ae3155b0884d1 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 10 Oct 2023 20:24:16 +0800 Subject: [PATCH 103/229] Add suggestions to mention sourcing `env.fish` --- src/cli/self_update.rs | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index e3823980af..854e32e2c8 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -225,13 +225,12 @@ This would reload your `PATH` environment variable to include Cargo's bin directory ({cargo_home}/bin). To configure your current shell, you need to source -the `env` file ({cargo_home}/env). +the corresponding `env` file under {cargo_home}. -This is usually done by running: - source "{cargo_home}/env" - -The `source` command above might need to be replaced with `.` -on shells like `ash`, `dash` and `pdksh`. +This is usually done by running one of the following: + source "{cargo_home}/env" # For bash/zsh + . "{cargo_home}/env" # For ash/dash/pdksh (note the leading DOT) + source "{cargo_home}/env.fish" # For fish "# }; } @@ -258,13 +257,12 @@ To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` environment variable. This has not been done automatically. To configure your current shell, you need to source -the `env` file ({cargo_home}/env). - -This is usually done by running: - source "{cargo_home}/env" +the corresponding `env` file under {cargo_home}. -The `source` command above might need to be replaced with `.` -on shells like `ash`, `dash` and `pdksh`. +This is usually done by running one of the following: + source "{cargo_home}/env" # For bash/zsh + . "{cargo_home}/env" # For ash/dash/pdksh (note the leading DOT) + source "{cargo_home}/env.fish" # For fish "# }; } From 104322c2b2a8d105783046895a768942303ab151 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 11 Oct 2023 14:03:59 +0800 Subject: [PATCH 104/229] Extract `post_install_msg_unix_source_env!()` --- src/cli/self_update.rs | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 854e32e2c8..b839665685 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -216,15 +216,9 @@ but will not be added automatically." } #[cfg(not(windows))] -macro_rules! post_install_msg_unix { +macro_rules! post_install_msg_unix_source_env { () => { - r#"# Rust is installed now. Great! - -To get started you may need to restart your current shell. -This would reload your `PATH` environment variable to include -Cargo's bin directory ({cargo_home}/bin). - -To configure your current shell, you need to source + r#"To configure your current shell, you need to source the corresponding `env` file under {cargo_home}. This is usually done by running one of the following: @@ -235,6 +229,22 @@ This is usually done by running one of the following: }; } +#[cfg(not(windows))] +macro_rules! post_install_msg_unix { + () => { + concat!( + r"# Rust is installed now. Great! + +To get started you may need to restart your current shell. +This would reload your `PATH` environment variable to include +Cargo's bin directory ({cargo_home}/bin). + +", + post_install_msg_unix_source_env!(), + ) + }; +} + #[cfg(windows)] macro_rules! post_install_msg_win { () => { @@ -251,19 +261,15 @@ Cargo's bin directory ({cargo_home}\\bin). #[cfg(not(windows))] macro_rules! post_install_msg_unix_no_modify_path { () => { - r#"# Rust is installed now. Great! + concat!( + r"# Rust is installed now. Great! To get started you need Cargo's bin directory ({cargo_home}/bin) in your `PATH` environment variable. This has not been done automatically. -To configure your current shell, you need to source -the corresponding `env` file under {cargo_home}. - -This is usually done by running one of the following: - source "{cargo_home}/env" # For bash/zsh - . "{cargo_home}/env" # For ash/dash/pdksh (note the leading DOT) - source "{cargo_home}/env.fish" # For fish -"# +", + post_install_msg_unix_source_env!(), + ) }; } From fa2336d53a76d2c56d764cf4f761143f991d0eb9 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 10 Oct 2023 20:27:57 +0800 Subject: [PATCH 105/229] Apply `clippy` suggestions --- src/cli/self_update/shell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index 4983a5dd4a..fdd220e235 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -212,7 +212,7 @@ impl UnixShell for Fish { fn does_exist(&self) -> bool { // fish has to either be the shell or be callable for fish setup. matches!(process().var("SHELL"), Ok(sh) if sh.contains("fish")) - || matches!(utils::find_cmd(&["fish"]), Some(_)) + || utils::find_cmd(&["fish"]).is_some() } // > "$XDG_CONFIG_HOME/fish/conf.d" (or "~/.config/fish/conf.d" if that variable is unset) for the user From a027d9578194d58e0af1a203029b3944c718008a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:05:04 +0000 Subject: [PATCH 106/229] Update Rust crate zstd to 0.13 --- Cargo.lock | 9 ++++----- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 748cb1316b..4f3afd7235 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3035,20 +3035,19 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index d144c003a2..3d265e5f0f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -93,7 +93,7 @@ url.workspace = true wait-timeout = "0.2" walkdir = { workspace = true, optional = true } xz2 = "0.1.3" -zstd = "0.12" +zstd = "0.13" [dependencies.openssl] # Used by `curl` or `reqwest` backend although it isn't imported by our rustup : From 737ad82333742dfd350a733c1649ce4e36109773 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 12 Oct 2023 22:32:24 +0800 Subject: [PATCH 107/229] Restrict zsh `shwordsplit` to `downloader()` --- rustup-init.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rustup-init.sh b/rustup-init.sh index f7d13eef44..fda7b681fc 100755 --- a/rustup-init.sh +++ b/rustup-init.sh @@ -19,10 +19,9 @@ has_local() { has_local 2>/dev/null || alias local=typeset -# zsh does not split words by default, Required for curl retry arguments below. -if [ -n "$ZSH_VERSION" ]; then - setopt shwordsplit -fi +is_zsh() { + [ -n "${ZSH_VERSION-}" ] +} set -u @@ -575,6 +574,9 @@ ignore() { # This wraps curl or wget. Try curl first, if not installed, # use wget instead. downloader() { + # zsh does not split words by default, Required for curl retry arguments below. + is_zsh && setopt local_options shwordsplit + local _dld local _ciphersuites local _err From 81f96daf9bdf00d375ca4cbd6c98a43f84654f99 Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 13 Oct 2023 00:07:59 +0800 Subject: [PATCH 108/229] Adjust suggestions about sourcing `env` files --- src/cli/self_update.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index b839665685..4ccf7b3653 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -221,10 +221,9 @@ macro_rules! post_install_msg_unix_source_env { r#"To configure your current shell, you need to source the corresponding `env` file under {cargo_home}. -This is usually done by running one of the following: - source "{cargo_home}/env" # For bash/zsh - . "{cargo_home}/env" # For ash/dash/pdksh (note the leading DOT) - source "{cargo_home}/env.fish" # For fish +This is usually done by running one of the following (note the leading DOT): + . "{cargo_home}/env" # For sh/bash/zsh/ash/dash/pdksh + source "{cargo_home}/env.fish" # For fish "# }; } From 1241a2f3bab47bbf229cffdfe539586aea5f6468 Mon Sep 17 00:00:00 2001 From: Sandesh Pyakurel Date: Fri, 13 Oct 2023 20:40:49 +0545 Subject: [PATCH 109/229] Typo fixed in tips-and-tricks.md file --- doc/dev-guide/src/tips-and-tricks.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/dev-guide/src/tips-and-tricks.md b/doc/dev-guide/src/tips-and-tricks.md index 3fc33bc27b..a1fba10c0a 100644 --- a/doc/dev-guide/src/tips-and-tricks.md +++ b/doc/dev-guide/src/tips-and-tricks.md @@ -15,7 +15,7 @@ RUSTUP_FORCE_ARG0=rustup cargo run -- uninstall nightly If it's necessary to alter the backtracking limit from the default of half a release cycle for some reason, you can set the `RUSTUP_BACKTRACK_LIMIT` -environment variable. If this is unparseable as an `i32` or if it's absent +environment variable. If this is unparsable as an `i32` or if it's absent then the default of 21 days (half a cycle) is used. If it parses and is less than 1, it is clamped to 1 at minimum. From b900a6cd87e1f463a55ce02e956c24b2cccdd0f0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 16 Oct 2023 00:44:15 +0000 Subject: [PATCH 110/229] Lock file maintenance --- Cargo.lock | 151 +++++++++++++++++++++++++---------------------------- 1 file changed, 71 insertions(+), 80 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f3afd7235..e90f157c40 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -19,9 +19,9 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" [[package]] name = "aho-corasick" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea5d730647d4fadd988536d06fecce94b7b4f2a7efdae548f1cf4b63205518ab" +checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" dependencies = [ "memchr", ] @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb42b2197bf15ccb092b62c74515dbd8b86d0effd934795f6687c93b6e679a2c" +checksum = "f658e2baef915ba0f26f1f7c42bfb8e12f532a01f449a090ded75ae7a07e9ba2" dependencies = [ "flate2", "futures-core", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -217,9 +217,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" [[package]] name = "block-buffer" @@ -232,12 +232,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.6.2" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c2f7349907b712260e64b0afe2f84692af14a454be26187d9df565c7f69266a" +checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", - "regex-automata 0.3.9", + "regex-automata 0.4.2", "serde", ] @@ -440,9 +440,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.66+curl-8.3.0" +version = "0.4.68+curl-8.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70c44a72e830f0e40ad90dda8a6ab6ed6314d39776599a58a2e5e37fbc6db5b9" +checksum = "b4a0d18d88360e374b16b2273c832b5e57258ffc1d4aa4f96b108e0738d5752f" dependencies = [ "cc", "libc", @@ -464,9 +464,12 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2696e8a945f658fd14dc3b87242e6b80cd0f36ff04ea560fa39082368847946" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] [[package]] name = "derivative" @@ -589,25 +592,14 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "add4f07d43996f76ef320709726a556a9d4f965d9410d8d0271132d2f8293480" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" dependencies = [ - "errno-dragonfly", "libc", "windows-sys 0.48.0", ] -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "fastrand" version = "2.0.1" @@ -628,9 +620,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -1019,9 +1011,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "jobserver" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" +checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" dependencies = [ "libc", ] @@ -1067,9 +1059,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.8" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3852614a3bd9ca9804678ba6be5e3b8ce76dfc902cae004e3e0c44051b6e88db" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "log" @@ -1250,7 +1242,7 @@ version = "0.10.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "cfg-if 1.0.0", "foreign-types", "libc", @@ -1389,9 +1381,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.9.1" +version = "3.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a54938017eacd63036332b4ae5c8a49fc8c0c1d6d629893057e4f13609edd06" +checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" dependencies = [ "num-traits", ] @@ -1456,6 +1448,12 @@ version = "0.3.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1464,9 +1462,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.68" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b1106fec09662ec6dd98ccac0f81cef56984d0b49f75c92d8cbad76e20c005c" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -1479,7 +1477,7 @@ checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.0", + "bitflags 2.4.1", "lazy_static", "num-traits", "rand", @@ -1610,14 +1608,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d119d7c7ca818f8a53c300863d4f87566aac09943aef5b355bb83969dae75d87" +checksum = "aaac441002f822bc9705a681810a4dd2963094b9ca0ddc41cb963a4c189189ea" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.1", - "regex-syntax 0.8.0", + "regex-automata 0.4.2", + "regex-syntax 0.8.2", ] [[package]] @@ -1631,19 +1629,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" - -[[package]] -name = "regex-automata" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465c6fc0621e4abc4187a2bda0937bfd4f722c2730b29562e19689ea796c9a4b" +checksum = "5011c7e263a695dc8ca064cddb722af1be54e517a280b12a5356f98366899e5d" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.0", + "regex-syntax 0.8.2", ] [[package]] @@ -1660,9 +1652,9 @@ checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" [[package]] name = "regex-syntax" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3cbb081b9784b07cceb8824c8583f86db4814d172ab043f3c23f7dc600bf83d" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "remove_dir_all" @@ -1769,11 +1761,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.17" +version = "0.38.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7" +checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" dependencies = [ - "bitflags 2.4.0", + "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", @@ -1979,24 +1971,24 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.19" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad977052201c6de01a8ef2aa3378c4bd23217a056337d1d6da40468d267a4fb0" +checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.189" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" dependencies = [ "proc-macro2", "quote", @@ -2294,12 +2286,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "426f806f4089c493dcac0d24c29c01e2c38baf8e30f1b716ee37e83d200b18fe" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", "itoa", + "powerfmt", "serde", "time-core", "time-macros", @@ -2337,9 +2330,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -2526,11 +2519,10 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.37" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" +checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" dependencies = [ - "cfg-if 1.0.0", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -2538,9 +2530,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.26" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", @@ -2549,9 +2541,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", "valuable", @@ -2988,9 +2980,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.16" +version = "0.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "037711d82167854aff2018dfd193aa0fef5370f456732f0d5a0c59b0f1b4b907" +checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" dependencies = [ "memchr", ] @@ -3053,11 +3045,10 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.8+zstd.1.5.5" +version = "2.0.9+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" +checksum = "9e16efa8a874a0481a574084d34cc26fdb3b99627480f785888deb6386506656" dependencies = [ "cc", - "libc", "pkg-config", ] From 33ad33ef66512ba61ab46d466f53b483987b8ad9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 23 Oct 2023 01:14:25 +0000 Subject: [PATCH 111/229] Lock file maintenance --- Cargo.lock | 60 +++++++++++++++++++++++++++--------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e90f157c40..7d58f12dc9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -237,7 +237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" dependencies = [ "memchr", - "regex-automata 0.4.2", + "regex-automata 0.4.3", "serde", ] @@ -354,9 +354,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" +checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" dependencies = [ "libc", ] @@ -434,7 +434,7 @@ dependencies = [ "openssl-probe", "openssl-sys", "schannel", - "socket2 0.4.9", + "socket2 0.4.10", "winapi", ] @@ -544,9 +544,9 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.6.3" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c188012f8542dee7b3996e44dd89461d64aa471b0a7c71a1ae2f595d259e96e5" +checksum = "53337c2dbf26a3c31eccc73a37b10c1614e8d4ae99b6a50d553e8936423c1f16" dependencies = [ "enum-map-derive", ] @@ -826,9 +826,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dfda62a12f55daeae5015f81b0baea145391cb4520f86c248fc615d72640d12" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" [[package]] name = "hermit-abi" @@ -912,7 +912,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.9", + "socket2 0.4.10", "tokio", "tower-service", "tracing", @@ -985,14 +985,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" dependencies = [ "equivalent", - "hashbrown 0.14.1", + "hashbrown 0.14.2", ] [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" @@ -1608,13 +1608,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.1" +version = "1.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaac441002f822bc9705a681810a4dd2963094b9ca0ddc41cb963a4c189189ea" +checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.2", + "regex-automata 0.4.3", "regex-syntax 0.8.2", ] @@ -1629,9 +1629,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5011c7e263a695dc8ca064cddb722af1be54e517a280b12a5356f98366899e5d" +checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" dependencies = [ "aho-corasick", "memchr", @@ -1761,9 +1761,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.19" +version = "0.38.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "745ecfa778e66b2b63c88a61cb36e0eea109e803b0b86bf9879fbc77c70e86ed" +checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" dependencies = [ "bitflags 2.4.1", "errno", @@ -2107,9 +2107,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" dependencies = [ "libc", "winapi", @@ -2117,9 +2117,9 @@ dependencies = [ [[package]] name = "socket2" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4031e820eb552adee9295814c0ced9e5cf38ddf1e8b7d566d6de8e2538ea989e" +checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", "windows-sys 0.48.0", @@ -2247,18 +2247,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", @@ -2340,7 +2340,7 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.4", + "socket2 0.5.5", "tokio-macros", "windows-sys 0.48.0", ] @@ -2519,9 +2519,9 @@ checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" [[package]] name = "tracing" -version = "0.1.39" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee2ef2af84856a50c1d430afce2fdded0a4ec7eda868db86409b4543df0797f9" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", "tracing-attributes", From 0907089ccdc3b2848200a3c4350d5789e3bbe6b5 Mon Sep 17 00:00:00 2001 From: Kornel Date: Thu, 8 Sep 2022 12:34:29 +0100 Subject: [PATCH 112/229] Warn when running under Rosetta emulation --- src/cli/common.rs | 14 +++++++++++++- src/cli/rustup_mode.rs | 5 +++++ src/cli/self_update.rs | 4 ++++ src/dist/dist.rs | 22 ++++++++++++++++++++++ 4 files changed, 44 insertions(+), 1 deletion(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index e9f3d700dd..a0c9ca7b2d 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -20,10 +20,11 @@ use crate::currentprocess::{ terminalsource, varsource::VarSource, }; +use crate::dist::dist::{TargetTriple, ToolchainDesc}; +use crate::install::UpdateStatus; use crate::utils::notifications as util_notifications; use crate::utils::notify::NotificationLevel; use crate::utils::utils; -use crate::{dist::dist::ToolchainDesc, install::UpdateStatus}; use crate::{ dist::notifications as dist_notifications, toolchain::distributable::DistributableToolchain, }; @@ -674,3 +675,14 @@ pub(crate) fn ignorable_error(error: &'static str, no_prompt: bool) -> Result<() Err(error) } } + +/// Warns if rustup is running under emulation, such as macOS Rosetta +pub(crate) fn warn_if_host_is_emulated() { + if TargetTriple::is_host_emulated() { + warn!( + "Rustup is not running natively. It's running under emulation of {}.", + TargetTriple::from_host_or_build() + ); + warn!("For best compatibility and performance you should reinstall rustup for your native CPU."); + } +} diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index e29c189754..0be87295cb 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -840,6 +840,8 @@ fn maybe_upgrade_data(cfg: &Cfg, m: &ArgMatches) -> Result { } fn default_(cfg: &Cfg, m: &ArgMatches) -> Result { + common::warn_if_host_is_emulated(); + if let Some(toolchain) = m.get_one::("toolchain") { match toolchain.to_owned() { MaybeResolvableToolchainName::None => { @@ -917,6 +919,7 @@ fn check_updates(cfg: &Cfg) -> Result { } fn update(cfg: &mut Cfg, m: &ArgMatches) -> Result { + common::warn_if_host_is_emulated(); let self_update_mode = cfg.get_self_update_mode()?; // Priority: no-self-update feature > self_update_mode > no-self-update args. // Update only if rustup does **not** have the no-self-update feature, @@ -1050,6 +1053,8 @@ fn which(cfg: &Cfg, m: &ArgMatches) -> Result { #[cfg_attr(feature = "otel", tracing::instrument(skip_all))] fn show(cfg: &Cfg, m: &ArgMatches) -> Result { + common::warn_if_host_is_emulated(); + let verbose = m.get_flag("verbose"); // Print host triple diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 4ccf7b3653..8c21038a4c 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -604,6 +604,8 @@ fn do_pre_install_sanity_checks(no_prompt: bool) -> Result<()> { } fn do_pre_install_options_sanity_checks(opts: &InstallOpts<'_>) -> Result<()> { + common::warn_if_host_is_emulated(); + // Verify that the installation options are vaguely sane (|| { let host_triple = opts @@ -1073,6 +1075,8 @@ pub(crate) fn uninstall(no_prompt: bool) -> Result { /// rustup-init is stored in `CARGO_HOME`/bin, and then deleted next /// time rustup runs. pub(crate) fn update(cfg: &Cfg) -> Result { + common::warn_if_host_is_emulated(); + use common::SelfUpdatePermission::*; let update_permitted = if NEVER_SELF_UPDATE { HardFail diff --git a/src/dist/dist.rs b/src/dist/dist.rs index ceceae331e..78932111ac 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -253,6 +253,28 @@ impl TargetTriple { } } + #[cfg(not(target_os = "macos"))] + pub(crate) fn is_host_emulated() -> bool { + false + } + + /// Detects Rosetta emulation on macOS + #[cfg(target_os = "macos")] + pub(crate) fn is_host_emulated() -> bool { + unsafe { + let mut ret: libc::c_int = 0; + let mut size = std::mem::size_of::() as libc::size_t; + let err = libc::sysctlbyname( + b"sysctl.proc_translated\0".as_ptr().cast(), + (&mut ret) as *mut _ as *mut libc::c_void, + &mut size, + std::ptr::null_mut(), + 0, + ); + err == 0 && ret != 0 + } + } + pub(crate) fn from_host() -> Option { #[cfg(windows)] fn inner() -> Option { From c5f0316582b63f7a8faa0c0a73b705b6e584bb7d Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 8 Oct 2023 19:27:15 +0800 Subject: [PATCH 113/229] Clean up some `manifestation` logic --- src/dist/manifestation.rs | 44 +++++++++++++-------------------------- 1 file changed, 14 insertions(+), 30 deletions(-) diff --git a/src/dist/manifestation.rs b/src/dist/manifestation.rs index 8b66ca47b0..c6ecf742ed 100644 --- a/src/dist/manifestation.rs +++ b/src/dist/manifestation.rs @@ -130,25 +130,19 @@ impl Manifestation { } // Validate that the requested components are available - match update.unavailable_components(new_manifest, toolchain_str) { - Ok(_) => {} - Err(e) => { - if force_update { - if let Ok(RustupError::RequestedComponentsUnavailable { components, .. }) = - e.downcast::() - { - for component in &components { - (download_cfg.notify_handler)( - Notification::ForcingUnavailableComponent( - component.name(new_manifest).as_str(), - ), - ); - } - update.drop_components_to_install(&components); - } - } else { - return Err(e); + if let Err(e) = update.unavailable_components(new_manifest, toolchain_str) { + if !force_update { + return Err(e); + } + if let Ok(RustupError::RequestedComponentsUnavailable { components, .. }) = + e.downcast::() + { + for component in &components { + (download_cfg.notify_handler)(Notification::ForcingUnavailableComponent( + &component.name(new_manifest), + )); } + update.drop_components_to_install(&components); } } @@ -678,18 +672,8 @@ impl Update { } fn drop_components_to_install(&mut self, to_drop: &[Component]) { - let components: Vec<_> = self - .components_to_install - .drain(..) - .filter(|c| !to_drop.contains(c)) - .collect(); - self.components_to_install.extend(components); - let final_components: Vec<_> = self - .final_component_list - .drain(..) - .filter(|c| !to_drop.contains(c)) - .collect(); - self.final_component_list = final_components; + self.components_to_install.retain(|c| !to_drop.contains(c)); + self.final_component_list.retain(|c| !to_drop.contains(c)); } /// Map components to urls and hashes From e814458b665f9b85b5ca9ba2ef2bfa6d85096031 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 8 Oct 2023 19:27:16 +0800 Subject: [PATCH 114/229] Delete suggestions of removing the relevant component from `component_unavailable_msg` After digging into the codebase, I realized that the message generated by `component_unavailable_msg` is used only when: - Some components are missing from the toolchain so that the installation can no longer proceed; - We are not installing these components as a part of a toolchain-wide operation (e.g. updating the existing `nightly`), which is covered by `components_missing_msg` by catching the `RustupError::RequestedComponentsUnavailable` and re-throwing it as a `DistError::ToolchainComponentsMissing` (see for more info). Thus, I decided to remove the `rustup component remove` suggestion altogether. --- src/dist/manifestation/tests.rs | 88 +++++++++++++++++++++++++-------- src/errors.rs | 43 +++------------- 2 files changed, 76 insertions(+), 55 deletions(-) diff --git a/src/dist/manifestation/tests.rs b/src/dist/manifestation/tests.rs index 7dd9180525..cfe81562cf 100644 --- a/src/dist/manifestation/tests.rs +++ b/src/dist/manifestation/tests.rs @@ -772,8 +772,17 @@ fn unavailable_component() { ) .unwrap_err(); match err.downcast::() { - Ok(e @ RustupError::RequestedComponentsUnavailable { .. }) => { - assert!(e.to_string().contains("rustup component remove --toolchain nightly --target x86_64-apple-darwin bonus")); + Ok(RustupError::RequestedComponentsUnavailable { + components, + manifest, + toolchain, + }) => { + assert_eq!(toolchain, "nightly"); + let descriptions = components + .iter() + .map(|c| c.description(&manifest)) + .collect::>(); + assert_eq!(descriptions, ["'bonus' for target 'x86_64-apple-darwin'"]) } _ => panic!(), } @@ -833,8 +842,17 @@ fn unavailable_component_from_profile() { ) .unwrap_err(); match err.downcast::() { - Ok(e @ RustupError::RequestedComponentsUnavailable { .. }) => { - assert!(e.to_string().contains("rustup component remove --toolchain nightly --target x86_64-apple-darwin rustc")); + Ok(RustupError::RequestedComponentsUnavailable { + components, + manifest, + toolchain, + }) => { + assert_eq!(toolchain, "nightly"); + let descriptions = components + .iter() + .map(|c| c.description(&manifest)) + .collect::>(); + assert_eq!(descriptions, ["'rustc' for target 'x86_64-apple-darwin'"]) } _ => panic!(), } @@ -913,8 +931,17 @@ fn removed_component() { ) .unwrap_err(); match err.downcast::() { - Ok(e @ RustupError::RequestedComponentsUnavailable { .. }) => { - assert!(e.to_string().contains("rustup component remove --toolchain nightly --target x86_64-apple-darwin bonus")); + Ok(RustupError::RequestedComponentsUnavailable { + components, + manifest, + toolchain, + }) => { + assert_eq!(toolchain, "nightly"); + let descriptions = components + .iter() + .map(|c| c.description(&manifest)) + .collect::>(); + assert_eq!(descriptions, ["'bonus' for target 'x86_64-apple-darwin'"]) } _ => panic!(), } @@ -992,13 +1019,24 @@ fn unavailable_components_is_target() { ) .unwrap_err(); match err.downcast::() { - Ok(e @ RustupError::RequestedComponentsUnavailable { .. }) => { - let err_str = e.to_string(); - assert!(err_str - .contains("rustup target remove --toolchain nightly i686-apple-darwin")); - assert!(err_str.contains( - "rustup target remove --toolchain nightly i686-unknown-linux-gnu" - )); + Ok(RustupError::RequestedComponentsUnavailable { + components, + manifest, + toolchain, + }) => { + assert_eq!(toolchain, "nightly"); + let descriptions = components + .iter() + .map(|c| c.description(&manifest)) + .collect::>(); + assert_eq!( + descriptions, + [ + "'rust-std' for target 'x86_64-apple-darwin'", + "'rust-std' for target 'i686-apple-darwin'", + "'rust-std' for target 'i686-unknown-linux-gnu'" + ] + ); } _ => panic!(), } @@ -1071,13 +1109,23 @@ fn unavailable_components_with_same_target() { ) .unwrap_err(); match err.downcast::() { - Ok(e @ RustupError::RequestedComponentsUnavailable { .. }) => { - let err_str = e.to_string(); - assert!(err_str - .contains("rustup target remove --toolchain nightly x86_64-apple-darwin")); - assert!(err_str.contains( - "rustup component remove --toolchain nightly --target x86_64-apple-darwin rustc" - )); + Ok(RustupError::RequestedComponentsUnavailable { + components, + manifest, + toolchain, + }) => { + assert_eq!(toolchain, "nightly"); + let descriptions = components + .iter() + .map(|c| c.description(&manifest)) + .collect::>(); + assert_eq!( + descriptions, + [ + "'rustc' for target 'x86_64-apple-darwin'", + "'rust-std' for target 'x86_64-apple-darwin'" + ] + ); } _ => panic!(), } diff --git a/src/errors.rs b/src/errors.rs index e6014cdb3f..03511f8771 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -147,29 +147,6 @@ fn suggest_message(suggestion: &Option) -> String { } } -fn remove_component_msg(cs: &Component, manifest: &Manifest, toolchain: &str) -> String { - if cs.short_name_in_manifest() == "rust-std" { - // We special-case rust-std as it's the stdlib so really you want to do - // rustup target remove - format!( - " rustup target remove --toolchain {} {}", - toolchain, - cs.target.as_deref().unwrap_or(toolchain) - ) - } else { - format!( - " rustup component remove --toolchain {}{} {}", - toolchain, - if let Some(target) = cs.target.as_ref() { - format!(" --target {target}") - } else { - String::default() - }, - cs.short_name(manifest) - ) - } -} - fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &str) -> String { assert!(!cs.is_empty()); @@ -188,11 +165,6 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: & "Sometimes not all components are available in any given nightly. " ); } - let _ = write!( - buf, - "If you don't need the component, you can remove it with:\n\n{}", - remove_component_msg(&cs[0], manifest, toolchain) - ); } else { // More than one component @@ -212,16 +184,17 @@ fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: & .join(", ") }; - let remove_msg = cs - .iter() - .map(|c| remove_component_msg(c, manifest, toolchain)) - .collect::>() - .join("\n"); let _ = write!( buf, - "some components unavailable for download for channel '{toolchain}': {cs_str}\n\ - If you don't need the components, you can remove them with:\n\n{remove_msg}\n\n{TOOLSTATE_MSG}", + "some components unavailable for download for channel '{toolchain}': {cs_str}", ); + + if toolchain.starts_with("nightly") { + let _ = write!( + buf, + "Sometimes not all components are available in any given nightly. " + ); + } } String::from_utf8(buf).unwrap() From 7f86b758921cfd9eeac86d9865d97f3afab3d684 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 10 Oct 2023 18:09:01 +0800 Subject: [PATCH 115/229] Refactor `components_*_msg` --- src/dist/dist.rs | 64 ++++++++++++++++++++++------------------- src/errors.rs | 75 ++++++++++++++++++++++++------------------------ 2 files changed, 72 insertions(+), 67 deletions(-) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 78932111ac..8b1768bfa9 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -44,45 +44,49 @@ static TOOLCHAIN_CHANNELS: &[&str] = &[ ]; fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &str) -> String { - assert!(!cs.is_empty()); let mut buf = vec![]; let suggestion = format!(" rustup toolchain add {toolchain} --profile minimal"); let nightly_tips = "Sometimes not all components are available in any given nightly. "; - if cs.len() == 1 { - let _ = writeln!( - buf, - "component {} is unavailable for download for channel '{}'", - &cs[0].description(manifest), - toolchain, - ); + match cs { + [] => panic!("`components_missing_msg` should not be called with an empty collection of unavailable components"), + [c] => { + let _ = writeln!( + buf, + "component {} is unavailable for download for channel '{}'", + c.description(manifest), + toolchain, + ); + + if toolchain.starts_with("nightly") { + let _ = write!(buf, "{nightly_tips}"); + } - if toolchain.starts_with("nightly") { - let _ = write!(buf, "{nightly_tips}"); + let _ = write!( + buf, + "If you don't need the component, you could try a minimal installation with:\n\n{suggestion}" + ); } + cs => { + let cs_str = cs + .iter() + .map(|c| c.description(manifest)) + .collect::>() + .join(", "); + let _ = write!( + buf, + "some components unavailable for download for channel '{toolchain}': {cs_str}" + ); - let _ = write!( - buf, - "If you don't need the component, you could try a minimal installation with:\n\n{suggestion}" - ); - } else { - let cs_str = cs - .iter() - .map(|c| c.description(manifest)) - .collect::>() - .join(", "); - let _ = write!( - buf, - "some components unavailable for download for channel '{toolchain}': {cs_str}" - ); + if toolchain.starts_with("nightly") { + let _ = write!(buf, "{nightly_tips}"); + } - if toolchain.starts_with("nightly") { - let _ = write!(buf, "{nightly_tips}"); + let _ = write!( + buf, + "If you don't need the components, you could try a minimal installation with:\n\n{suggestion}" + ); } - let _ = write!( - buf, - "If you don't need the components, you could try a minimal installation with:\n\n{suggestion}" - ); } String::from_utf8(buf).unwrap() diff --git a/src/errors.rs b/src/errors.rs index 03511f8771..df4df3f428 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -148,52 +148,53 @@ fn suggest_message(suggestion: &Option) -> String { } fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &str) -> String { - assert!(!cs.is_empty()); - let mut buf = vec![]; - - if cs.len() == 1 { - let _ = writeln!( - buf, - "component {} is unavailable for download for channel '{}'", - &cs[0].description(manifest), - toolchain, - ); - if toolchain.starts_with("nightly") { - let _ = write!( + match cs { + [] => panic!("`component_unavailable_msg` should not be called with an empty collection of unavailable components"), + [c] => { + let _ = writeln!( buf, - "Sometimes not all components are available in any given nightly. " + "component {} is unavailable for download for channel '{}'", + c.description(manifest), + toolchain, ); - } - } else { - // More than one component - - let same_target = cs - .iter() - .all(|c| c.target == cs[0].target || c.target.is_none()); - let cs_str = if same_target { - cs.iter() - .map(|c| format!("'{}'", c.short_name(manifest))) - .collect::>() - .join(", ") - } else { - cs.iter() - .map(|c| c.description(manifest)) - .collect::>() - .join(", ") - }; + if toolchain.starts_with("nightly") { + let _ = write!( + buf, + "Sometimes not all components are available in any given nightly. " + ); + } + } + cs => { + // More than one component + let same_target = cs + .iter() + .all(|c| c.target == cs[0].target || c.target.is_none()); - let _ = write!( - buf, - "some components unavailable for download for channel '{toolchain}': {cs_str}", - ); + let cs_str = if same_target { + cs.iter() + .map(|c| format!("'{}'", c.short_name(manifest))) + .collect::>() + .join(", ") + } else { + cs.iter() + .map(|c| c.description(manifest)) + .collect::>() + .join(", ") + }; - if toolchain.starts_with("nightly") { let _ = write!( buf, - "Sometimes not all components are available in any given nightly. " + "some components unavailable for download for channel '{toolchain}': {cs_str}" ); + + if toolchain.starts_with("nightly") { + let _ = write!( + buf, + "Sometimes not all components are available in any given nightly. " + ); + } } } From 53d44ac269f000a303b0d74693a8f9ee22e29114 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 10 Oct 2023 18:09:22 +0800 Subject: [PATCH 116/229] Add `Panics` sections to docstrings --- src/dist/dist.rs | 7 +++++++ src/errors.rs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 8b1768bfa9..63bc750857 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -43,6 +43,13 @@ static TOOLCHAIN_CHANNELS: &[&str] = &[ r"\d{1}\.\d{1,3}(?:\.\d{1,2})?", ]; +/// Returns a error message indicating that certain [`Component`]s are missing in a toolchain distribution. +/// +/// This message is currently used exclusively in toolchain-wide operations, +/// otherwise [`component_unavailable_msg`](../../errors/fn.component_unavailable_msg.html) will be used. +/// +/// # Panics +/// This function will panic when the collection of unavailable components `cs` is empty. fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &str) -> String { let mut buf = vec![]; let suggestion = format!(" rustup toolchain add {toolchain} --profile minimal"); diff --git a/src/errors.rs b/src/errors.rs index df4df3f428..d6d21388f2 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -147,6 +147,13 @@ fn suggest_message(suggestion: &Option) -> String { } } +/// Returns a error message indicating that certain [`Component`]s are unavailable. +/// +/// See also [`component_missing_msg`](../dist/dist/fn.components_missing_msg.html) +/// which generates error messages for component unavailability toolchain-wide operations. +/// +/// # Panics +/// This function will panic when the collection of unavailable components `cs` is empty. fn component_unavailable_msg(cs: &[Component], manifest: &Manifest, toolchain: &str) -> String { let mut buf = vec![]; match cs { From 310570beffa8925a600ebbb160b99ce51e999155 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 8 Oct 2023 19:27:16 +0800 Subject: [PATCH 117/229] Add test to ensure resolution of #3418 --- tests/suite/cli_v2.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index f94f3da91a..15673ab53a 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -1034,6 +1034,27 @@ fn update_unavailable_std() { }); } +#[test] +fn add_missing_component() { + setup(&|config| { + make_component_unavailable(config, "rls-preview", &this_host_triple()); + config.expect_ok(&["rustup", "toolchain", "add", "nightly"]); + config.expect_err( + &["rustup", "component", "add", "rls-preview"], + for_host!( + "component 'rls' for target '{0}' is unavailable for download for channel 'nightly'\n\ + Sometimes not all components are available in any given nightly." + ), + ); + // Make sure the following pattern does not match, + // thus addressing https://github.com/rust-lang/rustup/issues/3418. + config.expect_not_stderr_err( + &["rustup", "component", "add", "rls-preview"], + "If you don't need the component, you can remove it with:", + ); + }); +} + #[test] fn add_missing_component_toolchain() { setup(&|config| { From b5d74ac69307de29cee586c779bdb6b3aee7f7af Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 8 Oct 2023 19:27:16 +0800 Subject: [PATCH 118/229] Move `TOOLSTATE_MSG` to `dist` to serve toolchain-wide operations --- src/dist/dist.rs | 12 ++++++++++-- src/errors.rs | 8 -------- tests/suite/cli_v2.rs | 13 ++++++++++++- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 63bc750857..67d0c6ff15 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -43,6 +43,14 @@ static TOOLCHAIN_CHANNELS: &[&str] = &[ r"\d{1}\.\d{1,3}(?:\.\d{1,2})?", ]; +const TOOLSTATE_MSG: &str = + "If you require these components, please install and use the latest successful build version,\n\ + which you can find at .\n\nAfter determining \ + the correct date, install it with a command such as:\n\n \ + rustup toolchain install nightly-2018-12-27\n\n\ + Then you can use the toolchain with commands such as:\n\n \ + cargo +nightly-2018-12-27 build"; + /// Returns a error message indicating that certain [`Component`]s are missing in a toolchain distribution. /// /// This message is currently used exclusively in toolchain-wide operations, @@ -71,7 +79,7 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s let _ = write!( buf, - "If you don't need the component, you could try a minimal installation with:\n\n{suggestion}" + "If you don't need the component, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}" ); } cs => { @@ -91,7 +99,7 @@ fn components_missing_msg(cs: &[Component], manifest: &ManifestV2, toolchain: &s let _ = write!( buf, - "If you don't need the components, you could try a minimal installation with:\n\n{suggestion}" + "If you don't need the components, you could try a minimal installation with:\n\n{suggestion}\n\n{TOOLSTATE_MSG}" ); } } diff --git a/src/errors.rs b/src/errors.rs index d6d21388f2..a320ee4d5f 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -19,14 +19,6 @@ use crate::{ toolchain::names::{PathBasedToolchainName, ToolchainName}, }; -const TOOLSTATE_MSG: &str = - "If you require these components, please install and use the latest successful build version,\n\ - which you can find at .\n\nAfter determining \ - the correct date, install it with a command such as:\n\n \ - rustup toolchain install nightly-2018-12-27\n\n\ - Then you can use the toolchain with commands such as:\n\n \ - cargo +nightly-2018-12-27 build"; - /// A type erasing thunk for the retry crate to permit use with anyhow. See #[derive(Debug, ThisError)] #[error(transparent)] diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index 15673ab53a..563e6609fc 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -1065,7 +1065,18 @@ fn add_missing_component_toolchain() { r"component 'rust-std' for target '{0}' is unavailable for download for channel 'nightly' Sometimes not all components are available in any given nightly. If you don't need the component, you could try a minimal installation with: - rustup toolchain add nightly --profile minimal" + rustup toolchain add nightly --profile minimal + +If you require these components, please install and use the latest successful build version, +which you can find at . + +After determining the correct date, install it with a command such as: + + rustup toolchain install nightly-2018-12-27 + +Then you can use the toolchain with commands such as: + + cargo +nightly-2018-12-27 build" ), ); }); From 13e53706aefc59527c56d03a6118f0240811bf7d Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Fri, 3 Nov 2023 02:14:32 +0000 Subject: [PATCH 119/229] Fix the test toolchain_broken_symlink on Windows `rustup` on Windows uses "directory junctions" instead of symbolic links for `rustup toolchain link`. These are somewhere between a symbolic and a hard link, and require fewer permissions. However, the test in question was trying to use symbolic links. It now uses the same codepath to create the link as `toolchain link` itself. --- src/utils/raw.rs | 2 +- tests/suite/cli_misc.rs | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/utils/raw.rs b/src/utils/raw.rs index bbfe799d1e..cd733f538e 100644 --- a/src/utils/raw.rs +++ b/src/utils/raw.rs @@ -131,7 +131,7 @@ pub fn append_file(dest: &Path, line: &str) -> io::Result<()> { Ok(()) } -pub(crate) fn symlink_dir(src: &Path, dest: &Path) -> io::Result<()> { +pub fn symlink_dir(src: &Path, dest: &Path) -> io::Result<()> { #[cfg(windows)] fn symlink_dir_inner(src: &Path, dest: &Path) -> io::Result<()> { // std's symlink uses Windows's symlink function, which requires diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index 4aaf5f76be..37bf1346cc 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -665,29 +665,22 @@ fn rename_rls_remove() { #[test] #[cfg(any(unix, windows))] fn toolchain_broken_symlink() { + use rustup::utils::raw::symlink_dir; use std::fs; use std::path::Path; - #[cfg(unix)] - fn create_symlink_dir, Q: AsRef>(src: P, dst: Q) { - use std::os::unix::fs; - fs::symlink(src, dst).unwrap(); - } - - #[cfg(windows)] - fn create_symlink_dir, Q: AsRef>(src: P, dst: Q) { - use std::os::windows::fs; - fs::symlink_dir(src, dst).unwrap(); - } - clitools::test(Scenario::None, &|config| { // We artificially create a broken symlink toolchain -- but this can also happen "legitimately" // by having a proper toolchain there, using "toolchain link", and later removing the directory. fs::create_dir(config.rustupdir.join("toolchains")).unwrap(); - create_symlink_dir( - config.rustupdir.join("this-directory-does-not-exist"), - config.rustupdir.join("toolchains").join("test"), - ); + fs::create_dir(config.rustupdir.join("this-directory-does-not-exist")).unwrap(); + symlink_dir( + &config.rustupdir.join("this-directory-does-not-exist"), + &config.rustupdir.join("toolchains").join("test"), + ) + .unwrap(); + fs::remove_dir(config.rustupdir.join("this-directory-does-not-exist")).unwrap(); + // Make sure this "fake install" actually worked config.expect_ok_ex(&["rustup", "toolchain", "list"], "test\n", ""); // Now try to uninstall it. That should work only once. From 089d04b8637aaf949985de84fc059e9efddbc6ee Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 30 Oct 2023 17:44:34 +0800 Subject: [PATCH 120/229] Suggest installing MSYS2 for `windows-gnu` --- doc/user-guide/src/installation/other.md | 16 ++++++++++------ doc/user-guide/src/installation/windows.md | 8 +++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/doc/user-guide/src/installation/other.md b/doc/user-guide/src/installation/other.md index f5f6ec82b6..49dae70eb4 100644 --- a/doc/user-guide/src/installation/other.md +++ b/doc/user-guide/src/installation/other.md @@ -56,7 +56,7 @@ which is a `brew`-managed `rust` toolchain installation. ## Manual installation You can manually download `rustup-init` for a given target from -`https://static.rust-lang.org/rustup/dist/{target-triple}/rustup-init[.exe]`[^msvc]. +`https://static.rust-lang.org/rustup/dist/{target-triple}/rustup-init[.exe]`[^msys2] [^msvc].
Direct links @@ -83,7 +83,7 @@ You can manually download `rustup-init` for a given target from - [sha256 file](https://static.rust-lang.org/rustup/dist/i686-apple-darwin/rustup-init.sha256) - [i686-linux-android](https://static.rust-lang.org/rustup/dist/i686-linux-android/rustup-init) - [sha256 file](https://static.rust-lang.org/rustup/dist/i686-linux-android/rustup-init.sha256) -- [i686-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe) +- [i686-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe)[^msys2] - [sha256 file](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe.sha256) - [i686-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-init.exe)[^msvc] - [sha256 file](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-init.exe.sha256) @@ -109,7 +109,7 @@ You can manually download `rustup-init` for a given target from - [sha256 file](https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-init.sha256) - [x86_64-linux-android](https://static.rust-lang.org/rustup/dist/x86_64-linux-android/rustup-init) - [sha256 file](https://static.rust-lang.org/rustup/dist/x86_64-linux-android/rustup-init.sha256) -- [x86_64-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe) +- [x86_64-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe)[^msys2] - [sha256 file](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe.sha256) - [x86_64-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe)[^msvc] - [sha256 file](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe.sha256) @@ -131,11 +131,15 @@ To get a previous version, use SHA-256 checksums are also available by appending `.sha256` to the link. +[^msys2]: Windows GNU builds require no additional software for basic use. + However, many library crates will not be able to compile until + the full [MSYS2] with MinGW has been installed. + +[MSYS2]: https://www.msys2.org/ + [^msvc]: MSVC builds of `rustup` additionally require an [installation of Visual Studio 2019 or the Visual C++ Build Tools 2019][vs]. For Visual - Studio, make sure to check the "C++ tools" and "Windows 10 SDK" option. No - additional software installation is necessary for basic use of the GNU - build. + Studio, make sure to check the "C++ tools" and "Windows 10 SDK" option. [vs]: https://visualstudio.microsoft.com/downloads/ diff --git a/doc/user-guide/src/installation/windows.md b/doc/user-guide/src/installation/windows.md index 769885705a..51742c607e 100644 --- a/doc/user-guide/src/installation/windows.md +++ b/doc/user-guide/src/installation/windows.md @@ -7,11 +7,13 @@ the native (MSVC) ABI used by [Visual Studio], and the GNU ABI used by the [GCC toolchain]. Which version of Rust you need depends largely on what C/C++ libraries you want to interoperate with: for interop with software produced by Visual Studio use the MSVC build of Rust; for interop with GNU software built -using the [MinGW/MSYS2 toolchain] use the GNU build. +using the [MinGW/MSYS2 toolchain][MSYS2] use the GNU build. When targeting the MSVC ABI, Rust additionally requires an [installation of Visual Studio][msvc install] so `rustc` can use its linker and libraries. -No additional software installation is necessary for basic use of the GNU build. + +When targeting the GNU ABI, no additional software is strictly required for basic use. +However, many library crates will not be able to compile until the full [MSYS2] with MinGW has been installed. By default `rustup` on Windows configures Rust to target the MSVC ABI, that is a target triple of either `i686-pc-windows-msvc`, `x86_64-pc-windows-msvc`, or `aarch64-pc-windows-msvc` @@ -60,7 +62,7 @@ targets with the same compiler. [ABIs]: https://en.wikipedia.org/wiki/Application_binary_interface [cross-compilation]: ../cross-compilation.md [GCC toolchain]: https://gcc.gnu.org/ -[MinGW/MSYS2 toolchain]: https://msys2.github.io/ +[MSYS2]: https://www.msys2.org/ [msvc-toolchain]: https://www.rust-lang.org/tools/install?platform_override=win [toolchain specification]: ../concepts/toolchains.md#toolchain-specification [msvc install]: windows-msvc.html From ac431340f3dbbc565f1cd2285103e911eb81ca43 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 20:49:38 +0800 Subject: [PATCH 121/229] Refine `test_toolchain_sort` --- src/toolchain/names.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index f24764c7c6..48f6b0cb4b 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -675,6 +675,9 @@ mod tests { "1.2.0-x86_64-unknown-linux-gnu", "1.8.0-x86_64-unknown-linux-gnu", "1.10.0-x86_64-unknown-linux-gnu", + "bar(baz)", + "foo#bar", + "this.is.not-a+semver", ] .into_iter() .map(|s| ToolchainName::try_from(s).unwrap()) @@ -688,6 +691,10 @@ mod tests { "1.10.0-x86_64-unknown-linux-gnu", "beta-x86_64-unknown-linux-gnu", "1.2.0-x86_64-unknown-linux-gnu", + // https://github.com/rust-lang/rustup/issues/3517 + "foo#bar", + "bar(baz)", + "this.is.not-a+semver", ] .into_iter() .map(|s| ToolchainName::try_from(s).unwrap()) From 02d6717705fe2f6cddc9a2d5cdb3fb6415efeafd Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 20:54:33 +0800 Subject: [PATCH 122/229] Replace `sort_by` with `sort_by_key` in `toolchain_sort` --- src/toolchain/names.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 48f6b0cb4b..6c8da9168e 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -333,13 +333,7 @@ pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { } } - v.sort_by(|a, b| { - let a_str = &format!("{a}"); - let b_str = &format!("{b}"); - let a_key = toolchain_sort_key(a_str); - let b_key = toolchain_sort_key(b_str); - a_key.cmp(&b_key) - }); + v.sort_by_key(|name| toolchain_sort_key(&format!("{name}"))); } /// ResolvableLocalToolchainName is used to process values set in From 16cdde265198b4240f3d089b3d081b7c0f90ce6e Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 20:55:53 +0800 Subject: [PATCH 123/229] Inline `toolchain_sort_key` in `toolchain_sort` --- src/toolchain/names.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 6c8da9168e..1825027589 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -321,7 +321,8 @@ pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { } } - fn toolchain_sort_key(s: &str) -> Version { + v.sort_by_key(|name| { + let s: &str = &format!("{name}"); if s.starts_with("stable") { special_version(0, s) } else if s.starts_with("beta") { @@ -331,9 +332,7 @@ pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { } else { Version::parse(&s.replace('_', "-")).unwrap_or_else(|_| special_version(3, s)) } - } - - v.sort_by_key(|name| toolchain_sort_key(&format!("{name}"))); + }); } /// ResolvableLocalToolchainName is used to process values set in From 4f26cf3d517a886d5426e8c22137a06d64917ae1 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 21:09:43 +0800 Subject: [PATCH 124/229] Inline `special_version` in `toolchain_sort` --- src/toolchain/names.rs | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 1825027589..033f399287 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -311,27 +311,33 @@ impl Display for ToolchainName { pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { use semver::{BuildMetadata, Prerelease, Version}; - fn special_version(ord: u64, s: &str) -> Version { - Version { + v.sort_by_key(|name| { + let s: &str = &format!("{name}"); + let default_ver = Version { major: 0, minor: 0, patch: 0, - pre: Prerelease::new(&format!("pre.{}.{}", ord, s.replace('_', "-"))).unwrap(), + pre: Prerelease::EMPTY, build: BuildMetadata::EMPTY, - } - } + }; - v.sort_by_key(|name| { - let s: &str = &format!("{name}"); if s.starts_with("stable") { - special_version(0, s) - } else if s.starts_with("beta") { - special_version(1, s) - } else if s.starts_with("nightly") { - special_version(2, s) - } else { - Version::parse(&s.replace('_', "-")).unwrap_or_else(|_| special_version(3, s)) + let pre = Prerelease::new(&format!("pre.{}.{}", 0, s.replace('_', "-"))).unwrap(); + return Version { pre, ..default_ver }; + } + if s.starts_with("beta") { + let pre = Prerelease::new(&format!("pre.{}.{}", 1, s.replace('_', "-"))).unwrap(); + return Version { pre, ..default_ver }; + } + if s.starts_with("nightly") { + let pre = Prerelease::new(&format!("pre.{}.{}", 2, s.replace('_', "-"))).unwrap(); + return Version { pre, ..default_ver }; + } + if let Ok(v) = Version::parse(&s.replace('_', "-")) { + return v; } + let pre = Prerelease::new(&format!("pre.{}.{}", 3, s.replace('_', "-"))).unwrap(); + Version { pre, ..default_ver } }); } From cc58a4194da0ef017ae7638947658592139490b4 Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 21:15:49 +0800 Subject: [PATCH 125/229] Change key used in `toolchain_sort` --- src/toolchain/names.rs | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 033f399287..0331756c04 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -309,36 +309,26 @@ impl Display for ToolchainName { } pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { - use semver::{BuildMetadata, Prerelease, Version}; + use semver::Version; v.sort_by_key(|name| { - let s: &str = &format!("{name}"); - let default_ver = Version { - major: 0, - minor: 0, - patch: 0, - pre: Prerelease::EMPTY, - build: BuildMetadata::EMPTY, - }; - + let s = name.to_string(); if s.starts_with("stable") { - let pre = Prerelease::new(&format!("pre.{}.{}", 0, s.replace('_', "-"))).unwrap(); - return Version { pre, ..default_ver }; + return (0, None, s); } if s.starts_with("beta") { - let pre = Prerelease::new(&format!("pre.{}.{}", 1, s.replace('_', "-"))).unwrap(); - return Version { pre, ..default_ver }; + return (1, None, s); } if s.starts_with("nightly") { - let pre = Prerelease::new(&format!("pre.{}.{}", 2, s.replace('_', "-"))).unwrap(); - return Version { pre, ..default_ver }; + return (2, None, s); } - if let Ok(v) = Version::parse(&s.replace('_', "-")) { - return v; + if let Some((ver_str, suffix)) = s.split_once('-') { + if let Ok(ver) = Version::parse(ver_str) { + return (3, Some(ver), suffix.to_owned()); + } } - let pre = Prerelease::new(&format!("pre.{}.{}", 3, s.replace('_', "-"))).unwrap(); - Version { pre, ..default_ver } - }); + (4, None, s) + }) } /// ResolvableLocalToolchainName is used to process values set in From 435ed0dff591be1d97d4db5ae500e29226dd0a1f Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 20:51:19 +0800 Subject: [PATCH 126/229] Add docs specifying `toolchain_sort`'s expected behavior --- src/toolchain/names.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 0331756c04..8ac13c5017 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -308,6 +308,10 @@ impl Display for ToolchainName { } } +/// Sorts [`ToolchainName`]s in the following order: +/// 1. `stable`/`beta`/`nightly`-prefixed names, in this exact order. +/// 2. `X.Y.Z-suffix` names, sorted by semver rules on `X.Y.Z`, then by `suffix`. +/// 3. Other names, sorted alphanumerically. pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { use semver::Version; From 01bc242e93a77044d4c9e07fb363088ea4db8c2c Mon Sep 17 00:00:00 2001 From: rami3l Date: Wed, 1 Nov 2023 21:18:31 +0800 Subject: [PATCH 127/229] Inline `semver::Version` in `toolchain_sort` --- src/toolchain/names.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 8ac13c5017..37b1819788 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -313,8 +313,6 @@ impl Display for ToolchainName { /// 2. `X.Y.Z-suffix` names, sorted by semver rules on `X.Y.Z`, then by `suffix`. /// 3. Other names, sorted alphanumerically. pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { - use semver::Version; - v.sort_by_key(|name| { let s = name.to_string(); if s.starts_with("stable") { @@ -327,7 +325,7 @@ pub(crate) fn toolchain_sort(v: &mut [ToolchainName]) { return (2, None, s); } if let Some((ver_str, suffix)) = s.split_once('-') { - if let Ok(ver) = Version::parse(ver_str) { + if let Ok(ver) = semver::Version::parse(ver_str) { return (3, Some(ver), suffix.to_owned()); } } From fb4b60b625ea2f3de6b8469be5625a051cd2a530 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 12:29:07 +0100 Subject: [PATCH 128/229] Use uniform dependency specification style --- Cargo.toml | 30 +++++++----------------------- download/Cargo.toml | 11 ++--------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 3d265e5f0f..0b625e0671 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,12 +64,17 @@ lazy_static.workspace = true libc = "0.2" once_cell = { workspace = true, optional = true } opener = "0.6.0" +# `openssl` is used by `curl` or `reqwest` backend although it isn't imported by rustup: this +# allows controlling the vendoring status without exposing the presence of the download crate. +openssl = { version = "0.10", optional = true } opentelemetry = { workspace = true, optional = true } opentelemetry-otlp = { workspace = true, optional = true } pulldown-cmark = { version = "0.9", default-features = false } rand = "0.8" regex = "1" remove_dir_all = { version = "0.8.1", features = ["parallel"] } +retry = { version = "2", default-features = false, features = ["random"] } +rs_tracing = { version = "1.1", features = ["rs_tracing"] } same-file = "1" scopeguard = "1" semver = "1.0" @@ -85,9 +90,7 @@ threadpool = "1" tokio = { workspace = true, optional = true } toml = "0.8" tracing-opentelemetry = { workspace = true, optional = true } -tracing-subscriber = { workspace = true, optional = true, features = [ - "env-filter", -] } +tracing-subscriber = { workspace = true, optional = true, features = ["env-filter"] } tracing.workspace = true url.workspace = true wait-timeout = "0.2" @@ -95,22 +98,6 @@ walkdir = { workspace = true, optional = true } xz2 = "0.1.3" zstd = "0.13" -[dependencies.openssl] -# Used by `curl` or `reqwest` backend although it isn't imported by our rustup : -# this allows controlling the vendoring status without exposing the presence of -# the download crate. -optional = true -version = "0.10" - -[dependencies.retry] -default-features = false -features = ["random"] -version = "2.0.0" - -[dependencies.rs_tracing] -features = ["rs_tracing"] -version = "1.1.0" - [target."cfg(windows)".dependencies] cc = "1" winreg = "0.51" @@ -155,7 +142,6 @@ features = [ ] version = "0.48.0" - [dev-dependencies] enum-map = "2.5.0" once_cell.workspace = true @@ -185,9 +171,7 @@ rustup-macros = { path = "rustup-macros" } tempfile = "3.8" termcolor = "1.2" thiserror = "1.0" -tokio = { version = "1.26.0", default-features = false, features = [ - "rt-multi-thread", -] } +tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-thread"] } tracing = "0.1" tracing-opentelemetry = { version = "0.21.0" } tracing-subscriber = "0.3.16" diff --git a/download/Cargo.toml b/download/Cargo.toml index f1b7c97dad..95748bad75 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -20,18 +20,11 @@ anyhow.workspace = true curl = { version = "0.4.44", optional = true } env_proxy = { version = "0.4.1", optional = true } lazy_static = { workspace = true, optional = true } -reqwest = { version = "0.11", default-features = false, features = [ - "blocking", - "gzip", - "socks", -], optional = true } +reqwest = { version = "0.11", default-features = false, features = ["blocking", "gzip", "socks"], optional = true } thiserror.workspace = true url.workspace = true [dev-dependencies] -hyper = { version = "0.14", default-features = false, features = [ - "tcp", - "server", -] } +hyper = { version = "0.14", default-features = false, features = ["tcp", "server"] } tempfile.workspace = true tokio = { workspace = true, default-features = false, features = ["sync"] } From a9cd735f7f9aac1c7582f04a0639131733ccab05 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 14:04:47 +0100 Subject: [PATCH 129/229] Update semver-compatible dependencies --- Cargo.lock | 242 +++++++++++++++++++++++++++-------------------------- 1 file changed, 125 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7d58f12dc9..887f1ccd93 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "bit-set" @@ -286,18 +286,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", @@ -308,18 +308,18 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.3" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" +checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" dependencies = [ "clap", ] [[package]] name = "clap_lex" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd7cc57abe963c6d3b9d8be5b06ba7c8957a930305ca90304f24ef040aa6f961" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "colorchoice" @@ -354,9 +354,9 @@ checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -559,7 +559,7 @@ checksum = "04d0b288e3bb1d861c4403c1774a6f7a798781dfc519b3647df2a3dd4ae95f25" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -571,7 +571,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -614,7 +614,7 @@ checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.3.5", "windows-sys 0.48.0", ] @@ -674,24 +674,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -700,38 +700,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-core", "futures-io", @@ -789,7 +789,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "time", ] @@ -921,9 +921,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d78e1e73ec14cf7375674f74d7dde185c8206fd9dea6fb6295e8a98098aaa97" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http", @@ -980,9 +980,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8adf3ddd720272c6ea8bf59463c04e0f93d0bbf7c5439b691bca2987e0270897" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", "hashbrown 0.14.2", @@ -1020,9 +1020,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1035,9 +1035,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.149" +version = "0.2.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" +checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" [[package]] name = "libm" @@ -1127,9 +1127,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -1238,9 +1238,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -1259,7 +1259,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1270,18 +1270,18 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.5+3.1.3" +version = "300.1.6+3.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "559068e4c12950d7dcaa1857a61725c0d38d4fc03ff8e070ab31a75d6e316491" +checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085" dependencies = [ "cc", ] [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" dependencies = [ "cc", "libc", @@ -1427,7 +1427,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1606,6 +1606,15 @@ dependencies = [ "bitflags 1.3.2", ] +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "regex" version = "1.10.2" @@ -1730,17 +1739,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -1761,9 +1769,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -1774,9 +1782,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -1807,9 +1815,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -1885,7 +1893,7 @@ dependencies = [ "quote", "regex", "sha2", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -1938,9 +1946,9 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -1977,29 +1985,29 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -2008,9 +2016,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -2127,9 +2135,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stable_deref_trait" @@ -2156,9 +2164,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.38" +version = "2.0.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" dependencies = [ "proc-macro2", "quote", @@ -2215,13 +2223,13 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if 1.0.0", "fastrand", - "redox_syscall", + "redox_syscall 0.4.1", "rustix", "windows-sys 0.48.0", ] @@ -2262,7 +2270,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2363,7 +2371,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2411,9 +2419,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -2425,9 +2433,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc" dependencies = [ "serde", "serde_spanned", @@ -2437,20 +2445,20 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.20.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" dependencies = [ - "indexmap 2.0.2", + "indexmap 2.1.0", "serde", "serde_spanned", "toml_datetime", @@ -2536,7 +2544,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", ] [[package]] @@ -2551,12 +2559,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -2660,9 +2668,9 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" @@ -2741,9 +2749,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2751,24 +2759,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -2778,9 +2786,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2788,28 +2796,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", - "syn 2.0.38", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", @@ -2980,9 +2988,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "winnow" -version = "0.5.17" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3b801d0e0a6726477cc207f60162da452f3a95adb368399bef20a946e06f65c" +checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" dependencies = [ "memchr", ] From f613d3bb38322b123c307a823efe0617d6c79fc8 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 13:26:33 +0100 Subject: [PATCH 130/229] Remove authors from Cargo manifest (per RFC 3052) --- Cargo.toml | 4 ---- download/Cargo.toml | 2 -- 2 files changed, 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0b625e0671..0c25140540 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,4 @@ [package] -authors = [ - "Daniel Silverstone ", - "Diggory Blake ", -] build = "build.rs" description = "Manage multiple rust installations with ease" edition = "2021" diff --git a/download/Cargo.toml b/download/Cargo.toml index 95748bad75..b52681a955 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -1,6 +1,4 @@ [package] - -authors = ["Brian Anderson "] edition = "2021" license = "MIT OR Apache-2.0" name = "download" From 9f4857e22e42ef4b7c26f8f826adeb96b9b187e3 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 13:27:07 +0100 Subject: [PATCH 131/229] Use more conventional field order in package table --- Cargo.toml | 8 ++++---- download/Cargo.toml | 4 ++-- rustup-macros/Cargo.toml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0c25140540..507bf8894e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,14 +1,14 @@ [package] -build = "build.rs" -description = "Manage multiple rust installations with ease" +name = "rustup" +version = "1.26.0" edition = "2021" +description = "Manage multiple rust installations with ease" homepage = "https://github.com/rust-lang/rustup" keywords = ["rustup", "multirust", "install", "proxy"] license = "MIT OR Apache-2.0" -name = "rustup" readme = "README.md" repository = "https://github.com/rust-lang/rustup" -version = "1.26.0" +build = "build.rs" [features] curl-backend = ["download/curl-backend"] diff --git a/download/Cargo.toml b/download/Cargo.toml index b52681a955..40720af32b 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -1,8 +1,8 @@ [package] -edition = "2021" -license = "MIT OR Apache-2.0" name = "download" version = "1.26.0" +edition = "2021" +license = "MIT OR Apache-2.0" [features] diff --git a/rustup-macros/Cargo.toml b/rustup-macros/Cargo.toml index c9f8572b0d..12decf2fb0 100644 --- a/rustup-macros/Cargo.toml +++ b/rustup-macros/Cargo.toml @@ -1,8 +1,8 @@ [package] -edition = "2021" name = "rustup-macros" -publish = false version = "0.1.0" +edition = "2021" +publish = false [lib] proc-macro = true From 867dfc7d46e46bc718bb4b947291990bdf4c7e61 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 13:41:22 +0100 Subject: [PATCH 132/229] Replace usage of lazy_static with once_cell --- Cargo.lock | 3 +- Cargo.toml | 9 ++---- download/Cargo.toml | 4 +-- download/src/lib.rs | 54 ++++++++++++++------------------ src/cli/common.rs | 12 +++----- src/cli/errors.rs | 7 ++--- src/cli/self_update.rs | 6 ++-- src/dist/dist.rs | 21 ++++++------- src/dist/triple.rs | 13 ++++---- src/test/mock/clitools.rs | 65 +++++++++++++++++++-------------------- src/test/mock/dist.rs | 9 +++--- 11 files changed, 91 insertions(+), 112 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 887f1ccd93..809ca27a88 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -500,7 +500,7 @@ dependencies = [ "curl", "env_proxy", "hyper", - "lazy_static", + "once_cell", "reqwest", "tempfile", "thiserror", @@ -1842,7 +1842,6 @@ dependencies = [ "fs_at", "git-testament", "home", - "lazy_static", "libc", "once_cell", "opener", diff --git a/Cargo.toml b/Cargo.toml index 507bf8894e..1d9efce9a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ otel = [ ] # Exports code dependent on private interfaces for the integration test suite -test = ["dep:once_cell", "dep:walkdir"] +test = ["dep:walkdir"] # Sorted by alphabetic order [dependencies] @@ -56,9 +56,8 @@ flate2 = "1" fs_at.workspace = true git-testament = "0.2" home = "0.5.4" -lazy_static.workspace = true libc = "0.2" -once_cell = { workspace = true, optional = true } +once_cell.workspace = true opener = "0.6.0" # `openssl` is used by `curl` or `reqwest` backend although it isn't imported by rustup: this # allows controlling the vendoring status without exposing the presence of the download crate. @@ -140,14 +139,13 @@ version = "0.48.0" [dev-dependencies] enum-map = "2.5.0" -once_cell.workspace = true proptest.workspace = true rustup-macros.workspace = true tokio = { workspace = true, features = ["rt-multi-thread", "macros"] } trycmd = "0.14.13" [build-dependencies] -lazy_static = "1" +once_cell.workspace = true regex = "1" [workspace] @@ -158,7 +156,6 @@ anyhow = "1.0.69" derivative = "2.2.0" enum_dispatch = "0.3.11" fs_at = "0.1.6" -lazy_static = "1" once_cell = "1.18.0" opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } opentelemetry-otlp = { version = "0.13.0" } diff --git a/download/Cargo.toml b/download/Cargo.toml index 40720af32b..b0c2ea0c8d 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0" default = ["reqwest-backend", "reqwest-rustls-tls", "reqwest-default-tls"] curl-backend = ["curl"] -reqwest-backend = ["reqwest", "env_proxy", "lazy_static"] +reqwest-backend = ["reqwest", "env_proxy"] reqwest-default-tls = ["reqwest/default-tls"] reqwest-rustls-tls = ["reqwest/rustls-tls-native-roots"] @@ -17,7 +17,7 @@ reqwest-rustls-tls = ["reqwest/rustls-tls-native-roots"] anyhow.workspace = true curl = { version = "0.4.44", optional = true } env_proxy = { version = "0.4.1", optional = true } -lazy_static = { workspace = true, optional = true } +once_cell.workspace = true reqwest = { version = "0.11", default-features = false, features = ["blocking", "gzip", "socks"], optional = true } thiserror.workspace = true url.workspace = true diff --git a/download/src/lib.rs b/download/src/lib.rs index 0cf20f7994..cc496f7103 100644 --- a/download/src/lib.rs +++ b/download/src/lib.rs @@ -270,7 +270,7 @@ pub mod reqwest_be { use anyhow::{anyhow, Context, Result}; #[cfg(any(feature = "reqwest-rustls-tls", feature = "reqwest-default-tls"))] - use lazy_static::lazy_static; + use once_cell::sync::Lazy; use reqwest::blocking::{Client, ClientBuilder, Response}; use reqwest::{header, Proxy}; use url::Url; @@ -324,40 +324,32 @@ pub mod reqwest_be { .proxy(Proxy::custom(env_proxy)) .timeout(Duration::from_secs(30)) } + #[cfg(feature = "reqwest-rustls-tls")] - lazy_static! { - static ref CLIENT_RUSTLS_TLS: Client = { - let catcher = || { - client_generic().use_rustls_tls() - .build() - }; + static CLIENT_RUSTLS_TLS: Lazy = Lazy::new(|| { + let catcher = || client_generic().use_rustls_tls().build(); + + // woah, an unwrap?! + // It's OK. This is the same as what is happening in curl. + // + // The curl::Easy::new() internally assert!s that the initialized + // Easy is not null. Inside reqwest, the errors here would be from + // the TLS library returning a null pointer as well. + catcher().unwrap() + }); - // woah, an unwrap?! - // It's OK. This is the same as what is happening in curl. - // - // The curl::Easy::new() internally assert!s that the initialized - // Easy is not null. Inside reqwest, the errors here would be from - // the TLS library returning a null pointer as well. - catcher().unwrap() - }; - } #[cfg(feature = "reqwest-default-tls")] - lazy_static! { - static ref CLIENT_DEFAULT_TLS: Client = { - let catcher = || { - client_generic() - .build() - }; + static CLIENT_DEFAULT_TLS: Lazy = Lazy::new(|| { + let catcher = || client_generic().build(); - // woah, an unwrap?! - // It's OK. This is the same as what is happening in curl. - // - // The curl::Easy::new() internally assert!s that the initialized - // Easy is not null. Inside reqwest, the errors here would be from - // the TLS library returning a null pointer as well. - catcher().unwrap() - }; - } + // woah, an unwrap?! + // It's OK. This is the same as what is happening in curl. + // + // The curl::Easy::new() internally assert!s that the initialized + // Easy is not null. Inside reqwest, the errors here would be from + // the TLS library returning a null pointer as well. + catcher().unwrap() + }); fn env_proxy(url: &Url) -> Option { env_proxy::for_url(url).to_url() diff --git a/src/cli/common.rs b/src/cli/common.rs index a0c9ca7b2d..9a85aca25b 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -10,7 +10,7 @@ use std::{cmp, env}; use anyhow::{anyhow, Context, Result}; use git_testament::{git_testament, render_testament}; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use super::self_update; use crate::cli::download_tracker::DownloadTracker; @@ -566,12 +566,10 @@ pub(crate) fn list_overrides(cfg: &Cfg) -> Result { git_testament!(TESTAMENT); pub(crate) fn version() -> &'static str { - lazy_static! { - // Because we trust our `stable` branch given the careful release - // process, we mark it trusted here so that our version numbers look - // right when built from CI before the tag is pushed - static ref RENDERED: String = render_testament!(TESTAMENT, "stable"); - } + // Because we trust our `stable` branch given the careful release + // process, we mark it trusted here so that our version numbers look + // right when built from CI before the tag is pushed + static RENDERED: Lazy = Lazy::new(|| render_testament!(TESTAMENT, "stable")); &RENDERED } diff --git a/src/cli/errors.rs b/src/cli/errors.rs index 5eca75880c..7866db34a2 100644 --- a/src/cli/errors.rs +++ b/src/cli/errors.rs @@ -4,7 +4,7 @@ use std::io; use std::path::PathBuf; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use regex::Regex; use strsim::damerau_levenshtein; use thiserror::Error as ThisError; @@ -24,10 +24,7 @@ pub enum CLIError { fn maybe_suggest_toolchain(bad_name: &str) -> String { let bad_name = &bad_name.to_ascii_lowercase(); static VALID_CHANNELS: &[&str] = &["stable", "beta", "nightly"]; - lazy_static! { - static ref NUMBERED: Regex = Regex::new(r"^\d+\.\d+$").unwrap(); - } - + static NUMBERED: Lazy = Lazy::new(|| Regex::new(r"^\d+\.\d+$").unwrap()); if NUMBERED.is_match(bad_name) { return format!(". Toolchain numbers tend to have three parts, e.g. {bad_name}.0"); } diff --git a/src/cli/self_update.rs b/src/cli/self_update.rs index 8c21038a4c..5b0709e758 100644 --- a/src/cli/self_update.rs +++ b/src/cli/self_update.rs @@ -1139,12 +1139,10 @@ fn get_new_rustup_version(path: &Path) -> Option { } fn parse_new_rustup_version(version: String) -> String { - use lazy_static::lazy_static; + use once_cell::sync::Lazy; use regex::Regex; - lazy_static! { - static ref RE: Regex = Regex::new(r"\d+.\d+.\d+[0-9a-zA-Z-]*").unwrap(); - } + static RE: Lazy = Lazy::new(|| Regex::new(r"\d+.\d+.\d+[0-9a-zA-Z-]*").unwrap()); let capture = RE.captures(&version); let matched_version = match capture { diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 67d0c6ff15..9218abcc81 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -9,7 +9,7 @@ use std::str::FromStr; use anyhow::{anyhow, bail, Context, Result}; use chrono::NaiveDate; -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use regex::Regex; use thiserror::Error as ThisError; @@ -182,15 +182,15 @@ static TRIPLE_MIPS64_UNKNOWN_LINUX_GNUABI64: &str = "mips64el-unknown-linux-gnua impl FromStr for ParsedToolchainDesc { type Err = anyhow::Error; fn from_str(desc: &str) -> Result { - lazy_static! { - static ref TOOLCHAIN_CHANNEL_PATTERN: String = format!( + // Note this regex gives you a guaranteed match of the channel (1) + // and an optional match of the date (2) and target (3) + static TOOLCHAIN_CHANNEL_RE: Lazy = Lazy::new(|| { + Regex::new(&format!( r"^({})(?:-(\d{{4}}-\d{{2}}-\d{{2}}))?(?:-(.+))?$", TOOLCHAIN_CHANNELS.join("|") - ); - // Note this regex gives you a guaranteed match of the channel (1) - // and an optional match of the date (2) and target (3) - static ref TOOLCHAIN_CHANNEL_RE: Regex = Regex::new(&TOOLCHAIN_CHANNEL_PATTERN).unwrap(); - } + )) + .unwrap() + }); let d = TOOLCHAIN_CHANNEL_RE.captures(desc).map(|c| { fn fn_map(s: &str) -> Option { @@ -603,9 +603,8 @@ impl ToolchainDesc { /// date field is empty. pub(crate) fn is_tracking(&self) -> bool { let channels = ["nightly", "beta", "stable"]; - lazy_static! { - static ref TRACKING_VERSION: Regex = Regex::new(r"^\d{1}\.\d{1,3}$").unwrap(); - } + static TRACKING_VERSION: Lazy = + Lazy::new(|| Regex::new(r"^\d{1}\.\d{1,3}$").unwrap()); (channels.iter().any(|x| *x == self.channel) || TRACKING_VERSION.is_match(&self.channel)) && self.date.is_none() } diff --git a/src/dist/triple.rs b/src/dist/triple.rs index db64f6b305..acf9e96b94 100644 --- a/src/dist/triple.rs +++ b/src/dist/triple.rs @@ -1,4 +1,4 @@ -use lazy_static::lazy_static; +use once_cell::sync::Lazy; use regex::Regex; // These lists contain the targets known to rustup, and used to build @@ -68,15 +68,16 @@ impl PartialTargetTriple { // we can count on all triple components being // delineated by it. let name = format!("-{name}"); - lazy_static! { - static ref PATTERN: String = format!( + static RE: Lazy = Lazy::new(|| { + Regex::new(&format!( r"^(?:-({}))?(?:-({}))?(?:-({}))?$", LIST_ARCHS.join("|"), LIST_OSES.join("|"), LIST_ENVS.join("|") - ); - static ref RE: Regex = Regex::new(&PATTERN).unwrap(); - } + )) + .unwrap() + }); + RE.captures(&name).map(|c| { fn fn_map(s: &str) -> Option { if s.is_empty() { diff --git a/src/test/mock/clitools.rs b/src/test/mock/clitools.rs index fe5f834844..65e4b4e40f 100644 --- a/src/test/mock/clitools.rs +++ b/src/test/mock/clitools.rs @@ -15,7 +15,6 @@ use std::{ }; use enum_map::{enum_map, Enum, EnumMap}; -use lazy_static::lazy_static; use once_cell::sync::Lazy; use url::Url; @@ -1501,39 +1500,39 @@ fn build_combined_installer(components: &[&MockInstallerBuilder]) -> MockInstall /// and then we store some associated files next to it which indicate /// the version/version hash information. fn mock_bin(name: &str, version: &str, version_hash: &str) -> Vec { - lazy_static! { - static ref MOCK_BIN: Arc> = { - // Create a temp directory to hold the source and the output - let tempdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); - let source_path = tempdir.path().join("in.rs"); - let dest_path = tempdir.path().join(format!("out{EXE_SUFFIX}")); - - // Write the source - let source = include_bytes!("mock_bin_src.rs"); - fs::write(&source_path, &source[..]).unwrap(); - - // Create the executable - let status = Command::new("rustc") - .arg(&source_path) - .arg("-C").arg("panic=abort") - .arg("-O") - .arg("-o").arg(&dest_path) - .status() - .unwrap(); - assert!(status.success()); - assert!(dest_path.exists()); - - // Remove debug info from std/core which included in every programs, - // otherwise we just ignore the return result here - if cfg!(unix) { - drop(Command::new("strip").arg(&dest_path).status()); - } + static MOCK_BIN: Lazy>> = Lazy::new(|| { + // Create a temp directory to hold the source and the output + let tempdir = tempfile::Builder::new().prefix("rustup").tempdir().unwrap(); + let source_path = tempdir.path().join("in.rs"); + let dest_path = tempdir.path().join(format!("out{EXE_SUFFIX}")); + + // Write the source + let source = include_bytes!("mock_bin_src.rs"); + fs::write(&source_path, &source[..]).unwrap(); + + // Create the executable + let status = Command::new("rustc") + .arg(&source_path) + .arg("-C") + .arg("panic=abort") + .arg("-O") + .arg("-o") + .arg(&dest_path) + .status() + .unwrap(); + assert!(status.success()); + assert!(dest_path.exists()); - // Now load it into memory - let buf = fs::read(dest_path).unwrap(); - Arc::new(buf) - }; - } + // Remove debug info from std/core which included in every programs, + // otherwise we just ignore the return result here + if cfg!(unix) { + drop(Command::new("strip").arg(&dest_path).status()); + } + + // Now load it into memory + let buf = fs::read(dest_path).unwrap(); + Arc::new(buf) + }); let name = format!("bin/{name}{EXE_SUFFIX}"); vec![ diff --git a/src/test/mock/dist.rs b/src/test/mock/dist.rs index 04268abacf..9a92b483a0 100644 --- a/src/test/mock/dist.rs +++ b/src/test/mock/dist.rs @@ -1,13 +1,14 @@ //! Tools for building and working with the filesystem of a mock Rust //! distribution server, with v1 and v2 manifests. -use lazy_static::lazy_static; -use sha2::{Digest, Sha256}; use std::collections::HashMap; use std::fs::{self, File}; use std::io::{self, Read, Write}; use std::path::{Path, PathBuf}; use std::sync::Mutex; + +use once_cell::sync::Lazy; +use sha2::{Digest, Sha256}; use url::Url; use super::clitools::hard_link; @@ -217,9 +218,7 @@ impl MockDistServer { type Tarball = HashMap<(String, MockTargetedPackage, String), (Vec, String)>; // Tarball creation can be super slow, so cache created tarballs // globally to avoid recreating and recompressing tons of tarballs. - lazy_static! { - static ref TARBALLS: Mutex = Mutex::new(HashMap::new()); - } + static TARBALLS: Lazy> = Lazy::new(|| Mutex::new(HashMap::new())); let key = ( installer_name.to_string(), From e386f892284b967ccaef12e6ccb1a0e2de2892c3 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 13:58:41 +0100 Subject: [PATCH 133/229] Remove unused dependencies from macros crate --- Cargo.lock | 2 -- rustup-macros/Cargo.toml | 2 -- 2 files changed, 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 809ca27a88..93adebe660 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1890,8 +1890,6 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "regex", - "sha2", "syn 2.0.39", ] diff --git a/rustup-macros/Cargo.toml b/rustup-macros/Cargo.toml index 12decf2fb0..886819a511 100644 --- a/rustup-macros/Cargo.toml +++ b/rustup-macros/Cargo.toml @@ -10,6 +10,4 @@ proc-macro = true [dependencies] proc-macro2 = "1.0.63" quote = "1.0.23" -regex = "1.10.0" -sha2 = "0.10.6" syn = { version = "2.0.13", features = ["full"] } From 5e2be623ddf8752168ccab02dd31ff41df3c331f Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 14:08:30 +0100 Subject: [PATCH 134/229] Explicitly import symbols --- src/bin/rustup-init.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index 19c8dd99e9..c5475e0171 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -15,7 +15,10 @@ use anyhow::{anyhow, Result}; use cfg_if::cfg_if; -use rs_tracing::*; +// Public macros require availability of the internal symbols +use rs_tracing::{ + close_trace_file, close_trace_file_internal, open_trace_file, trace_to_file_internal, +}; use rustup::cli::common; use rustup::cli::proxy_mode; From 68fbf3fb1ce8ccc5b1d052186b6add848afe897d Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 14:12:10 +0100 Subject: [PATCH 135/229] Remove unused import --- tests/suite/cli_misc.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/suite/cli_misc.rs b/tests/suite/cli_misc.rs index 37bf1346cc..49982fd223 100644 --- a/tests/suite/cli_misc.rs +++ b/tests/suite/cli_misc.rs @@ -667,7 +667,6 @@ fn rename_rls_remove() { fn toolchain_broken_symlink() { use rustup::utils::raw::symlink_dir; use std::fs; - use std::path::Path; clitools::test(Scenario::None, &|config| { // We artificially create a broken symlink toolchain -- but this can also happen "legitimately" From 5af4bc4a0d4bc69ea9091a7935fb3783c5fb508e Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Mon, 6 Nov 2023 14:25:03 +0100 Subject: [PATCH 136/229] Inline channel pattern list --- src/dist/dist.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 9218abcc81..aca41172d9 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -34,15 +34,6 @@ pub static DEFAULT_DIST_SERVER: &str = "https://static.rust-lang.org"; // Deprecated pub(crate) static DEFAULT_DIST_ROOT: &str = "https://static.rust-lang.org/dist"; -// The channel patterns we support -static TOOLCHAIN_CHANNELS: &[&str] = &[ - "nightly", - "beta", - "stable", - // Allow from 1.0.0 through to 9.999.99 with optional patch version - r"\d{1}\.\d{1,3}(?:\.\d{1,2})?", -]; - const TOOLSTATE_MSG: &str = "If you require these components, please install and use the latest successful build version,\n\ which you can find at .\n\nAfter determining \ @@ -187,7 +178,15 @@ impl FromStr for ParsedToolchainDesc { static TOOLCHAIN_CHANNEL_RE: Lazy = Lazy::new(|| { Regex::new(&format!( r"^({})(?:-(\d{{4}}-\d{{2}}-\d{{2}}))?(?:-(.+))?$", - TOOLCHAIN_CHANNELS.join("|") + // The channel patterns we support + [ + "nightly", + "beta", + "stable", + // Allow from 1.0.0 through to 9.999.99 with optional patch version + r"\d{1}\.\d{1,3}(?:\.\d{1,2})?", + ] + .join("|") )) .unwrap() }); From fc5ce0b31ae1f60d2099695f25465725da45814e Mon Sep 17 00:00:00 2001 From: Olivier Lemasle Date: Thu, 9 Nov 2023 13:36:56 +0100 Subject: [PATCH 137/229] [doc] windows.md: fix link Link `[Visual Studio]` was not rendered, since its href had been deleted. --- doc/user-guide/src/installation/windows.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/user-guide/src/installation/windows.md b/doc/user-guide/src/installation/windows.md index 51742c607e..8b2d65c396 100644 --- a/doc/user-guide/src/installation/windows.md +++ b/doc/user-guide/src/installation/windows.md @@ -61,6 +61,7 @@ targets with the same compiler. [ABIs]: https://en.wikipedia.org/wiki/Application_binary_interface [cross-compilation]: ../cross-compilation.md +[Visual Studio]: https://visualstudio.microsoft.com/ [GCC toolchain]: https://gcc.gnu.org/ [MSYS2]: https://www.msys2.org/ [msvc-toolchain]: https://www.rust-lang.org/tools/install?platform_override=win From 7dd4871be13dcf4d569ec4a716ea01839f572c1f Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 9 Nov 2023 00:32:57 +0800 Subject: [PATCH 138/229] Update opentelemetry --- Cargo.lock | 91 ++++++++++++++++++++++++------------------ Cargo.toml | 9 +++-- src/bin/rustup-init.rs | 10 ++--- src/test.rs | 19 ++++----- 4 files changed, 71 insertions(+), 58 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 93adebe660..ceb0a00b49 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1292,26 +1292,32 @@ dependencies = [ [[package]] name = "opentelemetry" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9591d937bc0e6d2feb6f71a559540ab300ea49955229c347a517a28d27784c54" +checksum = "1e32339a5dc40459130b3bd269e9892439f55b33e772d2a9d402a789baaf4e8a" dependencies = [ - "opentelemetry_api", - "opentelemetry_sdk", + "futures-core", + "futures-sink", + "indexmap 2.1.0", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror", + "urlencoding", ] [[package]] name = "opentelemetry-otlp" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e5e5a5c4135864099f3faafbe939eb4d7f9b80ebf68a8448da961b32a7c1275" +checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" dependencies = [ "async-trait", "futures-core", "http", + "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", - "opentelemetry_api", "opentelemetry_sdk", "prost", "thiserror", @@ -1321,11 +1327,11 @@ dependencies = [ [[package]] name = "opentelemetry-proto" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1e3f814aa9f8c905d0ee4bde026afd3b2577a97c10e1699912e3e44f0c4cbeb" +checksum = "a2e155ce5cc812ea3d1dffbd1539aed653de4bf4882d60e6e04dcf0901d674e1" dependencies = [ - "opentelemetry_api", + "opentelemetry", "opentelemetry_sdk", "prost", "tonic", @@ -1333,47 +1339,30 @@ dependencies = [ [[package]] name = "opentelemetry-semantic-conventions" -version = "0.12.0" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73c9f9340ad135068800e7f1b24e9e09ed9e7143f5bf8518ded3d3ec69789269" +checksum = "f5774f1ef1f982ef2a447f6ee04ec383981a3ab99c8e77a1a7b30182e65bbc84" dependencies = [ "opentelemetry", ] -[[package]] -name = "opentelemetry_api" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a81f725323db1b1206ca3da8bb19874bbd3f57c3bcd59471bfb04525b265b9b" -dependencies = [ - "futures-channel", - "futures-util", - "indexmap 1.9.3", - "js-sys", - "once_cell", - "pin-project-lite", - "thiserror", - "urlencoding", -] - [[package]] name = "opentelemetry_sdk" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa8e705a0612d48139799fcbaba0d4a90f06277153e43dd2bdc16c6f0edd8026" +checksum = "a5b3ce3f5705e2ae493be467a0b23be4bc563c193cdb7713e55372c89a906b34" dependencies = [ "async-trait", "crossbeam-channel", "futures-channel", "futures-executor", "futures-util", + "glob", "once_cell", - "opentelemetry_api", + "opentelemetry", "ordered-float", "percent-encoding", "rand", - "regex", - "serde_json", "thiserror", "tokio", "tokio-stream", @@ -1381,9 +1370,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.9.2" +version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +checksum = "536900a8093134cf9ccf00a27deb3532421099e958d9dd431135d0c7543ca1e8" dependencies = [ "num-traits", ] @@ -1848,6 +1837,7 @@ dependencies = [ "openssl", "opentelemetry", "opentelemetry-otlp", + "opentelemetry_sdk", "proptest", "pulldown-cmark", "rand", @@ -2565,20 +2555,33 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + [[package]] name = "tracing-opentelemetry" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75327c6b667828ddc28f5e3f169036cb793c3f588d83bf0f262a7f062ffed3c8" +checksum = "c67ac25c5407e7b961fafc6f7e9aa5958fd297aada2d20fa2ae1737357e55596" dependencies = [ + "js-sys", "once_cell", "opentelemetry", "opentelemetry_sdk", "smallvec", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.2.0", "tracing-subscriber", + "web-time", ] [[package]] @@ -2596,7 +2599,7 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log", + "tracing-log 0.1.4", ] [[package]] @@ -2820,6 +2823,16 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "web-time" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index 1d9efce9a9..1609b80be4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ otel = [ "dep:tracing-opentelemetry", "dep:tracing-subscriber", "dep:opentelemetry", + "dep:opentelemetry_sdk", "dep:tokio", ] @@ -63,6 +64,7 @@ opener = "0.6.0" # allows controlling the vendoring status without exposing the presence of the download crate. openssl = { version = "0.10", optional = true } opentelemetry = { workspace = true, optional = true } +opentelemetry_sdk = { workspace = true, optional = true } opentelemetry-otlp = { workspace = true, optional = true } pulldown-cmark = { version = "0.9", default-features = false } rand = "0.8" @@ -157,8 +159,9 @@ derivative = "2.2.0" enum_dispatch = "0.3.11" fs_at = "0.1.6" once_cell = "1.18.0" -opentelemetry = { version = "0.20.0", features = ["rt-tokio"] } -opentelemetry-otlp = { version = "0.13.0" } +opentelemetry = { version = "0.21.0" } +opentelemetry_sdk = { version = "0.21.0", features = ["rt-tokio"] } +opentelemetry-otlp = { version = "0.14.0" } proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.8" @@ -166,7 +169,7 @@ termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-thread"] } tracing = "0.1" -tracing-opentelemetry = { version = "0.21.0" } +tracing-opentelemetry = { version = "0.22.0" } tracing-subscriber = "0.3.16" url = "2.4" walkdir = "2" diff --git a/src/bin/rustup-init.rs b/src/bin/rustup-init.rs index c5475e0171..bd39295f97 100644 --- a/src/bin/rustup-init.rs +++ b/src/bin/rustup-init.rs @@ -54,13 +54,13 @@ fn maybe_trace_rustup() -> Result { { use std::time::Duration; - use opentelemetry::sdk::{ + use opentelemetry::{global, KeyValue}; + use opentelemetry_otlp::WithExportConfig; + use opentelemetry_sdk::{ + propagation::TraceContextPropagator, trace::{self, Sampler}, Resource, }; - use opentelemetry::KeyValue; - use opentelemetry::{global, sdk::propagation::TraceContextPropagator}; - use opentelemetry_otlp::WithExportConfig; use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; // Background submission requires a runtime, and since we're probably @@ -84,7 +84,7 @@ fn maybe_trace_rustup() -> Result { "rustup", )])), ) - .install_batch(opentelemetry::runtime::Tokio)?; + .install_batch(opentelemetry_sdk::runtime::Tokio)?; let env_filter = EnvFilter::try_from_default_env().unwrap_or(EnvFilter::new("INFO")); let telemetry = tracing_opentelemetry::layer().with_tracer(tracer); let subscriber = Registry::default().with(env_filter).with(telemetry); diff --git a/src/test.rs b/src/test.rs index 638bd28554..1e9ed4ffd9 100644 --- a/src/test.rs +++ b/src/test.rs @@ -233,19 +233,16 @@ static TRACE_RUNTIME: Lazy = Lazy::new(|| tokio::runtime::Runtime::new().unwrap()); /// A tracer for the tests. #[cfg(feature = "otel")] -static TRACER: Lazy = Lazy::new(|| { +static TRACER: Lazy = Lazy::new(|| { use std::time::Duration; - use opentelemetry::KeyValue; - use opentelemetry::{ - global, - sdk::{ - propagation::TraceContextPropagator, - trace::{self, Sampler}, - Resource, - }, - }; + use opentelemetry::{global, KeyValue}; use opentelemetry_otlp::WithExportConfig; + use opentelemetry_sdk::{ + propagation::TraceContextPropagator, + trace::{self, Sampler}, + Resource, + }; use tokio::runtime::Handle; use tracing_subscriber::{layer::SubscriberExt, EnvFilter, Registry}; @@ -268,7 +265,7 @@ static TRACER: Lazy = Lazy::new(|| { .with_sampler(Sampler::AlwaysOn) .with_resource(Resource::new(vec![KeyValue::new("service.name", "rustup")])), ) - .install_batch(opentelemetry::runtime::Tokio) + .install_batch(opentelemetry_sdk::runtime::Tokio) .unwrap(); global::set_text_map_propagator(TraceContextPropagator::new()); From 8040fe8ddcf8b38e34517073a9985a2bddf86206 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 9 Nov 2023 00:33:33 +0800 Subject: [PATCH 139/229] Streamline dependencies in `Cargo.toml` --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 1609b80be4..f3a085d5d1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -159,9 +159,9 @@ derivative = "2.2.0" enum_dispatch = "0.3.11" fs_at = "0.1.6" once_cell = "1.18.0" -opentelemetry = { version = "0.21.0" } +opentelemetry = "0.21.0" opentelemetry_sdk = { version = "0.21.0", features = ["rt-tokio"] } -opentelemetry-otlp = { version = "0.14.0" } +opentelemetry-otlp = "0.14.0" proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.8" @@ -169,7 +169,7 @@ termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-thread"] } tracing = "0.1" -tracing-opentelemetry = { version = "0.22.0" } +tracing-opentelemetry = "0.22.0" tracing-subscriber = "0.3.16" url = "2.4" walkdir = "2" From 519381b19d7ab75ba160c68479e4dd4579fb51e1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 14 Nov 2023 03:56:36 +0000 Subject: [PATCH 140/229] Update Rust crate termcolor to 1.4 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ceb0a00b49..11bf90982b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2223,9 +2223,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" +checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" dependencies = [ "winapi-util", ] diff --git a/Cargo.toml b/Cargo.toml index f3a085d5d1..42bd5a180c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -165,7 +165,7 @@ opentelemetry-otlp = "0.14.0" proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.8" -termcolor = "1.2" +termcolor = "1.4" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-thread"] } tracing = "0.1" From 393e187b773b4b82bc71e244193b4a9d9d3aa38e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 15 Nov 2023 21:14:40 +0000 Subject: [PATCH 141/229] Update Rust crate windows-sys to 0.52.0 --- Cargo.lock | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++- Cargo.toml | 2 +- 2 files changed, 68 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 11bf90982b..7050b61b6f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1868,7 +1868,7 @@ dependencies = [ "wait-timeout", "walkdir", "winapi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", "winreg 0.51.0", "xz2", "zstd", @@ -2882,6 +2882,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-targets" version = "0.42.2" @@ -2912,6 +2921,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" @@ -2924,6 +2948,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.42.2" @@ -2936,6 +2966,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.42.2" @@ -2948,6 +2984,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.42.2" @@ -2960,6 +3002,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.42.2" @@ -2972,6 +3020,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" @@ -2984,6 +3038,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.42.2" @@ -2996,6 +3056,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "winnow" version = "0.5.19" diff --git a/Cargo.toml b/Cargo.toml index 42bd5a180c..f6817dbb2c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -137,7 +137,7 @@ features = [ "Win32_System_IO", "Win32_System_Ioctl", ] -version = "0.48.0" +version = "0.52.0" [dev-dependencies] enum-map = "2.5.0" From ec452c7d572f9a76b7b3ed96f81c752bc087f5c3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 00:05:48 +0000 Subject: [PATCH 142/229] Lock file maintenance --- Cargo.lock | 134 ++++++++++++++++++++++++++--------------------------- 1 file changed, 65 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7050b61b6f..b65da7478e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f658e2baef915ba0f26f1f7c42bfb8e12f532a01f449a090ded75ae7a07e9ba2" +checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" dependencies = [ "flate2", "futures-core", @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79ad7fb2dd38f3dabd76b09c6a5a20c038fc0213ef1e9afd30eb777f120f019" +checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" dependencies = [ "memchr", "regex-automata 0.4.3", @@ -286,18 +286,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" +checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.7" +version = "4.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" +checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" dependencies = [ "anstream", "anstyle", @@ -544,18 +544,18 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.7.0" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53337c2dbf26a3c31eccc73a37b10c1614e8d4ae99b6a50d553e8936423c1f16" +checksum = "09e6b4f374c071b18172e23134e01026653dc980636ee139e0dfe59c538c61e5" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.14.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04d0b288e3bb1d861c4403c1774a6f7a798781dfc519b3647df2a3dd4ae95f25" +checksum = "bfdb3d73d1beaf47c8593a1364e577fde072677cbfd103600345c0f547408cc0" dependencies = [ "proc-macro2", "quote", @@ -592,9 +592,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.5" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" dependencies = [ "libc", "windows-sys 0.48.0", @@ -756,9 +756,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" dependencies = [ "cfg-if 1.0.0", "libc", @@ -801,9 +801,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.21" +version = "0.3.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" dependencies = [ "bytes", "fnv", @@ -811,7 +811,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 1.9.3", + "indexmap 2.1.0", "slab", "tokio", "tokio-util", @@ -847,9 +847,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.9" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" +checksum = "8947b1a6fad4393052c7ba1f4cd97bed3e953a95c79c92ad9b051a04611d9fbb" dependencies = [ "bytes", "fnv", @@ -1059,9 +1059,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.10" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" +checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" [[package]] name = "log" @@ -1348,9 +1348,9 @@ dependencies = [ [[package]] name = "opentelemetry_sdk" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b3ce3f5705e2ae493be467a0b23be4bc563c193cdb7713e55372c89a906b34" +checksum = "968ba3f2ca03e90e5187f5e4f46c791ef7f2c163ae87789c8ce5f5ca3b7b7de5" dependencies = [ "async-trait", "crossbeam-channel", @@ -1460,9 +1460,9 @@ dependencies = [ [[package]] name = "proptest" -version = "1.3.1" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c003ac8c77cb07bb74f5f198bce836a689bcd5a42574612bf14d17bfd08c20e" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", @@ -1472,7 +1472,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.7.5", + "regex-syntax 0.8.2", "rusty-fork", "tempfile", "unarray", @@ -1642,12 +1642,6 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" -[[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" - [[package]] name = "regex-syntax" version = "0.8.2" @@ -1758,9 +1752,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" dependencies = [ "bitflags 2.4.1", "errno", @@ -1771,9 +1765,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.8" +version = "0.21.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" +checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" dependencies = [ "log", "ring", @@ -1795,9 +1789,9 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "1.0.3" +version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ "base64", ] @@ -1972,18 +1966,18 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.190" +version = "1.0.192" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", @@ -2065,9 +2059,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.1" +version = "1.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "942b4a808e05215192e39f4ab80813e599068285906cc91aa64f923db842bd5a" +checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "snapbox" @@ -2325,9 +2319,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" +checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" dependencies = [ "backtrace", "bytes", @@ -2352,9 +2346,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", @@ -2420,14 +2414,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ff9e3abce27ee2c9a37f9ad37238c1bdd4e789c84ba37df76aa4d528f5072cc" +checksum = "a1a195ec8c9da26928f773888e0742ca3ca1040c6cd859c919c9f59c1954ab35" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.21.0", ] [[package]] @@ -2452,6 +2446,19 @@ dependencies = [ "winnow", ] +[[package]] +name = "toml_edit" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +dependencies = [ + "indexmap 2.1.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow", +] + [[package]] name = "tonic" version = "0.9.2" @@ -2544,17 +2551,6 @@ dependencies = [ "valuable", ] -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - [[package]] name = "tracing-log" version = "0.2.0" @@ -2579,16 +2575,16 @@ dependencies = [ "smallvec", "tracing", "tracing-core", - "tracing-log 0.2.0", + "tracing-log", "tracing-subscriber", "web-time", ] [[package]] name = "tracing-subscriber" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" dependencies = [ "matchers", "nu-ansi-term", @@ -2599,7 +2595,7 @@ dependencies = [ "thread_local", "tracing", "tracing-core", - "tracing-log 0.1.4", + "tracing-log", ] [[package]] @@ -2621,7 +2617,7 @@ dependencies = [ "serde", "shlex", "snapbox", - "toml_edit", + "toml_edit 0.20.7", ] [[package]] From 79e88a2d422afb33acc247ff19c467667f458df7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 20 Nov 2023 00:04:50 +0000 Subject: [PATCH 143/229] Update Rust crate winreg to 0.52 --- Cargo.lock | 6 +++--- Cargo.toml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b65da7478e..e3a7143484 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1863,7 +1863,7 @@ dependencies = [ "walkdir", "winapi", "windows-sys 0.52.0", - "winreg 0.51.0", + "winreg 0.52.0", "xz2", "zstd", ] @@ -3079,9 +3079,9 @@ dependencies = [ [[package]] name = "winreg" -version = "0.51.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" dependencies = [ "cfg-if 1.0.0", "windows-sys 0.48.0", diff --git a/Cargo.toml b/Cargo.toml index f6817dbb2c..a0dc259a22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -97,7 +97,7 @@ zstd = "0.13" [target."cfg(windows)".dependencies] cc = "1" -winreg = "0.51" +winreg = "0.52" [target."cfg(windows)".dependencies.winapi] features = [ From a0b692cdde59db853ce5a2a398eae6e78f41ab34 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 22 Nov 2023 21:38:59 +0000 Subject: [PATCH 144/229] Update Rust crate url to 2.5 --- Cargo.lock | 16 ++++++++-------- Cargo.toml | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3a7143484..4aaa07baa4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -651,9 +651,9 @@ checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" [[package]] name = "form_urlencoded" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" dependencies = [ "percent-encoding", ] @@ -960,9 +960,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1395,9 +1395,9 @@ checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pin-project" @@ -2670,9 +2670,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" +checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" dependencies = [ "form_urlencoded", "idna", diff --git a/Cargo.toml b/Cargo.toml index a0dc259a22..9646fd0394 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -171,7 +171,7 @@ tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-th tracing = "0.1" tracing-opentelemetry = "0.22.0" tracing-subscriber = "0.3.16" -url = "2.4" +url = "2.5" walkdir = "2" [lib] From a602238b4bdebc557cc3998a77be19382dd0b87c Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Fri, 17 Nov 2023 11:51:09 +0800 Subject: [PATCH 145/229] CI: Disable openssl for loongarch64-unknown-linux-gnu --- ci/run.bash | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/ci/run.bash b/ci/run.bash index 670ebbc196..8c0a0951ae 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -8,10 +8,22 @@ rustc -vV cargo -vV -FEATURES=('--no-default-features' '--features' 'curl-backend,reqwest-backend,reqwest-default-tls') +FEATURES=('--no-default-features' '--features' 'reqwest-backend') case "$(uname -s)" in *NT* ) ;; # Windows NT - * ) FEATURES+=('--features' 'vendored-openssl') ;; + * ) + case "$TARGET" in + loongarch* ) ;; + *) FEATURES+=('--features' 'vendored-openssl') ;; + esac + ;; +esac + +case "$TARGET" in + # these platforms aren't supported by openssl: + loongarch* ) ;; + # default case, build with openssl enabled + * ) FEATURES+=('--features' 'curl-backend,reqwest-default-tls') ;; esac case "$TARGET" in @@ -20,7 +32,6 @@ case "$TARGET" in mips* ) ;; riscv* ) ;; s390x* ) ;; - loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) FEATURES+=('--features' 'reqwest-rustls-tls') ;; @@ -40,14 +51,21 @@ target_cargo() { target_cargo build download_pkg_test() { - features=('--no-default-features' '--features' 'curl-backend,reqwest-backend,reqwest-default-tls') + features=('--no-default-features' '--features' 'reqwest-backend') + + case "$TARGET" in + # these platforms aren't supported by openssl: + loongarch* ) ;; + # default case, build with openssl enabled + * ) features+=('--features' 'curl-backend,reqwest-default-tls') ;; + esac + case "$TARGET" in # these platforms aren't supported by ring: powerpc* ) ;; mips* ) ;; riscv* ) ;; s390x* ) ;; - loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) features+=('--features' 'reqwest-rustls-tls') ;; From e9de88557eddb727548a29111a3f09bdf88d6ee1 Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Thu, 23 Nov 2023 16:32:27 +0000 Subject: [PATCH 146/229] Remove rel paths from rust-toolchain.toml docs Remove a reference to relative paths from documentation for the toolchain settings file. Relative paths were removed recently for security reasons. --- doc/user-guide/src/overrides.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/user-guide/src/overrides.md b/doc/user-guide/src/overrides.md index 3115b96bfc..d3cfa56480 100644 --- a/doc/user-guide/src/overrides.md +++ b/doc/user-guide/src/overrides.md @@ -137,9 +137,8 @@ host-specific toolchains. #### path -The `path` setting allows a custom toolchain to be used. The value is a -path string. A relative path is resolved relative to the location of the -`rust-toolchain.toml` file. +The `path` setting allows a custom toolchain to be used. The value is an +absolute path string. Since a `path` directive directly names a local toolchain, other options like `components`, `targets`, and `profile` have no effect. From ab0f5bb78c60fa8d2e7a9e59ef0ac590a657f6cc Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Thu, 23 Nov 2023 16:34:22 +0000 Subject: [PATCH 147/229] Clarify several docs and help messages --- doc/user-guide/src/concepts/profiles.md | 13 ++++++++++--- src/cli/rustup_mode.rs | 6 +++--- .../suite/cli-ui/rustup/rustup_help_cmd_stdout.toml | 2 +- .../cli-ui/rustup/rustup_help_flag_stdout.toml | 2 +- .../cli-ui/rustup/rustup_only_options_stdout.toml | 2 +- .../rustup_override_cmd_help_flag_stdout.toml | 2 +- .../rustup/rustup_set_cmd_help_flag_stdout.toml | 2 +- ...rustup_set_cmd_profile_cmd_help_flag_stdout.toml | 2 +- .../rustup/rustup_show_cmd_help_flag_stdout.toml | 2 +- ...ustup_show_cmd_profile_cmd_help_flag_stdout.toml | 2 +- 10 files changed, 21 insertions(+), 14 deletions(-) diff --git a/doc/user-guide/src/concepts/profiles.md b/doc/user-guide/src/concepts/profiles.md index abb445991f..68b30287c7 100644 --- a/doc/user-guide/src/concepts/profiles.md +++ b/doc/user-guide/src/concepts/profiles.md @@ -20,15 +20,22 @@ available at this time are `minimal`, `default`, and `complete`: install the needed additional components manually, either by using `rustup component add` or by using `-c` when installing the toolchain. -To change the `rustup` profile you can use the `rustup set profile` command. +To change the profile `rustup install` uses by default, you can use the +`rustup set profile` command. For example, to select the minimal profile you can use: ```console rustup set profile minimal ``` -It's also possible to choose the profile when installing `rustup` for the -first time, either interactively by choosing the "Customize installation" +You can also directly select the profile used when installing a toolchain with: + +```console +rustup install --profile +``` + +It's also possible to choose the default profile when installing `rustup` for +the first time, either interactively by choosing the "Customize installation" option or programmatically by passing the `--profile=` flag. Profiles will only affect newly installed toolchains: as usual it will be possible to install individual components later with: `rustup component add`. diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 0be87295cb..ae472c7469 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -304,7 +304,7 @@ pub(crate) fn cli() -> Command { Command::new("home") .about("Display the computed value of RUSTUP_HOME"), ) - .subcommand(Command::new("profile").about("Show the current profile")) + .subcommand(Command::new("profile").about("Show the default profile used for the `rustup install` command")) ) .subcommand( Command::new("install") @@ -625,7 +625,7 @@ pub(crate) fn cli() -> Command { ) .subcommand( Command::new("override") - .about("Modify directory toolchain overrides") + .about("Modify toolchain overrides for directories") .after_help(OVERRIDE_HELP) .subcommand_required(true) .arg_required_else_help(true) @@ -784,7 +784,7 @@ pub(crate) fn cli() -> Command { ) .subcommand( Command::new("profile") - .about("The default components installed") + .about("The default components installed with a toolchain") .arg( Arg::new("profile-name") .required(true) diff --git a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml index 791eb0fcf3..eba5f967c7 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_cmd_stdout.toml @@ -16,7 +16,7 @@ Commands: toolchain Modify or query the installed toolchains target Modify a toolchain's supported targets component Modify a toolchain's installed components - override Modify directory toolchain overrides + override Modify toolchain overrides for directories run Run a command with an environment configured for a given toolchain which Display which binary will be run for a given command doc Open the documentation for the current toolchain diff --git a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml index b93ab136ec..d1b11958f9 100644 --- a/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_help_flag_stdout.toml @@ -16,7 +16,7 @@ Commands: toolchain Modify or query the installed toolchains target Modify a toolchain's supported targets component Modify a toolchain's installed components - override Modify directory toolchain overrides + override Modify toolchain overrides for directories run Run a command with an environment configured for a given toolchain which Display which binary will be run for a given command doc Open the documentation for the current toolchain diff --git a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml index 1b24ddd30a..6eacafa20d 100644 --- a/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_only_options_stdout.toml @@ -16,7 +16,7 @@ Commands: toolchain Modify or query the installed toolchains target Modify a toolchain's supported targets component Modify a toolchain's installed components - override Modify directory toolchain overrides + override Modify toolchain overrides for directories run Run a command with an environment configured for a given toolchain which Display which binary will be run for a given command doc Open the documentation for the current toolchain diff --git a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml index a9ae2a9f58..27bc0713a4 100644 --- a/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_override_cmd_help_flag_stdout.toml @@ -2,7 +2,7 @@ bin.name = "rustup" args = ["override","--help"] stdout = """ ... -Modify directory toolchain overrides +Modify toolchain overrides for directories Usage: rustup[EXE] override diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml index 04ce4aaa5a..3d5ffe91f5 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_help_flag_stdout.toml @@ -8,7 +8,7 @@ Usage: rustup[EXE] set Commands: default-host The triple used to identify toolchains when not specified - profile The default components installed + profile The default components installed with a toolchain auto-self-update The rustup auto self update mode help Print this message or the help of the given subcommand(s) diff --git a/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml index d92d750e17..9ef3527c4e 100644 --- a/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_set_cmd_profile_cmd_help_flag_stdout.toml @@ -2,7 +2,7 @@ bin.name = "rustup" args = ["set","profile","--help"] stdout = """ ... -The default components installed +The default components installed with a toolchain Usage: rustup[EXE] set profile diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml index b69b13990d..4291fc5a33 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_help_flag_stdout.toml @@ -9,7 +9,7 @@ Usage: rustup[EXE] show [OPTIONS] [COMMAND] Commands: active-toolchain Show the active toolchain home Display the computed value of RUSTUP_HOME - profile Show the current profile + profile Show the default profile used for the `rustup install` command help Print this message or the help of the given subcommand(s) Options: diff --git a/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml b/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml index af20a30cbc..b0449e2670 100644 --- a/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml +++ b/tests/suite/cli-ui/rustup/rustup_show_cmd_profile_cmd_help_flag_stdout.toml @@ -2,7 +2,7 @@ bin.name = "rustup" args = ["show","profile","--help"] stdout = """ ... -Show the current profile +Show the default profile used for the `rustup install` command Usage: rustup[EXE] show profile From c91ee064ab1ed72fac9055cee9fdac9e6b7aff6f Mon Sep 17 00:00:00 2001 From: Dezhi Wu Date: Sat, 25 Nov 2023 23:04:04 +0800 Subject: [PATCH 148/229] Upgrade hyper to 1.0 (#3543) --- Cargo.lock | 117 ++++++++++++++++++++++++++++------ download/Cargo.toml | 4 +- download/tests/support/mod.rs | 50 +++++++++------ 3 files changed, 131 insertions(+), 40 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4aaa07baa4..fdbdaf629a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -139,9 +139,9 @@ dependencies = [ "bitflags 1.3.2", "bytes", "futures-util", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.5", + "hyper 0.14.27", "itoa", "matchit", "memchr", @@ -165,8 +165,8 @@ dependencies = [ "async-trait", "bytes", "futures-util", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.5", "mime", "rustversion", "tower-layer", @@ -499,7 +499,9 @@ dependencies = [ "anyhow", "curl", "env_proxy", - "hyper", + "http-body-util", + "hyper 1.0.1", + "hyper-util", "once_cell", "reqwest", "tempfile", @@ -810,7 +812,7 @@ dependencies = [ "futures-core", "futures-sink", "futures-util", - "http", + "http 0.2.11", "indexmap 2.1.0", "slab", "tokio", @@ -856,6 +858,17 @@ dependencies = [ "itoa", ] +[[package]] +name = "http" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + [[package]] name = "http-body" version = "0.4.5" @@ -863,7 +876,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" dependencies = [ "bytes", - "http", + "http 0.2.11", + "pin-project-lite", +] + +[[package]] +name = "http-body" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +dependencies = [ + "bytes", + "http 1.0.0", +] + +[[package]] +name = "http-body-util" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +dependencies = [ + "bytes", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", "pin-project-lite", ] @@ -906,8 +942,8 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", + "http 0.2.11", + "http-body 0.4.5", "httparse", "httpdate", "itoa", @@ -919,6 +955,24 @@ dependencies = [ "want", ] +[[package]] +name = "hyper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "403f9214f3e703236b221f1a9cd88ec8b4adfa5296de01ab96216361f4692f56" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "tokio", +] + [[package]] name = "hyper-rustls" version = "0.24.2" @@ -926,8 +980,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", - "http", - "hyper", + "http 0.2.11", + "hyper 0.14.27", "rustls", "tokio", "tokio-rustls", @@ -939,7 +993,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper", + "hyper 0.14.27", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -952,12 +1006,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper", + "hyper 0.14.27", "native-tls", "tokio", "tokio-native-tls", ] +[[package]] +name = "hyper-util" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ca339002caeb0d159cc6e023dff48e199f081e42fa039895c7c6f38b37f2e9d" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http 1.0.0", + "http-body 1.0.0", + "hyper 1.0.1", + "pin-project-lite", + "socket2 0.5.5", + "tokio", + "tower", + "tower-service", + "tracing", +] + [[package]] name = "idna" version = "0.5.0" @@ -1314,7 +1388,7 @@ checksum = "f24cda83b20ed2433c68241f918d0f6fdec8b1d43b7a9590ab4420c5095ca930" dependencies = [ "async-trait", "futures-core", - "http", + "http 0.2.11", "opentelemetry", "opentelemetry-proto", "opentelemetry-semantic-conventions", @@ -1678,9 +1752,9 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-rustls", "hyper-tls", "ipnet", @@ -2472,9 +2546,9 @@ dependencies = [ "futures-core", "futures-util", "h2", - "http", - "http-body", - "hyper", + "http 0.2.11", + "http-body 0.4.5", + "hyper 0.14.27", "hyper-timeout", "percent-encoding", "pin-project", @@ -2525,6 +2599,7 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ + "log", "pin-project-lite", "tracing-attributes", "tracing-core", diff --git a/download/Cargo.toml b/download/Cargo.toml index b0c2ea0c8d..45d5d0dbce 100644 --- a/download/Cargo.toml +++ b/download/Cargo.toml @@ -23,6 +23,8 @@ thiserror.workspace = true url.workspace = true [dev-dependencies] -hyper = { version = "0.14", default-features = false, features = ["tcp", "server"] } +http-body-util = "0.1.0" +hyper = { version = "1.0", default-features = false, features = ["server", "http1"] } +hyper-util = { version = "0.1.1", features = ["tokio"] } tempfile.workspace = true tokio = { workspace = true, default-features = false, features = ["sync"] } diff --git a/download/tests/support/mod.rs b/download/tests/support/mod.rs index 58951a5d87..d4e826f617 100644 --- a/download/tests/support/mod.rs +++ b/download/tests/support/mod.rs @@ -6,9 +6,11 @@ use std::path::Path; use std::sync::mpsc::{channel, Sender}; use std::thread; -use hyper::server::conn::AddrStream; -use hyper::service::{make_service_fn, service_fn}; -use hyper::{Body, Request}; +use http_body_util::Full; +use hyper::body::Bytes; +use hyper::server::conn::http1; +use hyper::service::service_fn; +use hyper::Request; use tempfile::TempDir; pub fn tmp_dir() -> TempDir { @@ -31,26 +33,38 @@ pub fn write_file(path: &Path, contents: &str) { file.sync_data().expect("writing test data"); } +// A dead simple hyper server implementation. +// For more info, see: +// https://hyper.rs/guides/1/server/hello-world/ async fn run_server(addr_tx: Sender, addr: SocketAddr, contents: Vec) { - let make_svc = make_service_fn(|_: &AddrStream| { + let svc = service_fn(move |req: Request| { let contents = contents.clone(); async move { - Ok::<_, Infallible>(service_fn(move |req: Request| { - let contents = contents.clone(); - async move { - let res = serve_contents(req, contents); - Ok::<_, Infallible>(res) - } - })) + let res = serve_contents(req, contents); + Ok::<_, Infallible>(res) } }); - let server = hyper::server::Server::bind(&addr).serve(make_svc); - let addr = server.local_addr(); + let listener = tokio::net::TcpListener::bind(&addr) + .await + .expect("can not bind"); + + let addr = listener.local_addr().unwrap(); addr_tx.send(addr).unwrap(); - if let Err(e) = server.await { - eprintln!("server error: {e}"); + loop { + let (stream, _) = listener + .accept() + .await + .expect("could not accept connection"); + let io = hyper_util::rt::TokioIo::new(stream); + + let svc = svc.clone(); + tokio::spawn(async move { + if let Err(err) = http1::Builder::new().serve_connection(io, svc).await { + eprintln!("failed to serve connection: {:?}", err); + } + }); } } @@ -69,9 +83,9 @@ pub fn serve_file(contents: Vec) -> SocketAddr { } fn serve_contents( - req: hyper::Request, + req: hyper::Request, contents: Vec, -) -> hyper::Response { +) -> hyper::Response> { let mut range_header = None; let (status, body) = if let Some(range) = req.headers().get(hyper::header::RANGE) { // extract range "bytes={start}-" @@ -95,7 +109,7 @@ fn serve_contents( let mut res = hyper::Response::builder() .status(status) .header(hyper::header::CONTENT_LENGTH, body.len()) - .body(hyper::Body::from(body)) + .body(Full::new(Bytes::from(body))) .unwrap(); if let Some(range) = range_header { res.headers_mut() From 94d41c6f692ec403a7f01481c2b0e1901566eb03 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 27 Nov 2023 01:44:11 +0000 Subject: [PATCH 149/229] Lock file maintenance --- Cargo.lock | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fdbdaf629a..9c5bf39899 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -546,18 +546,18 @@ dependencies = [ [[package]] name = "enum-map" -version = "2.7.2" +version = "2.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09e6b4f374c071b18172e23134e01026653dc980636ee139e0dfe59c538c61e5" +checksum = "6866f3bfdf8207509a033af1a75a7b08abda06bbaaeae6669323fd5a097df2e9" dependencies = [ "enum-map-derive", ] [[package]] name = "enum-map-derive" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfdb3d73d1beaf47c8593a1364e577fde072677cbfd103600345c0f547408cc0" +checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", @@ -769,9 +769,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "git-testament" @@ -828,9 +828,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hermit-abi" @@ -1059,7 +1059,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", ] [[package]] @@ -1312,9 +1312,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.59" +version = "0.10.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" +checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -1353,9 +1353,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.95" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ "cc", "libc", @@ -1525,9 +1525,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" dependencies = [ "unicode-ident", ] @@ -2040,18 +2040,18 @@ checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.193" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", From d0ec36b3854f0f53c2f35f9ef8c3bb9a27fec78b Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Fri, 1 Dec 2023 09:03:33 +0000 Subject: [PATCH 150/229] Fix panic in `component list --toolchain stable` Fixes a panic caused by the signature of the parser passed to Claps's `Arg.value_parser()` having PartialToolchainDesc, not matching `ArgMatches.get_one::()` in `explicit_or_dir_toolchain()` Also, rename `explicit_or_dir_toolchain()` -> `explicit_desc_or_dir_toolchain()` and consolidate its use across various CLI subcommands. Also fixes a similar panic in `rustup man --toolchain stable` --- src/cli/rustup_mode.rs | 45 ++++++++++++++++-------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index ae472c7469..8281e77ebe 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -596,7 +596,7 @@ pub(crate) fn cli() -> Command { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") .num_args(1) - .value_parser( partial_toolchain_desc_parser), + .value_parser(partial_toolchain_desc_parser), ) .arg( Arg::new("target") @@ -614,7 +614,7 @@ pub(crate) fn cli() -> Command { .help(OFFICIAL_TOOLCHAIN_ARG_HELP) .long("toolchain") .num_args(1) - .value_parser( partial_toolchain_desc_parser), + .value_parser(partial_toolchain_desc_parser), ) .arg( Arg::new("target") @@ -1263,10 +1263,7 @@ fn show_rustup_home(cfg: &Cfg) -> Result { } fn target_list(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m - .get_one::("toolchain") - .map(Into::into); - let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; // downcasting required because the toolchain files can name any toolchain let distributable = (&toolchain).try_into()?; @@ -1278,10 +1275,7 @@ fn target_list(cfg: &Cfg, m: &ArgMatches) -> Result { } fn target_add(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain_name = m - .get_one::("toolchain") - .map(Into::into); - let toolchain = explicit_or_dir_toolchain2(cfg, toolchain_name)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; // XXX: long term move this error to cli ? the normal .into doesn't work // because Result here is the wrong sort and expression type ascription // isn't a feature yet. @@ -1336,10 +1330,7 @@ fn target_add(cfg: &Cfg, m: &ArgMatches) -> Result { } fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m - .get_one::("toolchain") - .map(Into::into); - let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; let distributable = DistributableToolchain::try_from(&toolchain)?; for target in m.get_many::("target").unwrap() { @@ -1355,7 +1346,7 @@ fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { } fn component_list(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; // downcasting required because the toolchain files can name any toolchain let distributable = (&toolchain).try_into()?; @@ -1368,10 +1359,7 @@ fn component_list(cfg: &Cfg, m: &ArgMatches) -> Result { } fn component_add(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m - .get_one::("toolchain") - .map(Into::into); - let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; let distributable = DistributableToolchain::try_from(&toolchain)?; let target = get_target(m, &distributable); @@ -1392,7 +1380,7 @@ fn get_target(m: &ArgMatches, distributable: &DistributableToolchain<'_>) -> Opt } fn component_remove(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; let distributable = DistributableToolchain::try_from(&toolchain)?; let target = get_target(m, &distributable); @@ -1405,9 +1393,13 @@ fn component_remove(cfg: &Cfg, m: &ArgMatches) -> Result { Ok(utils::ExitCode(0)) } -fn explicit_or_dir_toolchain<'a>(cfg: &'a Cfg, m: &ArgMatches) -> Result> { - let toolchain = m.get_one::("toolchain"); - explicit_or_dir_toolchain2(cfg, toolchain.cloned()) +// Make *sure* only to use this for a subcommand whose "toolchain" argument +// has .value_parser(partial_toolchain_desc_parser), or it will panic. +fn explicit_desc_or_dir_toolchain<'a>(cfg: &'a Cfg, m: &ArgMatches) -> Result> { + let toolchain = m + .get_one::("toolchain") + .map(Into::into); + explicit_or_dir_toolchain2(cfg, toolchain) } fn explicit_or_dir_toolchain2( @@ -1556,10 +1548,7 @@ const DOCS_DATA: &[(&str, &str, &str)] = &[ ]; fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { - let toolchain = m - .get_one::("toolchain") - .map(Into::into); - let toolchain = explicit_or_dir_toolchain2(cfg, toolchain)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; if let Ok(distributable) = DistributableToolchain::try_from(&toolchain) { let manifestation = distributable.get_manifestation()?; @@ -1613,7 +1602,7 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { fn man(cfg: &Cfg, m: &ArgMatches) -> Result { let command = m.get_one::("command").unwrap(); - let toolchain = explicit_or_dir_toolchain(cfg, m)?; + let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; let mut path = toolchain.path().to_path_buf(); path.push("share"); path.push("man"); From 85788ceaf62aa3646351af60445587a9ea6c2e09 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 4 Dec 2023 00:40:11 +0000 Subject: [PATCH 151/229] Lock file maintenance --- Cargo.lock | 72 +++++++++++++++++++++++++++--------------------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c5bf39899..9b558e2ac6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,18 +286,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.8" +version = "4.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" +checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.8" +version = "4.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" +checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" dependencies = [ "anstream", "anstyle", @@ -338,9 +338,9 @@ dependencies = [ [[package]] name = "core-foundation" -version = "0.9.3" +version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" dependencies = [ "core-foundation-sys", "libc", @@ -348,9 +348,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" @@ -464,9 +464,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" dependencies = [ "powerfmt", ] @@ -594,12 +594,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f258a7194e7f7c2a7837a8913aeab7fd8c383457034fa20ce4dd3dcb813e8eb8" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1094,9 +1094,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] @@ -1133,9 +1133,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" [[package]] name = "log" @@ -1796,9 +1796,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.5" +version = "0.17.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" dependencies = [ "cc", "getrandom", @@ -1826,15 +1826,15 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.25" +version = "0.38.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc99bc2d4f1fed22595588a013687477aedf3cdcfb26558c559edb67b4d9b22e" +checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" dependencies = [ "bitflags 2.4.1", "errno", "libc", "linux-raw-sys", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2820,9 +2820,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2830,9 +2830,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", @@ -2845,9 +2845,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -2857,9 +2857,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2867,9 +2867,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", @@ -2880,15 +2880,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", From 25da604ae5d8a77253d713c88f587e633d658339 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 7 Dec 2023 18:48:40 +0800 Subject: [PATCH 152/229] chore(renovate): prevent unnecessary `Cargo.toml` bumps --- .github/renovate.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index c309fbb86d..1f15c94ff9 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -11,7 +11,7 @@ "automerge": true }, "prCreation": "not-pending", - "rangeStrategy": "replace", + "rangeStrategy": "update-lockfile", "stabilityDays": 3, "github-actions": { "fileMatch": [ From 7a5f47b2d49b4afc3e35f8287defbed05bcc2d9c Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 7 Dec 2023 18:50:10 +0800 Subject: [PATCH 153/229] chore(deps): revert `Cargo.toml` bump in #3532 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9646fd0394..866d7065e9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -165,7 +165,7 @@ opentelemetry-otlp = "0.14.0" proptest = "1.1.0" rustup-macros = { path = "rustup-macros" } tempfile = "3.8" -termcolor = "1.4" +termcolor = "1.2" thiserror = "1.0" tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-thread"] } tracing = "0.1" From 38ddd53d4a518f659a0a9349ebc2da15187669d5 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 7 Dec 2023 18:50:17 +0800 Subject: [PATCH 154/229] chore(deps): revert `Cargo.toml` bump in #3540 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 866d7065e9..2a84c608d2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -171,7 +171,7 @@ tokio = { version = "1.26.0", default-features = false, features = ["rt-multi-th tracing = "0.1" tracing-opentelemetry = "0.22.0" tracing-subscriber = "0.3.16" -url = "2.5" +url = "2.4" walkdir = "2" [lib] From 3a513bae6ed6821ac88264f32a7cce39e98e4021 Mon Sep 17 00:00:00 2001 From: Matt Harding Date: Tue, 5 Dec 2023 19:18:28 +0000 Subject: [PATCH 155/229] Fix test permanently adding to PATH --- tests/suite/cli_inst_interactive.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/suite/cli_inst_interactive.rs b/tests/suite/cli_inst_interactive.rs index 61382a6b7e..0a0bd5a26f 100644 --- a/tests/suite/cli_inst_interactive.rs +++ b/tests/suite/cli_inst_interactive.rs @@ -131,7 +131,11 @@ fn blank_lines_around_stderr_log_output_update() { config.expect_ok(&["rustup-init", "-y", "--no-modify-path"]); let out = run_input( config, - &["rustup-init", "--no-update-default-toolchain"], + &[ + "rustup-init", + "--no-update-default-toolchain", + "--no-modify-path", + ], "\n\n", ); println!("-- stdout --\n {}", out.stdout); From 58ddd3451c2f73dbecc633aca739d24b58b49a27 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:20:23 +0000 Subject: [PATCH 156/229] fix(deps): update rust crate openssl to v0.10.61 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b558e2ac6..e60ced061a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1312,9 +1312,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.60" +version = "0.10.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" +checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -1353,9 +1353,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.96" +version = "0.9.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" +checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" dependencies = [ "cc", "libc", From d3113a395b8f1aa85165cce4b7df811d5c726962 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:57:33 +0000 Subject: [PATCH 157/229] fix(deps): update rust crate clap to v4.4.11 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e60ced061a..ecec1eaf4b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,18 +286,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.10" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fffed7514f420abec6d183b1d3acfd9099c79c3a10a06ade4f8203f1411272" +checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.9" +version = "4.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63361bae7eef3771745f02d8d892bec2fee5f6e34af316ba556e7f97a7069ff1" +checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" dependencies = [ "anstream", "anstyle", From b430816406df4695405344c148c1391b8f66ec1f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:48:56 +0000 Subject: [PATCH 158/229] chore(deps): update rust crate once_cell to v1.19.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ecec1eaf4b..f0139c5883 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1295,9 +1295,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opener" From 04e135ccc9bda76f5d0a45a058a63ba098314bf3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 10 Dec 2023 17:00:21 +0000 Subject: [PATCH 159/229] fix(deps): update rust crate libc to v0.2.151 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0139c5883..82b21290c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1109,9 +1109,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.151" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" [[package]] name = "libm" From 3f89ba1de5257bc3463b842fe360001ee50bf43c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 03:40:11 +0000 Subject: [PATCH 160/229] fix(deps): update rust crate syn to v2.0.40 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 82b21290c8..d6e923cb9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -561,7 +561,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -573,7 +573,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -714,7 +714,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -791,7 +791,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", "time", ] @@ -1333,7 +1333,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -1490,7 +1490,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -1948,7 +1948,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -2055,7 +2055,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -2219,9 +2219,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "13fa70a4ee923979ffb522cacce59d34421ebdea5625e1073c4326ef9d2dd42e" dependencies = [ "proc-macro2", "quote", @@ -2325,7 +2325,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -2426,7 +2426,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -2613,7 +2613,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", ] [[package]] @@ -2839,7 +2839,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", "wasm-bindgen-shared", ] @@ -2873,7 +2873,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.40", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From 6f34807b14a811f2673d4bc639abcff58e40e0e4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 08:19:29 +0000 Subject: [PATCH 161/229] chore(deps): lock file maintenance --- Cargo.lock | 117 +++++++++++++++++++++++++---------------------------- 1 file changed, 55 insertions(+), 62 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d6e923cb9c..783c881aa3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" dependencies = [ "anstyle", "anstyle-parse", @@ -57,30 +57,30 @@ checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -140,7 +140,7 @@ dependencies = [ "bytes", "futures-util", "http 0.2.11", - "http-body 0.4.5", + "http-body 0.4.6", "hyper 0.14.27", "itoa", "matchit", @@ -166,7 +166,7 @@ dependencies = [ "bytes", "futures-util", "http 0.2.11", - "http-body 0.4.5", + "http-body 0.4.6", "mime", "rustversion", "tower-layer", @@ -440,9 +440,9 @@ dependencies = [ [[package]] name = "curl-sys" -version = "0.4.68+curl-8.4.0" +version = "0.4.70+curl-8.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a0d18d88360e374b16b2273c832b5e57258ffc1d4aa4f96b108e0738d5752f" +checksum = "3c0333d8849afe78a4c8102a429a446bfdd055832af071945520e835ae2d841e" dependencies = [ "cc", "libc", @@ -610,14 +610,14 @@ checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.3.5", - "windows-sys 0.48.0", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] @@ -871,9 +871,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http 0.2.11", @@ -943,7 +943,7 @@ dependencies = [ "futures-util", "h2", "http 0.2.11", - "http-body 0.4.5", + "http-body 0.4.6", "httparse", "httpdate", "itoa", @@ -1079,9 +1079,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "jobserver" @@ -1201,9 +1201,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi", @@ -1344,9 +1344,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.1.6+3.1.4" +version = "300.2.0+3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439fac53e092cd7442a3660c85dde4643ab3b5bd39040912388dcdabf6b88085" +checksum = "b1ebed1d188c4cd64c2bcd73d6c1fe1092f3d98c111831923cc1b706c3859fca" dependencies = [ "cc", ] @@ -1444,9 +1444,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "4.1.1" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536900a8093134cf9ccf00a27deb3532421099e958d9dd431135d0c7543ca1e8" +checksum = "a76df7075c7d4d01fdcb46c912dd17fba5b60c78ea480b475f2b6ab6f666584e" dependencies = [ "num-traits", ] @@ -1660,15 +1660,6 @@ dependencies = [ "crossbeam-utils", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -1753,7 +1744,7 @@ dependencies = [ "futures-util", "h2", "http 0.2.11", - "http-body 0.4.5", + "http-body 0.4.6", "hyper 0.14.27", "hyper-rustls", "hyper-tls", @@ -1796,9 +1787,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.6" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "684d5e6e18f669ccebf64a92236bb7db9a34f07be010e3627368182027180866" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", @@ -1826,9 +1817,9 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.26" +version = "0.38.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" dependencies = [ "bitflags 2.4.1", "errno", @@ -1839,9 +1830,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.9" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "629648aced5775d558af50b2b4c7b02983a04b312126d45eeead26e7caa498b9" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", "ring", @@ -1971,9 +1962,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "same-file" @@ -2139,9 +2130,9 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "snapbox" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b377c0b6e4715c116473d8e40d51e3fa5b0a2297ca9b2a931ba800667b259ed" +checksum = "c4f1976ee8fd1be27d5f72c98be0aac4397a882a4736935d47418a5fbbd12042" dependencies = [ "anstream", "anstyle", @@ -2156,7 +2147,7 @@ dependencies = [ "tempfile", "wait-timeout", "walkdir", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2284,7 +2275,7 @@ checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if 1.0.0", "fastrand", - "redox_syscall 0.4.1", + "redox_syscall", "rustix", "windows-sys 0.48.0", ] @@ -2393,9 +2384,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.34.0" +version = "1.35.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" dependencies = [ "backtrace", "bytes", @@ -2547,7 +2538,7 @@ dependencies = [ "futures-util", "h2", "http 0.2.11", - "http-body 0.4.5", + "http-body 0.4.6", "hyper 0.14.27", "hyper-timeout", "percent-encoding", @@ -2675,9 +2666,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trycmd" @@ -2718,9 +2709,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -3135,9 +3126,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.19" +version = "0.5.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" +checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" dependencies = [ "memchr", ] @@ -3164,11 +3155,13 @@ dependencies = [ [[package]] name = "xattr" -version = "1.0.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +checksum = "d367426ae76bdfce3d8eaea6e94422afd6def7d46f9c89e2980309115b3c2c41" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] [[package]] From 29eeae464244411dc340ff2e39083143818374c7 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 13 Dec 2023 01:13:15 +0000 Subject: [PATCH 162/229] fix(deps): update rust crate syn to v2.0.41 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 783c881aa3..1960fe34ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -561,7 +561,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -573,7 +573,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -714,7 +714,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -791,7 +791,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", "time", ] @@ -1333,7 +1333,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -1490,7 +1490,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -1939,7 +1939,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -2046,7 +2046,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -2210,9 +2210,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.40" +version = "2.0.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13fa70a4ee923979ffb522cacce59d34421ebdea5625e1073c4326ef9d2dd42e" +checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" dependencies = [ "proc-macro2", "quote", @@ -2316,7 +2316,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -2417,7 +2417,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -2604,7 +2604,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", ] [[package]] @@ -2830,7 +2830,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", "wasm-bindgen-shared", ] @@ -2864,7 +2864,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.40", + "syn 2.0.41", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From c91f0ee6897d53520b2a293cda2199b47d307afc Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Tue, 12 Dec 2023 10:42:28 +0800 Subject: [PATCH 163/229] fix(deps): update rust crate openssl-src to v300.2.1+3.2.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1960fe34ee..6142442752 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1344,9 +1344,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.2.0+3.2.0" +version = "300.2.1+3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1ebed1d188c4cd64c2bcd73d6c1fe1092f3d98c111831923cc1b706c3859fca" +checksum = "3fe476c29791a5ca0d1273c697e96085bbabbbea2ef7afd5617e78a4b40332d3" dependencies = [ "cc", ] From 87afd6029ab849a24d0a2f588edf40b3977be571 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Tue, 12 Dec 2023 10:38:52 +0800 Subject: [PATCH 164/229] CI: Revert "Disable openssl for loongarch64-unknown-linux-gnu" This reverts commit a602238b4bdebc557cc3998a77be19382dd0b87c. --- ci/run.bash | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/ci/run.bash b/ci/run.bash index 8c0a0951ae..670ebbc196 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -8,22 +8,10 @@ rustc -vV cargo -vV -FEATURES=('--no-default-features' '--features' 'reqwest-backend') +FEATURES=('--no-default-features' '--features' 'curl-backend,reqwest-backend,reqwest-default-tls') case "$(uname -s)" in *NT* ) ;; # Windows NT - * ) - case "$TARGET" in - loongarch* ) ;; - *) FEATURES+=('--features' 'vendored-openssl') ;; - esac - ;; -esac - -case "$TARGET" in - # these platforms aren't supported by openssl: - loongarch* ) ;; - # default case, build with openssl enabled - * ) FEATURES+=('--features' 'curl-backend,reqwest-default-tls') ;; + * ) FEATURES+=('--features' 'vendored-openssl') ;; esac case "$TARGET" in @@ -32,6 +20,7 @@ case "$TARGET" in mips* ) ;; riscv* ) ;; s390x* ) ;; + loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) FEATURES+=('--features' 'reqwest-rustls-tls') ;; @@ -51,21 +40,14 @@ target_cargo() { target_cargo build download_pkg_test() { - features=('--no-default-features' '--features' 'reqwest-backend') - - case "$TARGET" in - # these platforms aren't supported by openssl: - loongarch* ) ;; - # default case, build with openssl enabled - * ) features+=('--features' 'curl-backend,reqwest-default-tls') ;; - esac - + features=('--no-default-features' '--features' 'curl-backend,reqwest-backend,reqwest-default-tls') case "$TARGET" in # these platforms aren't supported by ring: powerpc* ) ;; mips* ) ;; riscv* ) ;; s390x* ) ;; + loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) features+=('--features' 'reqwest-rustls-tls') ;; From 6115956bafb0ae1e27385f0acad928aa15167f39 Mon Sep 17 00:00:00 2001 From: WANG Rui Date: Tue, 12 Dec 2023 10:43:39 +0800 Subject: [PATCH 165/229] CI: Enable rustls on loongarch64 --- ci/run.bash | 2 -- 1 file changed, 2 deletions(-) diff --git a/ci/run.bash b/ci/run.bash index 670ebbc196..4e4dd0cef3 100644 --- a/ci/run.bash +++ b/ci/run.bash @@ -20,7 +20,6 @@ case "$TARGET" in mips* ) ;; riscv* ) ;; s390x* ) ;; - loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) FEATURES+=('--features' 'reqwest-rustls-tls') ;; @@ -47,7 +46,6 @@ download_pkg_test() { mips* ) ;; riscv* ) ;; s390x* ) ;; - loongarch* ) ;; aarch64-pc-windows-msvc ) ;; # default case, build with rustls enabled * ) features+=('--features' 'reqwest-rustls-tls') ;; From 631f03a1f329957bbb028c52c77fe70a33100f1a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 00:18:45 +0000 Subject: [PATCH 166/229] chore(deps): lock file maintenance --- Cargo.lock | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6142442752..2ab2eeb186 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -372,9 +372,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.8" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" +checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" dependencies = [ "cfg-if 1.0.0", "crossbeam-utils", @@ -382,9 +382,9 @@ dependencies = [ [[package]] name = "crossbeam-deque" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" dependencies = [ "cfg-if 1.0.0", "crossbeam-epoch", @@ -393,22 +393,21 @@ dependencies = [ [[package]] name = "crossbeam-epoch" -version = "0.9.15" +version = "0.9.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", "memoffset", - "scopeguard", ] [[package]] name = "crossbeam-utils" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" +checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" dependencies = [ "cfg-if 1.0.0", ] @@ -840,11 +839,11 @@ checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2301,18 +2300,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.51" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", @@ -3126,9 +3125,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.26" +version = "0.5.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" +checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" dependencies = [ "memchr", ] @@ -3155,9 +3154,9 @@ dependencies = [ [[package]] name = "xattr" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d367426ae76bdfce3d8eaea6e94422afd6def7d46f9c89e2980309115b3c2c41" +checksum = "a7dae5072fe1f8db8f8d29059189ac175196e410e40ba42d5d4684ae2f750995" dependencies = [ "libc", "linux-raw-sys", From 3509215d59a5a7a34963b6f662cc84a2f63584e7 Mon Sep 17 00:00:00 2001 From: Eric Swanson <64809312+ericswanson-dfinity@users.noreply.github.com> Date: Sun, 17 Dec 2023 19:30:01 -0800 Subject: [PATCH 167/229] Fix rustup-init failure to read ZDOTDIR from zsh when SHELL is not zsh (#3584) --- src/cli/self_update/shell.rs | 2 +- tests/suite/cli_paths.rs | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/cli/self_update/shell.rs b/src/cli/self_update/shell.rs index fdd220e235..f6bc1a802c 100644 --- a/src/cli/self_update/shell.rs +++ b/src/cli/self_update/shell.rs @@ -166,7 +166,7 @@ impl Zsh { } } else { match std::process::Command::new("zsh") - .args(["-c", "'echo $ZDOTDIR'"]) + .args(["-c", "echo -n $ZDOTDIR"]) .output() { Ok(io) if !io.stdout.is_empty() => Ok(PathBuf::from(OsStr::from_bytes(&io.stdout))), diff --git a/tests/suite/cli_paths.rs b/tests/suite/cli_paths.rs index f6078b7578..9882ca662a 100644 --- a/tests/suite/cli_paths.rs +++ b/tests/suite/cli_paths.rs @@ -144,6 +144,45 @@ export PATH="$HOME/apple/bin" }); } + #[test] + fn install_with_zdotdir_from_calling_zsh() { + // This test requires that zsh is callable. + if std::process::Command::new("zsh") + .arg("-c") + .arg("true") + .status() + .is_err() + { + return; + } + clitools::test(Scenario::Empty, &|config| { + let zdotdir = tempfile::Builder::new() + .prefix("zdotdir") + .tempdir() + .unwrap(); + let rc = zdotdir.path().join(".zshenv"); + raw::write_file(&rc, FAKE_RC).unwrap(); + + // If $SHELL doesn't include "zsh", Zsh::zdotdir() will call zsh to obtain $ZDOTDIR. + // ZDOTDIR could be set directly in the environment, but having ~/.zshenv set + // ZDOTDIR is a normal setup, and ensures that the value came from calling zsh. + let home_zshenv = config.homedir.join(".zshenv"); + let export_zdotdir = format!( + "export ZDOTDIR=\"{}\"\n", + zdotdir.path().as_os_str().to_str().unwrap() + ); + raw::write_file(&home_zshenv, &export_zdotdir).unwrap(); + + let mut cmd = clitools::cmd(config, "rustup-init", &INIT_NONE[1..]); + cmd.env("SHELL", "/bin/sh"); + assert!(cmd.output().unwrap().status.success()); + + let new_rc = fs::read_to_string(&rc).unwrap(); + let expected = FAKE_RC.to_owned() + &source(config.cargodir.display(), POSIX_SH); + assert_eq!(new_rc, expected); + }); + } + #[test] fn install_adds_path_to_rc_just_once() { clitools::test(Scenario::Empty, &|config| { From 38d9df16fc7edc38bba9949588ac1b2c1e3c6ac8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 03:30:26 +0000 Subject: [PATCH 168/229] chore(deps): update actions/upload-artifact action to v4 --- .github/workflows/linux-builds-on-master.yaml | 2 +- .github/workflows/linux-builds-on-pr.yaml | 2 +- .github/workflows/linux-builds-on-stable.yaml | 2 +- .github/workflows/macos-builds-on-all.yaml | 2 +- .github/workflows/windows-builds-on-master.yaml | 2 +- .github/workflows/windows-builds-on-pr.yaml | 2 +- .github/workflows/windows-builds-on-stable.yaml | 2 +- ci/actions-templates/linux-builds-template.yaml | 2 +- ci/actions-templates/macos-builds-template.yaml | 2 +- ci/actions-templates/windows-builds-template.yaml | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml index e30a03a75a..3a53089a1a 100644 --- a/.github/workflows/linux-builds-on-master.yaml +++ b/.github/workflows/linux-builds-on-master.yaml @@ -129,7 +129,7 @@ jobs: "${DOCKER}" \ -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - name: Upload the built artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: matrix.mode == 'release' with: name: rustup-init-${{ matrix.target }} diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml index a8549040e4..e6ffd388c6 100644 --- a/.github/workflows/linux-builds-on-pr.yaml +++ b/.github/workflows/linux-builds-on-pr.yaml @@ -123,7 +123,7 @@ jobs: "${DOCKER}" \ -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - name: Upload the built artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: matrix.mode == 'release' with: name: rustup-init-${{ matrix.target }} diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml index 36f31944ce..1cac2fe5ee 100644 --- a/.github/workflows/linux-builds-on-stable.yaml +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -153,7 +153,7 @@ jobs: "${DOCKER}" \ -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - name: Upload the built artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: matrix.mode == 'release' with: name: rustup-init-${{ matrix.target }} diff --git a/.github/workflows/macos-builds-on-all.yaml b/.github/workflows/macos-builds-on-all.yaml index 7dd3381d70..95088e0ba0 100644 --- a/.github/workflows/macos-builds-on-all.yaml +++ b/.github/workflows/macos-builds-on-all.yaml @@ -104,7 +104,7 @@ jobs: fi - name: Upload the built artifact if: matrix.mode == 'release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rustup-init-${{ matrix.target }} path: | diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml index 105d1b7ef0..877a3c0f5c 100644 --- a/.github/workflows/windows-builds-on-master.yaml +++ b/.github/workflows/windows-builds-on-master.yaml @@ -118,7 +118,7 @@ jobs: cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rustup-init-${{ matrix.target }} path: | diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml index af7d61b133..0a4bd47d31 100644 --- a/.github/workflows/windows-builds-on-pr.yaml +++ b/.github/workflows/windows-builds-on-pr.yaml @@ -112,7 +112,7 @@ jobs: cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rustup-init-${{ matrix.target }} path: | diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml index a199b94c6c..768ca6091d 100644 --- a/.github/workflows/windows-builds-on-stable.yaml +++ b/.github/workflows/windows-builds-on-stable.yaml @@ -121,7 +121,7 @@ jobs: cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rustup-init-${{ matrix.target }} path: | diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 3375bae2e1..b6febedeb7 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -162,7 +162,7 @@ jobs: "${DOCKER}" \ -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - name: Upload the built artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: matrix.mode == 'release' with: name: rustup-init-${{ matrix.target }} diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml index 7dd3381d70..95088e0ba0 100644 --- a/ci/actions-templates/macos-builds-template.yaml +++ b/ci/actions-templates/macos-builds-template.yaml @@ -104,7 +104,7 @@ jobs: fi - name: Upload the built artifact if: matrix.mode == 'release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rustup-init-${{ matrix.target }} path: | diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 84749550a9..a2db565216 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -130,7 +130,7 @@ jobs: cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: rustup-init-${{ matrix.target }} path: | From 29f67ca1e32befc5f38c416c26143df045b5046b Mon Sep 17 00:00:00 2001 From: Burak Emir Date: Mon, 18 Dec 2023 10:19:17 +0100 Subject: [PATCH 169/229] =?UTF-8?q?docs:=20move=20"rls"=20and=20"rust-anal?= =?UTF-8?q?ysis"=20to=20separate=20section=20"previous=E2=80=A6"=20(#3591)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/user-guide/src/concepts/components.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/doc/user-guide/src/concepts/components.md b/doc/user-guide/src/concepts/components.md index ba74f96276..56046f7620 100644 --- a/doc/user-guide/src/concepts/components.md +++ b/doc/user-guide/src/concepts/components.md @@ -42,19 +42,15 @@ toolchains. The following is an overview of the different components: doc --help` for more options. * `rust-analyzer` — [rust-analyzer] is a language server that provides support for editors and IDEs. -* `rls` — [RLS] is a language server that is deprecated and has been replaced - by rust-analyzer. * `clippy` — [Clippy] is a lint tool that provides extra checks for common mistakes and stylistic choices. * `miri` — [Miri] is an experimental Rust interpreter, which can be used for checking for undefined-behavior. * `rust-src` — This is a local copy of the source code of the Rust standard - library. This can be used by some tools, such as [RLS], to provide + library. This can be used by some tools, such as [rust-analyzer], to provide auto-completion for functions within the standard library; [Miri] which is a Rust interpreter; and Cargo's experimental [build-std] feature, which allows you to rebuild the standard library locally. -* `rust-analysis` — Metadata about the standard library, used by tools like - [RLS]. * `rust-mingw` — This contains a linker and platform libraries for building on the `x86_64-pc-windows-gnu` platform. * `llvm-tools-preview` — This is an experimental component which contains a @@ -63,6 +59,14 @@ toolchains. The following is an overview of the different components: will not need this; it is only needed for development *of* tools that link to the compiler, such as making modifications to [Clippy]. +### Previous components + +These components have been deprecated and are not published in new Rust releases. + +* `rls` — [RLS] is a language server that is deprecated and has been replaced + by rust-analyzer. +* `rust-analysis` — Metadata about the standard library, used by [RLS]. + ## Component availability Not all components are available for all toolchains. Especially on the nightly From 343e594bb7f2bfddbd376db2b209a170f713300c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 18 Dec 2023 16:52:26 +0000 Subject: [PATCH 170/229] chore(deps): update rust crate hyper to v1.1.0 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2ab2eeb186..9b95222245 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -499,7 +499,7 @@ dependencies = [ "curl", "env_proxy", "http-body-util", - "hyper 1.0.1", + "hyper 1.1.0", "hyper-util", "once_cell", "reqwest", @@ -956,9 +956,9 @@ dependencies = [ [[package]] name = "hyper" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "403f9214f3e703236b221f1a9cd88ec8b4adfa5296de01ab96216361f4692f56" +checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" dependencies = [ "bytes", "futures-channel", @@ -1022,7 +1022,7 @@ dependencies = [ "futures-util", "http 1.0.0", "http-body 1.0.0", - "hyper 1.0.1", + "hyper 1.1.0", "pin-project-lite", "socket2 0.5.5", "tokio", From 0b928185fa98e65a0eba9919796f82f34b27f765 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 00:32:34 +0000 Subject: [PATCH 171/229] fix(deps): update rust crate reqwest to v0.11.23 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9b95222245..904cc1062e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1731,9 +1731,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ "async-compression", "base64", From bb0ba78ed729da0e5407ecbf7a71674aa1fadeee Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 19 Dec 2023 18:31:49 +0000 Subject: [PATCH 172/229] chore(deps): update rust crate tokio to v1.35.1 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 904cc1062e..8897c6cffa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2383,9 +2383,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.35.0" +version = "1.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841d45b238a16291a4e1584e61820b8ae57d696cc5015c459c229ccc6990cc1c" +checksum = "c89b4efa943be685f629b149f53829423f8f5531ea21249408e8e2f8671ec104" dependencies = [ "backtrace", "bytes", From 95d467f67afb988c6606feacacddb53b909f3e2e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 20 Dec 2023 22:25:33 +0000 Subject: [PATCH 173/229] chore(deps): update rust crate hyper-util to v0.1.2 --- Cargo.lock | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8897c6cffa..b2eb663866 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1013,9 +1013,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ca339002caeb0d159cc6e023dff48e199f081e42fa039895c7c6f38b37f2e9d" +checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" dependencies = [ "bytes", "futures-channel", @@ -1026,8 +1026,6 @@ dependencies = [ "pin-project-lite", "socket2 0.5.5", "tokio", - "tower", - "tower-service", "tracing", ] @@ -2589,7 +2587,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", From bd10cbcd7250c7bc4896d6db2de8767405b99ced Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 02:32:02 +0000 Subject: [PATCH 174/229] chore(deps): update rust crate anyhow to v1.0.76 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b2eb663866..007e7bc2c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" [[package]] name = "as-slice" From f8d7b3baba7a63237cb2b82ef49a68a37dd0633c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 02:32:08 +0000 Subject: [PATCH 175/229] fix(deps): update rust crate syn to v2.0.42 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 007e7bc2c3..0a9334407c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.41" +version = "2.0.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" +checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2313,7 @@ checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.41", + "syn 2.0.42", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From 2fc3baacbf402c3ff33b1fa23774aee40001d1aa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 21 Dec 2023 19:32:38 +0000 Subject: [PATCH 176/229] fix(deps): update rust crate proc-macro2 to v1.0.71 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0a9334407c..26366a632b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1522,9 +1522,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.70" +version = "1.0.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39278fbbf5fb4f646ce651690877f89d1c5811a3d4acb27700c1cb3cdb78fd3b" +checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" dependencies = [ "unicode-ident", ] From 79e6407b75085a185871178be5db46047151ac3e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:29:49 +0000 Subject: [PATCH 177/229] fix(deps): update rust crate openssl to v0.10.62 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26366a632b..58b9395ce2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1309,9 +1309,9 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.61" +version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b8419dc8cc6d866deb801274bba2e6f8f6108c1bb7fcc10ee5ab864931dbb45" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ "bitflags 2.4.1", "cfg-if 1.0.0", @@ -1350,9 +1350,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.97" +version = "0.9.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3eaad34cdd97d81de97964fc7f29e2d104f483840d906ef56daa1912338460b" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", From e00bb67ccddd7867c2deea34342af8188cbf8056 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 07:17:39 +0000 Subject: [PATCH 178/229] fix(deps): update rust crate syn to v2.0.43 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 58b9395ce2..3ecea90dd2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.42" +version = "2.0.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" +checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2313,7 @@ checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.43", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From 65aa5278c4354b734f3364bfb9775927d8a62b52 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 25 Dec 2023 22:10:08 +0000 Subject: [PATCH 179/229] chore(deps): update rust crate thiserror to v1.0.52 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ecea90dd2..e4cc4f9736 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2298,18 +2298,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f11c217e1416d6f036b870f14e0413d480dbf28edbee1f877abaf0206af43bb7" +checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.51" +version = "1.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01742297787513b79cf8e29d1056ede1313e2420b7b3b15d0a768b4921f549df" +checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" dependencies = [ "proc-macro2", "quote", From 2467feb5730cd621da20cbad4ba8af090123772e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Dec 2023 00:03:08 +0000 Subject: [PATCH 180/229] chore(deps): update rust crate anyhow to v1.0.77 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e4cc4f9736..3718db6472 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.76" +version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" +checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" [[package]] name = "as-slice" From 5162a98938a13276604c8d656a22f1cf34b36415 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 27 Dec 2023 19:07:50 +0000 Subject: [PATCH 181/229] fix(deps): update rust crate clap_complete to v4.4.5 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3718db6472..ec7919581a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.4" +version = "4.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" +checksum = "a51919c5608a32e34ea1d6be321ad070065e17613e168c5b6977024290f2630b" dependencies = [ "clap", ] From 472ac67fd473019439d81c0d729fcb80ccf293b3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Dec 2023 10:42:32 +0000 Subject: [PATCH 182/229] chore(deps): update rust crate tempfile to v3.9.0 --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec7919581a..8b4bddef3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2266,15 +2266,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if 1.0.0", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] From 13fad17c202128ccdfb3d72febf392c8a2168dd5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 28 Dec 2023 21:44:39 +0000 Subject: [PATCH 183/229] fix(deps): update rust crate clap to v4.4.12 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b4bddef3b..4eb77132da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,18 +286,18 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" dependencies = [ "anstream", "anstyle", From 239c2f7dfbc0b248b22dc128b7c96208dcb5ba25 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 00:13:28 +0000 Subject: [PATCH 184/229] chore(deps): update rust crate thiserror to v1.0.53 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4eb77132da..f7fe0e0b83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2298,18 +2298,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.52" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a48fd946b02c0a526b2e9481c8e2a17755e47039164a86c4070446e3a4614d" +checksum = "b2cd5904763bad08ad5513ddbb12cf2ae273ca53fa9f68e843e236ec6dfccc09" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.52" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7fbe9b594d6568a6a1443250a7e67d80b74e1e96f6d1715e1e21cc1888291d3" +checksum = "3dcf4a824cce0aeacd6f38ae6f24234c8e80d68632338ebaa1443b5df9e29e19" dependencies = [ "proc-macro2", "quote", From f656948277ed93c4914c27c4c2dda17a8ef92fd2 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 05:08:44 +0000 Subject: [PATCH 185/229] chore(deps): update rust crate anyhow to v1.0.78 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f7fe0e0b83..06ce073b4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.77" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9d19de80eff169429ac1e9f48fffb163916b448a44e8e046186232046d9e1f9" +checksum = "ca87830a3e3fb156dc96cfbd31cb620265dd053be734723f22b760d6cc3c3051" [[package]] name = "as-slice" From 7f382a9f73edec8f1f55eb975fd81ddf2c4d0731 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 07:11:25 +0000 Subject: [PATCH 186/229] fix(deps): update rust crate proc-macro2 to v1.0.72 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 06ce073b4d..5dc63c1995 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1522,9 +1522,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "a293318316cf6478ec1ad2a21c49390a8d5b5eae9fab736467d93fbc0edc29c5" dependencies = [ "unicode-ident", ] From 567ffc0657cdee8b1465baa2bc4689cd545ca31e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 31 Dec 2023 18:13:06 +0000 Subject: [PATCH 187/229] fix(deps): update rust crate quote to v1.0.34 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dc63c1995..68559b3501 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1591,9 +1591,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "22a37c9326af5ed140c86a46655b5278de879853be5573c01df185b6f49a580a" dependencies = [ "proc-macro2", ] From 0e86a229eb41ace326ef67d76eaf2205b04dbddd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 08:23:39 +0000 Subject: [PATCH 188/229] fix(deps): update rust crate syn to v2.0.44 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68559b3501..4ca9743c2b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.43" +version = "2.0.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee659fb5f3d355364e1f3e5bc10fb82068efbf824a1e9d1c9504244a6469ad53" +checksum = "92d27c2c202598d05175a6dd3af46824b7f747f8d8e9b14c623f19fa5069735d" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2313,7 @@ checksum = "3dcf4a824cce0aeacd6f38ae6f24234c8e80d68632338ebaa1443b5df9e29e19" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.43", + "syn 2.0.44", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From 3b5529b8c1b03bce867ce0b16f4bc4614b046196 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 08:23:36 +0000 Subject: [PATCH 189/229] fix(deps): update rust crate proc-macro2 to v1.0.73 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4ca9743c2b..5bde5b5816 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1522,9 +1522,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.72" +version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a293318316cf6478ec1ad2a21c49390a8d5b5eae9fab736467d93fbc0edc29c5" +checksum = "2dd5e8a1f1029c43224ad5898e50140c2aebb1705f19e67c918ebf5b9e797fe1" dependencies = [ "unicode-ident", ] From 8d54f007e3a0831792a0d2b70e7014df993ecd8b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 1 Jan 2024 19:49:06 +0000 Subject: [PATCH 190/229] fix(deps): update rust crate syn to v2.0.45 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5bde5b5816..ed5d1a20a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.44" +version = "2.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d27c2c202598d05175a6dd3af46824b7f747f8d8e9b14c623f19fa5069735d" +checksum = "0eae3c679c56dc214320b67a1bc04ef3dfbd6411f6443974b5e4893231298e66" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2313,7 @@ checksum = "3dcf4a824cce0aeacd6f38ae6f24234c8e80d68632338ebaa1443b5df9e29e19" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.44", + "syn 2.0.45", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From d8fac6983639b170b89c6a722be214eb1b49774f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 06:33:12 +0000 Subject: [PATCH 191/229] chore(deps): update rust crate anyhow to v1.0.79 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ed5d1a20a1..12c422fca4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -85,9 +85,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca87830a3e3fb156dc96cfbd31cb620265dd053be734723f22b760d6cc3c3051" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "as-slice" From 3b0ae079d91144ea9cf99a5fc6d493701a160823 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 14:16:04 +0000 Subject: [PATCH 192/229] chore(deps): update rust crate thiserror to v1.0.56 --- Cargo.lock | 48 ++++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 12c422fca4..2448aa9b84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -1522,9 +1522,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.73" +version = "1.0.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dd5e8a1f1029c43224ad5898e50140c2aebb1705f19e67c918ebf5b9e797fe1" +checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" dependencies = [ "unicode-ident", ] @@ -1591,9 +1591,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.34" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a37c9326af5ed140c86a46655b5278de879853be5573c01df185b6f49a580a" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.45" +version = "2.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eae3c679c56dc214320b67a1bc04ef3dfbd6411f6443974b5e4893231298e66" +checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" dependencies = [ "proc-macro2", "quote", @@ -2298,22 +2298,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2cd5904763bad08ad5513ddbb12cf2ae273ca53fa9f68e843e236ec6dfccc09" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcf4a824cce0aeacd6f38ae6f24234c8e80d68632338ebaa1443b5df9e29e19" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.45", + "syn 2.0.46", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From d2b33747d9c543d1da89a9c6a87770ece4a69e1e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 18:14:42 +0000 Subject: [PATCH 193/229] fix(deps): update rust crate semver to v1.0.21 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2448aa9b84..592a056a3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2022,9 +2022,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" From 534eb03656721cb1f8f0feb27fe07a53ee1aa879 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 22:59:35 +0000 Subject: [PATCH 194/229] fix(deps): update rust crate serde to v1.0.194 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 592a056a3c..0458aada6c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2028,18 +2028,18 @@ checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.194" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", From 66d6af9a78d7c4a2e72a35776f5ce926a37d7810 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 2 Jan 2024 22:59:30 +0000 Subject: [PATCH 195/229] fix(deps): update rust crate clap_complete to v4.4.6 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 0458aada6c..e3ba951513 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.5" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a51919c5608a32e34ea1d6be321ad070065e17613e168c5b6977024290f2630b" +checksum = "97aeaa95557bd02f23fbb662f981670c3d20c5a26e69f7354b28f57092437fcd" dependencies = [ "clap", ] From 2ee8aa0e5f4b03f97af1e12c5b004b1e48d8b5c9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 01:05:22 +0000 Subject: [PATCH 196/229] fix(deps): update rust crate proc-macro2 to v1.0.75 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e3ba951513..1cf6568e69 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1522,9 +1522,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.74" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2de98502f212cfcea8d0bb305bd0f49d7ebdd75b64ba0a68f937d888f4e0d6db" +checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" dependencies = [ "unicode-ident", ] From b6614e7e858e85188bfafd50e843a4e373eae11f Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 01:05:27 +0000 Subject: [PATCH 197/229] fix(deps): update rust crate syn to v2.0.47 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1cf6568e69..e8fa4220fc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.46" +version = "2.0.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89456b690ff72fddcecf231caedbe615c59480c93358a93dfae7fc29e3ebbf0e" +checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2313,7 @@ checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.46", + "syn 2.0.47", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From fe7b117b3a745e30b90ef3b6b6bbd8181162a81e Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 4 Jan 2024 13:08:34 +0800 Subject: [PATCH 198/229] chore(deps): update `renovate.json` to remove version bumps covered by lockfile maintenance PRs --- .github/renovate.json | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 1f15c94ff9..ab0e036354 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -24,21 +24,6 @@ "opentelemetry" ], "groupName": "opentelemetry" - }, - { - "matchUpdateTypes": [ - "minor", - "patch" - ], - "matchCurrentVersion": "!/^0/", - "automerge": true - }, - { - "matchUpdateTypes": [ - "patch" - ], - "matchCurrentVersion": "/^0\\./", - "automerge": true } ] } \ No newline at end of file From 0e939bb629f378689fc4eeea5767344b9b2bcb8e Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 14 Dec 2023 11:41:47 +0800 Subject: [PATCH 199/229] chore(ci): clean up current CI files --- .github/workflows/all-features.yaml | 3 +-- .github/workflows/test-docs.yaml | 3 +-- .../workflows/windows-builds-on-master.yaml | 14 ++++++------- .github/workflows/windows-builds-on-pr.yaml | 8 ++++---- .../workflows/windows-builds-on-stable.yaml | 20 +++++++++---------- .../windows-builds-template.yaml | 20 +++++++++---------- 6 files changed, 33 insertions(+), 35 deletions(-) diff --git a/.github/workflows/all-features.yaml b/.github/workflows/all-features.yaml index a596654806..ab4ac749b3 100644 --- a/.github/workflows/all-features.yaml +++ b/.github/workflows/all-features.yaml @@ -12,8 +12,7 @@ on: - renovate/* jobs: - build: - name: Build + build-all-features: runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/.github/workflows/test-docs.yaml b/.github/workflows/test-docs.yaml index 2c4e5bd56d..3e20f1fe9b 100644 --- a/.github/workflows/test-docs.yaml +++ b/.github/workflows/test-docs.yaml @@ -10,7 +10,6 @@ on: jobs: doc: - name: Documentation runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -28,4 +27,4 @@ jobs: - name: Build dev-guide run: | cd doc/dev-guide - mdbook build \ No newline at end of file + mdbook build diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml index 877a3c0f5c..f590512933 100644 --- a/.github/workflows/windows-builds-on-master.yaml +++ b/.github/workflows/windows-builds-on-master.yaml @@ -25,13 +25,13 @@ jobs: - x86_64-pc-windows-gnu # skip-pr mode: - dev - - release + - release include: - target: x86_64-pc-windows-msvc run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr steps: - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag @@ -104,18 +104,18 @@ jobs: rustup target install ${{ matrix.target }} - name: Run a full build env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} BUILD_PROFILE: ${{ matrix.mode }} run: bash ci/run.bash - name: Run cargo check and clippy if: matrix.mode != 'release' env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v4 diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml index 0a4bd47d31..a61bfc51e0 100644 --- a/.github/workflows/windows-builds-on-pr.yaml +++ b/.github/workflows/windows-builds-on-pr.yaml @@ -22,7 +22,7 @@ jobs: - x86_64-pc-windows-msvc mode: - dev - - release + - release include: - target: x86_64-pc-windows-msvc run_tests: YES @@ -98,18 +98,18 @@ jobs: rustup target install ${{ matrix.target }} - name: Run a full build env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} BUILD_PROFILE: ${{ matrix.mode }} run: bash ci/run.bash - name: Run cargo check and clippy if: matrix.mode != 'release' env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v4 diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml index 768ca6091d..8560cc5996 100644 --- a/.github/workflows/windows-builds-on-stable.yaml +++ b/.github/workflows/windows-builds-on-stable.yaml @@ -25,16 +25,16 @@ jobs: - i686-pc-windows-gnu # skip-pr skip-master mode: - dev - - release + - release include: - target: x86_64-pc-windows-msvc run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - - target: i686-pc-windows-gnu # skip-pr skip-master - mingwdir: mingw32 # skip-pr skip-master - mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + - target: i686-pc-windows-gnu # skip-pr skip-master + mingwdir: mingw32 # skip-pr skip-master + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master steps: - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag @@ -107,18 +107,18 @@ jobs: rustup target install ${{ matrix.target }} - name: Run a full build env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} BUILD_PROFILE: ${{ matrix.mode }} run: bash ci/run.bash - name: Run cargo check and clippy if: matrix.mode != 'release' env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v4 diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index a2db565216..f7c81477c6 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -34,16 +34,16 @@ jobs: - i686-pc-windows-gnu # skip-pr skip-master mode: - dev - - release + - release include: - target: x86_64-pc-windows-msvc run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - - target: i686-pc-windows-gnu # skip-pr skip-master - mingwdir: mingw32 # skip-pr skip-master - mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + - target: i686-pc-windows-gnu # skip-pr skip-master + mingwdir: mingw32 # skip-pr skip-master + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master steps: - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag @@ -116,18 +116,18 @@ jobs: rustup target install ${{ matrix.target }} - name: Run a full build env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} BUILD_PROFILE: ${{ matrix.mode }} run: bash ci/run.bash - name: Run cargo check and clippy if: matrix.mode != 'release' env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v4 From 93ec5323638e3a3cba9f5c974458447b50070b87 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 14 Dec 2023 11:41:11 +0800 Subject: [PATCH 200/229] refactor(ci): merge all current GitHub Actions workflows into `ci.yaml` --- .../workflows/centos-fmt-clippy-on-all.yaml | 97 -- .github/workflows/ci.yaml | 1168 +++++++++++++++++ .github/workflows/linux-builds-on-master.yaml | 159 --- .github/workflows/linux-builds-on-pr.yaml | 153 --- .github/workflows/linux-builds-on-stable.yaml | 183 --- .github/workflows/macos-builds-on-all.yaml | 138 -- .../workflows/windows-builds-on-master.yaml | 147 --- .github/workflows/windows-builds-on-pr.yaml | 141 -- .../workflows/windows-builds-on-stable.yaml | 150 --- .../all-features-template.yaml | 22 +- .../centos-fmt-clippy-template.yaml | 21 +- ci/actions-templates/gen-workflows.sh | 56 +- .../linux-builds-template.yaml | 30 +- .../macos-builds-template.yaml | 22 +- .../actions-templates/test-docs-template.yaml | 17 +- .../windows-builds-template.yaml | 30 +- 16 files changed, 1246 insertions(+), 1288 deletions(-) delete mode 100644 .github/workflows/centos-fmt-clippy-on-all.yaml create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/linux-builds-on-master.yaml delete mode 100644 .github/workflows/linux-builds-on-pr.yaml delete mode 100644 .github/workflows/linux-builds-on-stable.yaml delete mode 100644 .github/workflows/macos-builds-on-all.yaml delete mode 100644 .github/workflows/windows-builds-on-master.yaml delete mode 100644 .github/workflows/windows-builds-on-pr.yaml delete mode 100644 .github/workflows/windows-builds-on-stable.yaml rename .github/workflows/all-features.yaml => ci/actions-templates/all-features-template.yaml (71%) rename .github/workflows/test-docs.yaml => ci/actions-templates/test-docs-template.yaml (65%) diff --git a/.github/workflows/centos-fmt-clippy-on-all.yaml b/.github/workflows/centos-fmt-clippy-on-all.yaml deleted file mode 100644 index f75f37151a..0000000000 --- a/.github/workflows/centos-fmt-clippy-on-all.yaml +++ /dev/null @@ -1,97 +0,0 @@ -# This is ci/actions-templates/centos-fmt-clippy.yaml -# Do not edit this file in .github/workflows - -name: General Checks - -on: - pull_request: - branches: - - "*" - push: - branches: - - master - - stable - - renovate/* - schedule: - - cron: "30 0 * * 1" # Every Monday at half past midnight - -jobs: - check: - name: Checks - runs-on: ubuntu-latest - strategy: - fail-fast: false - steps: - - name: Clone repo - uses: actions/checkout@v4 - with: - # v2 defaults to a shallow checkout, but we need at least to the previous tag - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - mkdir -p ~/.cargo/{registry,git} - - name: Set environment variables appropriately for the build - run: | - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using ./rustup-init.sh - run: | - sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y - - name: Ensure Beta is up to date - run: | - if rustc +beta -vV >/dev/null 2>/dev/null; then - rustup toolchain uninstall beta - fi - rustup toolchain install --profile=minimal beta - rustup default beta - - name: Ensure we have the components we need - run: | - rustup component add rustfmt - rustup component add clippy - - name: Run the centos check within the docker image - run: | - docker run \ - --volume "$PWD":/checkout:ro \ - --workdir /checkout \ - --tty \ - --init \ - --rm \ - centos:7 \ - sh ./ci/raw_init.sh - - name: Run shell checks - run: | - shellcheck -x -s dash -- rustup-init.sh - git ls-files -- '*.sh' | xargs shellcheck -x -s dash - git ls-files -- '*.bash' | xargs shellcheck -x -s bash - - name: Run formatting checks - run: | - cargo fmt --all --check - - name: Run cargo check and clippy - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --all --all-targets --features test diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..0404f9ebb5 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,1168 @@ +# GitHub Actions workflow generated by ci/actions-templates/gen-workflows.sh +# Do not edit this file in .github/workflows + +name: CI + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + - renovate/* + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight UTC + +jobs: + + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-pr: # skip-master skip-stable + runs-on: windows-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + mode: + - dev + - release + include: + - target: x86_64-pc-windows-msvc + run_tests: YES + steps: + - uses: actions/checkout@v4 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + shell: powershell + if: matrix.mingw != '' + - name: Set PATH + run: | + echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + shell: bash + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: rustup update stable + shell: bash + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + env: + TARGET: ${{ matrix.target }} + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Run cargo check and clippy + if: matrix.mode != 'release' + env: + TARGET: ${{ matrix.target }} + # os-specific code leads to lints escaping if we only run this in one target + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --workspace --all-targets --features test + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init.exe + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + choco upgrade awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-master: # skip-pr skip-stable + runs-on: windows-latest + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + - aarch64-pc-windows-msvc # skip-pr + - x86_64-pc-windows-gnu # skip-pr + mode: + - dev + - release + include: + - target: x86_64-pc-windows-msvc + run_tests: YES + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + steps: + - uses: actions/checkout@v4 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + shell: powershell + if: matrix.mingw != '' + - name: Set PATH + run: | + echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + shell: bash + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: rustup update stable + shell: bash + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + env: + TARGET: ${{ matrix.target }} + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Run cargo check and clippy + if: matrix.mode != 'release' + env: + TARGET: ${{ matrix.target }} + # os-specific code leads to lints escaping if we only run this in one target + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --workspace --all-targets --features test + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init.exe + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + choco upgrade awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-stable: # skip-master skip-pr + runs-on: windows-latest + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + - i686-pc-windows-msvc # skip-pr skip-master + - aarch64-pc-windows-msvc # skip-pr + - x86_64-pc-windows-gnu # skip-pr + - i686-pc-windows-gnu # skip-pr skip-master + mode: + - dev + - release + include: + - target: x86_64-pc-windows-msvc + run_tests: YES + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + - target: i686-pc-windows-gnu # skip-pr skip-master + mingwdir: mingw32 # skip-pr skip-master + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master + steps: + - uses: actions/checkout@v4 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + shell: powershell + if: matrix.mingw != '' + - name: Set PATH + run: | + echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + shell: bash + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: rustup update stable + shell: bash + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + env: + TARGET: ${{ matrix.target }} + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Run cargo check and clippy + if: matrix.mode != 'release' + env: + TARGET: ${{ matrix.target }} + # os-specific code leads to lints escaping if we only run this in one target + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --workspace --all-targets --features test + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init.exe + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + choco upgrade awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-pr: # skip-master skip-stable + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + strategy: + fail-fast: false + matrix: + mode: + - dev + - release + target: + - x86_64-unknown-linux-gnu + - armv7-unknown-linux-gnueabihf + - aarch64-linux-android + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + #snap_arch: amd64 + - target: armv7-unknown-linux-gnueabihf + #snap_arch: armhf + steps: + - name: Clone repo + uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + mkdir -p ~/.cargo/{registry,git} + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y + - name: Ensure Stable is up to date + run: | + if rustc +stable -vV >/dev/null 2>/dev/null; then + rustup toolchain uninstall stable + fi + rustup toolchain install --profile=minimal stable + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Determine which docker we need to run in + run: | + case "$TARGET" in + *-linux-android*) DOCKER=android ;; # Android uses a local docker image + *) DOCKER="$TARGET" ;; + esac + echo "DOCKER=$DOCKER" >> $GITHUB_ENV + - name: Fetch the base docker images from rust-lang/rust + run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Maybe build a docker from there + run: | + if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then + docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . + fi + - name: Run the build within the docker image + env: + BUILD_PROFILE: ${{ matrix.mode }} + run: | + mkdir -p "${PWD}/target" + chown -R "$(id -u)":"$(id -g)" "${PWD}/target" + docker run \ + --entrypoint sh \ + --env BUILD_PROFILE="${BUILD_PROFILE}" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --env TARGET="${TARGET}" \ + --init \ + --rm \ + --tty \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HOME}/.cargo:/cargo" \ + --volume "${PWD}":/checkout:ro \ + --volume "${PWD}"/target:/checkout/target \ + --workdir /checkout \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Upload the built artifact + uses: actions/upload-artifact@v4 + if: matrix.mode == 'release' + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + pip3 install -U setuptools + pip3 install awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + bash ci/prepare-deploy.bash + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-master: # skip-pr skip-stable + runs-on: ubuntu-latest + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + strategy: + fail-fast: false + matrix: + mode: + - dev + - release + target: + - x86_64-unknown-linux-gnu + - armv7-unknown-linux-gnueabihf + - aarch64-linux-android + - aarch64-unknown-linux-gnu # skip-pr + - powerpc64-unknown-linux-gnu # skip-pr + - x86_64-unknown-linux-musl # skip-pr + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + #snap_arch: amd64 + - target: aarch64-unknown-linux-gnu # skip-pr + #snap_arch: arm64 # skip-pr + - target: armv7-unknown-linux-gnueabihf + #snap_arch: armhf + steps: + - name: Clone repo + uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + mkdir -p ~/.cargo/{registry,git} + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y + - name: Ensure Stable is up to date + run: | + if rustc +stable -vV >/dev/null 2>/dev/null; then + rustup toolchain uninstall stable + fi + rustup toolchain install --profile=minimal stable + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Determine which docker we need to run in + run: | + case "$TARGET" in + *-linux-android*) DOCKER=android ;; # Android uses a local docker image + *) DOCKER="$TARGET" ;; + esac + echo "DOCKER=$DOCKER" >> $GITHUB_ENV + - name: Fetch the base docker images from rust-lang/rust + run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Maybe build a docker from there + run: | + if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then + docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . + fi + - name: Run the build within the docker image + env: + BUILD_PROFILE: ${{ matrix.mode }} + run: | + mkdir -p "${PWD}/target" + chown -R "$(id -u)":"$(id -g)" "${PWD}/target" + docker run \ + --entrypoint sh \ + --env BUILD_PROFILE="${BUILD_PROFILE}" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --env TARGET="${TARGET}" \ + --init \ + --rm \ + --tty \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HOME}/.cargo:/cargo" \ + --volume "${PWD}":/checkout:ro \ + --volume "${PWD}"/target:/checkout/target \ + --workdir /checkout \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Upload the built artifact + uses: actions/upload-artifact@v4 + if: matrix.mode == 'release' + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + pip3 install -U setuptools + pip3 install awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + bash ci/prepare-deploy.bash + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-stable: # skip-master skip-pr + runs-on: ubuntu-latest + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + strategy: + fail-fast: false + matrix: + mode: + - dev + - release + target: + - x86_64-unknown-linux-gnu + - armv7-unknown-linux-gnueabihf + - aarch64-linux-android + - aarch64-unknown-linux-gnu # skip-pr + - aarch64-unknown-linux-musl # skip-pr skip-master + - powerpc64-unknown-linux-gnu # skip-pr + - x86_64-unknown-linux-musl # skip-pr + - i686-unknown-linux-gnu # skip-pr skip-master + - arm-unknown-linux-gnueabi # skip-pr skip-master + - arm-unknown-linux-gnueabihf # skip-pr skip-master + - x86_64-unknown-freebsd # skip-pr skip-master + - x86_64-unknown-netbsd # skip-pr skip-master + - x86_64-unknown-illumos # skip-pr skip-master + - powerpc-unknown-linux-gnu # skip-pr skip-master + - powerpc64le-unknown-linux-gnu # skip-pr skip-master + - mips-unknown-linux-gnu # skip-pr skip-master + - mips64-unknown-linux-gnuabi64 # skip-pr skip-master + - mipsel-unknown-linux-gnu # skip-pr skip-master + - mips64el-unknown-linux-gnuabi64 # skip-pr skip-master + - s390x-unknown-linux-gnu # skip-pr skip-master + - arm-linux-androideabi # skip-pr skip-master + - armv7-linux-androideabi # skip-pr skip-master + - i686-linux-android # skip-pr skip-master + - x86_64-linux-android # skip-pr skip-master + - riscv64gc-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-gnu # skip-pr skip-master + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + #snap_arch: amd64 + - target: i686-unknown-linux-gnu # skip-pr skip-master + #snap_arch: i386 # skip-pr skip-master + - target: aarch64-unknown-linux-gnu # skip-pr + #snap_arch: arm64 # skip-pr + - target: armv7-unknown-linux-gnueabihf + #snap_arch: armhf + - target: powerpc64le-unknown-linux-gnu # skip-pr skip-master + #snap_arch: ppc64el # skip-pr skip-master + - target: s390x-unknown-linux-gnu # skip-pr skip-master + #snap_arch: s390x # skip-pr skip-master + steps: + - name: Clone repo + uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + mkdir -p ~/.cargo/{registry,git} + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y + - name: Ensure Stable is up to date + run: | + if rustc +stable -vV >/dev/null 2>/dev/null; then + rustup toolchain uninstall stable + fi + rustup toolchain install --profile=minimal stable + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Determine which docker we need to run in + run: | + case "$TARGET" in + *-linux-android*) DOCKER=android ;; # Android uses a local docker image + *) DOCKER="$TARGET" ;; + esac + echo "DOCKER=$DOCKER" >> $GITHUB_ENV + - name: Fetch the base docker images from rust-lang/rust + run: bash ci/fetch-rust-docker.bash "${TARGET}" + - name: Maybe build a docker from there + run: | + if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then + docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . + fi + - name: Run the build within the docker image + env: + BUILD_PROFILE: ${{ matrix.mode }} + run: | + mkdir -p "${PWD}/target" + chown -R "$(id -u)":"$(id -g)" "${PWD}/target" + docker run \ + --entrypoint sh \ + --env BUILD_PROFILE="${BUILD_PROFILE}" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --env TARGET="${TARGET}" \ + --init \ + --rm \ + --tty \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HOME}/.cargo:/cargo" \ + --volume "${PWD}":/checkout:ro \ + --volume "${PWD}"/target:/checkout/target \ + --workdir /checkout \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Upload the built artifact + uses: actions/upload-artifact@v4 + if: matrix.mode == 'release' + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + pip3 install -U setuptools + pip3 install awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + bash ci/prepare-deploy.bash + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + + # This is ci/actions-templates/macos-builds-template.yaml + # Do not edit this file in .github/workflows + build-macos: + runs-on: macos-latest + strategy: + matrix: + target: + - x86_64-apple-darwin + - aarch64-apple-darwin + mode: + - dev + - release + include: + - target: x86_64-apple-darwin + run_tests: YES + steps: + - uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + mkdir -p ~/.cargo/{registry,git} + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + echo "SKIP_TESTS=" >> $GITHUB_ENV + echo "LZMA_API_STATIC=1" >> $GITHUB_ENV + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y + - name: Ensure Stable is up to date + run: | + if rustc +stable -vV >/dev/null 2>/dev/null; then + rustup toolchain uninstall stable + fi + rustup toolchain install --profile=minimal stable + - name: aarch64-specific items + run: | + # Use nightly for now + rustup toolchain install --profile=minimal nightly + rustup default nightly + if: matrix.target == 'aarch64-apple-darwin' + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Run a full build and test + env: + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Dump dynamic link targets + if: matrix.mode == 'release' + run: | + otool -L target/${TARGET}/release/rustup-init + if otool -L target/${TARGET}/release/rustup-init | grep -q -F /usr/local/; then + echo >&2 "Unfortunately there are /usr/local things in the link. Fail." + exit 1 + fi + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + pip3 install awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + bash ci/prepare-deploy.bash + - name: Deploy build to dev-static dist tree for release team + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_DEFAULT_REGION: us-west-1 + - name: Clear the cargo caches + run: | + cargo install cargo-cache --no-default-features --features ci-autoclean + cargo-cache + - name: Flush cache + # This is a workaround for a bug with GitHub Actions Cache that causes + # corrupt cache entries (particularly in the target directory). See + # https://github.com/actions/cache/issues/403 and + # https://github.com/rust-lang/cargo/issues/8603. + run: sudo /usr/sbin/purge + + # This is ci/actions-templates/centos-fmt-clippy.yaml + # Do not edit this file in .github/workflows + check: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Clone repo + uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Display the current git status + run: | + git status + git describe + - name: Prep cargo dirs + run: | + mkdir -p ~/.cargo/{registry,git} + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + - name: Cache cargo registry and git trees + uses: actions/cache@v3 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + - name: Get rustc commit hash + id: cargo-target-cache + run: | + echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT + shell: bash + - name: Cache cargo build + uses: actions/cache@v3 + with: + path: target + key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + restore-keys: ${{ github.base_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y + - name: Ensure Beta is up to date + run: | + if rustc +beta -vV >/dev/null 2>/dev/null; then + rustup toolchain uninstall beta + fi + rustup toolchain install --profile=minimal beta + rustup default beta + - name: Ensure we have the components we need + run: | + rustup component add rustfmt + rustup component add clippy + - name: Run the centos check within the docker image + run: | + docker run \ + --volume "$PWD":/checkout:ro \ + --workdir /checkout \ + --tty \ + --init \ + --rm \ + centos:7 \ + sh ./ci/raw_init.sh + - name: Run shell checks + run: | + shellcheck -x -s dash -- rustup-init.sh + git ls-files -- '*.sh' | xargs shellcheck -x -s dash + git ls-files -- '*.bash' | xargs shellcheck -x -s bash + - name: Run formatting checks + run: | + cargo fmt --all --check + - name: Run cargo check and clippy + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --all --all-targets --features test + + # This is ci/actions-templates/all-features-template.yaml + # Do not edit this file in .github/workflows + # + # This is an additional workflow to test building with all feature combinations. + # Unlike our main workflows, this doesn't self-test the rustup install scripts, + # nor run on the rust docker images. This permits a smaller workflow without the + # templating and so on. + build-all-features: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} + strategy: + fail-fast: false + matrix: + # Might add more targets in future. + target: + - x86_64-unknown-linux-gnu + steps: + - name: Clone repo + uses: actions/checkout@v4 + - name: Install rustup stable + run: rustup toolchain install stable --profile minimal + - name: Install Protoc + uses: arduino/setup-protoc@v1 + with: + version: "3.x" + repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Set environment variables appropriately for the build + run: | + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + - name: Cache Cargo + uses: Swatinem/rust-cache@v2 + - name: Install cargo-all-features + run: cargo install cargo-all-features --git https://github.com/rbtcollins/cargo-all-features.git + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Build every combination + run: | + cargo check-all-features --root-only + + # This is ci/actions-templates/test-docs-templates.yaml + # Do not edit this file in .github/workflows + # + # Builds docs for both stable and master branches. + # stable is placed in the root of the gh-pages branch, while master is placed at /devel + doc: + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install mdbook + run: | + mkdir mdbook + curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.6/mdbook-v0.4.6-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook + echo "`pwd`/mdbook" >> $GITHUB_PATH + - name: Build user-guide + run: | + cd doc/user-guide + mdbook build + - name: Build dev-guide + run: | + cd doc/dev-guide + mdbook build diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml deleted file mode 100644 index 3a53089a1a..0000000000 --- a/.github/workflows/linux-builds-on-master.yaml +++ /dev/null @@ -1,159 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Linux (master) # skip-pr skip-stable - -on: - push: # skip-pr - branches: # skip-pr - - master # skip-pr skip-stable - schedule: # skip-pr skip-stable - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable - -jobs: - build: - name: Build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - mode: - - dev - - release - target: - - x86_64-unknown-linux-gnu - - armv7-unknown-linux-gnueabihf - - aarch64-linux-android - - aarch64-unknown-linux-gnu # skip-pr - - powerpc64-unknown-linux-gnu # skip-pr - - x86_64-unknown-linux-musl # skip-pr - include: - - target: x86_64-unknown-linux-gnu - run_tests: YES - #snap_arch: amd64 - - target: aarch64-unknown-linux-gnu # skip-pr - #snap_arch: arm64 # skip-pr - - target: armv7-unknown-linux-gnueabihf - #snap_arch: armhf - steps: - - name: Clone repo - uses: actions/checkout@v4 - with: - # v2 defaults to a shallow checkout, but we need at least to the previous tag - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - mkdir -p ~/.cargo/{registry,git} - - name: Set environment variables appropriately for the build - run: | - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using ./rustup-init.sh - run: | - sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y - - name: Ensure Stable is up to date - run: | - if rustc +stable -vV >/dev/null 2>/dev/null; then - rustup toolchain uninstall stable - fi - rustup toolchain install --profile=minimal stable - - name: Ensure we have our goal target installed - run: | - rustup target install "$TARGET" - - name: Determine which docker we need to run in - run: | - case "$TARGET" in - *-linux-android*) DOCKER=android ;; # Android uses a local docker image - *) DOCKER="$TARGET" ;; - esac - echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the base docker images from rust-lang/rust - run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Maybe build a docker from there - run: | - if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then - docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . - fi - - name: Run the build within the docker image - env: - BUILD_PROFILE: ${{ matrix.mode }} - run: | - mkdir -p "${PWD}/target" - chown -R "$(id -u)":"$(id -g)" "${PWD}/target" - docker run \ - --entrypoint sh \ - --env BUILD_PROFILE="${BUILD_PROFILE}" \ - --env CARGO_HOME=/cargo \ - --env CARGO_TARGET_DIR=/checkout/target \ - --env LIBZ_SYS_STATIC=1 \ - --env SKIP_TESTS="${SKIP_TESTS}" \ - --env TARGET="${TARGET}" \ - --init \ - --rm \ - --tty \ - --user "$(id -u)":"$(id -g)" \ - --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ - --volume "${HOME}/.cargo:/cargo" \ - --volume "${PWD}":/checkout:ro \ - --volume "${PWD}"/target:/checkout/target \ - --workdir /checkout \ - "${DOCKER}" \ - -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - - name: Upload the built artifact - uses: actions/upload-artifact@v4 - if: matrix.mode == 'release' - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - pip3 install -U setuptools - pip3 install awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - bash ci/prepare-deploy.bash - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml deleted file mode 100644 index e6ffd388c6..0000000000 --- a/.github/workflows/linux-builds-on-pr.yaml +++ /dev/null @@ -1,153 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Linux (PR) # skip-master skip-stable - -on: - pull_request: # skip-master skip-stable - branches: # skip-master skip-stable - - "*" # skip-master skip-stable - - renovate/* # skip-master skip-stable - -jobs: - build: - name: Build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - mode: - - dev - - release - target: - - x86_64-unknown-linux-gnu - - armv7-unknown-linux-gnueabihf - - aarch64-linux-android - include: - - target: x86_64-unknown-linux-gnu - run_tests: YES - #snap_arch: amd64 - - target: armv7-unknown-linux-gnueabihf - #snap_arch: armhf - steps: - - name: Clone repo - uses: actions/checkout@v4 - with: - # v2 defaults to a shallow checkout, but we need at least to the previous tag - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - mkdir -p ~/.cargo/{registry,git} - - name: Set environment variables appropriately for the build - run: | - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using ./rustup-init.sh - run: | - sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y - - name: Ensure Stable is up to date - run: | - if rustc +stable -vV >/dev/null 2>/dev/null; then - rustup toolchain uninstall stable - fi - rustup toolchain install --profile=minimal stable - - name: Ensure we have our goal target installed - run: | - rustup target install "$TARGET" - - name: Determine which docker we need to run in - run: | - case "$TARGET" in - *-linux-android*) DOCKER=android ;; # Android uses a local docker image - *) DOCKER="$TARGET" ;; - esac - echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the base docker images from rust-lang/rust - run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Maybe build a docker from there - run: | - if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then - docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . - fi - - name: Run the build within the docker image - env: - BUILD_PROFILE: ${{ matrix.mode }} - run: | - mkdir -p "${PWD}/target" - chown -R "$(id -u)":"$(id -g)" "${PWD}/target" - docker run \ - --entrypoint sh \ - --env BUILD_PROFILE="${BUILD_PROFILE}" \ - --env CARGO_HOME=/cargo \ - --env CARGO_TARGET_DIR=/checkout/target \ - --env LIBZ_SYS_STATIC=1 \ - --env SKIP_TESTS="${SKIP_TESTS}" \ - --env TARGET="${TARGET}" \ - --init \ - --rm \ - --tty \ - --user "$(id -u)":"$(id -g)" \ - --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ - --volume "${HOME}/.cargo:/cargo" \ - --volume "${PWD}":/checkout:ro \ - --volume "${PWD}"/target:/checkout/target \ - --workdir /checkout \ - "${DOCKER}" \ - -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - - name: Upload the built artifact - uses: actions/upload-artifact@v4 - if: matrix.mode == 'release' - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - pip3 install -U setuptools - pip3 install awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - bash ci/prepare-deploy.bash - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml deleted file mode 100644 index 1cac2fe5ee..0000000000 --- a/.github/workflows/linux-builds-on-stable.yaml +++ /dev/null @@ -1,183 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Linux (stable) # skip-master skip-pr - -on: - push: # skip-pr - branches: # skip-pr - - stable # skip-pr skip-master - -jobs: - build: - name: Build - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - mode: - - dev - - release - target: - - x86_64-unknown-linux-gnu - - armv7-unknown-linux-gnueabihf - - aarch64-linux-android - - aarch64-unknown-linux-gnu # skip-pr - - aarch64-unknown-linux-musl # skip-pr skip-master - - powerpc64-unknown-linux-gnu # skip-pr - - x86_64-unknown-linux-musl # skip-pr - - i686-unknown-linux-gnu # skip-pr skip-master - - arm-unknown-linux-gnueabi # skip-pr skip-master - - arm-unknown-linux-gnueabihf # skip-pr skip-master - - x86_64-unknown-freebsd # skip-pr skip-master - - x86_64-unknown-netbsd # skip-pr skip-master - - x86_64-unknown-illumos # skip-pr skip-master - - powerpc-unknown-linux-gnu # skip-pr skip-master - - powerpc64le-unknown-linux-gnu # skip-pr skip-master - - mips-unknown-linux-gnu # skip-pr skip-master - - mips64-unknown-linux-gnuabi64 # skip-pr skip-master - - mipsel-unknown-linux-gnu # skip-pr skip-master - - mips64el-unknown-linux-gnuabi64 # skip-pr skip-master - - s390x-unknown-linux-gnu # skip-pr skip-master - - arm-linux-androideabi # skip-pr skip-master - - armv7-linux-androideabi # skip-pr skip-master - - i686-linux-android # skip-pr skip-master - - x86_64-linux-android # skip-pr skip-master - - riscv64gc-unknown-linux-gnu # skip-pr skip-master - - loongarch64-unknown-linux-gnu # skip-pr skip-master - include: - - target: x86_64-unknown-linux-gnu - run_tests: YES - #snap_arch: amd64 - - target: i686-unknown-linux-gnu # skip-pr skip-master - #snap_arch: i386 # skip-pr skip-master - - target: aarch64-unknown-linux-gnu # skip-pr - #snap_arch: arm64 # skip-pr - - target: armv7-unknown-linux-gnueabihf - #snap_arch: armhf - - target: powerpc64le-unknown-linux-gnu # skip-pr skip-master - #snap_arch: ppc64el # skip-pr skip-master - - target: s390x-unknown-linux-gnu # skip-pr skip-master - #snap_arch: s390x # skip-pr skip-master - steps: - - name: Clone repo - uses: actions/checkout@v4 - with: - # v2 defaults to a shallow checkout, but we need at least to the previous tag - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - mkdir -p ~/.cargo/{registry,git} - - name: Set environment variables appropriately for the build - run: | - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using ./rustup-init.sh - run: | - sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y - - name: Ensure Stable is up to date - run: | - if rustc +stable -vV >/dev/null 2>/dev/null; then - rustup toolchain uninstall stable - fi - rustup toolchain install --profile=minimal stable - - name: Ensure we have our goal target installed - run: | - rustup target install "$TARGET" - - name: Determine which docker we need to run in - run: | - case "$TARGET" in - *-linux-android*) DOCKER=android ;; # Android uses a local docker image - *) DOCKER="$TARGET" ;; - esac - echo "DOCKER=$DOCKER" >> $GITHUB_ENV - - name: Fetch the base docker images from rust-lang/rust - run: bash ci/fetch-rust-docker.bash "${TARGET}" - - name: Maybe build a docker from there - run: | - if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then - docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . - fi - - name: Run the build within the docker image - env: - BUILD_PROFILE: ${{ matrix.mode }} - run: | - mkdir -p "${PWD}/target" - chown -R "$(id -u)":"$(id -g)" "${PWD}/target" - docker run \ - --entrypoint sh \ - --env BUILD_PROFILE="${BUILD_PROFILE}" \ - --env CARGO_HOME=/cargo \ - --env CARGO_TARGET_DIR=/checkout/target \ - --env LIBZ_SYS_STATIC=1 \ - --env SKIP_TESTS="${SKIP_TESTS}" \ - --env TARGET="${TARGET}" \ - --init \ - --rm \ - --tty \ - --user "$(id -u)":"$(id -g)" \ - --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ - --volume "${HOME}/.cargo:/cargo" \ - --volume "${PWD}":/checkout:ro \ - --volume "${PWD}"/target:/checkout/target \ - --workdir /checkout \ - "${DOCKER}" \ - -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - - name: Upload the built artifact - uses: actions/upload-artifact@v4 - if: matrix.mode == 'release' - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - pip3 install -U setuptools - pip3 install awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - bash ci/prepare-deploy.bash - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache diff --git a/.github/workflows/macos-builds-on-all.yaml b/.github/workflows/macos-builds-on-all.yaml deleted file mode 100644 index 95088e0ba0..0000000000 --- a/.github/workflows/macos-builds-on-all.yaml +++ /dev/null @@ -1,138 +0,0 @@ -# This is ci/actions-templates/macos-builds-template.yaml -# Do not edit this file in .github/workflows - -name: macOS -on: - pull_request: - branches: - - "*" - push: - branches: - - master - - stable - - renovate/* - schedule: - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC - -jobs: - build: - name: Build - runs-on: macos-latest - strategy: - matrix: - target: - - x86_64-apple-darwin - - aarch64-apple-darwin - mode: - - dev - - release - include: - - target: x86_64-apple-darwin - run_tests: YES - steps: - - uses: actions/checkout@v4 - with: - # v2 defaults to a shallow checkout, but we need at least to the previous tag - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - mkdir -p ~/.cargo/{registry,git} - - name: Set environment variables appropriately for the build - run: | - echo "$HOME/.cargo/bin" >> $GITHUB_PATH - echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - echo "SKIP_TESTS=" >> $GITHUB_ENV - echo "LZMA_API_STATIC=1" >> $GITHUB_ENV - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using ./rustup-init.sh - run: | - sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y - - name: Ensure Stable is up to date - run: | - if rustc +stable -vV >/dev/null 2>/dev/null; then - rustup toolchain uninstall stable - fi - rustup toolchain install --profile=minimal stable - - name: aarch64-specific items - run: | - # Use nightly for now - rustup toolchain install --profile=minimal nightly - rustup default nightly - if: matrix.target == 'aarch64-apple-darwin' - - name: Ensure we have our goal target installed - run: | - rustup target install "$TARGET" - - name: Run a full build and test - env: - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Dump dynamic link targets - if: matrix.mode == 'release' - run: | - otool -L target/${TARGET}/release/rustup-init - if otool -L target/${TARGET}/release/rustup-init | grep -q -F /usr/local/; then - echo >&2 "Unfortunately there are /usr/local things in the link. Fail." - exit 1 - fi - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - pip3 install awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - bash ci/prepare-deploy.bash - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache - - name: Flush cache - # This is a workaround for a bug with GitHub Actions Cache that causes - # corrupt cache entries (particularly in the target directory). See - # https://github.com/actions/cache/issues/403 and - # https://github.com/rust-lang/cargo/issues/8603. - run: sudo /usr/sbin/purge diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml deleted file mode 100644 index f590512933..0000000000 --- a/.github/workflows/windows-builds-on-master.yaml +++ /dev/null @@ -1,147 +0,0 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Windows (master) # skip-pr skip-stable - -on: - push: # skip-pr - branches: # skip-pr - - master # skip-pr skip-stable - schedule: # skip-pr skip-stable - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable - -jobs: - build: - name: Build - runs-on: windows-latest - env: - RUSTFLAGS: -Ctarget-feature=+crt-static - strategy: - fail-fast: false - matrix: - target: - - x86_64-pc-windows-msvc - - aarch64-pc-windows-msvc # skip-pr - - x86_64-pc-windows-gnu # skip-pr - mode: - - dev - - release - include: - - target: x86_64-pc-windows-msvc - run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - steps: - - uses: actions/checkout@v4 - # v2 defaults to a shallow checkout, but we need at least to the previous tag - with: - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force - New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force - shell: powershell - - name: Install mingw - run: | - # We retrieve mingw from the Rust CI buckets - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z - 7z x -y mingw.7z -oC:\msys64 | Out-Null - del mingw.7z - echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - shell: powershell - if: matrix.mingw != '' - - name: Set PATH - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - shell: bash - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using win.rustup.rs - run: | - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe - .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal - del rustup-init.exe - shell: powershell - - name: Ensure stable toolchain is up to date - run: rustup update stable - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run a full build - env: - TARGET: ${{ matrix.target }} - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Run cargo check and clippy - if: matrix.mode != 'release' - env: - TARGET: ${{ matrix.target }} - # os-specific code leads to lints escaping if we only run this in one target - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init.exe - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - choco upgrade awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - .\ci\prepare-deploy.ps1 - shell: powershell - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml deleted file mode 100644 index a61bfc51e0..0000000000 --- a/.github/workflows/windows-builds-on-pr.yaml +++ /dev/null @@ -1,141 +0,0 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Windows (PR) # skip-master skip-stable - -on: - pull_request: # skip-master skip-stable - branches: # skip-master skip-stable - - "*" # skip-master skip-stable - - renovate/* # skip-master skip-stable - -jobs: - build: - name: Build - runs-on: windows-latest - env: - RUSTFLAGS: -Ctarget-feature=+crt-static - strategy: - fail-fast: false - matrix: - target: - - x86_64-pc-windows-msvc - mode: - - dev - - release - include: - - target: x86_64-pc-windows-msvc - run_tests: YES - steps: - - uses: actions/checkout@v4 - # v2 defaults to a shallow checkout, but we need at least to the previous tag - with: - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force - New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force - shell: powershell - - name: Install mingw - run: | - # We retrieve mingw from the Rust CI buckets - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z - 7z x -y mingw.7z -oC:\msys64 | Out-Null - del mingw.7z - echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - shell: powershell - if: matrix.mingw != '' - - name: Set PATH - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - shell: bash - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using win.rustup.rs - run: | - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe - .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal - del rustup-init.exe - shell: powershell - - name: Ensure stable toolchain is up to date - run: rustup update stable - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run a full build - env: - TARGET: ${{ matrix.target }} - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Run cargo check and clippy - if: matrix.mode != 'release' - env: - TARGET: ${{ matrix.target }} - # os-specific code leads to lints escaping if we only run this in one target - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init.exe - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - choco upgrade awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - .\ci\prepare-deploy.ps1 - shell: powershell - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml deleted file mode 100644 index 8560cc5996..0000000000 --- a/.github/workflows/windows-builds-on-stable.yaml +++ /dev/null @@ -1,150 +0,0 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Windows (stable) # skip-master skip-pr - -on: - push: # skip-pr - branches: # skip-pr - - stable # skip-pr skip-master - -jobs: - build: - name: Build - runs-on: windows-latest - env: - RUSTFLAGS: -Ctarget-feature=+crt-static - strategy: - fail-fast: false - matrix: - target: - - x86_64-pc-windows-msvc - - i686-pc-windows-msvc # skip-pr skip-master - - aarch64-pc-windows-msvc # skip-pr - - x86_64-pc-windows-gnu # skip-pr - - i686-pc-windows-gnu # skip-pr skip-master - mode: - - dev - - release - include: - - target: x86_64-pc-windows-msvc - run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - - target: i686-pc-windows-gnu # skip-pr skip-master - mingwdir: mingw32 # skip-pr skip-master - mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master - steps: - - uses: actions/checkout@v4 - # v2 defaults to a shallow checkout, but we need at least to the previous tag - with: - fetch-depth: 0 - - name: Acquire tags for the repo - run: | - git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - - name: Display the current git status - run: | - git status - git describe - - name: Prep cargo dirs - run: | - New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force - New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force - shell: powershell - - name: Install mingw - run: | - # We retrieve mingw from the Rust CI buckets - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z - 7z x -y mingw.7z -oC:\msys64 | Out-Null - del mingw.7z - echo "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - shell: powershell - if: matrix.mingw != '' - - name: Set PATH - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - shell: bash - - name: Cache cargo registry and git trees - uses: actions/cache@v3 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - - name: Get rustc commit hash - id: cargo-target-cache - run: | - echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT - shell: bash - - name: Cache cargo build - uses: actions/cache@v3 - with: - path: target - key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install Rustup using win.rustup.rs - run: | - # Disable the download progress bar which can cause perf issues - $ProgressPreference = "SilentlyContinue" - Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe - .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal - del rustup-init.exe - shell: powershell - - name: Ensure stable toolchain is up to date - run: rustup update stable - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run a full build - env: - TARGET: ${{ matrix.target }} - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Run cargo check and clippy - if: matrix.mode != 'release' - env: - TARGET: ${{ matrix.target }} - # os-specific code leads to lints escaping if we only run this in one target - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init.exe - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - choco upgrade awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - .\ci\prepare-deploy.ps1 - shell: powershell - - name: Deploy build to dev-static dist tree for release team - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - aws --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist - env: - AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} - AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} - AWS_DEFAULT_REGION: us-west-1 - - name: Clear the cargo caches - run: | - cargo install cargo-cache --no-default-features --features ci-autoclean - cargo-cache diff --git a/.github/workflows/all-features.yaml b/ci/actions-templates/all-features-template.yaml similarity index 71% rename from .github/workflows/all-features.yaml rename to ci/actions-templates/all-features-template.yaml index ab4ac749b3..67693ba5d3 100644 --- a/.github/workflows/all-features.yaml +++ b/ci/actions-templates/all-features-template.yaml @@ -1,19 +1,15 @@ -name: AllFeatures (PR) +jobs: # skip-all -# This is an additional workflow to test building with all feature combinations. -# Unlike our main workflows, this doesn't self-test the rustup install scripts, -# nor run on the rust docker images. This permits a smaller workflow without the -# templating and so on. - -on: - pull_request: - branches: - - "*" - - renovate/* - -jobs: + # This is ci/actions-templates/all-features-template.yaml + # Do not edit this file in .github/workflows + # + # This is an additional workflow to test building with all feature combinations. + # Unlike our main workflows, this doesn't self-test the rustup install scripts, + # nor run on the rust docker images. This permits a smaller workflow without the + # templating and so on. build-all-features: runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index f75f37151a..f46136ae2d 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -1,23 +1,8 @@ -# This is ci/actions-templates/centos-fmt-clippy.yaml -# Do not edit this file in .github/workflows +jobs: # skip-all -name: General Checks - -on: - pull_request: - branches: - - "*" - push: - branches: - - master - - stable - - renovate/* - schedule: - - cron: "30 0 * * 1" # Every Monday at half past midnight - -jobs: + # This is ci/actions-templates/centos-fmt-clippy.yaml + # Do not edit this file in .github/workflows check: - name: Checks runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/ci/actions-templates/gen-workflows.sh b/ci/actions-templates/gen-workflows.sh index d9c12019d1..e82a5bc4ef 100755 --- a/ci/actions-templates/gen-workflows.sh +++ b/ci/actions-templates/gen-workflows.sh @@ -1,25 +1,43 @@ #!/bin/sh INPATH=$(dirname "$0") -OUTPATH="${INPATH}/../../.github/workflows" +OUTPATH="${INPATH}/../../.github/workflows/ci.yaml" -gen_workflow () { - grep -v "skip-$2" "$INPATH/$1-template.yaml" > "$OUTPATH/$1-on-$2.yaml" +gen_job () { + grep -v "skip-$2" "$INPATH/$1-template.yaml" >> "$OUTPATH" } -mkdir -p "$OUTPATH" - -# macOS only has a single target so single flow -gen_workflow macos-builds all - -gen_workflow windows-builds pr -gen_workflow windows-builds master -gen_workflow windows-builds stable - -gen_workflow linux-builds pr -gen_workflow linux-builds master -gen_workflow linux-builds stable - -# The clippy checks only have a single target and thus single flow -gen_workflow centos-fmt-clippy all - +cat << EOF > "$OUTPATH" +# GitHub Actions workflow generated by ci/actions-templates/gen-workflows.sh +# Do not edit this file in .github/workflows + +name: CI + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + - renovate/* + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight UTC + +jobs: +EOF + +gen_job windows-builds pr +gen_job windows-builds master +gen_job windows-builds stable + +gen_job linux-builds pr +gen_job linux-builds master +gen_job linux-builds stable + +# The following targets only have a single job +gen_job macos-builds all +gen_job centos-fmt-clippy all +gen_job all-features all +gen_job test-docs all diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index b6febedeb7..f7dd59216b 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -1,26 +1,14 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows +jobs: # skip-master skip-pr skip-stable -name: Linux (PR) # skip-master skip-stable -name: Linux (master) # skip-pr skip-stable -name: Linux (stable) # skip-master skip-pr - -on: - pull_request: # skip-master skip-stable - branches: # skip-master skip-stable - - "*" # skip-master skip-stable - push: # skip-pr - branches: # skip-pr - - master # skip-pr skip-stable - - stable # skip-pr skip-master - - renovate/* # skip-master skip-stable - schedule: # skip-pr skip-stable - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable - -jobs: - build: - name: Build + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-pr: # skip-master skip-stable + build-linux-master: # skip-pr skip-stable + build-linux-stable: # skip-master skip-pr runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml index 95088e0ba0..609541b3c8 100644 --- a/ci/actions-templates/macos-builds-template.yaml +++ b/ci/actions-templates/macos-builds-template.yaml @@ -1,22 +1,8 @@ -# This is ci/actions-templates/macos-builds-template.yaml -# Do not edit this file in .github/workflows +jobs: # skip-all -name: macOS -on: - pull_request: - branches: - - "*" - push: - branches: - - master - - stable - - renovate/* - schedule: - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC - -jobs: - build: - name: Build + # This is ci/actions-templates/macos-builds-template.yaml + # Do not edit this file in .github/workflows + build-macos: runs-on: macos-latest strategy: matrix: diff --git a/.github/workflows/test-docs.yaml b/ci/actions-templates/test-docs-template.yaml similarity index 65% rename from .github/workflows/test-docs.yaml rename to ci/actions-templates/test-docs-template.yaml index 3e20f1fe9b..640d466189 100644 --- a/.github/workflows/test-docs.yaml +++ b/ci/actions-templates/test-docs-template.yaml @@ -1,16 +1,13 @@ -name: Test build docs on PR +jobs: # skip-all -on: - pull_request: - branches: - - "*" - -# Builds docs for both stable and master branches. -# stable is placed in the root of the gh-pages branch, while master is placed at /devel - -jobs: + # This is ci/actions-templates/test-docs-templates.yaml + # Do not edit this file in .github/workflows + # + # Builds docs for both stable and master branches. + # stable is placed in the root of the gh-pages branch, while master is placed at /devel doc: runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} steps: - uses: actions/checkout@v4 with: diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index f7c81477c6..68d5194d18 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -1,26 +1,14 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows +jobs: # skip-master skip-pr skip-stable -name: Windows (PR) # skip-master skip-stable -name: Windows (master) # skip-pr skip-stable -name: Windows (stable) # skip-master skip-pr - -on: - pull_request: # skip-master skip-stable - branches: # skip-master skip-stable - - "*" # skip-master skip-stable - push: # skip-pr - branches: # skip-pr - - master # skip-pr skip-stable - - stable # skip-pr skip-master - - renovate/* # skip-master skip-stable - schedule: # skip-pr skip-stable - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable - -jobs: - build: - name: Build + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-pr: # skip-master skip-stable + build-windows-master: # skip-pr skip-stable + build-windows-stable: # skip-master skip-pr runs-on: windows-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: From 5ad6f5c1e8b686740a492c595b0dd416113bbac8 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 14 Dec 2023 14:37:02 +0800 Subject: [PATCH 201/229] refactor(ci): move `freebsd-builds` to GitHub Actions --- .cirrus.yml | 16 ---------- .github/workflows/ci.yaml | 29 ++++++++++++++++++ .../freebsd-builds-template.yaml | 30 +++++++++++++++++++ ci/actions-templates/gen-workflows.sh | 1 + ci/cirrus-templates/script.bash | 6 +--- 5 files changed, 61 insertions(+), 21 deletions(-) delete mode 100644 .cirrus.yml create mode 100644 ci/actions-templates/freebsd-builds-template.yaml diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index f07c6523c3..0000000000 --- a/.cirrus.yml +++ /dev/null @@ -1,16 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .cirrus.yml - -task: - name: FreeBSD - freebsd_instance: - image: freebsd-13-2-release-amd64 - setup_script: | - pkg install -y git gmake bash - echo "=========" - echo "create non-root user and log into it" - pw group add -n tester - pw user add -n tester -g tester -s `which bash` - pw user mod tester -d `pwd` - chown -R tester . - sudo -u tester bash ci/cirrus-templates/script.bash diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0404f9ebb5..31a23851cf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1019,6 +1019,35 @@ jobs: # https://github.com/rust-lang/cargo/issues/8603. run: sudo /usr/sbin/purge + # This is ci/actions-templates/freebsd-builds-template.yaml + # Do not edit this file in .github/workflows + build-freebsd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Run a full build + uses: vmactions/freebsd-vm@v1 + with: + release: 13.2 + usesh: true + copyback: false + prepare: | + pkg install -y git gmake bash sudo + run: | + echo "=========" + echo "create non-root user and log into it" + pw group add -n tester + pw user add -n tester -g tester -s `which bash` + pw user mod tester -d `pwd` + chown -R tester . + sudo -u tester bash ci/cirrus-templates/script.bash + # This is ci/actions-templates/centos-fmt-clippy.yaml # Do not edit this file in .github/workflows check: diff --git a/ci/actions-templates/freebsd-builds-template.yaml b/ci/actions-templates/freebsd-builds-template.yaml new file mode 100644 index 0000000000..c2921d0322 --- /dev/null +++ b/ci/actions-templates/freebsd-builds-template.yaml @@ -0,0 +1,30 @@ +jobs: # skip-all + + # This is ci/actions-templates/freebsd-builds-template.yaml + # Do not edit this file in .github/workflows + build-freebsd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + # v2 defaults to a shallow checkout, but we need at least to the previous tag + fetch-depth: 0 + - name: Acquire tags for the repo + run: | + git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* + - name: Run a full build + uses: vmactions/freebsd-vm@v1 + with: + release: 13.2 + usesh: true + copyback: false + prepare: | + pkg install -y git gmake bash sudo + run: | + echo "=========" + echo "create non-root user and log into it" + pw group add -n tester + pw user add -n tester -g tester -s `which bash` + pw user mod tester -d `pwd` + chown -R tester . + sudo -u tester bash ci/cirrus-templates/script.bash diff --git a/ci/actions-templates/gen-workflows.sh b/ci/actions-templates/gen-workflows.sh index e82a5bc4ef..f385f4989e 100755 --- a/ci/actions-templates/gen-workflows.sh +++ b/ci/actions-templates/gen-workflows.sh @@ -38,6 +38,7 @@ gen_job linux-builds stable # The following targets only have a single job gen_job macos-builds all +gen_job freebsd-builds all gen_job centos-fmt-clippy all gen_job all-features all gen_job test-docs all diff --git a/ci/cirrus-templates/script.bash b/ci/cirrus-templates/script.bash index 98a4bade0e..5cf833fa47 100644 --- a/ci/cirrus-templates/script.bash +++ b/ci/cirrus-templates/script.bash @@ -5,15 +5,11 @@ set -ex # First, we check that this script is not run as root because it would fail tests. if [ "root" == "$(whoami)" ]; then exit 1; fi -echo "=========" -echo "Acquire tags for the repo" - -git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - echo "=========" echo "Display the current git status" git status +git tag --list git describe echo "=========" From 10837c4c030242053a66141dc6f2388b0ffb8650 Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 15 Dec 2023 13:54:34 +0800 Subject: [PATCH 202/229] feat(ci): add `conclusion` job --- .github/workflows/ci.yaml | 49 ++++++++++++++----- .../all-features-template.yaml | 2 +- .../centos-fmt-clippy-template.yaml | 2 +- ci/actions-templates/conclusion-template.yaml | 17 +++++++ .../freebsd-builds-template.yaml | 2 +- ci/actions-templates/gen-workflows.sh | 5 ++ .../linux-builds-template.yaml | 6 +-- .../macos-builds-template.yaml | 2 +- ci/actions-templates/test-docs-template.yaml | 2 +- .../windows-builds-template.yaml | 6 +-- 10 files changed, 71 insertions(+), 22 deletions(-) create mode 100644 ci/actions-templates/conclusion-template.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 31a23851cf..7c8020eaa1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,7 +19,7 @@ jobs: # This is ci/actions-templates/windows-builds-template.yaml # Do not edit this file in .github/workflows - build-windows-pr: # skip-master skip-stable + build-windows-pr: # job-name skip-master skip-stable runs-on: windows-latest if: ${{ github.event.pull_request }} # skip-master skip-stable env: @@ -151,7 +151,7 @@ jobs: # This is ci/actions-templates/windows-builds-template.yaml # Do not edit this file in .github/workflows - build-windows-master: # skip-pr skip-stable + build-windows-master: # job-name skip-pr skip-stable runs-on: windows-latest if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable env: @@ -288,7 +288,7 @@ jobs: # This is ci/actions-templates/windows-builds-template.yaml # Do not edit this file in .github/workflows - build-windows-stable: # skip-master skip-pr + build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master env: @@ -430,7 +430,7 @@ jobs: # This is ci/actions-templates/linux-builds-template.yaml # Do not edit this file in .github/workflows - build-linux-pr: # skip-master skip-stable + build-linux-pr: # job-name skip-master skip-stable runs-on: ubuntu-latest if: ${{ github.event.pull_request }} # skip-master skip-stable strategy: @@ -574,7 +574,7 @@ jobs: # This is ci/actions-templates/linux-builds-template.yaml # Do not edit this file in .github/workflows - build-linux-master: # skip-pr skip-stable + build-linux-master: # job-name skip-pr skip-stable runs-on: ubuntu-latest if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable strategy: @@ -723,7 +723,7 @@ jobs: # This is ci/actions-templates/linux-builds-template.yaml # Do not edit this file in .github/workflows - build-linux-stable: # skip-master skip-pr + build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master strategy: @@ -898,7 +898,7 @@ jobs: # This is ci/actions-templates/macos-builds-template.yaml # Do not edit this file in .github/workflows - build-macos: + build-macos: # job-name runs-on: macos-latest strategy: matrix: @@ -1021,7 +1021,7 @@ jobs: # This is ci/actions-templates/freebsd-builds-template.yaml # Do not edit this file in .github/workflows - build-freebsd: + build-freebsd: # job-name runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -1050,7 +1050,7 @@ jobs: # This is ci/actions-templates/centos-fmt-clippy.yaml # Do not edit this file in .github/workflows - check: + check: # job-name runs-on: ubuntu-latest strategy: fail-fast: false @@ -1136,7 +1136,7 @@ jobs: # Unlike our main workflows, this doesn't self-test the rustup install scripts, # nor run on the rust docker images. This permits a smaller workflow without the # templating and so on. - build-all-features: + build-all-features: # job-name runs-on: ubuntu-latest if: ${{ github.event.pull_request }} strategy: @@ -1175,7 +1175,7 @@ jobs: # # Builds docs for both stable and master branches. # stable is placed in the root of the gh-pages branch, while master is placed at /devel - doc: + doc: # job-name runs-on: ubuntu-latest if: ${{ github.event.pull_request }} steps: @@ -1195,3 +1195,30 @@ jobs: run: | cd doc/dev-guide mdbook build + + # This is ci/actions-templates/conclusion-template.yaml + # Do not edit this file in .github/workflows + conclusion: + # https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472 + if: always() + runs-on: ubuntu-latest + steps: + - name: Result + run: | + jq -C <<< "${needs}" + # Check if all needs were successful or skipped. + "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" + env: + needs: ${{ toJson(needs) }} + needs: + - build-all-features + - check + - build-freebsd + - build-linux-pr + - build-linux-master + - build-linux-stable + - build-macos + - doc + - build-windows-pr + - build-windows-master + - build-windows-stable diff --git a/ci/actions-templates/all-features-template.yaml b/ci/actions-templates/all-features-template.yaml index 67693ba5d3..7e7bab0c21 100644 --- a/ci/actions-templates/all-features-template.yaml +++ b/ci/actions-templates/all-features-template.yaml @@ -7,7 +7,7 @@ jobs: # skip-all # Unlike our main workflows, this doesn't self-test the rustup install scripts, # nor run on the rust docker images. This permits a smaller workflow without the # templating and so on. - build-all-features: + build-all-features: # job-name runs-on: ubuntu-latest if: ${{ github.event.pull_request }} strategy: diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index f46136ae2d..c06496380e 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -2,7 +2,7 @@ jobs: # skip-all # This is ci/actions-templates/centos-fmt-clippy.yaml # Do not edit this file in .github/workflows - check: + check: # job-name runs-on: ubuntu-latest strategy: fail-fast: false diff --git a/ci/actions-templates/conclusion-template.yaml b/ci/actions-templates/conclusion-template.yaml new file mode 100644 index 0000000000..451398a093 --- /dev/null +++ b/ci/actions-templates/conclusion-template.yaml @@ -0,0 +1,17 @@ +jobs: # skip-all + + # This is ci/actions-templates/conclusion-template.yaml + # Do not edit this file in .github/workflows + conclusion: + # https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472 + if: always() + runs-on: ubuntu-latest + steps: + - name: Result + run: | + jq -C <<< "${needs}" + # Check if all needs were successful or skipped. + "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" + env: + needs: ${{ toJson(needs) }} + needs: diff --git a/ci/actions-templates/freebsd-builds-template.yaml b/ci/actions-templates/freebsd-builds-template.yaml index c2921d0322..16545891f7 100644 --- a/ci/actions-templates/freebsd-builds-template.yaml +++ b/ci/actions-templates/freebsd-builds-template.yaml @@ -2,7 +2,7 @@ jobs: # skip-all # This is ci/actions-templates/freebsd-builds-template.yaml # Do not edit this file in .github/workflows - build-freebsd: + build-freebsd: # job-name runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/ci/actions-templates/gen-workflows.sh b/ci/actions-templates/gen-workflows.sh index f385f4989e..abe8d1d385 100755 --- a/ci/actions-templates/gen-workflows.sh +++ b/ci/actions-templates/gen-workflows.sh @@ -42,3 +42,8 @@ gen_job freebsd-builds all gen_job centos-fmt-clippy all gen_job all-features all gen_job test-docs all + +# Finally, we generate the conclusion, +# adding all the `# job-name` jobs to the `needs` list. +gen_job conclusion all +cat "$INPATH"/*-template.yaml | perl -nE 'say " - $1" if (m/^\s*([\w-_]+)\s*:.*job-name.*$/)' >> "$OUTPATH" diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index f7dd59216b..7523a706ce 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -2,9 +2,9 @@ jobs: # skip-master skip-pr skip-stable # This is ci/actions-templates/linux-builds-template.yaml # Do not edit this file in .github/workflows - build-linux-pr: # skip-master skip-stable - build-linux-master: # skip-pr skip-stable - build-linux-stable: # skip-master skip-pr + build-linux-pr: # job-name skip-master skip-stable + build-linux-master: # job-name skip-pr skip-stable + build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest if: ${{ github.event.pull_request }} # skip-master skip-stable if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml index 609541b3c8..e80db22354 100644 --- a/ci/actions-templates/macos-builds-template.yaml +++ b/ci/actions-templates/macos-builds-template.yaml @@ -2,7 +2,7 @@ jobs: # skip-all # This is ci/actions-templates/macos-builds-template.yaml # Do not edit this file in .github/workflows - build-macos: + build-macos: # job-name runs-on: macos-latest strategy: matrix: diff --git a/ci/actions-templates/test-docs-template.yaml b/ci/actions-templates/test-docs-template.yaml index 640d466189..c17cd52193 100644 --- a/ci/actions-templates/test-docs-template.yaml +++ b/ci/actions-templates/test-docs-template.yaml @@ -5,7 +5,7 @@ jobs: # skip-all # # Builds docs for both stable and master branches. # stable is placed in the root of the gh-pages branch, while master is placed at /devel - doc: + doc: # job-name runs-on: ubuntu-latest if: ${{ github.event.pull_request }} steps: diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 68d5194d18..e8f2af7bfd 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -2,9 +2,9 @@ jobs: # skip-master skip-pr skip-stable # This is ci/actions-templates/windows-builds-template.yaml # Do not edit this file in .github/workflows - build-windows-pr: # skip-master skip-stable - build-windows-master: # skip-pr skip-stable - build-windows-stable: # skip-master skip-pr + build-windows-pr: # job-name skip-master skip-stable + build-windows-master: # job-name skip-pr skip-stable + build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest if: ${{ github.event.pull_request }} # skip-master skip-stable if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable From d39b3a87cfb64b8dd64572e4b1f72a09c16df395 Mon Sep 17 00:00:00 2001 From: rami3l Date: Sun, 17 Dec 2023 10:40:23 +0800 Subject: [PATCH 203/229] refactor(ci): disassemble and reorganize `ci/cirrus-templates` --- .github/workflows/ci.yaml | 2 +- .../freebsd-builds-template.yaml | 2 +- ci/cirrus-templates/freebsd.yaml | 16 ---------------- ci/cirrus-templates/gen-workflows.sh | 6 ------ ci/{cirrus-templates => freebsd}/script.bash | 0 5 files changed, 2 insertions(+), 24 deletions(-) delete mode 100644 ci/cirrus-templates/freebsd.yaml delete mode 100644 ci/cirrus-templates/gen-workflows.sh rename ci/{cirrus-templates => freebsd}/script.bash (100%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c8020eaa1..318fb34d69 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1046,7 +1046,7 @@ jobs: pw user add -n tester -g tester -s `which bash` pw user mod tester -d `pwd` chown -R tester . - sudo -u tester bash ci/cirrus-templates/script.bash + sudo -u tester bash ci/freebsd/script.bash # This is ci/actions-templates/centos-fmt-clippy.yaml # Do not edit this file in .github/workflows diff --git a/ci/actions-templates/freebsd-builds-template.yaml b/ci/actions-templates/freebsd-builds-template.yaml index 16545891f7..22e2aeab2a 100644 --- a/ci/actions-templates/freebsd-builds-template.yaml +++ b/ci/actions-templates/freebsd-builds-template.yaml @@ -27,4 +27,4 @@ jobs: # skip-all pw user add -n tester -g tester -s `which bash` pw user mod tester -d `pwd` chown -R tester . - sudo -u tester bash ci/cirrus-templates/script.bash + sudo -u tester bash ci/freebsd/script.bash diff --git a/ci/cirrus-templates/freebsd.yaml b/ci/cirrus-templates/freebsd.yaml deleted file mode 100644 index 7df435be07..0000000000 --- a/ci/cirrus-templates/freebsd.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .cirrus.yml - -task: - name: FreeBSD - freebsd_instance: - image: freebsd-13-0-release-amd64 - setup_script: | - pkg install -y git gmake bash - echo "=========" - echo "create non-root user and log into it" - pw group add -n tester - pw user add -n tester -g tester -s `which bash` - pw user mod tester -d `pwd` - chown -R tester . - sudo -u tester bash ci/cirrus-templates/script.bash diff --git a/ci/cirrus-templates/gen-workflows.sh b/ci/cirrus-templates/gen-workflows.sh deleted file mode 100644 index 14d130ee9f..0000000000 --- a/ci/cirrus-templates/gen-workflows.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -INPATH=$(dirname "$0") -OUTPATH="${INPATH}/../.." - -cp freebsd.yaml "$OUTPATH/.cirrus.yml" diff --git a/ci/cirrus-templates/script.bash b/ci/freebsd/script.bash similarity index 100% rename from ci/cirrus-templates/script.bash rename to ci/freebsd/script.bash From d67cc9834ee209946a4551e93bc2ae1f76fc359d Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 18 Dec 2023 18:31:55 +0800 Subject: [PATCH 204/229] feat(ci): add CI workflow generation checks --- .github/workflows/ci.yaml | 4 ++++ ci/actions-templates/centos-fmt-clippy-template.yaml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 318fb34d69..9291668283 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1067,6 +1067,10 @@ jobs: run: | git status git describe + - name: Run CI workflow generation checks + run: | + ./ci/actions-templates/gen-workflows.sh + git diff --quiet - name: Prep cargo dirs run: | mkdir -p ~/.cargo/{registry,git} diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index c06496380e..99482e56bc 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -19,6 +19,10 @@ jobs: # skip-all run: | git status git describe + - name: Run CI workflow generation checks + run: | + ./ci/actions-templates/gen-workflows.sh + git diff --quiet - name: Prep cargo dirs run: | mkdir -p ~/.cargo/{registry,git} From 578696b8cc4491fedaff028fbbe1e86515aadab3 Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 5 Jan 2024 00:31:46 +0800 Subject: [PATCH 205/229] fix(ci): use `github.event_name == 'push'` instead of `github.event.push` --- .github/workflows/ci.yaml | 8 ++++---- ci/actions-templates/linux-builds-template.yaml | 4 ++-- ci/actions-templates/windows-builds-template.yaml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9291668283..8bacbb3dbf 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -153,7 +153,7 @@ jobs: # Do not edit this file in .github/workflows build-windows-master: # job-name skip-pr skip-stable runs-on: windows-latest - if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: @@ -290,7 +290,7 @@ jobs: # Do not edit this file in .github/workflows build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest - if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: @@ -576,7 +576,7 @@ jobs: # Do not edit this file in .github/workflows build-linux-master: # job-name skip-pr skip-stable runs-on: ubuntu-latest - if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable strategy: fail-fast: false matrix: @@ -725,7 +725,7 @@ jobs: # Do not edit this file in .github/workflows build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest - if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 7523a706ce..6c6e083f56 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -7,8 +7,8 @@ jobs: # skip-master skip-pr skip-stable build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest if: ${{ github.event.pull_request }} # skip-master skip-stable - if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable - if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index e8f2af7bfd..816d2886c1 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -7,8 +7,8 @@ jobs: # skip-master skip-pr skip-stable build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest if: ${{ github.event.pull_request }} # skip-master skip-stable - if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable - if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: From e173cb9742f4e766e7591d7aadb64ddc2bd68db9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 20:14:27 +0000 Subject: [PATCH 206/229] chore(deps): update rust crate opentelemetry_sdk to v0.21.2 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e8fa4220fc..8157d68ce8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1419,9 +1419,9 @@ dependencies = [ [[package]] name = "opentelemetry_sdk" -version = "0.21.1" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968ba3f2ca03e90e5187f5e4f46c791ef7f2c163ae87789c8ce5f5ca3b7b7de5" +checksum = "2f16aec8a98a457a52664d69e0091bac3a0abd18ead9b641cb00202ba4e0efe4" dependencies = [ "async-trait", "crossbeam-channel", From 434e9747428fb5f58594ddf3a132fe407b7bb8af Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:40:55 +0000 Subject: [PATCH 207/229] fix(deps): update rust crate syn to v2.0.48 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8157d68ce8..d79fb88667 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -119,7 +119,7 @@ checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -560,7 +560,7 @@ checksum = "f282cfdfe92516eb26c2af8589c274c7c17681f5ecc03c18255fe741c6aa64eb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -572,7 +572,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -713,7 +713,7 @@ checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -790,7 +790,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", "time", ] @@ -1330,7 +1330,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1487,7 +1487,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -1936,7 +1936,7 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2043,7 +2043,7 @@ checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2207,9 +2207,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.47" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1726efe18f42ae774cc644f330953a5e7b3c3003d3edcecf18850fe9d4dd9afb" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -2313,7 +2313,7 @@ checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2414,7 +2414,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2600,7 +2600,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", ] [[package]] @@ -2826,7 +2826,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", "wasm-bindgen-shared", ] @@ -2860,7 +2860,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.47", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] From b3c97bfd34a3ca59d974177812348d5d834009a4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 4 Jan 2024 22:40:51 +0000 Subject: [PATCH 208/229] fix(deps): update rust crate clap to v4.4.13 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d79fb88667..1704235812 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -286,9 +286,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.12" +version = "4.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcfab8ba68f3668e89f6ff60f5b205cea56aa7b769451a59f34b8682f51c056d" +checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" dependencies = [ "clap_builder", ] From ff87e917e42234035b124679018adca1e0daa784 Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 5 Jan 2024 11:16:12 +0800 Subject: [PATCH 209/229] chore(deps): update `renovate.json` to remove version bumps covered by lockfile maintenance PRs, take 2 --- .github/renovate.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/renovate.json b/.github/renovate.json index ab0e036354..2aee782ed8 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -19,6 +19,21 @@ ] }, "packageRules": [ + { + "matchManagers": ["cargo"], + "enabled": false + }, + { + "matchManagers": ["cargo"], + "matchUpdateTypes": ["major"], + "enabled": true + }, + { + "matchManagers": ["cargo"], + "matchUpdateTypes": ["minor"], + "matchCurrentVersion": "/^0\\./", + "enabled": true + }, { "matchPackagePatterns": [ "opentelemetry" @@ -26,4 +41,4 @@ "groupName": "opentelemetry" } ] -} \ No newline at end of file +} From b2d3ad399668a5e7c04979e8a1712f75740e7c6a Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 5 Jan 2024 13:03:53 +0800 Subject: [PATCH 210/229] fix(ci): use `github.event_name == 'schedule'` instead of `github.event.schedule` --- .github/workflows/ci.yaml | 4 ++-- ci/actions-templates/linux-builds-template.yaml | 2 +- ci/actions-templates/windows-builds-template.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8bacbb3dbf..e31fc96ebc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -153,7 +153,7 @@ jobs: # Do not edit this file in .github/workflows build-windows-master: # job-name skip-pr skip-stable runs-on: windows-latest - if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: @@ -576,7 +576,7 @@ jobs: # Do not edit this file in .github/workflows build-linux-master: # job-name skip-pr skip-stable runs-on: ubuntu-latest - if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 6c6e083f56..3327122cf9 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -7,7 +7,7 @@ jobs: # skip-master skip-pr skip-stable build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest if: ${{ github.event.pull_request }} # skip-master skip-stable - if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master strategy: fail-fast: false diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 816d2886c1..7f6ff3a254 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -7,7 +7,7 @@ jobs: # skip-master skip-pr skip-stable build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest if: ${{ github.event.pull_request }} # skip-master skip-stable - if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static From ea29d33ec552f4ba8b662c01cc081af00a38c63b Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 5 Jan 2024 13:13:15 +0800 Subject: [PATCH 211/229] feat(ci): enable the `merge_group` trigger --- .github/workflows/ci.yaml | 1 + ci/actions-templates/gen-workflows.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e31fc96ebc..e4f3b96d05 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,6 +4,7 @@ name: CI on: + merge_group: pull_request: branches: - "*" diff --git a/ci/actions-templates/gen-workflows.sh b/ci/actions-templates/gen-workflows.sh index abe8d1d385..4b06f882c4 100755 --- a/ci/actions-templates/gen-workflows.sh +++ b/ci/actions-templates/gen-workflows.sh @@ -14,6 +14,7 @@ cat << EOF > "$OUTPATH" name: CI on: + merge_group: pull_request: branches: - "*" From 935a5f75817792361e2ab7ca43c32648527152ca Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 5 Jan 2024 13:08:39 +0800 Subject: [PATCH 212/229] feat(ci): configure `merge_queue` to be a PR-like event --- .github/workflows/ci.yaml | 8 ++++---- ci/actions-templates/all-features-template.yaml | 2 +- ci/actions-templates/linux-builds-template.yaml | 2 +- ci/actions-templates/test-docs-template.yaml | 2 +- ci/actions-templates/windows-builds-template.yaml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e4f3b96d05..18552233dd 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -22,7 +22,7 @@ jobs: # Do not edit this file in .github/workflows build-windows-pr: # job-name skip-master skip-stable runs-on: windows-latest - if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: @@ -433,7 +433,7 @@ jobs: # Do not edit this file in .github/workflows build-linux-pr: # job-name skip-master skip-stable runs-on: ubuntu-latest - if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable strategy: fail-fast: false matrix: @@ -1143,7 +1143,7 @@ jobs: # templating and so on. build-all-features: # job-name runs-on: ubuntu-latest - if: ${{ github.event.pull_request }} + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} strategy: fail-fast: false matrix: @@ -1182,7 +1182,7 @@ jobs: # stable is placed in the root of the gh-pages branch, while master is placed at /devel doc: # job-name runs-on: ubuntu-latest - if: ${{ github.event.pull_request }} + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} steps: - uses: actions/checkout@v4 with: diff --git a/ci/actions-templates/all-features-template.yaml b/ci/actions-templates/all-features-template.yaml index 7e7bab0c21..3bfaa054f3 100644 --- a/ci/actions-templates/all-features-template.yaml +++ b/ci/actions-templates/all-features-template.yaml @@ -9,7 +9,7 @@ jobs: # skip-all # templating and so on. build-all-features: # job-name runs-on: ubuntu-latest - if: ${{ github.event.pull_request }} + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 3327122cf9..6e027e9e40 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -6,7 +6,7 @@ jobs: # skip-master skip-pr skip-stable build-linux-master: # job-name skip-pr skip-stable build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest - if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master strategy: diff --git a/ci/actions-templates/test-docs-template.yaml b/ci/actions-templates/test-docs-template.yaml index c17cd52193..ca5a899323 100644 --- a/ci/actions-templates/test-docs-template.yaml +++ b/ci/actions-templates/test-docs-template.yaml @@ -7,7 +7,7 @@ jobs: # skip-all # stable is placed in the root of the gh-pages branch, while master is placed at /devel doc: # job-name runs-on: ubuntu-latest - if: ${{ github.event.pull_request }} + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} steps: - uses: actions/checkout@v4 with: diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index 7f6ff3a254..fa693dcc5e 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -6,7 +6,7 @@ jobs: # skip-master skip-pr skip-stable build-windows-master: # job-name skip-pr skip-stable build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest - if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ contains('["pull_request", "merge_group"]', github.event_name) }} # skip-master skip-stable if: ${{ (github.event_name == 'push' && github.ref_name == 'master') || github.event_name == 'schedule' }} # skip-pr skip-stable if: ${{ github.event_name == 'push' && github.ref_name == 'stable' }} # skip-pr skip-master env: From 752ed6e9adc84d73c3ca1a41250a789950efa933 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 16 Jan 2024 11:46:57 +0800 Subject: [PATCH 213/229] chore(deps): update `renovate.json` to remove version bumps covered by lockfile maintenance PRs, take 3 --- .github/renovate.json | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/renovate.json b/.github/renovate.json index 2aee782ed8..a4f6cd96ca 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -21,18 +21,14 @@ "packageRules": [ { "matchManagers": ["cargo"], + "matchUpdateTypes": ["patch"], "enabled": false }, - { - "matchManagers": ["cargo"], - "matchUpdateTypes": ["major"], - "enabled": true - }, { "matchManagers": ["cargo"], "matchUpdateTypes": ["minor"], - "matchCurrentVersion": "/^0\\./", - "enabled": true + "matchCurrentVersion": "!/^0/", + "enabled": false }, { "matchPackagePatterns": [ From 2549431c00361c14a46ff8717ea851a1e09c5727 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:11:03 +0000 Subject: [PATCH 214/229] fix(deps): update rust crate strsim to 0.11 --- Cargo.lock | 10 ++++++++-- Cargo.toml | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1704235812..7101aa596e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -302,7 +302,7 @@ dependencies = [ "anstream", "anstyle", "clap_lex", - "strsim", + "strsim 0.10.0", "terminal_size", ] @@ -1908,7 +1908,7 @@ dependencies = [ "serde", "sha2", "sharded-slab", - "strsim", + "strsim 0.11.0", "tar", "tempfile", "termcolor", @@ -2194,6 +2194,12 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +[[package]] +name = "strsim" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee073c9e4cd00e28217186dbe12796d692868f432bf2e97ee73bed0c56dfa01" + [[package]] name = "syn" version = "1.0.109" diff --git a/Cargo.toml b/Cargo.toml index 2a84c608d2..bdf020478f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,7 @@ semver = "1.0" serde = { version = "1.0", features = ["derive"] } sha2 = "0.10" sharded-slab = "0.1.1" -strsim = "0.10" +strsim = "0.11" tar = "0.4.26" tempfile.workspace = true termcolor.workspace = true From 469d6a8f88f6287f61a74f0c109336f2e097ebaf Mon Sep 17 00:00:00 2001 From: Tianqi Date: Wed, 17 Jan 2024 03:21:59 +0800 Subject: [PATCH 215/229] www: detect RISC-V 64 platform --- www/rustup.js | 1 + 1 file changed, 1 insertion(+) diff --git a/www/rustup.js b/www/rustup.js index 03094cb06b..86558782d5 100644 --- a/www/rustup.js +++ b/www/rustup.js @@ -23,6 +23,7 @@ function detect_platform() { if (navigator.platform == "Linux ppc64") {os = "unix";} if (navigator.platform == "Linux mips") {os = "unix";} if (navigator.platform == "Linux mips64") {os = "unix";} + if (navigator.platform == "Linux riscv64") {os = "unix";} if (navigator.platform == "Mac") {os = "unix";} if (navigator.platform == "Win32") {os = "win32";} if (navigator.platform == "Win64" || From 8231e9a5d9c47c80002ba8ac4dd7e5af912c5945 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 15 Jan 2024 14:11:57 +0800 Subject: [PATCH 216/229] refactor(toolchain): extract `DistributableToolchain::components()` --- src/cli/common.rs | 7 +------ src/toolchain/distributable.rs | 7 +++++++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/cli/common.rs b/src/cli/common.rs index 9a85aca25b..20cbe7d1e1 100644 --- a/src/cli/common.rs +++ b/src/cli/common.rs @@ -448,12 +448,7 @@ pub(crate) fn list_components( pub(crate) fn list_installed_components(distributable: DistributableToolchain<'_>) -> Result<()> { let t = process().stdout(); - let manifestation = distributable.get_manifestation()?; - let config = manifestation.read_config()?.unwrap_or_default(); - let manifest = distributable.get_manifest()?; - let components = manifest.query_components(distributable.desc(), &config)?; - - for component in components { + for component in distributable.components()? { if component.installed { writeln!(t.lock(), "{}", component.name)?; } diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index d5aeadb8dc..8bc77901c2 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -115,6 +115,13 @@ impl<'a> DistributableToolchain<'a> { Ok(()) } + pub(crate) fn components(&self) -> anyhow::Result> { + let manifestation = self.get_manifestation()?; + let config = manifestation.read_config()?.unwrap_or_default(); + let manifest = self.get_manifest()?; + manifest.query_components(self.desc(), &config) + } + /// Are all the components installed in this distribution pub(crate) fn components_exist( &self, From edfaf094875584ba0bcdaf4d88f9ddaf5064a978 Mon Sep 17 00:00:00 2001 From: rami3l Date: Mon, 15 Jan 2024 14:59:14 +0800 Subject: [PATCH 217/229] feat(cli): warn when removing the last/host target for a toolchain --- Cargo.lock | 12 +++++++++++- Cargo.toml | 1 + src/cli/rustup_mode.rs | 23 ++++++++++++++++++----- tests/suite/cli_v2.rs | 26 ++++++++++++++++++++++++-- 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7101aa596e..ba86498de7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1074,6 +1074,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -1566,7 +1575,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -1887,6 +1896,7 @@ dependencies = [ "fs_at", "git-testament", "home", + "itertools 0.12.0", "libc", "once_cell", "opener", diff --git a/Cargo.toml b/Cargo.toml index bdf020478f..c3097e174b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -57,6 +57,7 @@ flate2 = "1" fs_at.workspace = true git-testament = "0.2" home = "0.5.4" +itertools = "0.12" libc = "0.2" once_cell.workspace = true opener = "0.6.0" diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 8281e77ebe..189899561c 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -10,6 +10,7 @@ use clap::{ Arg, ArgAction, ArgGroup, ArgMatches, Command, ValueEnum, }; use clap_complete::Shell; +use itertools::Itertools; use crate::{ cli::{ @@ -1334,11 +1335,23 @@ fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { let distributable = DistributableToolchain::try_from(&toolchain)?; for target in m.get_many::("target").unwrap() { - let new_component = Component::new( - "rust-std".to_string(), - Some(TargetTriple::new(target)), - false, - ); + let target = TargetTriple::new(target); + let default_target = cfg.get_default_host_triple()?; + if target == default_target { + warn!("after removing the default host target, proc-macros and build scripts might no longer build"); + } + let has_at_most_one_target = { + let components = distributable.components()?; + // Every component target that is not `None` (wildcard). + let targets = components + .iter() + .filter_map(|c| c.installed.then(|| c.component.target.clone()).flatten()); + targets.unique().at_most_one().is_ok() + }; + if has_at_most_one_target { + warn!("after removing the last target, no build targets will be available"); + } + let new_component = Component::new("rust-std".to_string(), Some(target), false); distributable.remove_component(new_component)?; } diff --git a/tests/suite/cli_v2.rs b/tests/suite/cli_v2.rs index 563e6609fc..81ba41e75d 100644 --- a/tests/suite/cli_v2.rs +++ b/tests/suite/cli_v2.rs @@ -952,9 +952,31 @@ fn remove_target_again() { #[test] fn remove_target_host() { setup(&|config| { - let trip = this_host_triple(); + let host = this_host_triple(); config.expect_ok(&["rustup", "default", "nightly"]); - config.expect_ok(&["rustup", "target", "remove", &trip]); + config.expect_ok(&["rustup", "target", "add", clitools::CROSS_ARCH1]); + config.expect_stderr_ok( + &["rustup", "target", "remove", &host], + "after removing the default host target, proc-macros and build scripts might no longer build", + ); + let path = format!("toolchains/nightly-{host}/lib/rustlib/{host}/lib/libstd.rlib"); + assert!(!config.rustupdir.has(path)); + let path = format!("toolchains/nightly-{host}/lib/rustlib/{host}/lib"); + assert!(!config.rustupdir.has(path)); + let path = format!("toolchains/nightly-{host}/lib/rustlib/{host}"); + assert!(!config.rustupdir.has(path)); + }); +} + +#[test] +fn remove_target_last() { + setup(&|config| { + let host = this_host_triple(); + config.expect_ok(&["rustup", "default", "nightly"]); + config.expect_stderr_ok( + &["rustup", "target", "remove", &host], + "after removing the last target, no build targets will be available", + ); }); } From 0bfdb38dd8b14d86662dbc492fa189606ae73c83 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 18 Jan 2024 18:01:04 +0800 Subject: [PATCH 218/229] refactor(cli): avoid nested combinators in `has_at_most_one_target` --- src/cli/rustup_mode.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 189899561c..4c92cfab6f 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -1340,14 +1340,17 @@ fn target_remove(cfg: &Cfg, m: &ArgMatches) -> Result { if target == default_target { warn!("after removing the default host target, proc-macros and build scripts might no longer build"); } - let has_at_most_one_target = { - let components = distributable.components()?; - // Every component target that is not `None` (wildcard). - let targets = components - .iter() - .filter_map(|c| c.installed.then(|| c.component.target.clone()).flatten()); - targets.unique().at_most_one().is_ok() - }; + // Whether we have at most 1 component target that is not `None` (wildcard). + let has_at_most_one_target = distributable + .components()? + .into_iter() + .filter_map(|c| match (c.installed, c.component.target) { + (true, Some(t)) => Some(t), + _ => None, + }) + .unique() + .at_most_one() + .is_ok(); if has_at_most_one_target { warn!("after removing the last target, no build targets will be available"); } From 10d093fb5267e280b2636cbce21389226b904df8 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 18 Jan 2024 18:03:28 +0800 Subject: [PATCH 219/229] refactor(distributable): import `ComponentStatus` --- src/toolchain/distributable.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/toolchain/distributable.rs b/src/toolchain/distributable.rs index 8bc77901c2..a22b026739 100644 --- a/src/toolchain/distributable.rs +++ b/src/toolchain/distributable.rs @@ -10,7 +10,7 @@ use crate::{ dist::{ config::Config, dist::{Profile, ToolchainDesc}, - manifest::{Component, Manifest}, + manifest::{Component, ComponentStatus, Manifest}, manifestation::{Changes, Manifestation}, prefix::InstallPrefix, }, @@ -115,7 +115,7 @@ impl<'a> DistributableToolchain<'a> { Ok(()) } - pub(crate) fn components(&self) -> anyhow::Result> { + pub(crate) fn components(&self) -> anyhow::Result> { let manifestation = self.get_manifestation()?; let config = manifestation.read_config()?.unwrap_or_default(); let manifest = self.get_manifest()?; From 0a72c68e38312bfe802bc7792afbcb933a27e175 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 18 Jan 2024 18:06:51 +0800 Subject: [PATCH 220/229] refactor: simplify `is_proxyable_tools` --- src/lib.rs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index af9875c969..b5215ea09f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -16,6 +16,7 @@ pub use crate::errors::*; pub(crate) use crate::notifications::*; pub(crate) use crate::utils::toml_utils; use anyhow::{anyhow, Result}; +use itertools::{chain, Itertools}; #[macro_use] extern crate rs_tracing; @@ -41,23 +42,15 @@ pub static DUP_TOOLS: &[&str] = &["rust-analyzer", "rustfmt", "cargo-fmt"]; // If the given name is one of the tools we proxy. pub fn is_proxyable_tools(tool: &str) -> Result<()> { - if TOOLS - .iter() - .chain(DUP_TOOLS.iter()) - .any(|&name| name == tool) - { + if chain!(TOOLS, DUP_TOOLS).contains(&tool) { Ok(()) } else { - Err(anyhow!(format!( - "unknown proxy name: '{}'; valid proxy names are {}", - tool, - TOOLS - .iter() - .chain(DUP_TOOLS.iter()) + Err(anyhow!( + "unknown proxy name: '{tool}'; valid proxy names are {}", + chain!(TOOLS, DUP_TOOLS) .map(|s| format!("'{s}'")) - .collect::>() - .join(", ") - ))) + .join(", "), + )) } } From ee2ffb761685ecbeb755f8b28cbcb5fe35bc8e19 Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 19 Jan 2024 19:19:51 +0800 Subject: [PATCH 221/229] refactor(names): replace `maybe_official_toolchainame_parser` with `impl FromStr` --- src/cli/setup_mode.rs | 6 +++--- src/toolchain/names.rs | 17 ++++++++--------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index 39a1368774..cc48172271 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -1,5 +1,5 @@ use anyhow::Result; -use clap::{builder::PossibleValuesParser, Arg, ArgAction, Command}; +use clap::{builder::PossibleValuesParser, value_parser, Arg, ArgAction, Command}; use crate::{ cli::{ @@ -9,7 +9,7 @@ use crate::{ currentprocess::{argsource::ArgSource, filesource::StdoutSource}, dist::dist::Profile, process, - toolchain::names::{maybe_official_toolchainame_parser, MaybeOfficialToolchainName}, + toolchain::names::MaybeOfficialToolchainName, utils::utils, }; @@ -66,7 +66,7 @@ pub fn main() -> Result { .long("default-toolchain") .num_args(1) .help("Choose a default toolchain to install. Use 'none' to not install any toolchains at all") - .value_parser(maybe_official_toolchainame_parser) + .value_parser(value_parser!(MaybeOfficialToolchainName)) ) .arg( Arg::new("profile") diff --git a/src/toolchain/names.rs b/src/toolchain/names.rs index 37b1819788..cbae1669ed 100644 --- a/src/toolchain/names.rs +++ b/src/toolchain/names.rs @@ -95,6 +95,14 @@ macro_rules! try_from_str { $to::validate(&value) } } + + impl FromStr for $to { + type Err = InvalidName; + + fn from_str(value: &str) -> std::result::Result { + $to::validate(value) + } + } }; ($from:ty, $to:ident) => { impl TryFrom<$from> for $to { @@ -264,15 +272,6 @@ impl Display for MaybeOfficialToolchainName { } } -/// Thunk to avoid errors like -/// = note: `fn(&'2 str) -> Result>::Error> {>::try_from}` must implement `FnOnce<(&'1 str,)>`, for any lifetime `'1`... -/// = note: ...but it actually implements `FnOnce<(&'2 str,)>`, for some specific lifetime `'2` -pub(crate) fn maybe_official_toolchainame_parser( - value: &str, -) -> Result { - MaybeOfficialToolchainName::try_from(value) -} - /// ToolchainName can be used in calls to Cfg that alter configuration, /// like setting overrides, or that depend on configuration, like calculating /// the toolchain directory. From 9955b9f889889a495b380e73709db5480c6a656b Mon Sep 17 00:00:00 2001 From: rami3l Date: Fri, 19 Jan 2024 19:33:30 +0800 Subject: [PATCH 222/229] refactor(cli): simplify case splitting on `clap::error::ErrorKind` --- src/cli/setup_mode.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/cli/setup_mode.rs b/src/cli/setup_mode.rs index cc48172271..cada019e5a 100644 --- a/src/cli/setup_mode.rs +++ b/src/cli/setup_mode.rs @@ -15,6 +15,8 @@ use crate::{ #[cfg_attr(feature = "otel", tracing::instrument)] pub fn main() -> Result { + use clap::error::ErrorKind; + let args: Vec<_> = process().args().collect(); let arg1 = args.get(1).map(|a| &**a); @@ -107,10 +109,7 @@ pub fn main() -> Result { let matches = match cli.try_get_matches_from(process().args_os()) { Ok(matches) => matches, - Err(e) - if e.kind() == clap::error::ErrorKind::DisplayHelp - || e.kind() == clap::error::ErrorKind::DisplayVersion => - { + Err(e) if [ErrorKind::DisplayHelp, ErrorKind::DisplayVersion].contains(&e.kind()) => { write!(process().stdout().lock(), "{e}")?; return Ok(utils::ExitCode(0)); } From c6f81da2090b1e104254583c9fb5b6297637cdec Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 20 Jan 2024 18:29:21 +0000 Subject: [PATCH 223/229] chore(deps): update actions/cache action to v4 --- .github/workflows/ci.yaml | 32 +++++++++---------- .../centos-fmt-clippy-template.yaml | 4 +-- .../linux-builds-template.yaml | 4 +-- .../macos-builds-template.yaml | 4 +-- .../windows-builds-template.yaml | 4 +-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 18552233dd..91772c0c24 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -75,7 +75,7 @@ jobs: echo "SKIP_TESTS=yes" >> $GITHUB_ENV shell: bash - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -87,7 +87,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -212,7 +212,7 @@ jobs: echo "SKIP_TESTS=yes" >> $GITHUB_ENV shell: bash - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -224,7 +224,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -354,7 +354,7 @@ jobs: echo "SKIP_TESTS=yes" >> $GITHUB_ENV shell: bash - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -366,7 +366,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -475,7 +475,7 @@ jobs: run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -487,7 +487,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -624,7 +624,7 @@ jobs: run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -636,7 +636,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -799,7 +799,7 @@ jobs: run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -811,7 +811,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -938,7 +938,7 @@ jobs: run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -950,7 +950,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} @@ -1079,7 +1079,7 @@ jobs: run: | echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -1091,7 +1091,7 @@ jobs: echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index 99482e56bc..2a54fae4b3 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -30,7 +30,7 @@ jobs: # skip-all run: | echo "$HOME/.cargo/bin" >> $GITHUB_PATH - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -42,7 +42,7 @@ jobs: # skip-all echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index 6e027e9e40..8c6041378f 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -81,7 +81,7 @@ jobs: # skip-master skip-pr skip-stable run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -93,7 +93,7 @@ jobs: # skip-master skip-pr skip-stable echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml index e80db22354..7c18561570 100644 --- a/ci/actions-templates/macos-builds-template.yaml +++ b/ci/actions-templates/macos-builds-template.yaml @@ -41,7 +41,7 @@ jobs: # skip-all run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -53,7 +53,7 @@ jobs: # skip-all echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index fa693dcc5e..74d6366415 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -71,7 +71,7 @@ jobs: # skip-master skip-pr skip-stable echo "SKIP_TESTS=yes" >> $GITHUB_ENV shell: bash - name: Cache cargo registry and git trees - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: | ~/.cargo/registry @@ -83,7 +83,7 @@ jobs: # skip-master skip-pr skip-stable echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT shell: bash - name: Cache cargo build - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} From 7cbc3c9f4a946a1e78c99ba8986a4c7c51c083df Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 22 Jan 2024 23:39:16 +0000 Subject: [PATCH 224/229] chore(deps): lock file maintenance --- Cargo.lock | 338 ++++++++++++++++++++++++----------------------------- 1 file changed, 154 insertions(+), 184 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba86498de7..f4ef959e48 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -37,9 +37,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "async-compression" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc2d0cfb2a7388d34f590e76686704c494ed7aaceed62ee1ba35cbf363abc2a5" +checksum = "a116f46a969224200a0a97f29cfd4c50e7534e4b4826bd23ea2c3c533039c82c" dependencies = [ "flate2", "futures-core", @@ -113,9 +113,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", @@ -141,7 +141,7 @@ dependencies = [ "futures-util", "http 0.2.11", "http-body 0.4.6", - "hyper 0.14.27", + "hyper 0.14.28", "itoa", "matchit", "memchr", @@ -190,9 +190,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bit-set" @@ -217,9 +217,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "block-buffer" @@ -232,12 +232,12 @@ dependencies = [ [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "serde", ] @@ -277,27 +277,27 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "41daef31d7a747c5c847246f36de49ced6f7403b4cdabc807a97b5cc184cda7a" dependencies = [ "num-traits", ] [[package]] name = "clap" -version = "4.4.13" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52bdc885e4cacc7f7c9eedc1ef6da641603180c783c41a15c264944deeaab642" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", ] [[package]] name = "clap_builder" -version = "4.4.12" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7fb5e4e979aec3be7791562fcba452f94ad85e954da024396433e0e25a79e9" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -308,9 +308,9 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.4.6" +version = "4.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97aeaa95557bd02f23fbb662f981670c3d20c5a26e69f7354b28f57092437fcd" +checksum = "df631ae429f6613fcd3a7c1adbdb65f637271e561b03680adaa6573015dfb106" dependencies = [ "clap", ] @@ -354,9 +354,9 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -372,45 +372,37 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c3242926edf34aec4ac3a77108ad4854bffaa2e4ddc1824124ce59231302d5" +checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" dependencies = [ - "cfg-if 1.0.0", "crossbeam-utils", ] [[package]] name = "crossbeam-deque" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fca89a0e215bab21874660c67903c5f143333cab1da83d041c7ded6053774751" +checksum = "613f8cc01fe9cf1a3eb3d7f488fd2fa8388403e97039e2f73692932e291a770d" dependencies = [ - "cfg-if 1.0.0", "crossbeam-epoch", "crossbeam-utils", ] [[package]] name = "crossbeam-epoch" -version = "0.9.16" +version = "0.9.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2fe95351b870527a5d09bf563ed3c97c0cffb87cf1c78a591bf48bb218d9aa" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" dependencies = [ - "autocfg", - "cfg-if 1.0.0", "crossbeam-utils", - "memoffset", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if 1.0.0", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-common" @@ -463,9 +455,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.10" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eb30d70a07a3b04884d2677f06bec33509dc67ca60d92949e5535352d3191dc" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", ] @@ -675,24 +667,24 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -701,15 +693,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", @@ -718,21 +710,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-core", "futures-io", @@ -757,9 +749,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if 1.0.0", "libc", @@ -802,9 +794,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.22" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -833,9 +825,9 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "5d3d0e0f38255e7fa3cf31335b3a56f05febd18025f4db5ef7a0cfb4f8da651f" [[package]] name = "home" @@ -932,9 +924,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -947,7 +939,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -980,7 +972,7 @@ checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" dependencies = [ "futures-util", "http 0.2.11", - "hyper 0.14.27", + "hyper 0.14.28", "rustls", "tokio", "tokio-rustls", @@ -992,7 +984,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" dependencies = [ - "hyper 0.14.27", + "hyper 0.14.28", "pin-project-lite", "tokio", "tokio-io-timeout", @@ -1005,7 +997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6183ddfa99b85da61a140bea0efc93fdf56ceaa041b37d553518030827f9905" dependencies = [ "bytes", - "hyper 0.14.27", + "hyper 0.14.28", "native-tls", "tokio", "tokio-native-tls", @@ -1100,9 +1092,9 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" dependencies = [ "wasm-bindgen", ] @@ -1115,9 +1107,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libm" @@ -1127,9 +1119,9 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "libz-sys" -version = "1.1.12" +version = "1.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" +checksum = "295c17e837573c8c821dbaeb3cceb3d745ad082f7572191409e69cbc1b3fd050" dependencies = [ "cc", "libc", @@ -1139,9 +1131,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "log" @@ -1177,18 +1169,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1292,9 +1275,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -1318,11 +1301,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.62" +version = "0.10.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" +checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "cfg-if 1.0.0", "foreign-types", "libc", @@ -1359,9 +1342,9 @@ dependencies = [ [[package]] name = "openssl-sys" -version = "0.9.98" +version = "0.9.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" +checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" dependencies = [ "cc", "libc", @@ -1459,12 +1442,12 @@ dependencies = [ [[package]] name = "os_pipe" -version = "1.1.4" +version = "1.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ae859aa07428ca9a929b936690f8b12dc5f11dd8c6992a18ca93919f28bc177" +checksum = "57119c3b893986491ec9aa85056780d3a0f3cf4da7cc09dd3650dbd6c6738fb9" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1513,9 +1496,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "powerfmt" @@ -1531,9 +1514,9 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "proc-macro2" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "907a61bd0f64c2f29cd1cf1dc34d05176426a3f504a78010f08416ddb7b13708" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ "unicode-ident", ] @@ -1546,7 +1529,7 @@ checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.1", + "bitflags 2.4.2", "lazy_static", "num-traits", "rand", @@ -1648,9 +1631,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -1658,9 +1641,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -1677,13 +1660,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.3", + "regex-automata 0.4.4", "regex-syntax 0.8.2", ] @@ -1698,9 +1681,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" dependencies = [ "aho-corasick", "memchr", @@ -1751,7 +1734,7 @@ dependencies = [ "h2", "http 0.2.11", "http-body 0.4.6", - "hyper 0.14.27", + "hyper 0.14.28", "hyper-rustls", "hyper-tls", "ipnet", @@ -1823,11 +1806,11 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.28" +version = "0.38.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72e572a5e8ca657d7366229cdde4bd14c4eb5499a9573d4d366fe1b599daa316" +checksum = "322394588aaf33c24007e8bb3238ee3e4c5c09c084ab32bc73890b99ff326bca" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", @@ -1984,11 +1967,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2038,18 +2021,18 @@ checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b114498256798c94a0689e1a15fec6005dee8ac1f41de56404b67afc2a4b773" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.194" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3385e45322e8f9931410f01b3031ec534c3947d0e94c18049af4d9f9907d4e0" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", @@ -2058,9 +2041,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -2069,9 +2052,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -2110,15 +2093,15 @@ dependencies = [ [[package]] name = "shlex" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "similar" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aeaf503862c419d66959f5d7ca015337d864e9c49485d771b732e2a20453597" +checksum = "32fea41aca09ee824cc9724996433064c89f7777e60762749a4170a14abbfa21" [[package]] name = "slab" @@ -2131,15 +2114,15 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "snapbox" -version = "0.4.15" +version = "0.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4f1976ee8fd1be27d5f72c98be0aac4397a882a4736935d47418a5fbbd12042" +checksum = "73145a30df4935f50a7b13c1882bce7d194d7071ad0bcc36e7cacbf9ef16e3ec" dependencies = [ "anstream", "anstyle", @@ -2159,9 +2142,9 @@ dependencies = [ [[package]] name = "snapbox-macros" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed1559baff8a696add3322b9be3e940d433e7bb4e38d79017205fd37ff28b28e" +checksum = "78ccde059aad940984ff696fe8c280900f7ea71a6fb45fce65071a3f2c40b667" dependencies = [ "anstream", ] @@ -2295,9 +2278,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -2353,9 +2336,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -2373,9 +2356,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -2499,7 +2482,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.21.0", + "toml_edit", ] [[package]] @@ -2511,19 +2494,6 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.1.0", - "serde", - "serde_spanned", - "toml_datetime", - "winnow", -] - [[package]] name = "toml_edit" version = "0.21.0" @@ -2552,7 +2522,7 @@ dependencies = [ "h2", "http 0.2.11", "http-body 0.4.6", - "hyper 0.14.27", + "hyper 0.14.28", "hyper-timeout", "percent-encoding", "pin-project", @@ -2684,9 +2654,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trycmd" -version = "0.14.19" +version = "0.14.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed009372a42fb103e6f8767b9222925485e03cca032b700d203e2c5b67bee4fb" +checksum = "b7ad3a033f38ca4d9eedf36ba792622027119c61b62b57970c5bed42cfd0c40d" dependencies = [ "glob", "humantime", @@ -2695,7 +2665,7 @@ dependencies = [ "serde", "shlex", "snapbox", - "toml_edit 0.20.7", + "toml_edit", ] [[package]] @@ -2721,9 +2691,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" +checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" @@ -2823,9 +2793,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -2833,9 +2803,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -2848,9 +2818,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.39" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" +checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" dependencies = [ "cfg-if 1.0.0", "js-sys", @@ -2860,9 +2830,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2870,9 +2840,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -2883,15 +2853,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "web-sys" -version = "0.3.66" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" +checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" dependencies = [ "js-sys", "wasm-bindgen", @@ -2899,9 +2869,9 @@ dependencies = [ [[package]] name = "web-time" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57099a701fb3a8043f993e8228dc24229c7b942e2b009a1b962e54489ba1d3bf" +checksum = "aa30049b1c872b72c89866d458eae9f20380ab280ffd1b1e18df2d3e2d98cfe0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3138,9 +3108,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.28" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c830786f7720c2fd27a1a0e27a709dbd3c4d009b56d098fc742d4f4eab91fe2" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] @@ -3167,9 +3137,9 @@ dependencies = [ [[package]] name = "xattr" -version = "1.1.3" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dae5072fe1f8db8f8d29059189ac175196e410e40ba42d5d4684ae2f750995" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", "linux-raw-sys", From 1b400b4e928df9b30d1c25512d469f6461638a05 Mon Sep 17 00:00:00 2001 From: rami3l Date: Tue, 23 Jan 2024 13:18:53 +0800 Subject: [PATCH 225/229] chore: disable some unix-only helper functions on Windows --- src/cli/rustup_mode.rs | 8 +++++--- src/dist/dist.rs | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/cli/rustup_mode.rs b/src/cli/rustup_mode.rs index 4c92cfab6f..e7682d1be1 100644 --- a/src/cli/rustup_mode.rs +++ b/src/cli/rustup_mode.rs @@ -1,7 +1,6 @@ use std::fmt; use std::io::Write; use std::path::{Path, PathBuf}; -use std::process; use std::str::FromStr; use anyhow::{anyhow, Error, Result}; @@ -24,7 +23,6 @@ use crate::{ currentprocess::{ argsource::ArgSource, filesource::{StderrSource, StdoutSource}, - varsource::VarSource, }, dist::{ dist::{PartialToolchainDesc, Profile, TargetTriple}, @@ -212,6 +210,7 @@ pub fn main() -> Result { ("run", m) => run(cfg, m)?, ("which", m) => which(cfg, m)?, ("doc", m) => doc(cfg, m)?, + #[cfg(not(windows))] ("man", m) => man(cfg, m)?, ("self", c) => match c.subcommand() { Some(s) => match s { @@ -1615,7 +1614,10 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result { } } +#[cfg(not(windows))] fn man(cfg: &Cfg, m: &ArgMatches) -> Result { + use crate::currentprocess::varsource::VarSource; + let command = m.get_one::("command").unwrap(); let toolchain = explicit_desc_or_dir_toolchain(cfg, m)?; @@ -1629,7 +1631,7 @@ fn man(cfg: &Cfg, m: &ArgMatches) -> Result { if let Some(path) = process().var_os("MANPATH") { manpaths.push(path); } - process::Command::new("man") + std::process::Command::new("man") .env("MANPATH", manpaths) .arg(command) .status() diff --git a/src/dist/dist.rs b/src/dist/dist.rs index aca41172d9..5edb88514e 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -1,8 +1,7 @@ use std::collections::HashSet; use std::env; use std::fmt; -use std::fs; -use std::io::{self, Read, Write}; +use std::io::Write; use std::ops::Deref; use std::path::Path; use std::str::FromStr; @@ -238,10 +237,13 @@ impl Deref for TargetTriple { } } +#[cfg(not(windows))] fn is_32bit_userspace() -> bool { // Check if /bin/sh is a 32-bit binary. If it doesn't exist, fall back to // checking if _we_ are a 32-bit binary. // rustup-init.sh also relies on checking /bin/sh for bitness. + use std::fs; + use std::io::{self, Read}; // inner function is to simplify error handling. fn inner() -> io::Result { From 45827349fddbd52b107ac2b5558240a2bc1ee592 Mon Sep 17 00:00:00 2001 From: rami3l Date: Thu, 25 Jan 2024 11:25:35 +0800 Subject: [PATCH 226/229] chore: add docstring to `is_32bit_userspace()` --- src/dist/dist.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/dist/dist.rs b/src/dist/dist.rs index 5edb88514e..eb96e5094f 100644 --- a/src/dist/dist.rs +++ b/src/dist/dist.rs @@ -237,11 +237,11 @@ impl Deref for TargetTriple { } } +/// Check if /bin/sh is a 32-bit binary. If it doesn't exist, fall back to +/// checking if _we_ are a 32-bit binary. +/// rustup-init.sh also relies on checking /bin/sh for bitness. #[cfg(not(windows))] fn is_32bit_userspace() -> bool { - // Check if /bin/sh is a 32-bit binary. If it doesn't exist, fall back to - // checking if _we_ are a 32-bit binary. - // rustup-init.sh also relies on checking /bin/sh for bitness. use std::fs; use std::io::{self, Read}; From f0d76d04cdf80d9bb99611cd64e375bcf4c0c6b0 Mon Sep 17 00:00:00 2001 From: Mathias Brossard Date: Mon, 11 Dec 2023 13:54:28 -0600 Subject: [PATCH 227/229] Component is now named 'llvm-tools' --- doc/user-guide/src/concepts/components.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/user-guide/src/concepts/components.md b/doc/user-guide/src/concepts/components.md index 56046f7620..b7e551d4d8 100644 --- a/doc/user-guide/src/concepts/components.md +++ b/doc/user-guide/src/concepts/components.md @@ -53,8 +53,7 @@ toolchains. The following is an overview of the different components: you to rebuild the standard library locally. * `rust-mingw` — This contains a linker and platform libraries for building on the `x86_64-pc-windows-gnu` platform. -* `llvm-tools-preview` — This is an experimental component which contains a - collection of [LLVM] tools. +* `llvm-tools` — This component contains a collection of [LLVM] tools. * `rustc-dev` — This component contains the compiler as a library. Most users will not need this; it is only needed for development *of* tools that link to the compiler, such as making modifications to [Clippy]. From 33ad3a4304eeeddc651eea95edb17cc7c6bc88d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Sun, 21 Jan 2024 14:28:39 +0100 Subject: [PATCH 228/229] Download rust CI Docker images from a registry --- ci/fetch-rust-docker.bash | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/ci/fetch-rust-docker.bash b/ci/fetch-rust-docker.bash index 120385a4dc..23fbabfe76 100644 --- a/ci/fetch-rust-docker.bash +++ b/ci/fetch-rust-docker.bash @@ -14,7 +14,7 @@ RUST_REPO="https://github.com/rust-lang/rust" ARTIFACTS_BASE_URL="https://ci-artifacts.rust-lang.org/rustc-builds" # A `Dockerfile` under `rustup`'s `ci/docker` directory may start with `FROM rust-$TARGET`. -# This means it is using an S3-cached Docker image provided by `rustc`'s CI. +# This means it is using a Docker image fetched from a container registry provided by `rustc`'s CI. LOCAL_DOCKER_TAG="rust-$TARGET" # The following is a mapping from `$TARGET`s to cached Docker images built from `Dockerfile`s under # , @@ -51,16 +51,11 @@ info="/tmp/image-$image.txt" rm -f "$info" curl -o "$info" "$image_url" -digest=$(grep -m1 ^sha "$info") if [ -z "$(docker images -q "${LOCAL_DOCKER_TAG}")" ]; then - url=$(grep -m1 ^https "$info") - cache=/tmp/rustci_docker_cache - echo "Attempting to download $url" - rm -f "$cache" - set +e - command_retry curl -y 30 -Y 10 --connect-timeout 30 -f -L -C - -o "$cache" "$url" set -e - docker load --quiet -i "$cache" - docker tag "$digest" "${LOCAL_DOCKER_TAG}" + image_tag=$(cat $info) + echo "Attempting to pull image ${image_tag}" + docker pull "${image_tag}" + docker tag "${image_tag}" "${LOCAL_DOCKER_TAG}" fi From c2f9763b2e0801f10efbab8a5d71eaf7bb6f9554 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Mon, 29 Jan 2024 23:01:09 +0800 Subject: [PATCH 229/229] Revert "1.26.0 should not be unreleased in the changelog" This reverts commit 3ec15a10a979f3f6be2b40043dc4e4463d611217. --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 408a0038f3..305d591098 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## [1.26.0] - 2023-04-05 +## [1.26.0] - unreleased This version of Rustup involves a significant number of internal refactors, both in terms of the Rustup code and its tests. @@ -48,7 +48,6 @@ please review the repository. - Fix RUSTUP_PERMIT_COPY_RENAME condition so it is actually used [pr#3292] - Bump a lot of dependencies to their latest versions [pr#renovate-bot] -[1.26.0]: https://github.com/rust-lang/rustup/releases/tag/1.26.0 [rust-analyzer]: https://github.com/rust-lang/rust-analyzer [proxy]: https://rust-lang.github.io/rustup/concepts/proxies.html [clap]: https://crates.io/crates/clap