Rename {HeadersCache, iter_header} -> {DirectivesCache, iter_directives} for self-consistency

This commit is contained in:
Jieyou Xu 2025-06-30 17:28:08 +08:00
parent 475f447f12
commit 0346895e26
No known key found for this signature in database
GPG key ID: 045B995028EA6AFC
3 changed files with 14 additions and 14 deletions

View file

@ -24,11 +24,11 @@ mod needs;
#[cfg(test)]
mod tests;
pub struct HeadersCache {
pub struct DirectivesCache {
needs: CachedNeedsConditions,
}
impl HeadersCache {
impl DirectivesCache {
pub fn load(config: &Config) -> Self {
Self { needs: CachedNeedsConditions::load(config) }
}
@ -54,7 +54,7 @@ impl EarlyProps {
pub fn from_reader<R: Read>(config: &Config, testfile: &Utf8Path, rdr: R) -> Self {
let mut props = EarlyProps::default();
let mut poisoned = false;
iter_header(
iter_directives(
config.mode,
&config.suite,
&mut poisoned,
@ -347,7 +347,7 @@ impl TestProps {
let mut poisoned = false;
iter_header(
iter_directives(
config.mode,
&config.suite,
&mut poisoned,
@ -794,7 +794,7 @@ const KNOWN_JSONDOCCK_DIRECTIVE_NAMES: &[&str] =
&["count", "!count", "has", "!has", "is", "!is", "ismany", "!ismany", "set", "!set"];
/// The (partly) broken-down contents of a line containing a test directive,
/// which [`iter_header`] passes to its callback function.
/// which [`iter_directives`] passes to its callback function.
///
/// For example:
///
@ -867,7 +867,7 @@ pub(crate) fn check_directive<'a>(
const COMPILETEST_DIRECTIVE_PREFIX: &str = "//@";
fn iter_header(
fn iter_directives(
mode: Mode,
_suite: &str,
poisoned: &mut bool,
@ -1372,7 +1372,7 @@ where
pub(crate) fn make_test_description<R: Read>(
config: &Config,
cache: &HeadersCache,
cache: &DirectivesCache,
name: String,
path: &Utf8Path,
src: R,
@ -1386,7 +1386,7 @@ pub(crate) fn make_test_description<R: Read>(
let mut local_poisoned = false;
// Scan through the test file to handle `ignore-*`, `only-*`, and `needs-*` directives.
iter_header(
iter_directives(
config.mode,
&config.suite,
&mut local_poisoned,

View file

@ -4,7 +4,7 @@ use camino::Utf8Path;
use semver::Version;
use super::{
EarlyProps, HeadersCache, extract_llvm_version, extract_version_range, iter_header,
DirectivesCache, EarlyProps, extract_llvm_version, extract_version_range, iter_directives,
parse_normalize_rule,
};
use crate::common::{Config, Debugger, Mode};
@ -17,7 +17,7 @@ fn make_test_description<R: Read>(
src: R,
revision: Option<&str>,
) -> CollectedTestDesc {
let cache = HeadersCache::load(config);
let cache = DirectivesCache::load(config);
let mut poisoned = false;
let test = crate::directives::make_test_description(
config,
@ -785,7 +785,7 @@ fn threads_support() {
fn run_path(poisoned: &mut bool, path: &Utf8Path, buf: &[u8]) {
let rdr = std::io::Cursor::new(&buf);
iter_header(Mode::Ui, "ui", poisoned, path, rdr, &mut |_| {});
iter_directives(Mode::Ui, "ui", poisoned, path, rdr, &mut |_| {});
}
#[test]

View file

@ -42,7 +42,7 @@ use crate::common::{
CompareMode, Config, Debugger, Mode, PassMode, TestPaths, UI_EXTENSIONS, expected_output_path,
output_base_dir, output_relative_path,
};
use crate::directives::HeadersCache;
use crate::directives::DirectivesCache;
use crate::executor::{CollectedTest, ColorConfig, OutputFormat};
use crate::util::logv;
@ -618,7 +618,7 @@ pub fn run_tests(config: Arc<Config>) {
/// Read-only context data used during test collection.
struct TestCollectorCx {
config: Arc<Config>,
cache: HeadersCache,
cache: DirectivesCache,
common_inputs_stamp: Stamp,
modified_tests: Vec<Utf8PathBuf>,
}
@ -654,7 +654,7 @@ pub(crate) fn collect_and_make_tests(config: Arc<Config>) -> Vec<CollectedTest>
modified_tests(&config, &config.src_test_suite_root).unwrap_or_else(|err| {
fatal!("modified_tests: {}: {err}", config.src_test_suite_root);
});
let cache = HeadersCache::load(&config);
let cache = DirectivesCache::load(&config);
let cx = TestCollectorCx { config, cache, common_inputs_stamp, modified_tests };
let collector = collect_tests_from_dir(&cx, &cx.config.src_test_suite_root, Utf8Path::new(""))