Skip to content

Commit 26bba48

Browse files
committed
Auto merge of #12565 - weihanglo:rust-1.72.0-backport, r=ehuss
[stable-1.72.0] add missing `windows-sys` features back Stable backports: - <#12563> In order to make CI pass, the following PRs are also cherry-picked: - b4a26b0 from #12475 - c508cb6 from #12538 - 43c253e from #12351 - 689defd from #12500 --- Fixes <#12562> This won't affect Rust releases, i.e. no 1.72.1 will happen. We do this only for release `cargo` crate.
2 parents 103a7ff + ac023fc commit 26bba48

File tree

12 files changed

+59
-33
lines changed

12 files changed

+59
-33
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+4-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ windows-sys = "0.48"
9595

9696
[package]
9797
name = "cargo"
98-
version = "0.73.0"
98+
version = "0.73.1"
9999
edition = "2021"
100100
license = "MIT OR Apache-2.0"
101101
homepage = "https://crates.io"
@@ -181,10 +181,12 @@ fwdansi.workspace = true
181181
workspace = true
182182
features = [
183183
"Win32_Foundation",
184+
"Win32_Security",
184185
"Win32_Storage_FileSystem",
186+
"Win32_System_IO",
185187
"Win32_System_Console",
186-
"Win32_System_Threading",
187188
"Win32_System_JobObjects",
189+
"Win32_System_Threading",
188190
]
189191

190192
[dev-dependencies]

crates/xtask-stale-label/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ fn main() {
3434

3535
for (label, value) in autolabel.iter() {
3636
let Some(trigger_files) = value.get("trigger_files") else {
37-
continue
37+
continue;
3838
};
3939
let trigger_files = trigger_files.as_array().expect("an array");
4040
let missing_files: Vec<_> = trigger_files

src/cargo/ops/cargo_compile/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//! rough outline is:
66
//!
77
//! 1. Resolve the dependency graph (see [`ops::resolve`]).
8-
//! 2. Download any packages needed (see [`PackageSet`](crate::core::PackageSet)).
8+
//! 2. Download any packages needed (see [`PackageSet`].
99
//! 3. Generate a list of top-level "units" of work for the targets the user
1010
//! requested on the command-line. Each [`Unit`] corresponds to a compiler
1111
//! invocation. This is done in this module ([`UnitGenerator::generate_root_units`]).

src/cargo/sources/git/known_hosts.rs

+13-5
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub fn certificate_check(
141141
let Some(host_key) = cert.as_hostkey() else {
142142
// Return passthrough for TLS X509 certificates to use whatever validation
143143
// was done in git2.
144-
return Ok(CertificateCheckStatus::CertificatePassthrough)
144+
return Ok(CertificateCheckStatus::CertificatePassthrough);
145145
};
146146
// If a nonstandard port is in use, check for that first.
147147
// The fallback to check without a port is handled in the HostKeyNotFound handler.
@@ -611,10 +611,18 @@ impl KnownHost {
611611
}
612612

613613
fn hashed_hostname_matches(host: &str, hashed: &str) -> bool {
614-
let Some((b64_salt, b64_host)) = hashed.split_once('|') else { return false; };
615-
let Ok(salt) = STANDARD.decode(b64_salt) else { return false; };
616-
let Ok(hashed_host) = STANDARD.decode(b64_host) else { return false; };
617-
let Ok(mut mac) = hmac::Hmac::<sha1::Sha1>::new_from_slice(&salt) else { return false; };
614+
let Some((b64_salt, b64_host)) = hashed.split_once('|') else {
615+
return false;
616+
};
617+
let Ok(salt) = STANDARD.decode(b64_salt) else {
618+
return false;
619+
};
620+
let Ok(hashed_host) = STANDARD.decode(b64_host) else {
621+
return false;
622+
};
623+
let Ok(mut mac) = hmac::Hmac::<sha1::Sha1>::new_from_slice(&salt) else {
624+
return false;
625+
};
618626
mac.update(host.as_bytes());
619627
let result = mac.finalize().into_bytes();
620628
hashed_host == &result[..]

src/cargo/sources/registry/http_remote.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,9 @@ impl<'cfg> Downloads<'cfg> {
808808
/// Updates the state of the progress bar for downloads.
809809
fn tick(&self) -> CargoResult<()> {
810810
let mut progress = self.progress.borrow_mut();
811-
let Some(progress) = progress.as_mut() else { return Ok(()); };
811+
let Some(progress) = progress.as_mut() else {
812+
return Ok(());
813+
};
812814

813815
// Since the sparse protocol discovers dependencies as it goes,
814816
// it's not possible to get an accurate progress indication.

src/cargo/sources/registry/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@ impl<'cfg> Source for RegistrySource<'cfg> {
887887

888888
impl RegistryConfig {
889889
/// File name of [`RegistryConfig`].
890-
const NAME: &str = "config.json";
890+
const NAME: &'static str = "config.json";
891891
}
892892

893893
/// Get the maximum upack size that Cargo permits

src/cargo/util/auth/asymmetric.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ pub fn public_token_from_credential(
7373
source_id: &SourceId,
7474
mutation: Option<&'_ Mutation<'_>>,
7575
) -> CargoResult<Secret<String>> {
76-
let RegistryCredentialConfig::AsymmetricKey((secret_key, secret_key_subject)) = credential else {
76+
let RegistryCredentialConfig::AsymmetricKey((secret_key, secret_key_subject)) = credential
77+
else {
7778
anyhow::bail!("credential must be an asymmetric secret key")
7879
};
7980

src/cargo/util/toml/embedded.rs

+20-11
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,11 @@ impl DocFragment {
207207
let syn::Meta::NameValue(nv) = &attr.meta else {
208208
anyhow::bail!("unsupported attr meta for {:?}", attr.meta.path())
209209
};
210-
let syn::Expr::Lit(syn::ExprLit { lit: syn::Lit::Str(lit), .. }) = &nv.value else {
210+
let syn::Expr::Lit(syn::ExprLit {
211+
lit: syn::Lit::Str(lit),
212+
..
213+
}) = &nv.value
214+
else {
211215
anyhow::bail!("only string literals are supported")
212216
};
213217
Ok(Self {
@@ -373,16 +377,21 @@ fn unindent_doc_fragments(docs: &mut [DocFragment]) {
373377
let Some(min_indent) = docs
374378
.iter()
375379
.map(|fragment| {
376-
fragment.doc.as_str().lines().fold(usize::MAX, |min_indent, line| {
377-
if line.chars().all(|c| c.is_whitespace()) {
378-
min_indent
379-
} else {
380-
// Compare against either space or tab, ignoring whether they are
381-
// mixed or not.
382-
let whitespace = line.chars().take_while(|c| *c == ' ' || *c == '\t').count();
383-
min_indent.min(whitespace)
384-
}
385-
})
380+
fragment
381+
.doc
382+
.as_str()
383+
.lines()
384+
.fold(usize::MAX, |min_indent, line| {
385+
if line.chars().all(|c| c.is_whitespace()) {
386+
min_indent
387+
} else {
388+
// Compare against either space or tab, ignoring whether they are
389+
// mixed or not.
390+
let whitespace =
391+
line.chars().take_while(|c| *c == ' ' || *c == '\t').count();
392+
min_indent.min(whitespace)
393+
}
394+
})
386395
})
387396
.min()
388397
else {

src/cargo/util/toml/mod.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -2835,7 +2835,9 @@ fn parse_unstable_lints<T: Deserialize<'static>>(
28352835
config: &Config,
28362836
warnings: &mut Vec<String>,
28372837
) -> CargoResult<Option<T>> {
2838-
let Some(lints) = lints else { return Ok(None); };
2838+
let Some(lints) = lints else {
2839+
return Ok(None);
2840+
};
28392841

28402842
if !config.cli_unstable().lints {
28412843
warn_for_lint_feature(config, warnings);
@@ -2878,7 +2880,9 @@ switch to nightly channel you can pass
28782880
}
28792881

28802882
fn verify_lints(lints: Option<TomlLints>) -> CargoResult<Option<TomlLints>> {
2881-
let Some(lints) = lints else { return Ok(None); };
2883+
let Some(lints) = lints else {
2884+
return Ok(None);
2885+
};
28822886

28832887
for (tool, lints) in &lints {
28842888
let supported = ["rust", "clippy", "rustdoc"];

tests/testsuite/bench.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ fn cargo_bench_failing_test() {
314314
[RUNNING] [..] (target/release/deps/foo-[..][EXE])",
315315
)
316316
.with_stdout_contains("[..]thread '[..]' panicked at[..]")
317-
.with_stdout_contains("[..]assertion failed[..]")
318-
.with_stdout_contains("[..]left: `\"hello\"`[..]")
319-
.with_stdout_contains("[..]right: `\"nope\"`[..]")
317+
.with_stdout_contains("[..]assertion [..]failed[..]")
318+
.with_stdout_contains("[..]left: [..]\"hello\"[..]")
319+
.with_stdout_contains("[..]right: [..]\"nope\"[..]")
320320
.with_stdout_contains("[..]src/main.rs:15[..]")
321321
.with_status(101)
322322
.run();

tests/testsuite/test.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -389,10 +389,10 @@ failures:
389389
---- test_hello stdout ----
390390
[..]thread '[..]' panicked at [..]",
391391
)
392-
.with_stdout_contains("[..]assertion failed[..]")
393-
.with_stdout_contains("[..]`(left == right)`[..]")
394-
.with_stdout_contains("[..]left: `\"hello\"`,[..]")
395-
.with_stdout_contains("[..]right: `\"nope\"`[..]")
392+
.with_stdout_contains("[..]assertion [..]failed[..]")
393+
.with_stdout_contains("[..]left == right[..]")
394+
.with_stdout_contains("[..]left: [..]\"hello\"[..]")
395+
.with_stdout_contains("[..]right: [..]\"nope\"[..]")
396396
.with_stdout_contains("[..]src/main.rs:12[..]")
397397
.with_stdout_contains(
398398
"\

0 commit comments

Comments
 (0)