From ef11e90e1c7fbf7dbff21bdd058447c167bf5f69 Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Mon, 7 Aug 2023 20:57:57 +0100 Subject: [PATCH 1/5] Bump cargo library to 0.72.2 for CVE patches --- Cargo.lock | 2 +- Cargo.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 14fd1d056fe..55a625aac54 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -244,7 +244,7 @@ dependencies = [ [[package]] name = "cargo" -version = "0.72.1" +version = "0.72.2" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index 05c95c72716..c45dad57823 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -95,7 +95,7 @@ windows-sys = "0.48" [package] name = "cargo" -version = "0.72.1" +version = "0.72.2" edition = "2021" license = "MIT OR Apache-2.0" homepage = "https://crates.io" From 4798fb150922adcf8f53a20cb97ce735c2bef37f Mon Sep 17 00:00:00 2001 From: Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> Date: Tue, 1 Aug 2023 18:14:42 +0200 Subject: [PATCH 2/5] `#[allow(internal_features)]` in RUSTC_BOOTSTRAP test This will be required in the future (where "the future" is my PR which fails CI because of cargo here). --- tests/testsuite/build_script_env.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/testsuite/build_script_env.rs b/tests/testsuite/build_script_env.rs index bc87b7120a5..df574600c91 100644 --- a/tests/testsuite/build_script_env.rs +++ b/tests/testsuite/build_script_env.rs @@ -117,7 +117,10 @@ fn rustc_bootstrap() { "#; let p = project() .file("Cargo.toml", &basic_manifest("has-dashes", "0.0.1")) - .file("src/lib.rs", "#![feature(rustc_attrs)]") + .file( + "src/lib.rs", + "#![allow(internal_features)] #![feature(rustc_attrs)]", + ) .file("build.rs", build_rs) .build(); // RUSTC_BOOTSTRAP unset on stable should error @@ -154,7 +157,10 @@ fn rustc_bootstrap() { // Tests for binaries instead of libraries let p = project() .file("Cargo.toml", &basic_manifest("foo", "0.0.1")) - .file("src/main.rs", "#![feature(rustc_attrs)] fn main() {}") + .file( + "src/main.rs", + "#![allow(internal_features)] #![feature(rustc_attrs)] fn main() {}", + ) .file("build.rs", build_rs) .build(); // nightly should warn when there's no library whether or not RUSTC_BOOTSTRAP is set From a83644377c6c9d4318dd43d6b7a5d123b0680937 Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Sat, 5 Aug 2023 12:11:07 -0700 Subject: [PATCH 3/5] Add allow(internal_features) --- tests/testsuite/cargo_features.rs | 1 + tests/testsuite/custom_target.rs | 2 ++ tests/testsuite/doc.rs | 1 + 3 files changed, 4 insertions(+) diff --git a/tests/testsuite/cargo_features.rs b/tests/testsuite/cargo_features.rs index 6e553143174..ed5f53a1e6d 100644 --- a/tests/testsuite/cargo_features.rs +++ b/tests/testsuite/cargo_features.rs @@ -295,6 +295,7 @@ fn allow_features_to_rustc() { .file( "src/lib.rs", r#" + #![allow(internal_features)] #![feature(test_2018_feature)] "#, ) diff --git a/tests/testsuite/custom_target.rs b/tests/testsuite/custom_target.rs index b7ad4d835ec..491d3233ca3 100644 --- a/tests/testsuite/custom_target.rs +++ b/tests/testsuite/custom_target.rs @@ -4,6 +4,7 @@ use cargo_test_support::{basic_manifest, project}; use std::fs; const MINIMAL_LIB: &str = r#" +#![allow(internal_features)] #![feature(no_core)] #![feature(lang_items)] #![no_core] @@ -80,6 +81,7 @@ fn custom_target_dependency() { .file( "src/lib.rs", r#" + #![allow(internal_features)] #![feature(no_core)] #![feature(lang_items)] #![feature(auto_traits)] diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 739bcf3765c..126438671eb 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -756,6 +756,7 @@ fn doc_target() { .file( "src/lib.rs", r#" + #![allow(internal_features)] #![feature(no_core, lang_items)] #![no_core] From ed9845f32cae29473271ab2394f88b1a922476b4 Mon Sep 17 00:00:00 2001 From: Deadbeef Date: Thu, 1 Jun 2023 06:50:43 +0000 Subject: [PATCH 4/5] Remove a noop `.clone` --- src/cargo/sources/git/known_hosts.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cargo/sources/git/known_hosts.rs b/src/cargo/sources/git/known_hosts.rs index 9a623151ebb..f5efed799f4 100644 --- a/src/cargo/sources/git/known_hosts.rs +++ b/src/cargo/sources/git/known_hosts.rs @@ -408,7 +408,7 @@ fn check_ssh_known_hosts_loaded( // fingerprints (see FingerprintHash ssh config option). Here we only // support SHA256. let mut remote_fingerprint = cargo_util::Sha256::new(); - remote_fingerprint.update(remote_host_key.clone()); + remote_fingerprint.update(remote_host_key); let remote_fingerprint = STANDARD_NO_PAD.encode(remote_fingerprint.finish()); let remote_host_key_encoded = STANDARD.encode(remote_host_key); From c7182e76b4e15e2017a1ef70bcf454e5256f455f Mon Sep 17 00:00:00 2001 From: Weihang Lo Date: Sat, 29 Jul 2023 17:12:46 +0100 Subject: [PATCH 5/5] test: relax assertions of panic handler message format --- tests/testsuite/bench.rs | 5 ++--- tests/testsuite/install.rs | 3 ++- tests/testsuite/test.rs | 11 ++++++----- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/tests/testsuite/bench.rs b/tests/testsuite/bench.rs index 60ad2b60d34..581acbe1505 100644 --- a/tests/testsuite/bench.rs +++ b/tests/testsuite/bench.rs @@ -313,9 +313,8 @@ fn cargo_bench_failing_test() { [FINISHED] bench [optimized] target(s) in [..] [RUNNING] [..] (target/release/deps/foo-[..][EXE])", ) - .with_stdout_contains( - "[..]thread '[..]' panicked at 'assertion failed: `(left == right)`[..]", - ) + .with_stdout_contains("[..]thread '[..]' panicked at[..]") + .with_stdout_contains("[..]assertion failed[..]") .with_stdout_contains("[..]left: `\"hello\"`[..]") .with_stdout_contains("[..]right: `\"nope\"`[..]") .with_stdout_contains("[..]src/main.rs:15[..]") diff --git a/tests/testsuite/install.rs b/tests/testsuite/install.rs index 9b881dfdc68..54b366cc316 100644 --- a/tests/testsuite/install.rs +++ b/tests/testsuite/install.rs @@ -1269,7 +1269,8 @@ fn reports_unsuccessful_subcommand_result() { .run(); cargo_process("fail") .with_status(101) - .with_stderr_contains("thread '[..]' panicked at 'explicit panic', [..]") + .with_stderr_contains("thread '[..]' panicked at [..]src/main.rs:1:[..]") + .with_stderr_contains("[..]explicit panic[..]") .run(); } diff --git a/tests/testsuite/test.rs b/tests/testsuite/test.rs index add0a991f24..6a062cfb60f 100644 --- a/tests/testsuite/test.rs +++ b/tests/testsuite/test.rs @@ -387,8 +387,9 @@ test test_hello ... FAILED failures: ---- test_hello stdout ---- -[..]thread '[..]' panicked at 'assertion failed:[..]", +[..]thread '[..]' panicked at [..]", ) + .with_stdout_contains("[..]assertion failed[..]") .with_stdout_contains("[..]`(left == right)`[..]") .with_stdout_contains("[..]left: `\"hello\"`,[..]") .with_stdout_contains("[..]right: `\"nope\"`[..]") @@ -437,10 +438,10 @@ test test_hello ... FAILED failures: ---- test_hello stdout ---- -[..]thread '[..]' panicked at 'assertion failed: false', \ - tests/footest.rs:1[..] +[..]thread '[..]' panicked at [..]tests/footest.rs:1:[..] ", ) + .with_stdout_contains("[..]assertion failed[..]") .with_stdout_contains( "\ failures: @@ -473,10 +474,10 @@ test test_hello ... FAILED failures: ---- test_hello stdout ---- -[..]thread '[..]' panicked at 'assertion failed: false', \ - src/lib.rs:1[..] +[..]thread '[..]' panicked at [..]src/lib.rs:1:[..] ", ) + .with_stdout_contains("[..]assertion failed[..]") .with_stdout_contains( "\ failures: