Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build on nightly #299

Merged
merged 2 commits into from
Dec 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
10 changes: 9 additions & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<Mutex<File>> {
lazy_static::lazy_static! {
static ref COVERAGE_FILE_LOCKS: RwLock<HashMap<PathBuf, Arc<Mutex<File>>>> = RwLock::new(HashMap::new());
}
static COVERAGE_FILE_LOCKS: Lazy<RwLock<HashMap<PathBuf, Arc<Mutex<File>>>>> =
Lazy::new(Default::default);

{
let locks = COVERAGE_FILE_LOCKS.read().unwrap();
Expand Down
23 changes: 11 additions & 12 deletions tests/test_support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,18 +15,16 @@ thread_local! {
static TEST_ID: RefCell<Option<usize>> = 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<PathBuf> = 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);
Expand Down
Loading