about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <476013+matthiaskrgr@users.noreply.github.com>2025-07-10 15:19:35 +0200
committerGitHub <noreply@github.com>2025-07-10 15:19:35 +0200
commitb5b35f1aa4b95e47fe7e7c461e40c832a163fbe7 (patch)
tree8fa267ba13bfc72816dc14a93e8bd00337d4a7ee /src
parent8c5398a7f7d2aa70d373d4fc4434d0df7f62c5a5 (diff)
parent3f4f23af617171e2e03e867a61b952d56166143b (diff)
downloadrust-b5b35f1aa4b95e47fe7e7c461e40c832a163fbe7.tar.gz
rust-b5b35f1aa4b95e47fe7e7c461e40c832a163fbe7.zip
Rollup merge of #143683 - jieyouxu:rms-cleanup, r=Kobzol
Assorted `run-make-support` maintenance

This PR should contain no functional changes.

- Commit 1: Removes the support library's CHANGELOG. In the very beginning, I thought maybe we would try to version this library. But this is a purely internal test support library, and it's just extra busywork trying to maintain changelog/versions. It's also hopelessly outdated.
- Commit 2: Resets version number to `0.0.0`. Ditto on busywork.
- Commit 3: Bump `run-make-support` to Edition 2024. The support library was already "compliant" with Edition 2024.
- Commit 4: Slightly organizes the support library dependencies.
- Commit 5: Previously, I tried hopelessly to maintain some manual formatting, but that was annoying because it required skipping rustfmt (so export ordering etc. could not be extra formatted). Give up, and do some rearrangements / module prefix tricks to get the `lib.rs` looking at least *reasonable*. IMO this is not a strict improvement, but I rather regain the ability to auto-format it with rustfmt.
- Commit {6,7}: Noticed in rust-lang/rust#143669 that we apparently had *both* {`is_msvc`, `is_windows_msvc`}. This PR removes `is_msvc` in favor of `is_windows_msvc` to make it unambiguous (and only retain one way of gating) as there are some UEFI targets which are MSVC but not Windows.

Best reviewed commit-by-commit.

r? `@Kobzol`
Diffstat (limited to 'src')
-rw-r--r--src/tools/run-make-support/CHANGELOG.md83
-rw-r--r--src/tools/run-make-support/Cargo.toml21
-rw-r--r--src/tools/run-make-support/src/artifact_names.rs6
-rw-r--r--src/tools/run-make-support/src/external_deps/c_build.rs23
-rw-r--r--src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs6
-rw-r--r--src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs6
-rw-r--r--src/tools/run-make-support/src/external_deps/rustc.rs4
-rw-r--r--src/tools/run-make-support/src/lib.rs108
-rw-r--r--src/tools/run-make-support/src/linker.rs4
-rw-r--r--src/tools/run-make-support/src/targets.rs12
10 files changed, 85 insertions, 188 deletions
diff --git a/src/tools/run-make-support/CHANGELOG.md b/src/tools/run-make-support/CHANGELOG.md
deleted file mode 100644
index c1b7b618a92..00000000000
--- a/src/tools/run-make-support/CHANGELOG.md
+++ /dev/null
@@ -1,83 +0,0 @@
-# Changelog
-
-All notable changes to the `run_make_support` library should be documented in this file.
-
-The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the support
-library should adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) even if it's
-not intended for public consumption (it's moreso to help internally, to help test writers track
-changes to the support library).
-
-This support library will probably never reach 1.0. Please bump the minor version in `Cargo.toml` if
-you make any breaking changes or other significant changes, or bump the patch version for bug fixes.
-
-## [0.2.0] - 2024-06-11
-
-### Added
-
-- Added `fs_wrapper` module which provides panic-on-fail helpers for their respective `std::fs`
-  counterparts, the motivation is to:
-    - Reduce littering `.unwrap()` or `.expect()` everywhere for fs operations
-    - Help the test writer avoid forgetting to check fs results (even though enforced by
-      `-Dunused_must_use`)
-    - Provide better panic messages by default
-- Added `path()` helper which creates a `Path` relative to `cwd()` (but is less noisy).
-
-### Changed
-
-- Marked many functions with `#[must_use]`, and rmake.rs are now compiled with `-Dunused_must_use`.
-
-## [0.1.0] - 2024-06-09
-
-### Changed
-
-- Use *drop bombs* to enforce that commands are executed; a command invocation will panic if it is
-  constructed but never executed. Execution methods `Command::{run, run_fail}` will defuse the drop
-  bomb.
-- Added `Command` helpers that forward to `std::process::Command` counterparts.
-
-### Removed
-
-- The `env_var` method which was incorrectly named and is `env_clear` underneath and is a footgun
-  from `impl_common_helpers`. For example, removing `TMPDIR` on Unix and `TMP`/`TEMP` breaks
-  `std::env::temp_dir` and wrecks anything using that, such as rustc's codgen.
-- Removed `Deref`/`DerefMut` for `run_make_support::Command` -> `std::process::Command` because it
-  causes a method chain like `htmldocck().arg().run()` to fail, because `arg()` resolves to
-  `std::process::Command` which also returns a `&mut std::process::Command`, causing the `run()` to
-  be not found.
-
-## [0.0.0] - 2024-06-09
-
-Consider this version to contain all changes made to the support library before we started to track
-changes in this changelog.
-
-### Added
-
-- Custom command wrappers around `std::process::Command` (`run_make_support::Command`) and custom
-  wrapper around `std::process::Output` (`CompletedProcess`) to make it more convenient to work with
-  commands and their output, and help avoid forgetting to check for exit status.
-    - `Command`: `set_stdin`, `run`, `run_fail`.
-    - `CompletedProcess`: `std{err,out}_utf8`, `status`, `assert_std{err,out}_{equals, contains,
-      not_contains}`, `assert_exit_code`.
-- `impl_common_helpers` macro to avoid repeating adding common convenience methods, including:
-    - Environment manipulation methods: `env`, `env_remove`
-    - Command argument providers: `arg`, `args`
-    - Common invocation inspection (of the command invocation up until `inspect` is called):
-      `inspect`
-    - Execution methods: `run` (for commands expected to succeed execution, exit status `0`) and
-      `run_fail` (for commands expected to fail execution, exit status non-zero).
-- Command wrappers around: `rustc`, `clang`, `cc`, `rustc`, `rustdoc`, `llvm-readobj`.
-- Thin helpers to construct `python` and `htmldocck` commands.
-- `run` and `run_fail` (like `Command::{run, run_fail}`) for running binaries, which sets suitable
-  env vars (like `LD_LIB_PATH` or equivalent, `TARGET_RPATH_ENV`, `PATH` on Windows).
-- Pseudo command `diff` which has similar functionality as the cli util but not the same API.
-- Convenience panic-on-fail helpers `env_var`, `env_var_os`, `cwd` for their `std::env` conterparts.
-- Convenience panic-on-fail helpers for reading respective env vars: `target`, `source_root`.
-- Platform check helpers: `is_windows`, `is_msvc`, `cygpath_windows`, `uname`.
-- fs helpers: `copy_dir_all`.
-- `recursive_diff` helper.
-- Generic `assert_not_contains` helper.
-- Scoped run-with-teardown helper `run_in_tmpdir` which is designed to run commands in a temporary
-  directory that is cleared when closure returns.
-- Helpers for constructing the name of binaries and libraries: `rust_lib_name`, `static_lib_name`,
-  `bin_name`, `dynamic_lib_name`.
-- Re-export libraries: `gimli`, `object`, `regex`, `wasmparsmer`.
diff --git a/src/tools/run-make-support/Cargo.toml b/src/tools/run-make-support/Cargo.toml
index 3226f467ba4..a4e7534137d 100644
--- a/src/tools/run-make-support/Cargo.toml
+++ b/src/tools/run-make-support/Cargo.toml
@@ -1,18 +1,27 @@
 [package]
 name = "run_make_support"
-version = "0.2.0"
-edition = "2021"
+version = "0.0.0"
+edition = "2024"
 
 [dependencies]
+
+# These dependencies are either used to implement part of support library
+# functionality, or re-exported to test recipe programs via the support library,
+# or both.
+
+# tidy-alphabetical-start
 bstr = "1.12"
+gimli = "0.32"
+libc = "0.2"
 object = "0.37"
+regex = "1.11"
+serde_json = "1.0"
 similar = "2.7"
 wasmparser = { version = "0.219", default-features = false, features = ["std"] }
-regex = "1.11"
-gimli = "0.32"
+# tidy-alphabetical-end
+
+# Shared with bootstrap and compiletest
 build_helper = { path = "../../build_helper" }
-serde_json = "1.0"
-libc = "0.2"
 
 [lib]
 crate-type = ["lib", "dylib"]
diff --git a/src/tools/run-make-support/src/artifact_names.rs b/src/tools/run-make-support/src/artifact_names.rs
index b0d588d3550..a889b30e145 100644
--- a/src/tools/run-make-support/src/artifact_names.rs
+++ b/src/tools/run-make-support/src/artifact_names.rs
@@ -2,7 +2,7 @@
 //! libraries which are target-dependent.
 
 use crate::target;
-use crate::targets::is_msvc;
+use crate::targets::is_windows_msvc;
 
 /// Construct the static library name based on the target.
 #[track_caller]
@@ -10,7 +10,7 @@ use crate::targets::is_msvc;
 pub fn static_lib_name(name: &str) -> String {
     assert!(!name.contains(char::is_whitespace), "static library name cannot contain whitespace");
 
-    if is_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
+    if is_windows_msvc() { format!("{name}.lib") } else { format!("lib{name}.a") }
 }
 
 /// Construct the dynamic library name based on the target.
@@ -45,7 +45,7 @@ pub fn dynamic_lib_extension() -> &'static str {
 #[track_caller]
 #[must_use]
 pub fn msvc_import_dynamic_lib_name(name: &str) -> String {
-    assert!(is_msvc(), "this function is exclusive to MSVC");
+    assert!(is_windows_msvc(), "this function is exclusive to MSVC");
     assert!(!name.contains(char::is_whitespace), "import library name cannot contain whitespace");
 
     format!("{name}.dll.lib")
diff --git a/src/tools/run-make-support/src/external_deps/c_build.rs b/src/tools/run-make-support/src/external_deps/c_build.rs
index 9dd30713f95..ecbf5ba8fe0 100644
--- a/src/tools/run-make-support/src/external_deps/c_build.rs
+++ b/src/tools/run-make-support/src/external_deps/c_build.rs
@@ -4,7 +4,7 @@ use crate::artifact_names::{dynamic_lib_name, static_lib_name};
 use crate::external_deps::c_cxx_compiler::{cc, cxx};
 use crate::external_deps::llvm::llvm_ar;
 use crate::path_helpers::path;
-use crate::targets::{is_darwin, is_msvc, is_windows};
+use crate::targets::{is_darwin, is_windows, is_windows_msvc};
 
 // FIXME(Oneirical): These native build functions should take a Path-based generic.
 
@@ -24,12 +24,12 @@ pub fn build_native_static_lib_optimized(lib_name: &str) -> PathBuf {
 
 #[track_caller]
 fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
-    let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
+    let obj_file = if is_windows_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
     let src = format!("{lib_name}.c");
     let lib_path = static_lib_name(lib_name);
 
     let mut cc = cc();
-    if !is_msvc() {
+    if !is_windows_msvc() {
         cc.arg("-v");
     }
     if optimzed {
@@ -37,7 +37,7 @@ fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
     }
     cc.arg("-c").out_exe(&obj_file).input(src).optimize().run();
 
-    let obj_file = if is_msvc() {
+    let obj_file = if is_windows_msvc() {
         PathBuf::from(format!("{lib_name}.obj"))
     } else {
         PathBuf::from(format!("{lib_name}.o"))
@@ -50,16 +50,17 @@ fn build_native_static_lib_internal(lib_name: &str, optimzed: bool) -> PathBuf {
 /// [`std::env::consts::DLL_PREFIX`] and [`std::env::consts::DLL_EXTENSION`].
 #[track_caller]
 pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf {
-    let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
+    let obj_file = if is_windows_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
     let src = format!("{lib_name}.c");
     let lib_path = dynamic_lib_name(lib_name);
-    if is_msvc() {
+    if is_windows_msvc() {
         cc().arg("-c").out_exe(&obj_file).input(src).run();
     } else {
         cc().arg("-v").arg("-c").out_exe(&obj_file).input(src).run();
     };
-    let obj_file = if is_msvc() { format!("{lib_name}.obj") } else { format!("{lib_name}.o") };
-    if is_msvc() {
+    let obj_file =
+        if is_windows_msvc() { format!("{lib_name}.obj") } else { format!("{lib_name}.o") };
+    if is_windows_msvc() {
         let out_arg = format!("-out:{lib_path}");
         cc().input(&obj_file).args(&["-link", "-dll", &out_arg]).run();
     } else if is_darwin() {
@@ -79,15 +80,15 @@ pub fn build_native_dynamic_lib(lib_name: &str) -> PathBuf {
 /// Built from a C++ file.
 #[track_caller]
 pub fn build_native_static_lib_cxx(lib_name: &str) -> PathBuf {
-    let obj_file = if is_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
+    let obj_file = if is_windows_msvc() { format!("{lib_name}") } else { format!("{lib_name}.o") };
     let src = format!("{lib_name}.cpp");
     let lib_path = static_lib_name(lib_name);
-    if is_msvc() {
+    if is_windows_msvc() {
         cxx().arg("-EHs").arg("-c").out_exe(&obj_file).input(src).run();
     } else {
         cxx().arg("-c").out_exe(&obj_file).input(src).run();
     };
-    let obj_file = if is_msvc() {
+    let obj_file = if is_windows_msvc() {
         PathBuf::from(format!("{lib_name}.obj"))
     } else {
         PathBuf::from(format!("{lib_name}.o"))
diff --git a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs
index 0e6d6ea6075..31469e669e1 100644
--- a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs
+++ b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/cc.rs
@@ -1,7 +1,7 @@
 use std::path::Path;
 
 use crate::command::Command;
-use crate::{env_var, is_msvc};
+use crate::{env_var, is_windows_msvc};
 
 /// Construct a new platform-specific C compiler invocation.
 ///
@@ -82,7 +82,7 @@ impl Cc {
     pub fn out_exe(&mut self, name: &str) -> &mut Self {
         let mut path = std::path::PathBuf::from(name);
 
-        if is_msvc() {
+        if is_windows_msvc() {
             path.set_extension("exe");
             let fe_path = path.clone();
             path.set_extension("");
@@ -108,7 +108,7 @@ impl Cc {
     /// Optimize the output.
     /// Equivalent to `-O3` for GNU-compatible linkers or `-O2` for MSVC linkers.
     pub fn optimize(&mut self) -> &mut Self {
-        if is_msvc() {
+        if is_windows_msvc() {
             self.cmd.arg("-O2");
         } else {
             self.cmd.arg("-O3");
diff --git a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs
index c0317633873..ac7392641c0 100644
--- a/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs
+++ b/src/tools/run-make-support/src/external_deps/c_cxx_compiler/extras.rs
@@ -1,9 +1,9 @@
-use crate::{is_msvc, is_win7, is_windows, uname};
+use crate::{is_win7, is_windows, is_windows_msvc, uname};
 
 /// `EXTRACFLAGS`
 pub fn extra_c_flags() -> Vec<&'static str> {
     if is_windows() {
-        if is_msvc() {
+        if is_windows_msvc() {
             let mut libs =
                 vec!["ws2_32.lib", "userenv.lib", "bcrypt.lib", "ntdll.lib", "synchronization.lib"];
             if is_win7() {
@@ -29,7 +29,7 @@ pub fn extra_c_flags() -> Vec<&'static str> {
 /// `EXTRACXXFLAGS`
 pub fn extra_cxx_flags() -> Vec<&'static str> {
     if is_windows() {
-        if is_msvc() { vec![] } else { vec!["-lstdc++"] }
+        if is_windows_msvc() { vec![] } else { vec!["-lstdc++"] }
     } else {
         match &uname()[..] {
             "Darwin" => vec!["-lc++"],
diff --git a/src/tools/run-make-support/src/external_deps/rustc.rs b/src/tools/run-make-support/src/external_deps/rustc.rs
index 72a1e062a38..1ea549ca7ea 100644
--- a/src/tools/run-make-support/src/external_deps/rustc.rs
+++ b/src/tools/run-make-support/src/external_deps/rustc.rs
@@ -6,7 +6,7 @@ use crate::command::Command;
 use crate::env::env_var;
 use crate::path_helpers::cwd;
 use crate::util::set_host_compiler_dylib_path;
-use crate::{is_aix, is_darwin, is_msvc, is_windows, target, uname};
+use crate::{is_aix, is_darwin, is_windows, is_windows_msvc, target, uname};
 
 /// Construct a new `rustc` invocation. This will automatically set the library
 /// search path as `-L cwd()`. Use [`bare_rustc`] to avoid this.
@@ -377,7 +377,7 @@ impl Rustc {
             // So we end up with the following hack: we link use static:-bundle to only
             // link the parts of libstdc++ that we actually use, which doesn't include
             // the dependency on the pthreads DLL.
-            if !is_msvc() {
+            if !is_windows_msvc() {
                 self.cmd.arg("-lstatic:-bundle=stdc++");
             };
         } else if is_darwin() {
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 67d8c351a59..29cd6c4ad15 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -3,9 +3,6 @@
 //! notably is built via cargo: this means that if your test wants some non-trivial utility, such
 //! as `object` or `wasmparser`, they can be re-exported and be made available through this library.
 
-// We want to control use declaration ordering and spacing (and preserve use group comments), so
-// skip rustfmt on this file.
-#![cfg_attr(rustfmt, rustfmt::skip)]
 #![warn(unreachable_pub)]
 
 mod command;
@@ -22,8 +19,8 @@ pub mod path_helpers;
 pub mod run;
 pub mod scoped_run;
 pub mod string;
-pub mod targets;
 pub mod symbols;
+pub mod targets;
 
 // Internally we call our fs-related support module as `fs`, but re-export its content as `rfs`
 // to tests to avoid colliding with commonly used `use std::fs;`.
@@ -36,77 +33,56 @@ pub mod rfs {
 }
 
 // Re-exports of third-party library crates.
-// tidy-alphabetical-start
-pub use bstr;
-pub use gimli;
-pub use libc;
-pub use object;
-pub use regex;
-pub use serde_json;
-pub use similar;
-pub use wasmparser;
-// tidy-alphabetical-end
+pub use {bstr, gimli, libc, object, regex, serde_json, similar, wasmparser};
 
-// Re-exports of external dependencies.
-pub use external_deps::{
-    cargo, c_build, c_cxx_compiler, clang, htmldocck, llvm, python, rustc, rustdoc
+// Helpers for building names of output artifacts that are potentially target-specific.
+pub use crate::artifact_names::{
+    bin_name, dynamic_lib_extension, dynamic_lib_name, msvc_import_dynamic_lib_name, rust_lib_name,
+    static_lib_name,
 };
-
-// These rely on external dependencies.
-pub use c_cxx_compiler::{Cc, Gcc, cc, cxx, extra_c_flags, extra_cxx_flags, gcc};
-pub use c_build::{
+pub use crate::assertion_helpers::{
+    assert_contains, assert_contains_regex, assert_count_is, assert_dirs_are_equal, assert_equals,
+    assert_not_contains, assert_not_contains_regex,
+};
+// `diff` is implemented in terms of the [similar] library.
+//
+// [similar]: https://github.com/mitsuhiko/similar
+pub use crate::diff::{Diff, diff};
+// Panic-on-fail [`std::env::var`] and [`std::env::var_os`] wrappers.
+pub use crate::env::{env_var, env_var_os, set_current_dir};
+pub use crate::external_deps::c_build::{
     build_native_dynamic_lib, build_native_static_lib, build_native_static_lib_cxx,
     build_native_static_lib_optimized,
 };
-pub use cargo::cargo;
-pub use clang::{clang, Clang};
-pub use htmldocck::htmldocck;
-pub use llvm::{
-    llvm_ar, llvm_bcanalyzer, llvm_dis, llvm_dwarfdump, llvm_filecheck, llvm_nm, llvm_objcopy,
-    llvm_objdump, llvm_profdata, llvm_readobj, LlvmAr, LlvmBcanalyzer, LlvmDis, LlvmDwarfdump,
-    LlvmFilecheck, LlvmNm, LlvmObjcopy, LlvmObjdump, LlvmProfdata, LlvmReadobj,
-};
-pub use python::python_command;
-pub use rustc::{bare_rustc, rustc, rustc_path, Rustc};
-pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
-
-/// [`diff`][mod@diff] is implemented in terms of the [similar] library.
-///
-/// [similar]: https://github.com/mitsuhiko/similar
-pub use diff::{diff, Diff};
-
-/// Panic-on-fail [`std::env::var`] and [`std::env::var_os`] wrappers.
-pub use env::{env_var, env_var_os, set_current_dir};
-
-/// Convenience helpers for running binaries and other commands.
-pub use run::{cmd, run, run_fail, run_with_args};
-
-/// Helpers for checking target information.
-pub use targets::{
-    apple_os, is_aix, is_darwin, is_msvc, is_windows, is_windows_gnu, is_windows_msvc, is_win7, llvm_components_contain,
-    target, uname,
+// Re-exports of external dependencies.
+pub use crate::external_deps::c_cxx_compiler::{
+    Cc, Gcc, cc, cxx, extra_c_flags, extra_cxx_flags, gcc,
 };
-
-/// Helpers for building names of output artifacts that are potentially target-specific.
-pub use artifact_names::{
-    bin_name, dynamic_lib_extension, dynamic_lib_name, msvc_import_dynamic_lib_name, rust_lib_name,
-    static_lib_name,
+pub use crate::external_deps::cargo::cargo;
+pub use crate::external_deps::clang::{Clang, clang};
+pub use crate::external_deps::htmldocck::htmldocck;
+pub use crate::external_deps::llvm::{
+    self, LlvmAr, LlvmBcanalyzer, LlvmDis, LlvmDwarfdump, LlvmFilecheck, LlvmNm, LlvmObjcopy,
+    LlvmObjdump, LlvmProfdata, LlvmReadobj, llvm_ar, llvm_bcanalyzer, llvm_dis, llvm_dwarfdump,
+    llvm_filecheck, llvm_nm, llvm_objcopy, llvm_objdump, llvm_profdata, llvm_readobj,
 };
-
-/// Path-related helpers.
-pub use path_helpers::{
+pub use crate::external_deps::python::python_command;
+pub use crate::external_deps::rustc::{self, Rustc, bare_rustc, rustc, rustc_path};
+pub use crate::external_deps::rustdoc::{Rustdoc, bare_rustdoc, rustdoc};
+// Path-related helpers.
+pub use crate::path_helpers::{
     build_root, cwd, filename_contains, filename_not_in_denylist, has_extension, has_prefix,
     has_suffix, not_contains, path, shallow_find_directories, shallow_find_files, source_root,
 };
-
-/// Helpers for scoped test execution where certain properties are attempted to be maintained.
-pub use scoped_run::{run_in_tmpdir, test_while_readonly};
-
-pub use assertion_helpers::{
-    assert_contains, assert_contains_regex, assert_count_is, assert_dirs_are_equal, assert_equals,
-    assert_not_contains, assert_not_contains_regex,
-};
-
-pub use string::{
+// Convenience helpers for running binaries and other commands.
+pub use crate::run::{cmd, run, run_fail, run_with_args};
+// Helpers for scoped test execution where certain properties are attempted to be maintained.
+pub use crate::scoped_run::{run_in_tmpdir, test_while_readonly};
+pub use crate::string::{
     count_regex_matches_in_files_with_extension, invalid_utf8_contains, invalid_utf8_not_contains,
 };
+// Helpers for checking target information.
+pub use crate::targets::{
+    apple_os, is_aix, is_darwin, is_win7, is_windows, is_windows_gnu, is_windows_msvc,
+    llvm_components_contain, target, uname,
+};
diff --git a/src/tools/run-make-support/src/linker.rs b/src/tools/run-make-support/src/linker.rs
index 89093cf0113..b2893ad88fe 100644
--- a/src/tools/run-make-support/src/linker.rs
+++ b/src/tools/run-make-support/src/linker.rs
@@ -1,6 +1,6 @@
 use regex::Regex;
 
-use crate::{Rustc, is_msvc};
+use crate::{Rustc, is_windows_msvc};
 
 /// Asserts that `rustc` uses LLD for linking when executed.
 pub fn assert_rustc_uses_lld(rustc: &mut Rustc) {
@@ -22,7 +22,7 @@ pub fn assert_rustc_doesnt_use_lld(rustc: &mut Rustc) {
 
 fn get_stderr_with_linker_messages(rustc: &mut Rustc) -> String {
     // lld-link is used if msvc, otherwise a gnu-compatible lld is used.
-    let linker_version_flag = if is_msvc() { "--version" } else { "-Wl,-v" };
+    let linker_version_flag = if is_windows_msvc() { "--version" } else { "-Wl,-v" };
 
     let output = rustc.arg("-Wlinker-messages").link_arg(linker_version_flag).run();
     output.stderr_utf8()
diff --git a/src/tools/run-make-support/src/targets.rs b/src/tools/run-make-support/src/targets.rs
index 1ab2e2ab2be..b20e12561fb 100644
--- a/src/tools/run-make-support/src/targets.rs
+++ b/src/tools/run-make-support/src/targets.rs
@@ -16,10 +16,10 @@ pub fn is_windows() -> bool {
     target().contains("windows")
 }
 
-/// Check if target uses msvc.
+/// Check if target is windows-msvc.
 #[must_use]
-pub fn is_msvc() -> bool {
-    target().contains("msvc")
+pub fn is_windows_msvc() -> bool {
+    target().ends_with("windows-msvc")
 }
 
 /// Check if target is windows-gnu.
@@ -28,12 +28,6 @@ pub fn is_windows_gnu() -> bool {
     target().ends_with("windows-gnu")
 }
 
-/// Check if target is windows-msvc.
-#[must_use]
-pub fn is_windows_msvc() -> bool {
-    target().ends_with("windows-msvc")
-}
-
 /// Check if target is win7.
 #[must_use]
 pub fn is_win7() -> bool {