diff --git a/compiler/rustc_infer/messages.ftl b/compiler/rustc_infer/messages.ftl
index 8f1c4ad462a67..fbe8d31370cc3 100644
--- a/compiler/rustc_infer/messages.ftl
+++ b/compiler/rustc_infer/messages.ftl
@@ -104,10 +104,10 @@ infer_compare_impl_item_obligation = ...so that the definition in impl matches t
 infer_consider_specifying_length = consider specifying the actual array length
 infer_data_flows = ...but data{$label_var1_exists ->
     [true] {" "}from `{$label_var1}`
-    *[false] -> {""}
+    *[false] {""}
 } flows{$label_var2_exists ->
     [true] {" "}into `{$label_var2}`
-    *[false] -> {""}
+    *[false] {""}
 } here
 
 infer_data_lifetime_flow = ...but data with one lifetime flows into the other here
diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl
index 6f6480a496413..8b1a9a12886e6 100644
--- a/compiler/rustc_lint/messages.ftl
+++ b/compiler/rustc_lint/messages.ftl
@@ -627,7 +627,7 @@ lint_pattern_in_foreign = patterns aren't allowed in foreign function declaratio
     .label = pattern not allowed in foreign function
 
 lint_private_extern_crate_reexport =
-    extern crate `{$ident}` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
+    extern crate `{$ident}` is private, and cannot be re-exported, consider declaring with `pub`
 
 lint_proc_macro_back_compat = using an old version of `{$crate_name}`
     .note = older versions of the `{$crate_name}` crate will stop compiling in future versions of Rust; please update to `{$crate_name}` v{$fixed_version}, or switch to one of the `{$crate_name}` alternatives
diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs
index 0f059bceae7cb..a3a8e5199ff73 100644
--- a/compiler/rustc_lint/src/builtin.rs
+++ b/compiler/rustc_lint/src/builtin.rs
@@ -674,11 +674,10 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
                 return;
             }
         }
-        let param_env = ty::ParamEnv::empty();
-        if ty.is_copy_modulo_regions(cx.tcx, param_env) {
+        if ty.is_copy_modulo_regions(cx.tcx, cx.param_env) {
             return;
         }
-        if type_implements_negative_copy_modulo_regions(cx.tcx, ty, param_env) {
+        if type_implements_negative_copy_modulo_regions(cx.tcx, ty, cx.param_env) {
             return;
         }
         if def.is_variant_list_non_exhaustive()
@@ -694,7 +693,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
                 .tcx
                 .infer_ctxt()
                 .build()
-                .type_implements_trait(iter_trait, [ty], param_env)
+                .type_implements_trait(iter_trait, [ty], cx.param_env)
                 .must_apply_modulo_regions()
         {
             return;
@@ -711,7 +710,7 @@ impl<'tcx> LateLintPass<'tcx> for MissingCopyImplementations {
 
         if type_allowed_to_implement_copy(
             cx.tcx,
-            param_env,
+            cx.param_env,
             ty,
             traits::ObligationCause::misc(item.span, item.owner_id.def_id),
         )
diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs
index 3bd6faca37963..51f58e3f4e531 100644
--- a/compiler/rustc_lint/src/lints.rs
+++ b/compiler/rustc_lint/src/lints.rs
@@ -2227,7 +2227,7 @@ pub struct MacroUseDeprecated;
 pub struct UnusedMacroUse;
 
 #[derive(LintDiagnostic)]
-#[diag(lint_private_extern_crate_reexport)]
+#[diag(lint_private_extern_crate_reexport, code = E0365)]
 pub struct PrivateExternCrateReexport {
     pub ident: Ident,
 }
diff --git a/compiler/rustc_metadata/messages.ftl b/compiler/rustc_metadata/messages.ftl
index 2f5dfad265c80..932603cd6b267 100644
--- a/compiler/rustc_metadata/messages.ftl
+++ b/compiler/rustc_metadata/messages.ftl
@@ -91,9 +91,6 @@ metadata_found_staticlib =
     found staticlib `{$crate_name}` instead of rlib or dylib{$add_info}
     .help = please recompile that crate using --crate-type lib
 
-metadata_framework_only_windows =
-    link kind `raw-dylib` is only supported on Windows targets
-
 metadata_global_alloc_required =
     no global memory allocator found but one is required; link to std or add `#[global_allocator]` to a static item that implements the GlobalAlloc trait
 
@@ -233,6 +230,9 @@ metadata_profiler_builtins_needs_core =
 metadata_raw_dylib_no_nul =
     link name must not contain NUL characters if link kind is `raw-dylib`
 
+metadata_raw_dylib_only_windows =
+    link kind `raw-dylib` is only supported on Windows targets
+
 metadata_renaming_no_link =
     renaming of the library `{$lib_name}` was specified, however this crate contains no `#[link(...)]` attributes referencing this library
 
diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs
index fb0010f2c5d2e..47d183a044040 100644
--- a/compiler/rustc_metadata/src/errors.rs
+++ b/compiler/rustc_metadata/src/errors.rs
@@ -142,8 +142,8 @@ pub struct LinkFrameworkApple {
 }
 
 #[derive(Diagnostic)]
-#[diag(metadata_framework_only_windows, code = E0455)]
-pub struct FrameworkOnlyWindows {
+#[diag(metadata_raw_dylib_only_windows, code = E0455)]
+pub struct RawDylibOnlyWindows {
     #[primary_span]
     pub span: Span,
 }
diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs
index 58760be921a61..1254ebead0727 100644
--- a/compiler/rustc_metadata/src/native_libs.rs
+++ b/compiler/rustc_metadata/src/native_libs.rs
@@ -151,7 +151,7 @@ impl<'tcx> Collector<'tcx> {
                             }
                             "raw-dylib" => {
                                 if !sess.target.is_like_windows {
-                                    sess.dcx().emit_err(errors::FrameworkOnlyWindows { span });
+                                    sess.dcx().emit_err(errors::RawDylibOnlyWindows { span });
                                 }
                                 NativeLibKind::RawDylib
                             }
diff --git a/compiler/rustc_mir_build/messages.ftl b/compiler/rustc_mir_build/messages.ftl
index 0bb44dbb8706b..67e1e15defab4 100644
--- a/compiler/rustc_mir_build/messages.ftl
+++ b/compiler/rustc_mir_build/messages.ftl
@@ -335,12 +335,12 @@ mir_build_unsafe_fn_safe_body = an unsafe function restricts its caller, but its
 mir_build_unsafe_not_inherited = items do not inherit unsafety from separate enclosing items
 
 mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe =
-    borrow of layout constrained field with interior mutability is unsafe and requires unsafe block (error E0133)
+    borrow of layout constrained field with interior mutability is unsafe and requires unsafe block
     .note = references to fields of layout constrained fields lose the constraints. Coupled with interior mutability, the field can be changed to invalid values
     .label = borrow of layout constrained field with interior mutability
 
 mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe =
-    call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
+    call to function `{$function}` with `#[target_feature]` is unsafe and requires unsafe block
     .help = in order for the call to be safe, the context requires the following additional target {$missing_target_features_count ->
         [1] feature
         *[count] features
@@ -355,48 +355,47 @@ mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe =
     .label = call to function with `#[target_feature]`
 
 mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe =
-    call to unsafe function `{$function}` is unsafe and requires unsafe block (error E0133)
+    call to unsafe function `{$function}` is unsafe and requires unsafe block
     .note = consult the function's documentation for information on how to avoid undefined behavior
     .label = call to unsafe function
 
 mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless =
-    call to unsafe function is unsafe and requires unsafe block (error E0133)
+    call to unsafe function is unsafe and requires unsafe block
     .note = consult the function's documentation for information on how to avoid undefined behavior
     .label = call to unsafe function
 
 mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe =
-    dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+    dereference of raw pointer is unsafe and requires unsafe block
     .note = raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
     .label = dereference of raw pointer
 
 mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe =
-    use of extern static is unsafe and requires unsafe block (error E0133)
+    use of extern static is unsafe and requires unsafe block
     .note = extern statics are not controlled by the Rust type system: invalid data, aliasing violations or data races will cause undefined behavior
     .label = use of extern static
 
 mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe =
-    initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe
-    block (error E0133)
+    initializing type with `rustc_layout_scalar_valid_range` attr is unsafe and requires unsafe block
     .note = initializing a layout restricted type's field with a value outside the valid range is undefined behavior
     .label = initializing type with `rustc_layout_scalar_valid_range` attr
 
 mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe =
-    use of inline assembly is unsafe and requires unsafe block (error E0133)
+    use of inline assembly is unsafe and requires unsafe block
     .note = inline assembly is entirely unchecked and can cause undefined behavior
     .label = use of inline assembly
 
 mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe =
-    use of mutable static is unsafe and requires unsafe block (error E0133)
+    use of mutable static is unsafe and requires unsafe block
     .note = mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
     .label = use of mutable static
 
 mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe =
-    mutation of layout constrained field is unsafe and requires unsafe block (error E0133)
+    mutation of layout constrained field is unsafe and requires unsafe block
     .note = mutating layout constrained fields cannot statically be checked for valid values
     .label = mutation of layout constrained field
 
 mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe =
-    access to union field is unsafe and requires unsafe block (error E0133)
+    access to union field is unsafe and requires unsafe block
     .note = the field may not be properly initialized: using uninitialized data will cause undefined behavior
     .label = access to union field
 
diff --git a/compiler/rustc_mir_build/src/errors.rs b/compiler/rustc_mir_build/src/errors.rs
index e2a28467b8457..38e6c00add81e 100644
--- a/compiler/rustc_mir_build/src/errors.rs
+++ b/compiler/rustc_mir_build/src/errors.rs
@@ -21,7 +21,7 @@ pub struct UnconditionalRecursion {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
     #[label]
@@ -32,7 +32,7 @@ pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_unsafe_fn_requires_unsafe_nameless, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
     #[label]
@@ -42,7 +42,7 @@ pub struct UnsafeOpInUnsafeFnCallToUnsafeFunctionRequiresUnsafeNameless {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_inline_assembly_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
     #[label]
@@ -52,7 +52,7 @@ pub struct UnsafeOpInUnsafeFnUseOfInlineAssemblyRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_initializing_type_with_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
     #[label]
@@ -62,7 +62,7 @@ pub struct UnsafeOpInUnsafeFnInitializingTypeWithRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_mutable_static_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
     #[label]
@@ -72,7 +72,7 @@ pub struct UnsafeOpInUnsafeFnUseOfMutableStaticRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_extern_static_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
     #[label]
@@ -82,7 +82,7 @@ pub struct UnsafeOpInUnsafeFnUseOfExternStaticRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_deref_raw_pointer_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
     #[label]
@@ -92,7 +92,7 @@ pub struct UnsafeOpInUnsafeFnDerefOfRawPointerRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_union_field_requires_unsafe, code = E0133)]
 #[note]
 pub struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
     #[label]
@@ -102,7 +102,10 @@ pub struct UnsafeOpInUnsafeFnAccessToUnionFieldRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe)]
+#[diag(
+    mir_build_unsafe_op_in_unsafe_fn_mutation_of_layout_constrained_field_requires_unsafe,
+    code = E0133
+)]
 #[note]
 pub struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
     #[label]
@@ -112,7 +115,10 @@ pub struct UnsafeOpInUnsafeFnMutationOfLayoutConstrainedFieldRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe)]
+#[diag(
+    mir_build_unsafe_op_in_unsafe_fn_borrow_of_layout_constrained_field_requires_unsafe,
+    code = E0133,
+)]
 pub struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
     #[label]
     pub span: Span,
@@ -121,7 +127,7 @@ pub struct UnsafeOpInUnsafeFnBorrowOfLayoutConstrainedFieldRequiresUnsafe {
 }
 
 #[derive(LintDiagnostic)]
-#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe)]
+#[diag(mir_build_unsafe_op_in_unsafe_fn_call_to_fn_with_requires_unsafe, code = E0133)]
 #[help]
 pub struct UnsafeOpInUnsafeFnCallToFunctionWithRequiresUnsafe {
     #[label]
diff --git a/src/tools/run-make-support/src/cc.rs b/src/tools/run-make-support/src/cc.rs
index a67f5c8a9ee43..799c36b104999 100644
--- a/src/tools/run-make-support/src/cc.rs
+++ b/src/tools/run-make-support/src/cc.rs
@@ -45,6 +45,14 @@ impl Cc {
         self
     }
 
+    /// Adds directories to the list that the linker searches for libraries.
+    /// Equivalent to `-L`.
+    pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg("-L");
+        self.cmd.arg(path.as_ref());
+        self
+    }
+
     /// Specify `-o` or `-Fe`/`-Fo` depending on platform/compiler. This assumes that the executable
     /// is under `$TMPDIR`.
     pub fn out_exe(&mut self, name: &str) -> &mut Self {
diff --git a/src/tools/run-make-support/src/lib.rs b/src/tools/run-make-support/src/lib.rs
index 9854d91e19e33..6a7a11861cd72 100644
--- a/src/tools/run-make-support/src/lib.rs
+++ b/src/tools/run-make-support/src/lib.rs
@@ -6,7 +6,7 @@
 pub mod cc;
 pub mod clang;
 pub mod diff;
-pub mod llvm_readobj;
+pub mod llvm;
 pub mod run;
 pub mod rustc;
 pub mod rustdoc;
@@ -23,8 +23,8 @@ pub use wasmparser;
 pub use cc::{cc, extra_c_flags, extra_cxx_flags, Cc};
 pub use clang::{clang, Clang};
 pub use diff::{diff, Diff};
-pub use llvm_readobj::{llvm_readobj, LlvmReadobj};
-pub use run::{run, run_fail};
+pub use llvm::{llvm_profdata, llvm_readobj, llvm_filecheck, LlvmProfdata, LlvmReadobj, LlvmFilecheck};
+pub use run::{run, run_fail, run_with_args};
 pub use rustc::{aux_build, rustc, Rustc};
 pub use rustdoc::{bare_rustdoc, rustdoc, Rustdoc};
 
diff --git a/src/tools/run-make-support/src/llvm.rs b/src/tools/run-make-support/src/llvm.rs
new file mode 100644
index 0000000000000..503ac68b7a2d1
--- /dev/null
+++ b/src/tools/run-make-support/src/llvm.rs
@@ -0,0 +1,153 @@
+use std::env;
+use std::path::{Path, PathBuf};
+use std::process::{Command, Output};
+use std::io::{BufReader, Read, Write};
+use std::fs::File;
+
+use crate::handle_failed_output;
+
+/// Construct a new `llvm-readobj` invocation. This assumes that `llvm-readobj` is available
+/// at `$LLVM_BIN_DIR/llvm-readobj`.
+pub fn llvm_readobj() -> LlvmReadobj {
+    LlvmReadobj::new()
+}
+
+/// Construct a new `llvm-profdata` invocation. This assumes that `llvm-profdata` is available
+/// at `$LLVM_BIN_DIR/llvm-profdata`.
+pub fn llvm_profdata() -> LlvmProfdata {
+    LlvmProfdata::new()
+}
+
+/// Construct a new `llvm-filecheck` invocation. This assumes that `llvm-filecheck` is available
+/// at `$LLVM_FILECHECK`.
+pub fn llvm_filecheck() -> LlvmFilecheck {
+    LlvmFilecheck::new()
+}
+
+/// A `llvm-readobj` invocation builder.
+#[derive(Debug)]
+pub struct LlvmReadobj {
+    cmd: Command,
+}
+
+/// A `llvm-profdata` invocation builder.
+#[derive(Debug)]
+pub struct LlvmProfdata {
+    cmd: Command,
+}
+
+/// A `llvm-filecheck` invocation builder.
+#[derive(Debug)]
+pub struct LlvmFilecheck {
+    cmd: Command,
+}
+
+crate::impl_common_helpers!(LlvmReadobj);
+
+/// Generate the path to the bin directory of LLVM.
+pub fn llvm_bin_dir() -> PathBuf {
+    let llvm_bin_dir = env::var("LLVM_BIN_DIR")
+    .expect("`LLVM_BIN_DIR` not specified, but this is required to find `llvm-readobj`");
+    PathBuf::from(llvm_bin_dir)
+}
+
+impl LlvmReadobj {
+    /// Construct a new `llvm-readobj` invocation. This assumes that `llvm-readobj` is available
+    /// at `$LLVM_BIN_DIR/llvm-readobj`.
+    pub fn new() -> Self {
+        let llvm_readobj = llvm_bin_dir().join("llvm-readobj");
+        let cmd = Command::new(llvm_readobj);
+        Self { cmd }
+    }
+
+    /// Provide an input file.
+    pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg(path.as_ref());
+        self
+    }
+
+    /// Pass `--file-header` to display file headers.
+    pub fn file_header(&mut self) -> &mut Self {
+        self.cmd.arg("--file-header");
+        self
+    }
+
+    /// Get the [`Output`][::std::process::Output] of the finished process.
+    #[track_caller]
+    pub fn command_output(&mut self) -> Output {
+        self.cmd.output().expect("failed to get output of finished process")
+    }
+}
+
+impl LlvmProfdata {
+    /// Construct a new `llvm-profdata` invocation. This assumes that `llvm-profdata` is available
+    /// at `$LLVM_BIN_DIR/llvm-profdata`.
+    pub fn new() -> Self {
+        let llvm_profdata = llvm_bin_dir().join("llvm-profdata");
+        let cmd = Command::new(llvm_profdata);
+        Self { cmd }
+    }
+
+    /// Provide an input file.
+    pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg("-o");
+        self.cmd.arg(path.as_ref());
+        self
+    }
+
+    /// Specify the output file path.
+    pub fn output<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg(path.as_ref());
+        self
+    }
+
+    /// Take several profile data files generated by PGO instrumentation and merge them
+    /// together into a single indexed profile data file.
+    pub fn merge(&mut self) -> &mut Self {
+        self.cmd.arg("merge");
+        self
+    }
+
+    /// Get the [`Output`][::std::process::Output] of the finished process.
+    #[track_caller]
+    pub fn command_output(&mut self) -> Output {
+        self.cmd.output().expect("failed to get output of finished process")
+    }
+}
+
+impl LlvmFilecheck {
+    /// Construct a new `llvm-filecheck` invocation. This assumes that `llvm-filecheck` is available
+    /// at `$LLVM_FILECHECK`.
+    pub fn new() -> Self {
+        let llvm_filecheck = env::var("LLVM_FILECHECK").expect("LLVM_FILECHECK env var not specified");
+        let cmd = Command::new(llvm_filecheck);
+        Self { cmd }
+    }
+
+    /// Pipe a file into standard input containing patterns that will be matched against the .patterns(path) call.
+    pub fn stdin<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        let file = File::open(path).unwrap();
+        let reader = BufReader::new(file);
+        let byte_vec = read_bytes(reader).expect("failed to read bytes of standard input");
+        let byte_slice = byte_vec.as_slice();
+        self.cmd.stdin(std::process::Stdio::piped());
+        let mut child = self.cmd.spawn().unwrap();
+        let mut stdin = child.stdin.take().unwrap();
+        stdin.write_all(byte_slice).unwrap();
+        stdin.flush().unwrap();
+        child.wait_with_output().unwrap();
+        self
+    }
+
+    /// Provide the patterns that need to be matched.
+    pub fn patterns<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg(path.as_ref());
+        self
+    }
+}
+
+fn read_bytes<R: Read>(mut reader: R) -> Result<Vec<u8>, std::io::Error> {
+    let mut buffer = Vec::new();
+    reader.read_to_end(&mut buffer)?;
+    Ok(buffer)
+}
diff --git a/src/tools/run-make-support/src/llvm_readobj.rs b/src/tools/run-make-support/src/llvm_readobj.rs
deleted file mode 100644
index f114aacfa3fc7..0000000000000
--- a/src/tools/run-make-support/src/llvm_readobj.rs
+++ /dev/null
@@ -1,50 +0,0 @@
-use std::env;
-use std::path::{Path, PathBuf};
-use std::process::Command;
-
-use crate::handle_failed_output;
-
-/// Construct a new `llvm-readobj` invocation. This assumes that `llvm-readobj` is available
-/// at `$LLVM_BIN_DIR/llvm-readobj`.
-pub fn llvm_readobj() -> LlvmReadobj {
-    LlvmReadobj::new()
-}
-
-/// A `llvm-readobj` invocation builder.
-#[derive(Debug)]
-pub struct LlvmReadobj {
-    cmd: Command,
-}
-
-crate::impl_common_helpers!(LlvmReadobj);
-
-impl LlvmReadobj {
-    /// Construct a new `llvm-readobj` invocation. This assumes that `llvm-readobj` is available
-    /// at `$LLVM_BIN_DIR/llvm-readobj`.
-    pub fn new() -> Self {
-        let llvm_bin_dir = env::var("LLVM_BIN_DIR")
-            .expect("`LLVM_BIN_DIR` not specified, but this is required to find `llvm-readobj`");
-        let llvm_bin_dir = PathBuf::from(llvm_bin_dir);
-        let llvm_readobj = llvm_bin_dir.join("llvm-readobj");
-        let cmd = Command::new(llvm_readobj);
-        Self { cmd }
-    }
-
-    /// Provide an input file.
-    pub fn input<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
-        self.cmd.arg(path.as_ref());
-        self
-    }
-
-    /// Pass `--file-header` to display file headers.
-    pub fn file_header(&mut self) -> &mut Self {
-        self.cmd.arg("--file-header");
-        self
-    }
-
-    /// Get the [`Output`][::std::process::Output] of the finished process.
-    #[track_caller]
-    pub fn command_output(&mut self) -> ::std::process::Output {
-        self.cmd.output().expect("failed to get output of finished process")
-    }
-}
diff --git a/src/tools/run-make-support/src/run.rs b/src/tools/run-make-support/src/run.rs
index 9aad91f1b4630..2a571c93e0cb9 100644
--- a/src/tools/run-make-support/src/run.rs
+++ b/src/tools/run-make-support/src/run.rs
@@ -6,12 +6,17 @@ use crate::is_windows;
 
 use super::{bin_name, handle_failed_output};
 
-fn run_common(name: &str) -> (Command, Output) {
+fn run_common(name: &str, args: Option<&[&str]>) -> (Command, Output) {
     let mut bin_path = PathBuf::new();
     bin_path.push(env::var("TMPDIR").unwrap());
     bin_path.push(&bin_name(name));
     let ld_lib_path_envvar = env::var("LD_LIB_PATH_ENVVAR").unwrap();
     let mut cmd = Command::new(bin_path);
+    if let Some(args) = args {
+        for arg in args {
+            cmd.arg(arg);
+        }
+    }
     cmd.env(&ld_lib_path_envvar, {
         let mut paths = vec![];
         paths.push(PathBuf::from(env::var("TMPDIR").unwrap()));
@@ -43,7 +48,20 @@ pub fn run(name: &str) -> Output {
     let caller_location = std::panic::Location::caller();
     let caller_line_number = caller_location.line();
 
-    let (cmd, output) = run_common(name);
+    let (cmd, output) = run_common(name, None);
+    if !output.status.success() {
+        handle_failed_output(&cmd, output, caller_line_number);
+    }
+    output
+}
+
+/// Run a built binary with one or more argument(s) and make sure it succeeds.
+#[track_caller]
+pub fn run_with_args(name: &str, args: &[&str]) -> Output {
+    let caller_location = std::panic::Location::caller();
+    let caller_line_number = caller_location.line();
+
+    let (cmd, output) = run_common(name, Some(args));
     if !output.status.success() {
         handle_failed_output(&cmd, output, caller_line_number);
     }
@@ -56,7 +74,7 @@ pub fn run_fail(name: &str) -> Output {
     let caller_location = std::panic::Location::caller();
     let caller_line_number = caller_location.line();
 
-    let (cmd, output) = run_common(name);
+    let (cmd, output) = run_common(name, None);
     if output.status.success() {
         handle_failed_output(&cmd, output, caller_line_number);
     }
diff --git a/src/tools/run-make-support/src/rustc.rs b/src/tools/run-make-support/src/rustc.rs
index f581204d5f1cb..dbabecb24fa7b 100644
--- a/src/tools/run-make-support/src/rustc.rs
+++ b/src/tools/run-make-support/src/rustc.rs
@@ -131,6 +131,24 @@ impl Rustc {
         self
     }
 
+    /// Specify directory path used for profile generation
+    pub fn profile_generate<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        let mut arg = OsString::new();
+        arg.push("-Cprofile-generate=");
+        arg.push(path.as_ref());
+        self.cmd.arg(&arg);
+        self
+    }
+
+    /// Specify directory path used for profile usage
+    pub fn profile_use<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        let mut arg = OsString::new();
+        arg.push("-Cprofile-use=");
+        arg.push(path.as_ref());
+        self.cmd.arg(&arg);
+        self
+    }
+
     /// Specify error format to use
     pub fn error_format(&mut self, format: &str) -> &mut Self {
         self.cmd.arg(format!("--error-format={format}"));
@@ -156,13 +174,20 @@ impl Rustc {
         self
     }
 
-    /// Add a directory to the library search path. Equivalent to `-L`` in rustc.
+    /// Add a directory to the library search path. Equivalent to `-L` in rustc.
     pub fn library_search_path<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
         self.cmd.arg("-L");
         self.cmd.arg(path.as_ref());
         self
     }
 
+    /// Override the system root. Equivalent to `--sysroot` in rustc.
+    pub fn sysroot<P: AsRef<Path>>(&mut self, path: P) -> &mut Self {
+        self.cmd.arg("--sysroot");
+        self.cmd.arg(path.as_ref());
+        self
+    }
+
     /// Specify the edition year.
     pub fn edition(&mut self, edition: &str) -> &mut Self {
         self.cmd.arg("--edition");
diff --git a/src/tools/tidy/src/allowed_run_make_makefiles.txt b/src/tools/tidy/src/allowed_run_make_makefiles.txt
index 96fb8e27e6d21..5ff3cf824e0bb 100644
--- a/src/tools/tidy/src/allowed_run_make_makefiles.txt
+++ b/src/tools/tidy/src/allowed_run_make_makefiles.txt
@@ -3,7 +3,6 @@ run-make/allow-non-lint-warnings-cmdline/Makefile
 run-make/allow-warnings-cmdline-stability/Makefile
 run-make/archive-duplicate-names/Makefile
 run-make/atomic-lock-free/Makefile
-run-make/bare-outfile/Makefile
 run-make/branch-protection-check-IBT/Makefile
 run-make/c-dynamic-dylib/Makefile
 run-make/c-dynamic-rlib/Makefile
@@ -25,7 +24,6 @@ run-make/compiler-rt-works-on-mingw/Makefile
 run-make/compressed-debuginfo/Makefile
 run-make/const-prop-lint/Makefile
 run-make/const_fn_mir/Makefile
-run-make/core-no-oom-handling/Makefile
 run-make/crate-data-smoke/Makefile
 run-make/crate-hash-rustc-version/Makefile
 run-make/crate-name-priority/Makefile
@@ -48,7 +46,6 @@ run-make/emit-path-unhashed/Makefile
 run-make/emit-shared-files/Makefile
 run-make/emit-stack-sizes/Makefile
 run-make/emit-to-stdout/Makefile
-run-make/emit/Makefile
 run-make/env-dep-info/Makefile
 run-make/error-found-staticlib-instead-crate/Makefile
 run-make/error-writing-dependencies/Makefile
@@ -98,24 +95,20 @@ run-make/issue-15460/Makefile
 run-make/issue-18943/Makefile
 run-make/issue-20626/Makefile
 run-make/issue-22131/Makefile
-run-make/issue-24445/Makefile
 run-make/issue-25581/Makefile
 run-make/issue-26006/Makefile
 run-make/issue-26092/Makefile
 run-make/issue-28595/Makefile
-run-make/issue-30063/Makefile
 run-make/issue-33329/Makefile
 run-make/issue-35164/Makefile
 run-make/issue-36710/Makefile
 run-make/issue-37839/Makefile
 run-make/issue-37893/Makefile
-run-make/issue-38237/Makefile
 run-make/issue-40535/Makefile
 run-make/issue-46239/Makefile
 run-make/issue-47384/Makefile
 run-make/issue-47551/Makefile
 run-make/issue-51671/Makefile
-run-make/issue-53964/Makefile
 run-make/issue-64153/Makefile
 run-make/issue-68794-textrel-on-minimal-lib/Makefile
 run-make/issue-69368/Makefile
@@ -165,7 +158,6 @@ run-make/mingw-export-call-convention/Makefile
 run-make/mismatching-target-triples/Makefile
 run-make/missing-crate-dependency/Makefile
 run-make/mixing-deps/Makefile
-run-make/mixing-formats/Makefile
 run-make/mixing-libs/Makefile
 run-make/msvc-opt-minsize/Makefile
 run-make/multiple-emits/Makefile
@@ -193,7 +185,6 @@ run-make/pass-linker-flags/Makefile
 run-make/pass-non-c-like-enum-to-c/Makefile
 run-make/pdb-alt-path/Makefile
 run-make/pdb-buildinfo-cl-cmd/Makefile
-run-make/pgo-branch-weights/Makefile
 run-make/pgo-gen-lto/Makefile
 run-make/pgo-gen-no-imp-symbols/Makefile
 run-make/pgo-gen/Makefile
@@ -233,7 +224,6 @@ run-make/rlib-format-packed-bundled-libs/Makefile
 run-make/rmeta-preferred/Makefile
 run-make/rustc-macro-dep-files/Makefile
 run-make/rustdoc-io-error/Makefile
-run-make/rustdoc-scrape-examples-macros/Makefile
 run-make/rustdoc-verify-output-files/Makefile
 run-make/rustdoc-with-output-option/Makefile
 run-make/rustdoc-with-short-out-dir-option/Makefile
diff --git a/tests/run-make/alloc-no-oom-handling/rmake.rs b/tests/run-make/alloc-no-oom-handling/rmake.rs
index fec3c6532940e..4bca5d1f1efbe 100644
--- a/tests/run-make/alloc-no-oom-handling/rmake.rs
+++ b/tests/run-make/alloc-no-oom-handling/rmake.rs
@@ -1,4 +1,4 @@
-// This test checks that alloc can still compile correctly
+// This test checks that alloc can still compile successfully
 // when the unstable no_global_oom_handling feature is turned on.
 // See https://github.com/rust-lang/rust/pull/84266
 
diff --git a/tests/run-make/alloc-no-rc/rmake.rs b/tests/run-make/alloc-no-rc/rmake.rs
index c5744a3f5eef5..8ff73324b0832 100644
--- a/tests/run-make/alloc-no-rc/rmake.rs
+++ b/tests/run-make/alloc-no-rc/rmake.rs
@@ -1,4 +1,4 @@
-// This test checks that alloc can still compile correctly
+// This test checks that alloc can still compile successfully
 // when the unstable no_rc feature is turned on.
 // See https://github.com/rust-lang/rust/pull/84266
 
diff --git a/tests/run-make/alloc-no-sync/rmake.rs b/tests/run-make/alloc-no-sync/rmake.rs
index 6410eca80abff..3a3ceed686792 100644
--- a/tests/run-make/alloc-no-sync/rmake.rs
+++ b/tests/run-make/alloc-no-sync/rmake.rs
@@ -1,4 +1,4 @@
-// This test checks that alloc can still compile correctly
+// This test checks that alloc can still compile successfully
 // when the unstable no_sync feature is turned on.
 // See https://github.com/rust-lang/rust/pull/84266
 
diff --git a/tests/run-make/bare-outfile/Makefile b/tests/run-make/bare-outfile/Makefile
deleted file mode 100644
index ad6fe4bd167c4..0000000000000
--- a/tests/run-make/bare-outfile/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
-# This test checks that manually setting the output file as a bare file with no file extension still results in successful compilation.
-
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	cp foo.rs $(TMPDIR)
-	cd $(TMPDIR) && $(RUSTC) -o foo foo.rs
-	$(call RUN,foo)
diff --git a/tests/run-make/bare-outfile/rmake.rs b/tests/run-make/bare-outfile/rmake.rs
new file mode 100644
index 0000000000000..82d0fab5073b8
--- /dev/null
+++ b/tests/run-make/bare-outfile/rmake.rs
@@ -0,0 +1,15 @@
+// This test checks that manually setting the output file as a bare file with no file extension
+// still results in successful compilation.
+
+//@ ignore-cross-compile
+
+use run_make_support::{run, rustc, tmp_dir};
+use std::env;
+use std::fs;
+
+fn main() {
+    fs::copy("foo.rs", tmp_dir().join("foo.rs")).unwrap();
+    env::set_current_dir(tmp_dir());
+    rustc().output("foo").input("foo.rs").run();
+    run("foo");
+}
diff --git a/tests/run-make/core-no-oom-handling/Makefile b/tests/run-make/core-no-oom-handling/Makefile
deleted file mode 100644
index 28c5261ff854d..0000000000000
--- a/tests/run-make/core-no-oom-handling/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-include ../tools.mk
-
-FAKEROOT=$(TMPDIR)/fakeroot
-
-all:
-	$(RUSTC) --edition=2021 -Dwarnings --crate-type=rlib ../../../library/core/src/lib.rs --sysroot=$(FAKEROOT) --cfg no_global_oom_handling
diff --git a/tests/run-make/core-no-oom-handling/rmake.rs b/tests/run-make/core-no-oom-handling/rmake.rs
new file mode 100644
index 0000000000000..75767421cd1fa
--- /dev/null
+++ b/tests/run-make/core-no-oom-handling/rmake.rs
@@ -0,0 +1,16 @@
+// This test checks that the core library can still compile successfully
+// when the no_global_oom_handling feature is turned on.
+// See https://github.com/rust-lang/rust/pull/110649
+
+use run_make_support::{rustc, tmp_dir};
+
+fn main() {
+    rustc()
+        .edition("2021")
+        .arg("-Dwarnings")
+        .crate_type("rlib")
+        .input("../../../library/core/src/lib.rs")
+        .sysroot(tmp_dir().join("fakeroot"))
+        .cfg("no_global_oom_handling")
+        .run();
+}
diff --git a/tests/run-make/issue-38237/bar.rs b/tests/run-make/deref-impl-rustdoc-ice/bar.rs
similarity index 100%
rename from tests/run-make/issue-38237/bar.rs
rename to tests/run-make/deref-impl-rustdoc-ice/bar.rs
diff --git a/tests/run-make/issue-38237/baz.rs b/tests/run-make/deref-impl-rustdoc-ice/baz.rs
similarity index 100%
rename from tests/run-make/issue-38237/baz.rs
rename to tests/run-make/deref-impl-rustdoc-ice/baz.rs
diff --git a/tests/run-make/issue-38237/foo.rs b/tests/run-make/deref-impl-rustdoc-ice/foo.rs
similarity index 100%
rename from tests/run-make/issue-38237/foo.rs
rename to tests/run-make/deref-impl-rustdoc-ice/foo.rs
diff --git a/tests/run-make/deref-impl-rustdoc-ice/rmake.rs b/tests/run-make/deref-impl-rustdoc-ice/rmake.rs
new file mode 100644
index 0000000000000..c2156de03a974
--- /dev/null
+++ b/tests/run-make/deref-impl-rustdoc-ice/rmake.rs
@@ -0,0 +1,16 @@
+// A very specific set of circumstances (mainly, implementing Deref, and
+// having a procedural macro and a Debug derivation in external crates) caused
+// an internal compiler error (ICE) when trying to use rustdoc. This test
+// reproduces the exact circumstances which caused the bug and checks
+// that it does not happen again.
+// See https://github.com/rust-lang/rust/issues/38237
+
+//@ ignore-cross-compile
+
+use run_make_support::{rustc, rustdoc, tmp_dir};
+
+fn main() {
+    rustc().input("foo.rs").run();
+    rustc().input("bar.rs").run();
+    rustdoc().input("baz.rs").library_search_path(tmp_dir()).output(tmp_dir()).run();
+}
diff --git a/tests/run-make/emit/Makefile b/tests/run-make/emit/Makefile
deleted file mode 100644
index b3ca0b79fb0cf..0000000000000
--- a/tests/run-make/emit/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	$(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs
-	$(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs
-	$(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs
-	$(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs
-	$(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs
-	$(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-24876.rs
-	$(RUSTC) -Copt-level=0 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs
-	$(call RUN,test-26235) || exit 1
-	$(RUSTC) -Copt-level=1 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs
-	$(call RUN,test-26235) || exit 1
-	$(RUSTC) -Copt-level=2 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs
-	$(call RUN,test-26235) || exit 1
-	$(RUSTC) -Copt-level=3 --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs
-	$(call RUN,test-26235) || exit 1
-	$(RUSTC) -Copt-level=s --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs
-	$(call RUN,test-26235) || exit 1
-	$(RUSTC) -Copt-level=z --emit=llvm-bc,llvm-ir,asm,obj,link test-26235.rs
-	$(call RUN,test-26235) || exit 1
diff --git a/tests/run-make/emit/rmake.rs b/tests/run-make/emit/rmake.rs
new file mode 100644
index 0000000000000..8b3ddb66f9238
--- /dev/null
+++ b/tests/run-make/emit/rmake.rs
@@ -0,0 +1,19 @@
+// A bug from 2015 would cause errors when emitting multiple types of files
+// in the same rustc call. A fix was created in #30452. This test checks that rustc still compiles
+// a source file successfully when emission of multiple output artifacts are requested.
+// See https://github.com/rust-lang/rust/pull/30452
+
+//@ ignore-cross-compile
+
+use run_make_support::{run, rustc};
+
+fn main() {
+    let opt_levels = ["0", "1", "2", "3", "s", "z"];
+    for level in opt_levels {
+        rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-24876.rs").run();
+    }
+    for level in opt_levels {
+        rustc().opt_level(level).emit("llvm-bc,llvm-ir,asm,obj,link").input("test-26235.rs").run();
+        run("test-26235");
+    }
+}
diff --git a/tests/run-make/issue-53964/app.rs b/tests/run-make/external-crate-panic-handle-no-lint/app.rs
similarity index 100%
rename from tests/run-make/issue-53964/app.rs
rename to tests/run-make/external-crate-panic-handle-no-lint/app.rs
diff --git a/tests/run-make/issue-53964/panic.rs b/tests/run-make/external-crate-panic-handle-no-lint/panic.rs
similarity index 100%
rename from tests/run-make/issue-53964/panic.rs
rename to tests/run-make/external-crate-panic-handle-no-lint/panic.rs
diff --git a/tests/run-make/external-crate-panic-handle-no-lint/rmake.rs b/tests/run-make/external-crate-panic-handle-no-lint/rmake.rs
new file mode 100644
index 0000000000000..de4023282ef6e
--- /dev/null
+++ b/tests/run-make/external-crate-panic-handle-no-lint/rmake.rs
@@ -0,0 +1,12 @@
+// Defining a crate that provides panic handling as an external crate
+// could uselessly trigger the "unused external crate" lint. In this test,
+// if the lint is triggered, it will trip #![deny(unused_extern_crates)],
+// and cause the test to fail.
+// See https://github.com/rust-lang/rust/issues/53964
+
+use run_make_support::{rustc, tmp_dir};
+
+fn main() {
+    rustc().input("panic.rs").run();
+    rustc().input("app.rs").panic("abort").emit("obj").library_search_path(tmp_dir()).run();
+}
diff --git a/tests/run-make/issue-24445/Makefile b/tests/run-make/issue-24445/Makefile
deleted file mode 100644
index a13910aa73ed0..0000000000000
--- a/tests/run-make/issue-24445/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# only-linux
-
-all:
-	$(RUSTC) foo.rs
-	$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -o $(TMPDIR)/foo
-	$(call RUN,foo)
-	$(CC) foo.c -lfoo -L $(TMPDIR) -Wl,--gc-sections -lpthread -ldl -pie -fPIC -o $(TMPDIR)/foo
-	$(call RUN,foo)
diff --git a/tests/run-make/issue-30063/Makefile b/tests/run-make/issue-30063/Makefile
deleted file mode 100644
index 8a69ca79f5150..0000000000000
--- a/tests/run-make/issue-30063/Makefile
+++ /dev/null
@@ -1,36 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	rm -f $(TMPDIR)/foo-output
-	$(RUSTC) -C codegen-units=4 -o $(TMPDIR)/foo-output foo.rs
-	rm $(TMPDIR)/foo-output
-
-	rm -f $(TMPDIR)/asm-output
-	$(RUSTC) -C codegen-units=4 --emit=asm -o $(TMPDIR)/asm-output foo.rs
-	rm $(TMPDIR)/asm-output
-
-	rm -f $(TMPDIR)/bc-output
-	$(RUSTC) -C codegen-units=4 --emit=llvm-bc -o $(TMPDIR)/bc-output foo.rs
-	rm $(TMPDIR)/bc-output
-
-	rm -f $(TMPDIR)/ir-output
-	$(RUSTC) -C codegen-units=4 --emit=llvm-ir -o $(TMPDIR)/ir-output foo.rs
-	rm $(TMPDIR)/ir-output
-
-	rm -f $(TMPDIR)/link-output
-	$(RUSTC) -C codegen-units=4 --emit=link -o $(TMPDIR)/link-output foo.rs
-	rm $(TMPDIR)/link-output
-
-	rm -f $(TMPDIR)/obj-output
-	$(RUSTC) -C codegen-units=4 --emit=obj -o $(TMPDIR)/obj-output foo.rs
-	rm $(TMPDIR)/obj-output
-
-	rm -f $(TMPDIR)/dep-output
-	$(RUSTC) -C codegen-units=4 --emit=dep-info -o $(TMPDIR)/dep-output foo.rs
-	rm $(TMPDIR)/dep-output
-
-#	# (This case doesn't work yet, and may be fundamentally wrong-headed anyway.)
-#	rm -f $(TMPDIR)/multi-output
-#	$(RUSTC) -C codegen-units=4 --emit=asm,obj -o $(TMPDIR)/multi-output foo.rs
-#	rm $(TMPDIR)/multi-output
diff --git a/tests/run-make/issue-38237/Makefile b/tests/run-make/issue-38237/Makefile
deleted file mode 100644
index 80dddc5bd1331..0000000000000
--- a/tests/run-make/issue-38237/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-all:
-	$(RUSTC) foo.rs; $(RUSTC) bar.rs
-	$(RUSTDOC) baz.rs -L $(TMPDIR) -o $(TMPDIR)
diff --git a/tests/run-make/issue-53964/Makefile b/tests/run-make/issue-53964/Makefile
deleted file mode 100644
index 6bd83021374d9..0000000000000
--- a/tests/run-make/issue-53964/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-include ../tools.mk
-
-all:
-	$(RUSTC) panic.rs
-	$(RUSTC) -C panic=abort --emit=obj app.rs -L $(TMPDIR)
diff --git a/tests/run-make/mixing-formats/Makefile b/tests/run-make/mixing-formats/Makefile
deleted file mode 100644
index d01978a159953..0000000000000
--- a/tests/run-make/mixing-formats/Makefile
+++ /dev/null
@@ -1,75 +0,0 @@
-# ignore-cross-compile
-include ../tools.mk
-
-# Testing various mixings of rlibs and dylibs. Makes sure that it's possible to
-# link an rlib to a dylib. The dependency tree among the file looks like:
-#
-#				foo
-#			      /     \
-#			    bar1   bar2
-#			   /    \ /
-#			 baz    baz2
-#
-# This is generally testing the permutations of the foo/bar1/bar2 layer against
-# the baz/baz2 layer
-
-all:
-	# Building just baz
-	$(RUSTC) --crate-type=rlib  foo.rs
-	$(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=bin baz.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=rlib  bar1.rs
-	$(RUSTC) --crate-type=dylib,rlib baz.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=bin baz.rs
-	rm $(TMPDIR)/*
-	# Building baz2
-	$(RUSTC) --crate-type=rlib  foo.rs
-	$(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib baz2.rs && exit 1 || exit 0
-	$(RUSTC) --crate-type=bin baz2.rs && exit 1 || exit 0
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=rlib  foo.rs
-	$(RUSTC) --crate-type=rlib  bar1.rs
-	$(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs
-	$(RUSTC) --crate-type=bin baz2.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=rlib  foo.rs
-	$(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=rlib  bar2.rs
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=bin baz2.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=rlib  foo.rs
-	$(RUSTC) --crate-type=rlib  bar1.rs
-	$(RUSTC) --crate-type=rlib  bar2.rs
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=bin baz2.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=rlib  bar1.rs
-	$(RUSTC) --crate-type=rlib  bar2.rs
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=bin baz2.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=rlib  bar2.rs
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs
-	$(RUSTC) --crate-type=bin baz2.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=rlib  bar1.rs
-	$(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs
-	$(RUSTC) --crate-type=bin baz2.rs
-	rm $(TMPDIR)/*
-	$(RUSTC) --crate-type=dylib foo.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib bar1.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib bar2.rs -C prefer-dynamic
-	$(RUSTC) --crate-type=dylib,rlib baz2.rs
-	$(RUSTC) --crate-type=bin baz2.rs
diff --git a/tests/run-make/mixing-formats/rmake.rs b/tests/run-make/mixing-formats/rmake.rs
new file mode 100644
index 0000000000000..9e60d0e3a0d9d
--- /dev/null
+++ b/tests/run-make/mixing-formats/rmake.rs
@@ -0,0 +1,93 @@
+// Testing various mixings of rlibs and dylibs. Makes sure that it's possible to
+// link an rlib to a dylib. The dependency tree among the file looks like:
+//
+//                 foo
+//               /     \
+//             bar1   bar2
+//             /    \ /
+//          baz    baz2
+//
+// This is generally testing the permutations of the foo/bar1/bar2 layer against
+// the baz/baz2 layer
+
+//@ ignore-cross-compile
+
+use run_make_support::{rustc, tmp_dir};
+use std::fs;
+
+fn test_with_teardown(rustc_calls: impl Fn()) {
+    rustc_calls();
+    fs::remove_dir_all(tmp_dir()).unwrap();
+    fs::create_dir(tmp_dir()).unwrap();
+}
+
+fn main() {
+    test_with_teardown(|| {
+        // Building just baz
+        rustc().crate_type("rlib").input("foo.rs").run();
+        rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("bin").input("baz.rs").run();
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("rlib").input("bar1.rs").run();
+        rustc().crate_type("dylib,rlib").input("baz.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("bin").input("baz.rs").run();
+    });
+    test_with_teardown(|| {
+        // Building baz2
+        rustc().crate_type("rlib").input("foo.rs").run();
+        rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("dylib").input("baz2.rs").run_fail_assert_exit_code(1);
+        rustc().crate_type("bin").input("baz2.rs").run_fail_assert_exit_code(1);
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("rlib").input("foo.rs").run();
+        rustc().crate_type("rlib").input("bar1.rs").run();
+        rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("dylib,rlib").input("baz2.rs").run();
+        rustc().crate_type("bin").input("baz2.rs").run();
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("rlib").input("foo.rs").run();
+        rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("rlib").input("bar2.rs").run();
+        rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("bin").input("baz2.rs").run();
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("rlib").input("foo.rs").run();
+        rustc().crate_type("rlib").input("bar1.rs").run();
+        rustc().crate_type("rlib").input("bar2.rs").run();
+        rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("bin").input("baz2.rs").run();
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("rlib").input("bar1.rs").run();
+        rustc().crate_type("rlib").input("bar2.rs").run();
+        rustc().crate_type("dylib,rlib").input("baz2.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("bin").input("baz2.rs").run();
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("rlib").input("bar2.rs").run();
+        rustc().crate_type("dylib,rlib").input("baz2.rs").run();
+        rustc().crate_type("bin").input("baz2.rs").run();
+    });
+    test_with_teardown(|| {
+        rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("rlib").input("bar1.rs").run();
+        rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
+        rustc().crate_type("dylib,rlib").input("baz2.rs").run();
+        rustc().crate_type("bin").input("baz2.rs").run();
+    });
+    rustc().crate_type("dylib").input("foo.rs").arg("-Cprefer-dynamic").run();
+    rustc().crate_type("dylib").input("bar1.rs").arg("-Cprefer-dynamic").run();
+    rustc().crate_type("dylib").input("bar2.rs").arg("-Cprefer-dynamic").run();
+    rustc().crate_type("dylib,rlib").input("baz2.rs").run();
+    rustc().crate_type("bin").input("baz2.rs").run();
+}
diff --git a/tests/run-make/issue-24445/foo.c b/tests/run-make/non-pie-thread-local/foo.c
similarity index 100%
rename from tests/run-make/issue-24445/foo.c
rename to tests/run-make/non-pie-thread-local/foo.c
diff --git a/tests/run-make/issue-24445/foo.rs b/tests/run-make/non-pie-thread-local/foo.rs
similarity index 100%
rename from tests/run-make/issue-24445/foo.rs
rename to tests/run-make/non-pie-thread-local/foo.rs
diff --git a/tests/run-make/non-pie-thread-local/rmake.rs b/tests/run-make/non-pie-thread-local/rmake.rs
new file mode 100644
index 0000000000000..1ef447e786019
--- /dev/null
+++ b/tests/run-make/non-pie-thread-local/rmake.rs
@@ -0,0 +1,34 @@
+// It was once required to use a position-independent executable (PIE)
+// in order to use the thread_local! macro, or some symbols would contain
+// a NULL address. This was fixed, and this test checks a non-PIE, then a PIE
+// build to see if this bug makes a resurgence.
+// See https://github.com/rust-lang/rust/pull/24448
+
+//@ ignore-cross-compile
+//@ only-linux
+
+use run_make_support::{cc, run, rustc, tmp_dir};
+
+fn main() {
+    rustc().input("foo.rs").run();
+    cc().input("foo.c")
+        .arg("-lfoo")
+        .library_search_path(tmp_dir())
+        .arg("-Wl,--gc-sections")
+        .arg("-lpthread")
+        .arg("-ldl")
+        .out_exe("foo")
+        .run();
+    run("foo");
+    cc().input("foo.c")
+        .arg("-lfoo")
+        .library_search_path(tmp_dir())
+        .arg("-Wl,--gc-sections")
+        .arg("-lpthread")
+        .arg("-ldl")
+        .arg("-pie")
+        .arg("-fPIC")
+        .out_exe("foo")
+        .run();
+    run("foo");
+}
diff --git a/tests/run-make/pgo-branch-weights/Makefile b/tests/run-make/pgo-branch-weights/Makefile
deleted file mode 100644
index 4c9f8b2493ab8..0000000000000
--- a/tests/run-make/pgo-branch-weights/Makefile
+++ /dev/null
@@ -1,35 +0,0 @@
-# needs-profiler-support
-# ignore-windows-gnu
-# ignore-cross-compile
-
-# FIXME(mati865): MinGW GCC miscompiles compiler-rt profiling library but with Clang it works
-# properly. Since we only have GCC on the CI ignore the test for now.
-
-include ../tools.mk
-
-# For some very small programs GNU ld seems to not properly handle
-# instrumentation sections correctly. Neither Gold nor LLD have that problem.
-ifeq ($(UNAME),Linux)
-ifneq (,$(findstring x86,$(TARGET)))
-COMMON_FLAGS=-Clink-args=-fuse-ld=gold
-endif
-endif
-
-
-all:
-	# We don't compile `opaque` with either optimizations or instrumentation.
-	$(RUSTC) $(COMMON_FLAGS) opaque.rs || exit 1
-	# Compile the test program with instrumentation
-	mkdir -p "$(TMPDIR)/prof_data_dir" || exit 1
-	$(RUSTC) $(COMMON_FLAGS) interesting.rs \
-		-Cprofile-generate="$(TMPDIR)/prof_data_dir" -O -Ccodegen-units=1 || exit 1
-	$(RUSTC) $(COMMON_FLAGS) main.rs -Cprofile-generate="$(TMPDIR)/prof_data_dir" -O || exit 1
-	# The argument below generates to the expected branch weights
-	$(call RUN,main aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc) || exit 1
-	"$(LLVM_BIN_DIR)/llvm-profdata" merge \
-		-o "$(TMPDIR)/prof_data_dir/merged.profdata" \
-		"$(TMPDIR)/prof_data_dir" || exit 1
-	$(RUSTC) $(COMMON_FLAGS) interesting.rs \
-		-Cprofile-use="$(TMPDIR)/prof_data_dir/merged.profdata" -O \
-		-Ccodegen-units=1 --emit=llvm-ir || exit 1
-	cat "$(TMPDIR)/interesting.ll" | "$(LLVM_FILECHECK)" filecheck-patterns.txt
diff --git a/tests/run-make/pgo-branch-weights/rmake.rs b/tests/run-make/pgo-branch-weights/rmake.rs
new file mode 100644
index 0000000000000..128e80524f8ce
--- /dev/null
+++ b/tests/run-make/pgo-branch-weights/rmake.rs
@@ -0,0 +1,48 @@
+// This test generates an instrumented binary - a program which
+// will keep track of how many times it calls each function, a useful
+// feature for optimization. Then, an argument (aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc)
+// is passed into the instrumented binary, which should react with a number of function calls
+// fully known in advance. (For example, the letter 'a' results in calling f1())
+
+// If the test passes, the expected function call count was added to the use-phase LLVM-IR.
+// See https://github.com/rust-lang/rust/pull/66631
+
+//@ needs-profiler-support
+//@ ignore-cross-compile
+
+// (This test has problems generating profdata on mingw. This could use further investigation.)
+//@ ignore-windows-gnu
+
+use run_make_support::{
+    llvm_filecheck, llvm_profdata, run_with_args, rustc, rustdoc, target, tmp_dir,
+};
+use std::fs;
+
+fn main() {
+    let path_prof_data_dir = tmp_dir().join("prof_data_dir");
+    let path_merged_profdata = path_prof_data_dir.join("merged.profdata");
+    rustc().input("opaque.rs").run();
+    fs::create_dir_all(&path_prof_data_dir);
+    rustc()
+        .input("interesting.rs")
+        .profile_generate(&path_prof_data_dir)
+        .opt()
+        .codegen_units(1)
+        .run();
+    rustc().input("main.rs").profile_generate(&path_prof_data_dir).opt().run();
+    run_with_args("main", &["aaaaaaaaaaaa2bbbbbbbbbbbb2bbbbbbbbbbbbbbbbcc"]);
+    llvm_profdata()
+        .merge()
+        .output(&path_merged_profdata)
+        .input(path_prof_data_dir)
+        .command_output();
+    rustc()
+        .input("interesting.rs")
+        .profile_use(path_merged_profdata)
+        .opt()
+        .codegen_units(1)
+        .emit("llvm-ir")
+        .run();
+    let interesting_ll = tmp_dir().join("interesting.ll");
+    llvm_filecheck().patterns("filecheck-patterns.txt").stdin(interesting_ll);
+}
diff --git a/tests/run-make/issue-30063/foo.rs b/tests/run-make/reset-codegen-1/foo.rs
similarity index 100%
rename from tests/run-make/issue-30063/foo.rs
rename to tests/run-make/reset-codegen-1/foo.rs
diff --git a/tests/run-make/reset-codegen-1/rmake.rs b/tests/run-make/reset-codegen-1/rmake.rs
new file mode 100644
index 0000000000000..4b91ba7df90bd
--- /dev/null
+++ b/tests/run-make/reset-codegen-1/rmake.rs
@@ -0,0 +1,38 @@
+// When rustc received 4 codegen-units, an output path and an emit flag all simultaneously,
+// this could cause an annoying recompilation issue, uselessly lengthening the build process.
+// A fix was delivered, which resets codegen-units to 1 when necessary,
+// but as it directly affected the way codegen-units are manipulated,
+// this test was created to check that this fix did not cause compilation failures.
+// See https://github.com/rust-lang/rust/issues/30063
+
+//@ ignore-cross-compile
+
+use run_make_support::{rustc, tmp_dir};
+use std::fs;
+
+fn compile(output_file: &str, emit: Option<&str>) {
+    let mut rustc = rustc();
+    let rustc = rustc.codegen_units(4).output(tmp_dir().join(output_file)).input("foo.rs");
+    if let Some(emit) = emit {
+        rustc.emit(emit);
+    }
+    rustc.run();
+}
+
+fn main() {
+    let flags = [
+        ("foo-output", None),
+        ("asm-output", Some("asm")),
+        ("bc-output", Some("llvm-bc")),
+        ("ir-output", Some("llvm-ir")),
+        ("link-output", Some("link")),
+        ("obj-output", Some("obj")),
+        ("dep-output", Some("dep-info")),
+        ("multi-output", Some("asm,obj")),
+    ];
+    for (output_file, emit) in flags {
+        fs::remove_file(output_file).unwrap_or_default();
+        compile(output_file, emit);
+        fs::remove_file(output_file);
+    }
+}
diff --git a/tests/run-make/rustdoc-scrape-examples-macros/Makefile b/tests/run-make/rustdoc-scrape-examples-macros/Makefile
deleted file mode 100644
index edc19d8cb5de4..0000000000000
--- a/tests/run-make/rustdoc-scrape-examples-macros/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-# ignore-cross-compile
-include ../../run-make/tools.mk
-
-OUTPUT_DIR := "$(TMPDIR)/rustdoc"
-DYLIB_NAME := $(shell echo | $(RUSTC) --crate-name foobar_macro --crate-type dylib --print file-names -)
-
-all:
-	$(RUSTC) src/proc.rs --crate-name foobar_macro --edition=2021 --crate-type proc-macro --emit=dep-info,link
-
-	$(RUSTC) src/lib.rs --crate-name foobar --edition=2021 --crate-type lib --emit=dep-info,link
-
-	$(RUSTDOC) examples/ex.rs --crate-name ex --crate-type bin --output $(OUTPUT_DIR) \
-		--extern foobar=$(TMPDIR)/libfoobar.rlib --extern foobar_macro=$(TMPDIR)/$(DYLIB_NAME) \
-		-Z unstable-options --scrape-examples-output-path $(TMPDIR)/ex.calls --scrape-examples-target-crate foobar
-
-	$(RUSTDOC) src/lib.rs --crate-name foobar --crate-type lib --output $(OUTPUT_DIR) \
-		-Z unstable-options --with-examples $(TMPDIR)/ex.calls
-
-	$(HTMLDOCCK) $(OUTPUT_DIR) src/lib.rs
diff --git a/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs
new file mode 100644
index 0000000000000..81b7defafc6c0
--- /dev/null
+++ b/tests/run-make/rustdoc-scrape-examples-macros/rmake.rs
@@ -0,0 +1,64 @@
+//@ ignore-cross-compile
+
+use run_make_support::{htmldocck, rustc, rustdoc, tmp_dir};
+
+fn main() {
+    let tmp_dir = tmp_dir();
+    let out_dir = tmp_dir.join("rustdoc");
+    let ex_dir = tmp_dir.join("ex.calls");
+    let proc_crate_name = "foobar_macro";
+    let crate_name = "foobar";
+
+    let dylib_name = String::from_utf8(
+        rustc()
+            .crate_name(proc_crate_name)
+            .crate_type("dylib")
+            .arg("--print")
+            .arg("file-names")
+            .arg("-")
+            .command_output()
+            .stdout,
+    )
+    .unwrap();
+
+    rustc()
+        .input("src/proc.rs")
+        .crate_name(proc_crate_name)
+        .edition("2021")
+        .crate_type("proc-macro")
+        .emit("dep-info,link")
+        .run();
+    rustc()
+        .input("src/lib.rs")
+        .crate_name(crate_name)
+        .edition("2021")
+        .crate_type("lib")
+        .emit("dep-info,link")
+        .run();
+
+    rustdoc()
+        .input("examples/ex.rs")
+        .crate_name("ex")
+        .crate_type("bin")
+        .output(&out_dir)
+        .extern_(crate_name, tmp_dir.join(format!("lib{crate_name}.rlib")))
+        .extern_(proc_crate_name, tmp_dir.join(dylib_name.trim()))
+        .arg("-Zunstable-options")
+        .arg("--scrape-examples-output-path")
+        .arg(&ex_dir)
+        .arg("--scrape-examples-target-crate")
+        .arg(crate_name)
+        .run();
+
+    rustdoc()
+        .input("src/lib.rs")
+        .crate_name(crate_name)
+        .crate_type("lib")
+        .output(&out_dir)
+        .arg("-Zunstable-options")
+        .arg("--with-examples")
+        .arg(&ex_dir)
+        .run();
+
+    assert!(htmldocck().arg(out_dir).arg("src/lib.rs").status().unwrap().success());
+}
diff --git a/tests/ui/lint/missing_copy_impl_trivial_bounds.rs b/tests/ui/lint/missing_copy_impl_trivial_bounds.rs
new file mode 100644
index 0000000000000..9b743417bd52b
--- /dev/null
+++ b/tests/ui/lint/missing_copy_impl_trivial_bounds.rs
@@ -0,0 +1,21 @@
+//@ check-pass
+
+#![feature(trivial_bounds)]
+#![allow(trivial_bounds)]
+
+// Make sure that we still use the where-clauses from the struct when checking
+// if it may implement `Copy` unconditionally.
+// Fix for <https://github.com/rust-lang/rust/issues/125394>.
+
+pub trait Foo {
+    type Assoc;
+}
+
+pub struct Bar;
+
+// This needs to be public
+pub struct Baz2(<Bar as Foo>::Assoc)
+where
+    Bar: Foo;
+
+fn main() {}
diff --git a/tests/ui/pub/pub-reexport-priv-extern-crate.stderr b/tests/ui/pub/pub-reexport-priv-extern-crate.stderr
index c7fadc6f92931..3fa5b0f9aef3e 100644
--- a/tests/ui/pub/pub-reexport-priv-extern-crate.stderr
+++ b/tests/ui/pub/pub-reexport-priv-extern-crate.stderr
@@ -22,7 +22,7 @@ note: the crate import `core` is defined here
 LL |         extern crate core;
    |         ^^^^^^^^^^^^^^^^^^
 
-error: extern crate `core` is private, and cannot be re-exported (error E0365), consider declaring with `pub`
+error[E0365]: extern crate `core` is private, and cannot be re-exported, consider declaring with `pub`
   --> $DIR/pub-reexport-priv-extern-crate.rs:2:9
    |
 LL | pub use core as reexported_core;
@@ -34,4 +34,5 @@ LL | pub use core as reexported_core;
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0603`.
+Some errors have detailed explanations: E0365, E0603.
+For more information about an error, try `rustc --explain E0365`.
diff --git a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
index aa660db38679c..537819ab8595c 100644
--- a/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
+++ b/tests/ui/rfcs/rfc-2396-target_feature-11/safe-calls.stderr
@@ -91,7 +91,7 @@ LL | const _: () = sse2_and_fxsr();
    = help: in order for the call to be safe, the context requires the following additional target features: sse2 and fxsr
    = note: the fxsr and sse2 target features being enabled in the build configuration does not remove the requirement to list them in `#[target_feature]`
 
-error: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to function `sse2` with `#[target_feature]` is unsafe and requires unsafe block
   --> $DIR/safe-calls.rs:70:5
    |
 LL |     sse2();
diff --git a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
index 2eb1754392e1a..fe12dd72d9ebe 100644
--- a/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
+++ b/tests/ui/unsafe/edition-2024-unsafe_op_in_unsafe_fn.stderr
@@ -1,4 +1,4 @@
-warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+warning[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/edition-2024-unsafe_op_in_unsafe_fn.rs:10:5
    |
 LL |     unsf();
@@ -15,3 +15,4 @@ LL | unsafe fn foo() {
 
 warning: 1 warning emitted
 
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr
index e6d1d4e5cc780..05f36ab47cb56 100644
--- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr
+++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/edition_2024_default.stderr
@@ -1,4 +1,4 @@
-warning: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+warning[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/edition_2024_default.rs:13:5
    |
 LL |     unsf();
@@ -15,3 +15,4 @@ LL | unsafe fn foo() {
 
 warning: 1 warning emitted
 
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr
index 5092c1e689d67..3f97199458da4 100644
--- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr
+++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/in_2024_compatibility.stderr
@@ -1,4 +1,4 @@
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/in_2024_compatibility.rs:7:5
    |
 LL |     unsf();
@@ -20,3 +20,4 @@ LL | #![deny(rust_2024_compatibility)]
 
 error: aborting due to 1 previous error
 
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr
index 4bc604a110ea1..1f80342566ca3 100644
--- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr
+++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/rfc-2585-unsafe_op_in_unsafe_fn.stderr
@@ -1,4 +1,4 @@
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:9:5
    |
 LL |     unsf();
@@ -17,7 +17,7 @@ note: the lint level is defined here
 LL | #![deny(unsafe_op_in_unsafe_fn)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
 
-error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe block
   --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:11:5
    |
 LL |     *PTR;
@@ -26,7 +26,7 @@ LL |     *PTR;
    = note: for more information, see issue #71668 <https://github.com/rust-lang/rust/issues/71668>
    = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
-error: use of mutable static is unsafe and requires unsafe block (error E0133)
+error[E0133]: use of mutable static is unsafe and requires unsafe block
   --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:13:5
    |
 LL |     VOID = ();
@@ -47,7 +47,7 @@ note: the lint level is defined here
 LL | #![deny(unused_unsafe)]
    |         ^^^^^^^^^^^^^
 
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:24:5
    |
 LL |     unsf();
@@ -67,7 +67,7 @@ LL | #[deny(warnings)]
    |        ^^^^^^^^
    = note: `#[deny(unsafe_op_in_unsafe_fn)]` implied by `#[deny(warnings)]`
 
-error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe block
   --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:26:5
    |
 LL |     *PTR;
@@ -76,7 +76,7 @@ LL |     *PTR;
    = note: for more information, see issue #71668 <https://github.com/rust-lang/rust/issues/71668>
    = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
-error: use of mutable static is unsafe and requires unsafe block (error E0133)
+error[E0133]: use of mutable static is unsafe and requires unsafe block
   --> $DIR/rfc-2585-unsafe_op_in_unsafe_fn.rs:28:5
    |
 LL |     VOID = ();
diff --git a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr
index b9f5969474d00..1ce22ecfdc796 100644
--- a/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr
+++ b/tests/ui/unsafe/unsafe_op_in_unsafe_fn/wrapping-unsafe-block-sugg.stderr
@@ -1,4 +1,4 @@
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:13:5
    |
 LL |     unsf();
@@ -17,7 +17,7 @@ note: the lint level is defined here
 LL | #![deny(unsafe_op_in_unsafe_fn)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
 
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:17:5
    |
 LL |     unsf();
@@ -26,7 +26,7 @@ LL |     unsf();
    = note: for more information, see issue #71668 <https://github.com/rust-lang/rust/issues/71668>
    = note: consult the function's documentation for information on how to avoid undefined behavior
 
-error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:25:13
    |
 LL |     let y = *x;
@@ -40,7 +40,7 @@ note: an unsafe function restricts its caller, but its body is safe by default
 LL | pub unsafe fn bar(x: *const i32) -> i32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: dereference of raw pointer is unsafe and requires unsafe block (error E0133)
+error[E0133]: dereference of raw pointer is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:29:9
    |
 LL |     y + *x
@@ -49,7 +49,7 @@ LL |     y + *x
    = note: for more information, see issue #71668 <https://github.com/rust-lang/rust/issues/71668>
    = note: raw pointers may be null, dangling or unaligned; they can violate aliasing rules and cause data races: all of these are undefined behavior
 
-error: use of mutable static is unsafe and requires unsafe block (error E0133)
+error[E0133]: use of mutable static is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:38:13
    |
 LL |     let y = BAZ;
@@ -63,7 +63,7 @@ note: an unsafe function restricts its caller, but its body is safe by default
 LL | pub unsafe fn baz() -> i32 {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: use of mutable static is unsafe and requires unsafe block (error E0133)
+error[E0133]: use of mutable static is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:42:9
    |
 LL |     y + BAZ
@@ -72,7 +72,7 @@ LL |     y + BAZ
    = note: for more information, see issue #71668 <https://github.com/rust-lang/rust/issues/71668>
    = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
 
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:48:36
    |
 LL | macro_rules! unsafe_macro { () => (unsf()) }
@@ -90,7 +90,7 @@ LL | pub unsafe fn unsafe_in_macro() {
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = note: this error originates in the macro `unsafe_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
 
-error: call to unsafe function `unsf` is unsafe and requires unsafe block (error E0133)
+error[E0133]: call to unsafe function `unsf` is unsafe and requires unsafe block
   --> $DIR/wrapping-unsafe-block-sugg.rs:48:36
    |
 LL | macro_rules! unsafe_macro { () => (unsf()) }
@@ -105,3 +105,4 @@ LL |     unsafe_macro!();
 
 error: aborting due to 8 previous errors
 
+For more information about this error, try `rustc --explain E0133`.