From d413afc45b9aa9f5c293c15068c20db7391c0c6e Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 26 Aug 2023 10:59:04 +0100 Subject: [PATCH 1/6] chore: add missing `windows-sys` features back --- Cargo.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 7e383be69..00b70398d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -181,10 +181,12 @@ fwdansi.workspace = true workspace = true features = [ "Win32_Foundation", + "Win32_Security", "Win32_Storage_FileSystem", + "Win32_System_IO", "Win32_System_Console", - "Win32_System_Threading", "Win32_System_JobObjects", + "Win32_System_Threading", ] [dev-dependencies] From 8d5fd64dcd00f6da7ca6236a6ca04f092043c9ec Mon Sep 17 00:00:00 2001 From: Michael Goulet Date: Fri, 11 Aug 2023 01:06:59 +0000 Subject: [PATCH 2/6] Fix elided lifetime in associated const --- src/cargo/sources/registry/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index a0178db55..150c265ee 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -887,7 +887,7 @@ impl<'cfg> Source for RegistrySource<'cfg> { impl RegistryConfig { /// File name of [`RegistryConfig`]. - const NAME: &str = "config.json"; + const NAME: &'static str = "config.json"; } /// Get the maximum upack size that Cargo permits From e38468ebbd79fd1c3c8b96b9bcc96de863747b4c Mon Sep 17 00:00:00 2001 From: Ed Page Date: Mon, 21 Aug 2023 16:14:31 -0500 Subject: [PATCH 3/6] docs: Remove redundant explicit link CI is currently broken due to a new warning in nightlies --- src/cargo/ops/cargo_compile/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_compile/mod.rs b/src/cargo/ops/cargo_compile/mod.rs index f53a9e934..e54e0f5a2 100644 --- a/src/cargo/ops/cargo_compile/mod.rs +++ b/src/cargo/ops/cargo_compile/mod.rs @@ -5,7 +5,7 @@ //! rough outline is: //! //! 1. Resolve the dependency graph (see [`ops::resolve`]). -//! 2. Download any packages needed (see [`PackageSet`](crate::core::PackageSet)). +//! 2. Download any packages needed (see [`PackageSet`]. //! 3. Generate a list of top-level "units" of work for the targets the user //! requested on the command-line. Each [`Unit`] corresponds to a compiler //! invocation. This is done in this module ([`UnitGenerator::generate_root_units`]). From 2d3c5831ba4b57d559f0222f7c1a5da7dd68e9d1 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 11 Jul 2023 16:58:53 -0700 Subject: [PATCH 4/6] Rustfmt with latest nightly. --- crates/xtask-stale-label/src/main.rs | 2 +- src/cargo/sources/git/known_hosts.rs | 18 +++++++++---- src/cargo/sources/registry/http_remote.rs | 4 ++- src/cargo/util/auth/asymmetric.rs | 3 ++- src/cargo/util/toml/embedded.rs | 31 +++++++++++++++-------- src/cargo/util/toml/mod.rs | 8 ++++-- 6 files changed, 45 insertions(+), 21 deletions(-) diff --git a/crates/xtask-stale-label/src/main.rs b/crates/xtask-stale-label/src/main.rs index 37675979c..88c044b5b 100644 --- a/crates/xtask-stale-label/src/main.rs +++ b/crates/xtask-stale-label/src/main.rs @@ -34,7 +34,7 @@ fn main() { for (label, value) in autolabel.iter() { let Some(trigger_files) = value.get("trigger_files") else { - continue + continue; }; let trigger_files = trigger_files.as_array().expect("an array"); let missing_files: Vec<_> = trigger_files diff --git a/src/cargo/sources/git/known_hosts.rs b/src/cargo/sources/git/known_hosts.rs index 7b013f99c..41b965693 100644 --- a/src/cargo/sources/git/known_hosts.rs +++ b/src/cargo/sources/git/known_hosts.rs @@ -141,7 +141,7 @@ pub fn certificate_check( let Some(host_key) = cert.as_hostkey() else { // Return passthrough for TLS X509 certificates to use whatever validation // was done in git2. - return Ok(CertificateCheckStatus::CertificatePassthrough) + return Ok(CertificateCheckStatus::CertificatePassthrough); }; // If a nonstandard port is in use, check for that first. // The fallback to check without a port is handled in the HostKeyNotFound handler. @@ -611,10 +611,18 @@ impl KnownHost { } fn hashed_hostname_matches(host: &str, hashed: &str) -> bool { - let Some((b64_salt, b64_host)) = hashed.split_once('|') else { return false; }; - let Ok(salt) = STANDARD.decode(b64_salt) else { return false; }; - let Ok(hashed_host) = STANDARD.decode(b64_host) else { return false; }; - let Ok(mut mac) = hmac::Hmac::::new_from_slice(&salt) else { return false; }; + let Some((b64_salt, b64_host)) = hashed.split_once('|') else { + return false; + }; + let Ok(salt) = STANDARD.decode(b64_salt) else { + return false; + }; + let Ok(hashed_host) = STANDARD.decode(b64_host) else { + return false; + }; + let Ok(mut mac) = hmac::Hmac::::new_from_slice(&salt) else { + return false; + }; mac.update(host.as_bytes()); let result = mac.finalize().into_bytes(); hashed_host == &result[..] diff --git a/src/cargo/sources/registry/http_remote.rs b/src/cargo/sources/registry/http_remote.rs index c69ef8f9b..622590daf 100644 --- a/src/cargo/sources/registry/http_remote.rs +++ b/src/cargo/sources/registry/http_remote.rs @@ -808,7 +808,9 @@ impl<'cfg> Downloads<'cfg> { /// Updates the state of the progress bar for downloads. fn tick(&self) -> CargoResult<()> { let mut progress = self.progress.borrow_mut(); - let Some(progress) = progress.as_mut() else { return Ok(()); }; + let Some(progress) = progress.as_mut() else { + return Ok(()); + }; // Since the sparse protocol discovers dependencies as it goes, // it's not possible to get an accurate progress indication. diff --git a/src/cargo/util/auth/asymmetric.rs b/src/cargo/util/auth/asymmetric.rs index 50882a745..b038ba7f8 100644 --- a/src/cargo/util/auth/asymmetric.rs +++ b/src/cargo/util/auth/asymmetric.rs @@ -73,7 +73,8 @@ pub fn public_token_from_credential( source_id: &SourceId, mutation: Option<&'_ Mutation<'_>>, ) -> CargoResult> { - let RegistryCredentialConfig::AsymmetricKey((secret_key, secret_key_subject)) = credential else { + let RegistryCredentialConfig::AsymmetricKey((secret_key, secret_key_subject)) = credential + else { anyhow::bail!("credential must be an asymmetric secret key") }; diff --git a/src/cargo/util/toml/embedded.rs b/src/cargo/util/toml/embedded.rs index 8e41010b4..f88c630b1 100644 --- a/src/cargo/util/toml/embedded.rs +++ b/src/cargo/util/toml/embedded.rs @@ -207,7 +207,11 @@ impl DocFragment { let syn::Meta::NameValue(nv) = &attr.meta else { anyhow::bail!("unsupported attr meta for {:?}", attr.meta.path()) }; - let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. }) = &nv.value else { + let syn::Expr::Lit(syn::ExprLit { + lit: syn::Lit::Str(lit), + .. + }) = &nv.value + else { anyhow::bail!("only string literals are supported") }; Ok(Self { @@ -373,16 +377,21 @@ fn unindent_doc_fragments(docs: &mut [DocFragment]) { let Some(min_indent) = docs .iter() .map(|fragment| { - fragment.doc.as_str().lines().fold(usize::MAX, |min_indent, line| { - if line.chars().all(|c| c.is_whitespace()) { - min_indent - } else { - // Compare against either space or tab, ignoring whether they are - // mixed or not. - let whitespace = line.chars().take_while(|c| *c == ' ' || *c == '\t').count(); - min_indent.min(whitespace) - } - }) + fragment + .doc + .as_str() + .lines() + .fold(usize::MAX, |min_indent, line| { + if line.chars().all(|c| c.is_whitespace()) { + min_indent + } else { + // Compare against either space or tab, ignoring whether they are + // mixed or not. + let whitespace = + line.chars().take_while(|c| *c == ' ' || *c == '\t').count(); + min_indent.min(whitespace) + } + }) }) .min() else { diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 2202f6b3b..284c5dd35 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -2835,7 +2835,9 @@ fn parse_unstable_lints>( config: &Config, warnings: &mut Vec, ) -> CargoResult> { - let Some(lints) = lints else { return Ok(None); }; + let Some(lints) = lints else { + return Ok(None); + }; if !config.cli_unstable().lints { warn_for_lint_feature(config, warnings); @@ -2878,7 +2880,9 @@ switch to nightly channel you can pass } fn verify_lints(lints: Option) -> CargoResult> { - let Some(lints) = lints else { return Ok(None); }; + let Some(lints) = lints else { + return Ok(None); + }; for (tool, lints) in &lints { let supported = ["rust", "clippy", "rustdoc"]; From 64240800eacc093a991375df1b08b902ed5a127b Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Mon, 14 Aug 2023 19:10:17 +0100 Subject: [PATCH 5/6] test: relax assertions of panic message (again) --- tests/testsuite/bench.rs | 6 +++--- tests/testsuite/test.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index 581acbe15..24fe59268 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -314,9 +314,9 @@ fn cargo_bench_failing_test() { [RUNNING] [..] (target/release/deps/foo-[..][EXE])", ) .with_stdout_contains("[..]thread '[..]' panicked at[..]") - .with_stdout_contains("[..]assertion failed[..]") - .with_stdout_contains("[..]left: `\"hello\"`[..]") - .with_stdout_contains("[..]right: `\"nope\"`[..]") + .with_stdout_contains("[..]assertion [..]failed[..]") + .with_stdout_contains("[..]left: [..]\"hello\"[..]") + .with_stdout_contains("[..]right: [..]\"nope\"[..]") .with_stdout_contains("[..]src/main.rs:15[..]") .with_status(101) .run(); diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index 6a062cfb6..d7e48437a 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -389,10 +389,10 @@ failures: ---- test_hello stdout ---- [..]thread '[..]' panicked at [..]", ) - .with_stdout_contains("[..]assertion failed[..]") - .with_stdout_contains("[..]`(left == right)`[..]") - .with_stdout_contains("[..]left: `\"hello\"`,[..]") - .with_stdout_contains("[..]right: `\"nope\"`[..]") + .with_stdout_contains("[..]assertion [..]failed[..]") + .with_stdout_contains("[..]left == right[..]") + .with_stdout_contains("[..]left: [..]\"hello\"[..]") + .with_stdout_contains("[..]right: [..]\"nope\"[..]") .with_stdout_contains("[..]src/main.rs:12[..]") .with_stdout_contains( "\ From ac023fc0c4e8c9744bb39d9ebe70559dbe89ffdb Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 26 Aug 2023 12:15:48 +0100 Subject: [PATCH 6/6] Bump version to 0.73.1 --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe365bbcb..a99e1159c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -262,7 +262,7 @@ dependencies = [ [[package]] name = "cargo" -version = "0.73.0" +version = "0.73.1" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index 00b70398d..1b2acd37c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ windows-sys = "0.48" [package] name = "cargo" -version = "0.73.0" +version = "0.73.1" edition = "2021" license = "MIT OR Apache-2.0" homepage = "https://crates.io"