From cf5788d30dfbb3532c1e4fc18b009bfa51edb310 Mon Sep 17 00:00:00 2001 From: Jieyou Xu Date: Mon, 30 Jun 2025 17:15:32 +0800 Subject: [PATCH] Rename `header` -> `directives` compiletest has confusingly two terminology to refer to the same concept -- "headers" and "directives". To make this more self-consistent and less confusing, stick with "directives" only. This commit **intentionally** tries to be limited to move-only (modulo some key usage reference renames) to help git history. --- src/tools/compiletest/src/{header.rs => directives.rs} | 4 ++-- .../src/{header => directives}/auxiliary.rs | 0 .../compiletest/src/{header => directives}/cfg.rs | 2 +- .../compiletest/src/{header => directives}/needs.rs | 2 +- .../test-auxillary/error_annotation.rs | 0 .../test-auxillary/known_directive.rs | 0 .../test-auxillary/not_rs.Makefile | 0 .../test-auxillary/unknown_directive.rs | 0 .../compiletest/src/{header => directives}/tests.rs | 2 +- src/tools/compiletest/src/lib.rs | 10 +++++----- src/tools/compiletest/src/runtest.rs | 2 +- src/tools/rustdoc-gui-test/src/main.rs | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) rename src/tools/compiletest/src/{header.rs => directives.rs} (99%) rename src/tools/compiletest/src/{header => directives}/auxiliary.rs (100%) rename src/tools/compiletest/src/{header => directives}/cfg.rs (99%) rename src/tools/compiletest/src/{header => directives}/needs.rs (99%) rename src/tools/compiletest/src/{header => directives}/test-auxillary/error_annotation.rs (100%) rename src/tools/compiletest/src/{header => directives}/test-auxillary/known_directive.rs (100%) rename src/tools/compiletest/src/{header => directives}/test-auxillary/not_rs.Makefile (100%) rename src/tools/compiletest/src/{header => directives}/test-auxillary/unknown_directive.rs (100%) rename src/tools/compiletest/src/{header => directives}/tests.rs (99%) diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/directives.rs similarity index 99% rename from src/tools/compiletest/src/header.rs rename to src/tools/compiletest/src/directives.rs index 5636a146b0f4..f5201cdb4b3c 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/directives.rs @@ -13,8 +13,8 @@ use crate::common::{Config, Debugger, FailMode, Mode, PassMode}; use crate::debuggers::{extract_cdb_version, extract_gdb_version}; use crate::errors::ErrorKind; use crate::executor::{CollectedTestDesc, ShouldPanic}; -use crate::header::auxiliary::{AuxProps, parse_and_update_aux}; -use crate::header::needs::CachedNeedsConditions; +use crate::directives::auxiliary::{AuxProps, parse_and_update_aux}; +use crate::directives::needs::CachedNeedsConditions; use crate::help; use crate::util::static_regex; diff --git a/src/tools/compiletest/src/header/auxiliary.rs b/src/tools/compiletest/src/directives/auxiliary.rs similarity index 100% rename from src/tools/compiletest/src/header/auxiliary.rs rename to src/tools/compiletest/src/directives/auxiliary.rs diff --git a/src/tools/compiletest/src/header/cfg.rs b/src/tools/compiletest/src/directives/cfg.rs similarity index 99% rename from src/tools/compiletest/src/header/cfg.rs rename to src/tools/compiletest/src/directives/cfg.rs index f1f1384afb97..35f6a9e16448 100644 --- a/src/tools/compiletest/src/header/cfg.rs +++ b/src/tools/compiletest/src/directives/cfg.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; use crate::common::{CompareMode, Config, Debugger}; -use crate::header::IgnoreDecision; +use crate::directives::IgnoreDecision; const EXTRA_ARCHS: &[&str] = &["spirv"]; diff --git a/src/tools/compiletest/src/header/needs.rs b/src/tools/compiletest/src/directives/needs.rs similarity index 99% rename from src/tools/compiletest/src/header/needs.rs rename to src/tools/compiletest/src/directives/needs.rs index b1165f4bb184..ee46f4c70cb8 100644 --- a/src/tools/compiletest/src/header/needs.rs +++ b/src/tools/compiletest/src/directives/needs.rs @@ -1,5 +1,5 @@ use crate::common::{Config, KNOWN_CRATE_TYPES, KNOWN_TARGET_HAS_ATOMIC_WIDTHS, Sanitizer}; -use crate::header::{IgnoreDecision, llvm_has_libzstd}; +use crate::directives::{IgnoreDecision, llvm_has_libzstd}; pub(super) fn handle_needs( cache: &CachedNeedsConditions, diff --git a/src/tools/compiletest/src/header/test-auxillary/error_annotation.rs b/src/tools/compiletest/src/directives/test-auxillary/error_annotation.rs similarity index 100% rename from src/tools/compiletest/src/header/test-auxillary/error_annotation.rs rename to src/tools/compiletest/src/directives/test-auxillary/error_annotation.rs diff --git a/src/tools/compiletest/src/header/test-auxillary/known_directive.rs b/src/tools/compiletest/src/directives/test-auxillary/known_directive.rs similarity index 100% rename from src/tools/compiletest/src/header/test-auxillary/known_directive.rs rename to src/tools/compiletest/src/directives/test-auxillary/known_directive.rs diff --git a/src/tools/compiletest/src/header/test-auxillary/not_rs.Makefile b/src/tools/compiletest/src/directives/test-auxillary/not_rs.Makefile similarity index 100% rename from src/tools/compiletest/src/header/test-auxillary/not_rs.Makefile rename to src/tools/compiletest/src/directives/test-auxillary/not_rs.Makefile diff --git a/src/tools/compiletest/src/header/test-auxillary/unknown_directive.rs b/src/tools/compiletest/src/directives/test-auxillary/unknown_directive.rs similarity index 100% rename from src/tools/compiletest/src/header/test-auxillary/unknown_directive.rs rename to src/tools/compiletest/src/directives/test-auxillary/unknown_directive.rs diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/directives/tests.rs similarity index 99% rename from src/tools/compiletest/src/header/tests.rs rename to src/tools/compiletest/src/directives/tests.rs index 31b49b09bcdc..8068a4b5282c 100644 --- a/src/tools/compiletest/src/header/tests.rs +++ b/src/tools/compiletest/src/directives/tests.rs @@ -19,7 +19,7 @@ fn make_test_description( ) -> CollectedTestDesc { let cache = HeadersCache::load(config); let mut poisoned = false; - let test = crate::header::make_test_description( + let test = crate::directives::make_test_description( config, &cache, name, diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index 09de3eb4c702..7f2b73eb81bf 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -14,7 +14,7 @@ mod debuggers; pub mod diagnostics; pub mod errors; mod executor; -pub mod header; +pub mod directives; mod json; mod raise_fd_limit; mod read2; @@ -37,13 +37,13 @@ use rayon::iter::{ParallelBridge, ParallelIterator}; use tracing::debug; use walkdir::WalkDir; -use self::header::{EarlyProps, make_test_description}; +use self::directives::{EarlyProps, make_test_description}; use crate::common::{ CompareMode, Config, Debugger, Mode, PassMode, TestPaths, UI_EXTENSIONS, expected_output_path, output_base_dir, output_relative_path, }; use crate::executor::{CollectedTest, ColorConfig, OutputFormat}; -use crate::header::HeadersCache; +use crate::directives::HeadersCache; use crate::util::logv; /// Creates the `Config` instance for this invocation of compiletest. @@ -254,8 +254,8 @@ pub fn parse_config(args: Vec) -> Config { Some(x) => panic!("argument for --color must be auto, always, or never, but found `{}`", x), }; let llvm_version = - matches.opt_str("llvm-version").as_deref().map(header::extract_llvm_version).or_else( - || header::extract_llvm_version_from_binary(&matches.opt_str("llvm-filecheck")?), + matches.opt_str("llvm-version").as_deref().map(directives::extract_llvm_version).or_else( + || directives::extract_llvm_version_from_binary(&matches.opt_str("llvm-filecheck")?), ); let run_ignored = matches.opt_present("ignored"); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 53b5990d3cde..acc81dda4a81 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -24,7 +24,7 @@ use crate::common::{ }; use crate::compute_diff::{DiffLine, make_diff, write_diff, write_filtered_diff}; use crate::errors::{Error, ErrorKind, load_errors}; -use crate::header::TestProps; +use crate::directives::TestProps; use crate::read2::{Truncated, read2_abbreviated}; use crate::util::{Utf8PathBufExt, add_dylib_path, logv, static_regex}; use crate::{ColorConfig, help, json, stamp_file_path, warning}; diff --git a/src/tools/rustdoc-gui-test/src/main.rs b/src/tools/rustdoc-gui-test/src/main.rs index addb0af4a541..6461f38f527b 100644 --- a/src/tools/rustdoc-gui-test/src/main.rs +++ b/src/tools/rustdoc-gui-test/src/main.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use std::{env, fs}; use build_helper::util::try_run; -use compiletest::header::TestProps; +use compiletest::directives::TestProps; use config::Config; mod config;