Skip to content

Commit b388262

Browse files
authored
Merge pull request #299 from tamird/fix-nightly
Fix build on nightly
2 parents b3094c7 + 6b40285 commit b388262

File tree

4 files changed

+28
-20
lines changed

4 files changed

+28
-20
lines changed

Cargo.toml

+5-4
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ diff = "0.1.10"
2020
filetime = "0.2"
2121
getopts = "0.2"
2222
log = "0.4"
23+
once_cell = "1.20"
2324
regex = "1.0"
24-
tempfile = { version = "3.0", optional = true }
25+
rustfix = "0.8"
26+
rustversion = "1.0"
2527
serde = "1.0"
26-
serde_json = "1.0"
2728
serde_derive = "1.0"
28-
rustfix = "0.8"
29+
serde_json = "1.0"
30+
tempfile = { version = "3.0", optional = true }
2931
tester = "0.9"
30-
lazy_static = "1.4"
3132

3233
[target."cfg(unix)".dependencies]
3334
libc = "0.2"

src/common.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -415,10 +415,18 @@ mod config_tempdir {
415415
#[cfg(feature = "tmp")]
416416
pub use self::config_tempdir::ConfigWithTemp;
417417

418+
#[cfg(feature = "rustc")]
419+
#[rustversion::since(2024-11-03)]
420+
use rustc_session::config::host_tuple as host;
421+
422+
#[cfg(feature = "rustc")]
423+
#[rustversion::before(2024-11-03)]
424+
use rustc_session::config::host_triple as host;
425+
418426
impl Default for Config {
419427
fn default() -> Config {
420428
#[cfg(feature = "rustc")]
421-
let platform = rustc_session::config::host_triple().to_string();
429+
let platform = host().to_string();
422430

423431
Config {
424432
bless: false,

src/runtest.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use filetime::FileTime;
2121
use regex::Regex;
2222
use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
2323

24+
use once_cell::sync::Lazy;
2425
use std::collections::HashMap;
2526
use std::collections::HashSet;
2627
use std::env;
@@ -37,9 +38,8 @@ use std::sync::{Arc, Mutex, RwLock};
3738
use crate::extract_gdb_version;
3839

3940
fn get_or_create_coverage_file(path: &Path, create: impl FnOnce() -> File) -> Arc<Mutex<File>> {
40-
lazy_static::lazy_static! {
41-
static ref COVERAGE_FILE_LOCKS: RwLock<HashMap<PathBuf, Arc<Mutex<File>>>> = RwLock::new(HashMap::new());
42-
}
41+
static COVERAGE_FILE_LOCKS: Lazy<RwLock<HashMap<PathBuf, Arc<Mutex<File>>>>> =
42+
Lazy::new(Default::default);
4343

4444
{
4545
let locks = COVERAGE_FILE_LOCKS.read().unwrap();

tests/test_support/mod.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
//!
33
//! Inspired by cargo's `cargo-test-support` crate:
44
//! https://github.com/rust-lang/cargo/tree/master/crates/cargo-test-support
5+
use once_cell::sync::Lazy;
56
use std::cell::RefCell;
67
use std::env;
78
use std::fs;
@@ -14,18 +15,16 @@ thread_local! {
1415
static TEST_ID: RefCell<Option<usize>> = RefCell::new(None);
1516
}
1617

17-
lazy_static::lazy_static! {
18-
pub static ref GLOBAL_ROOT: PathBuf = {
19-
let mut path = env::current_exe().unwrap();
20-
path.pop(); // chop off exe name
21-
path.pop(); // chop off 'deps' part
22-
path.pop(); // chop off 'debug'
23-
24-
path.push(COMPILETEST_INTEGRATION_TEST_DIR);
25-
path.mkdir_p();
26-
path
27-
};
28-
}
18+
pub static GLOBAL_ROOT: Lazy<PathBuf> = Lazy::new(|| {
19+
let mut path = env::current_exe().unwrap();
20+
path.pop(); // chop off exe name
21+
path.pop(); // chop off 'deps' part
22+
path.pop(); // chop off 'debug'
23+
24+
path.push(COMPILETEST_INTEGRATION_TEST_DIR);
25+
path.mkdir_p();
26+
path
27+
});
2928

3029
pub fn testsuite(mode: &str) -> TestsuiteBuilder {
3130
let builder = TestsuiteBuilder::new(mode);

0 commit comments

Comments
 (0)