Skip to content

Commit c9d880b

Browse files
committed
compiletest: Move static_regex! into compiletest::util
1 parent 8337ba9 commit c9d880b

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

src/tools/compiletest/src/runtest.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::errors::{self, Error, ErrorKind};
1515
use crate::header::TestProps;
1616
use crate::json;
1717
use crate::read2::{read2_abbreviated, Truncated};
18-
use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, PathBufExt};
18+
use crate::util::{add_dylib_path, copy_dir_all, dylib_env_var, logv, static_regex, PathBufExt};
1919
use crate::ColorConfig;
2020
use colored::Colorize;
2121
use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
@@ -48,14 +48,6 @@ use debugger::DebuggerCommands;
4848
#[cfg(test)]
4949
mod tests;
5050

51-
macro_rules! static_regex {
52-
($re:literal) => {{
53-
static RE: ::std::sync::OnceLock<::regex::Regex> = ::std::sync::OnceLock::new();
54-
RE.get_or_init(|| ::regex::Regex::new($re).unwrap())
55-
}};
56-
}
57-
use static_regex;
58-
5951
const FAKE_SRC_BASE: &str = "fake-test-src-base";
6052

6153
#[cfg(windows)]

src/tools/compiletest/src/runtest/coverage.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ use std::process::Command;
77
use glob::glob;
88

99
use crate::common::{UI_COVERAGE, UI_COVERAGE_MAP};
10-
use crate::runtest::{static_regex, Emit, ProcRes, TestCx, WillExecute};
10+
use crate::runtest::{Emit, ProcRes, TestCx, WillExecute};
11+
use crate::util::static_regex;
1112

1213
impl<'test> TestCx<'test> {
1314
fn coverage_dump_path(&self) -> &Path {

src/tools/compiletest/src/util.rs

+8
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,11 @@ pub fn copy_dir_all(src: impl AsRef<Path>, dst: impl AsRef<Path>) -> std::io::Re
9090
}
9191
Ok(())
9292
}
93+
94+
macro_rules! static_regex {
95+
($re:literal) => {{
96+
static RE: ::std::sync::OnceLock<::regex::Regex> = ::std::sync::OnceLock::new();
97+
RE.get_or_init(|| ::regex::Regex::new($re).unwrap())
98+
}};
99+
}
100+
pub(crate) use static_regex;

0 commit comments

Comments
 (0)