diff --git a/Cargo.toml b/Cargo.toml index 67875a5..a318dee 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,14 +20,15 @@ diff = "0.1.10" filetime = "0.2" getopts = "0.2" log = "0.4" +once_cell = "1.20" regex = "1.0" -tempfile = { version = "3.0", optional = true } +rustfix = "0.8" +rustversion = "1.0" serde = "1.0" -serde_json = "1.0" serde_derive = "1.0" -rustfix = "0.8" +serde_json = "1.0" +tempfile = { version = "3.0", optional = true } tester = "0.9" -lazy_static = "1.4" [target."cfg(unix)".dependencies] libc = "0.2" diff --git a/src/common.rs b/src/common.rs index d1b8e68..169a6db 100644 --- a/src/common.rs +++ b/src/common.rs @@ -415,10 +415,18 @@ mod config_tempdir { #[cfg(feature = "tmp")] pub use self::config_tempdir::ConfigWithTemp; +#[cfg(feature = "rustc")] +#[rustversion::since(2024-11-03)] +use rustc_session::config::host_tuple as host; + +#[cfg(feature = "rustc")] +#[rustversion::before(2024-11-03)] +use rustc_session::config::host_triple as host; + impl Default for Config { fn default() -> Config { #[cfg(feature = "rustc")] - let platform = rustc_session::config::host_triple().to_string(); + let platform = host().to_string(); Config { bless: false, diff --git a/src/runtest.rs b/src/runtest.rs index 775166c..69e89f5 100644 --- a/src/runtest.rs +++ b/src/runtest.rs @@ -21,6 +21,7 @@ use filetime::FileTime; use regex::Regex; use rustfix::{apply_suggestions, get_suggestions_from_json, Filter}; +use once_cell::sync::Lazy; use std::collections::HashMap; use std::collections::HashSet; use std::env; @@ -37,9 +38,8 @@ use std::sync::{Arc, Mutex, RwLock}; use crate::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()); - } + static COVERAGE_FILE_LOCKS: Lazy>>>> = + Lazy::new(Default::default); { let locks = COVERAGE_FILE_LOCKS.read().unwrap(); diff --git a/tests/test_support/mod.rs b/tests/test_support/mod.rs index e775734..638f10c 100644 --- a/tests/test_support/mod.rs +++ b/tests/test_support/mod.rs @@ -2,6 +2,7 @@ //! //! Inspired by cargo's `cargo-test-support` crate: //! https://github.com/rust-lang/cargo/tree/master/crates/cargo-test-support +use once_cell::sync::Lazy; use std::cell::RefCell; use std::env; use std::fs; @@ -14,18 +15,16 @@ thread_local! { static TEST_ID: RefCell> = RefCell::new(None); } -lazy_static::lazy_static! { - pub static ref GLOBAL_ROOT: PathBuf = { - let mut path = env::current_exe().unwrap(); - path.pop(); // chop off exe name - path.pop(); // chop off 'deps' part - path.pop(); // chop off 'debug' - - path.push(COMPILETEST_INTEGRATION_TEST_DIR); - path.mkdir_p(); - path - }; -} +pub static GLOBAL_ROOT: Lazy = Lazy::new(|| { + let mut path = env::current_exe().unwrap(); + path.pop(); // chop off exe name + path.pop(); // chop off 'deps' part + path.pop(); // chop off 'debug' + + path.push(COMPILETEST_INTEGRATION_TEST_DIR); + path.mkdir_p(); + path +}); pub fn testsuite(mode: &str) -> TestsuiteBuilder { let builder = TestsuiteBuilder::new(mode);