From 20431706a863f92cb37dc512fef6e48d192aaf2c Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- vendor/compiletest_rs/.cargo-checksum.json | 2 +- vendor/compiletest_rs/Cargo.toml | 2 +- vendor/compiletest_rs/README.md | 4 +-- vendor/compiletest_rs/src/runtest.rs | 47 ++++++++++++++++++++++++------ 4 files changed, 42 insertions(+), 13 deletions(-) (limited to 'vendor/compiletest_rs') diff --git a/vendor/compiletest_rs/.cargo-checksum.json b/vendor/compiletest_rs/.cargo-checksum.json index 8533fd089..c7ba6752d 100644 --- a/vendor/compiletest_rs/.cargo-checksum.json +++ b/vendor/compiletest_rs/.cargo-checksum.json @@ -1 +1 @@ -{"files":{"Cargo.toml":"e66bd0207f0ea860188e04376705d67a4658e78295bcaf579b2a89dbd9088d54","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"e0655e85239c6e887c0f35e1b97fb2574127ea61c28e3deec93c20b560f47892","build.rs":"905784fbb4a75c17279a88fd476e7221104adf00b4dd745a4a66bd41cac8d77a","src/common.rs":"df14f9c75c6a341c5bbc90c4b386c20f66164196f3b4b2ffc19b454d6b658e2b","src/errors.rs":"88a36d1726d90b11bf9272b1439dd52cd4fdf2e70e6e0cb6cfb323f76d84e3ff","src/header.rs":"04e405d100c46dd82139705e8b833e03d19c597edf3a5f7fee92ad9cbd12c201","src/json.rs":"e278c4c3c32c60e840a250b0979926e2ac333dcbbbaae5ab6fcf01ca05bef625","src/lib.rs":"ac780a6ad8d9eb84bd0c6bd7c56fab64a98ef29b9133f1b4fb2a845b58c839bc","src/raise_fd_limit.rs":"b0840fe16df9edaae0571499e105db47768050fcd62729d1e56295f2db34318e","src/read2.rs":"fb9caa84bec8c9c3d2c1ee39a4a6698c461fdc77aec086c74fd7738a6acf4155","src/runtest.rs":"9dc12384637275790ca5a030f79e7ea72be991ff8d5365193e48895a30db6454","src/uidiff.rs":"2f612bd4ed76d68c0f6b3eb8dda5adf14a3e6ceef261c88c810ac6b6857e2d34","src/util.rs":"9cda9e803ffe5e1b5d4c74cf7da7bd51e28a8d1b09bda3d31e01c0f648c3262d","tests/bless.rs":"29031f02666102ab8cde316b9206bf1e770275f9fa6e0172754dcad859a52b5b","tests/test_support/mod.rs":"21ec96cca07cf95b6e3333917a5158a6c47356940063f77d52503b97fd3d8b79"},"package":"262134ef87408da1ddfe45e33daa0ca43b75286d6b1076446e602d264cf9847e"} \ No newline at end of file +{"files":{"Cargo.toml":"cc0342b513ff3ec9dd349398d0a851131ce10afa5b7748997fe7b66f4c75ad32","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"0621878e61f0d0fda054bcbe02df75192c28bde1ecc8289cbd86aeba2dd72720","README.md":"043fc0e7bbad6798c80b81640db2f45cea97b2cadadf8d21e08fe89119872e07","build.rs":"905784fbb4a75c17279a88fd476e7221104adf00b4dd745a4a66bd41cac8d77a","src/common.rs":"df14f9c75c6a341c5bbc90c4b386c20f66164196f3b4b2ffc19b454d6b658e2b","src/errors.rs":"88a36d1726d90b11bf9272b1439dd52cd4fdf2e70e6e0cb6cfb323f76d84e3ff","src/header.rs":"04e405d100c46dd82139705e8b833e03d19c597edf3a5f7fee92ad9cbd12c201","src/json.rs":"e278c4c3c32c60e840a250b0979926e2ac333dcbbbaae5ab6fcf01ca05bef625","src/lib.rs":"ac780a6ad8d9eb84bd0c6bd7c56fab64a98ef29b9133f1b4fb2a845b58c839bc","src/raise_fd_limit.rs":"b0840fe16df9edaae0571499e105db47768050fcd62729d1e56295f2db34318e","src/read2.rs":"fb9caa84bec8c9c3d2c1ee39a4a6698c461fdc77aec086c74fd7738a6acf4155","src/runtest.rs":"4d0d761d8f848ceda532ecc1363d5280951656c5a9ea7eff75d91475e7fcf269","src/uidiff.rs":"2f612bd4ed76d68c0f6b3eb8dda5adf14a3e6ceef261c88c810ac6b6857e2d34","src/util.rs":"9cda9e803ffe5e1b5d4c74cf7da7bd51e28a8d1b09bda3d31e01c0f648c3262d","tests/bless.rs":"29031f02666102ab8cde316b9206bf1e770275f9fa6e0172754dcad859a52b5b","tests/test_support/mod.rs":"21ec96cca07cf95b6e3333917a5158a6c47356940063f77d52503b97fd3d8b79"},"package":"70489bbb718aea4f92e5f48f2e3b5be670c2051de30e57cb6e5377b4aa08b372"} \ No newline at end of file diff --git a/vendor/compiletest_rs/Cargo.toml b/vendor/compiletest_rs/Cargo.toml index 9403548b8..f56e4d712 100644 --- a/vendor/compiletest_rs/Cargo.toml +++ b/vendor/compiletest_rs/Cargo.toml @@ -11,7 +11,7 @@ [package] name = "compiletest_rs" -version = "0.8.0" +version = "0.9.0" authors = [ "The Rust Project Developers", "Thomas Bracht Laumann Jespersen ", diff --git a/vendor/compiletest_rs/README.md b/vendor/compiletest_rs/README.md index bf7cac194..c01a40c9b 100644 --- a/vendor/compiletest_rs/README.md +++ b/vendor/compiletest_rs/README.md @@ -14,7 +14,7 @@ To use `compiletest-rs` in your application, add the following to `Cargo.toml` ```toml [dev-dependencies] -compiletest_rs = "0.7" +compiletest_rs = "0.9" ``` By default, `compiletest-rs` should be able to run on both stable, beta and @@ -28,7 +28,7 @@ crate. ```toml [dev-dependencies] -compiletest_rs = { version = "0.7", features = [ "rustc" ] } +compiletest_rs = { version = "0.9", features = [ "rustc" ] } ``` Create a `tests` folder in the root folder of your project. Create a test file diff --git a/vendor/compiletest_rs/src/runtest.rs b/vendor/compiletest_rs/src/runtest.rs index c52551488..47f9c4870 100644 --- a/vendor/compiletest_rs/src/runtest.rs +++ b/vendor/compiletest_rs/src/runtest.rs @@ -33,9 +33,28 @@ use std::io::{self, BufReader}; use std::path::{Path, PathBuf}; use std::process::{Command, Output, ExitStatus, Stdio, Child}; use std::str; +use std::sync::{Arc, Mutex, RwLock}; use extract_gdb_version; +fn get_or_create_coverage_file(path: &Path, create: impl FnOnce() -> File) -> Arc> { + lazy_static::lazy_static! { + static ref COVERAGE_FILE_LOCKS: RwLock>>> = RwLock::new(HashMap::new()); + } + + { + let locks = COVERAGE_FILE_LOCKS.read().unwrap(); + locks.get(path).map(Arc::clone) + } + .unwrap_or_else(|| { + let mut locks = COVERAGE_FILE_LOCKS.write().unwrap(); + locks + .entry(path.to_path_buf()) + .or_insert_with(|| Arc::new(Mutex::new(create()))) + .clone() + }) +} + /// The name of the environment variable that holds dynamic library locations. pub fn dylib_env_var() -> &'static str { if cfg!(windows) { @@ -2343,16 +2362,23 @@ actual:\n\ coverage_file_path.push("rustfix_missing_coverage.txt"); debug!("coverage_file_path: {}", coverage_file_path.display()); - let mut file = OpenOptions::new() - .create(true) - .append(true) - .open(coverage_file_path.as_path()) - .expect("could not create or open file"); - - if let Err(_) = writeln!(file, "{}", self.testpaths.file.display()) { + let file_ref = get_or_create_coverage_file(&coverage_file_path, || { + OpenOptions::new() + .create(true) + .write(true) + .truncate(true) + .open(coverage_file_path.as_path()) + .expect("could not create or open file") + }); + let mut file = file_ref.lock().unwrap(); + + if writeln!(file, "{}", self.testpaths.file.display()) + .and_then(|_| file.sync_data()) + .is_err() + { panic!("couldn't write to {}", coverage_file_path.display()); } - } + } } if self.props.run_rustfix { @@ -2408,10 +2434,13 @@ actual:\n\ // And finally, compile the fixed code and make sure it both // succeeds and has no diagnostics. let mut rustc = self.make_compile_args( - &self.testpaths.file.with_extension(UI_FIXED), + &expected_fixed_path, TargetLocation::ThisFile(self.make_exe_name()), AllowUnused::No, ); + // Set the crate name to avoid `file.revision.fixed` inferring the + // invalid name `file.revision` + rustc.arg("--crate-name=fixed"); rustc.arg("-L").arg(&self.aux_output_dir_name()); let res = self.compose_and_run_compiler(rustc, None); if !res.status.success() { -- cgit v1.2.3