about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-12-23 16:40:02 +0000
committerbors <bors@rust-lang.org>2024-12-23 16:40:02 +0000
commitaddbd001ec56741829f20a3000892f8620dd0843 (patch)
treed3685ceba04c07a235b4e73de23a54e7f31d63a8
parent904d8f6b39ce98fb890ac3381a710f071ddae44d (diff)
parenta16fc10f231f0a01ccaa065b8cfb6484d5d31017 (diff)
downloadrust-addbd001ec56741829f20a3000892f8620dd0843.tar.gz
rust-addbd001ec56741829f20a3000892f8620dd0843.zip
Auto merge of #134687 - matthiaskrgr:rollup-m32tkax, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #134363 (Use `#[derive(Default)]` instead of manual `impl` when possible)
 - #134517 (Add tests for coverage attribute on trait functions)
 - #134528 (opt-dist: propagate channel info to bootstrap)
 - #134669 (Document the `--dev` flag for `src/ci/docker/run.sh`)
 - #134680 (Clean up a few rmake tests  )

r? `@ghost`
`@rustbot` modify labels: rollup
-rw-r--r--compiler/rustc_ast/src/ast.rs19
-rw-r--r--compiler/rustc_ast_pretty/src/pprust/state/fixup.rs18
-rw-r--r--compiler/rustc_lint/src/unused.rs7
-rw-r--r--compiler/rustc_session/src/config.rs9
-rw-r--r--library/core/tests/hash/mod.rs15
-rw-r--r--library/proc_macro/src/bridge/fxhash.rs8
-rw-r--r--library/std/src/panicking.rs9
-rw-r--r--library/std/src/sys_common/process.rs8
-rw-r--r--src/ci/docker/README.md4
-rw-r--r--src/tools/opt-dist/src/tests.rs18
-rw-r--r--tests/coverage/attr/trait-impl-inherit.cov-map9
-rw-r--r--tests/coverage/attr/trait-impl-inherit.coverage26
-rw-r--r--tests/coverage/attr/trait-impl-inherit.rs25
-rw-r--r--tests/run-make/dump-ice-to-disk/rmake.rs2
-rw-r--r--tests/run-make/embed-source-dwarf/rmake.rs2
-rw-r--r--tests/run-make/import-macro-verbatim/verbatim.rs2
-rw-r--r--tests/run-make/libstd-no-protected/rmake.rs2
-rw-r--r--tests/run-make/libtest-thread-limit/rmake.rs5
-rw-r--r--tests/run-make/llvm-outputs/rmake.rs4
-rw-r--r--tests/run-make/missing-unstable-trait-bound/rmake.rs2
-rw-r--r--tests/run-make/musl-default-linking/rmake.rs2
-rw-r--r--tests/run-make/no-alloc-shim/rmake.rs2
-rw-r--r--tests/run-make/no-builtins-lto/rmake.rs2
-rw-r--r--tests/run-make/remove-dir-all-race/rmake.rs13
-rw-r--r--tests/run-make/rustdoc-map-file/rmake.rs2
-rw-r--r--tests/run-make/rustdoc-output-stdout/rmake.rs2
-rw-r--r--tests/run-make/symbol-visibility/rmake.rs2
-rw-r--r--tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr (renamed from tests/ui/bootstrap/rustc_bootstap.force_stable.stderr)0
-rw-r--r--tests/ui/bootstrap/rustc_bootstrap.rs (renamed from tests/ui/bootstrap/rustc_bootstap.rs)4
-rw-r--r--tests/ui/coverage-attr/no-coverage.rs9
-rw-r--r--tests/ui/coverage-attr/no-coverage.stderr36
31 files changed, 152 insertions, 116 deletions
diff --git a/compiler/rustc_ast/src/ast.rs b/compiler/rustc_ast/src/ast.rs
index cec868e5c8e..31e6750a678 100644
--- a/compiler/rustc_ast/src/ast.rs
+++ b/compiler/rustc_ast/src/ast.rs
@@ -31,7 +31,7 @@ use rustc_data_structures::sync::Lrc;
 use rustc_macros::{Decodable, Encodable, HashStable_Generic};
 pub use rustc_span::AttrId;
 use rustc_span::source_map::{Spanned, respan};
-use rustc_span::{DUMMY_SP, ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
+use rustc_span::{ErrorGuaranteed, Ident, Span, Symbol, kw, sym};
 use thin_vec::{ThinVec, thin_vec};
 
 pub use crate::format::*;
@@ -387,22 +387,15 @@ impl GenericParam {
 
 /// Represents lifetime, type and const parameters attached to a declaration of
 /// a function, enum, trait, etc.
-#[derive(Clone, Encodable, Decodable, Debug)]
+#[derive(Clone, Encodable, Decodable, Debug, Default)]
 pub struct Generics {
     pub params: ThinVec<GenericParam>,
     pub where_clause: WhereClause,
     pub span: Span,
 }
 
-impl Default for Generics {
-    /// Creates an instance of `Generics`.
-    fn default() -> Generics {
-        Generics { params: ThinVec::new(), where_clause: Default::default(), span: DUMMY_SP }
-    }
-}
-
 /// A where-clause in a definition.
-#[derive(Clone, Encodable, Decodable, Debug)]
+#[derive(Clone, Encodable, Decodable, Debug, Default)]
 pub struct WhereClause {
     /// `true` if we ate a `where` token.
     ///
@@ -419,12 +412,6 @@ impl WhereClause {
     }
 }
 
-impl Default for WhereClause {
-    fn default() -> WhereClause {
-        WhereClause { has_where_token: false, predicates: ThinVec::new(), span: DUMMY_SP }
-    }
-}
-
 /// A single predicate in a where-clause.
 #[derive(Clone, Encodable, Decodable, Debug)]
 pub struct WherePredicate {
diff --git a/compiler/rustc_ast_pretty/src/pprust/state/fixup.rs b/compiler/rustc_ast_pretty/src/pprust/state/fixup.rs
index 6f5382ce61d..ff466703f73 100644
--- a/compiler/rustc_ast_pretty/src/pprust/state/fixup.rs
+++ b/compiler/rustc_ast_pretty/src/pprust/state/fixup.rs
@@ -1,7 +1,9 @@
 use rustc_ast::Expr;
 use rustc_ast::util::{classify, parser};
 
-#[derive(Copy, Clone, Debug)]
+// The default amount of fixing is minimal fixing, so all fixups are set to `false` by `Default`.
+// Fixups should be turned on in a targeted fashion where needed.
+#[derive(Copy, Clone, Debug, Default)]
 pub(crate) struct FixupContext {
     /// Print expression such that it can be parsed back as a statement
     /// consisting of the original expression.
@@ -93,20 +95,6 @@ pub(crate) struct FixupContext {
     parenthesize_exterior_struct_lit: bool,
 }
 
-/// The default amount of fixing is minimal fixing. Fixups should be turned on
-/// in a targeted fashion where needed.
-impl Default for FixupContext {
-    fn default() -> Self {
-        FixupContext {
-            stmt: false,
-            leftmost_subexpression_in_stmt: false,
-            match_arm: false,
-            leftmost_subexpression_in_match_arm: false,
-            parenthesize_exterior_struct_lit: false,
-        }
-    }
-}
-
 impl FixupContext {
     /// Create the initial fixup for printing an expression in statement
     /// position.
diff --git a/compiler/rustc_lint/src/unused.rs b/compiler/rustc_lint/src/unused.rs
index 2b3cb14f9e9..8b1526bc747 100644
--- a/compiler/rustc_lint/src/unused.rs
+++ b/compiler/rustc_lint/src/unused.rs
@@ -1023,6 +1023,7 @@ declare_lint! {
     "`if`, `match`, `while` and `return` do not need parentheses"
 }
 
+#[derive(Default)]
 pub(crate) struct UnusedParens {
     with_self_ty_parens: bool,
     /// `1 as (i32) < 2` parses to ExprKind::Lt
@@ -1030,12 +1031,6 @@ pub(crate) struct UnusedParens {
     parens_in_cast_in_lt: Vec<ast::NodeId>,
 }
 
-impl Default for UnusedParens {
-    fn default() -> Self {
-        Self { with_self_ty_parens: false, parens_in_cast_in_lt: Vec::new() }
-    }
-}
-
 impl_lint_pass!(UnusedParens => [UNUSED_PARENS]);
 
 impl UnusedDelimLint for UnusedParens {
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 047e920e688..5c36c986490 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -168,9 +168,10 @@ pub struct CoverageOptions {
 }
 
 /// Controls whether branch coverage or MC/DC coverage is enabled.
-#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
+#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Default)]
 pub enum CoverageLevel {
     /// Instrument for coverage at the MIR block level.
+    #[default]
     Block,
     /// Also instrument branch points (includes block coverage).
     Branch,
@@ -195,12 +196,6 @@ pub enum CoverageLevel {
     Mcdc,
 }
 
-impl Default for CoverageLevel {
-    fn default() -> Self {
-        Self::Block
-    }
-}
-
 /// Settings for `-Z instrument-xray` flag.
 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
 pub struct InstrumentXRay {
diff --git a/library/core/tests/hash/mod.rs b/library/core/tests/hash/mod.rs
index bf91e9e5df0..9f14995f73f 100644
--- a/library/core/tests/hash/mod.rs
+++ b/library/core/tests/hash/mod.rs
@@ -4,16 +4,11 @@ use std::hash::{BuildHasher, Hash, Hasher};
 use std::ptr;
 use std::rc::Rc;
 
+#[derive(Default)]
 struct MyHasher {
     hash: u64,
 }
 
-impl Default for MyHasher {
-    fn default() -> MyHasher {
-        MyHasher { hash: 0 }
-    }
-}
-
 impl Hasher for MyHasher {
     fn write(&mut self, buf: &[u8]) {
         for byte in buf {
@@ -107,6 +102,8 @@ fn test_writer_hasher() {
 struct Custom {
     hash: u64,
 }
+
+#[derive(Default)]
 struct CustomHasher {
     output: u64,
 }
@@ -123,12 +120,6 @@ impl Hasher for CustomHasher {
     }
 }
 
-impl Default for CustomHasher {
-    fn default() -> CustomHasher {
-        CustomHasher { output: 0 }
-    }
-}
-
 impl Hash for Custom {
     fn hash<H: Hasher>(&self, state: &mut H) {
         state.write_u64(self.hash);
diff --git a/library/proc_macro/src/bridge/fxhash.rs b/library/proc_macro/src/bridge/fxhash.rs
index 74a41451825..3345e099a37 100644
--- a/library/proc_macro/src/bridge/fxhash.rs
+++ b/library/proc_macro/src/bridge/fxhash.rs
@@ -22,6 +22,7 @@ pub type FxHashMap<K, V> = HashMap<K, V, BuildHasherDefault<FxHasher>>;
 /// out-performs an FNV-based hash within rustc itself -- the collision rate is
 /// similar or slightly worse than FNV, but the speed of the hash function
 /// itself is much higher because it works on up to 8 bytes at a time.
+#[derive(Default)]
 pub struct FxHasher {
     hash: usize,
 }
@@ -31,13 +32,6 @@ const K: usize = 0x9e3779b9;
 #[cfg(target_pointer_width = "64")]
 const K: usize = 0x517cc1b727220a95;
 
-impl Default for FxHasher {
-    #[inline]
-    fn default() -> FxHasher {
-        FxHasher { hash: 0 }
-    }
-}
-
 impl FxHasher {
     #[inline]
     fn add_to_hash(&mut self, i: usize) {
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index dca5ccca0c4..e7ce5bc6140 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -81,7 +81,9 @@ extern "C" fn __rust_foreign_exception() -> ! {
     rtabort!("Rust cannot catch foreign exceptions");
 }
 
+#[derive(Default)]
 enum Hook {
+    #[default]
     Default,
     Custom(Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send>),
 }
@@ -96,13 +98,6 @@ impl Hook {
     }
 }
 
-impl Default for Hook {
-    #[inline]
-    fn default() -> Hook {
-        Hook::Default
-    }
-}
-
 static HOOK: RwLock<Hook> = RwLock::new(Hook::Default);
 
 /// Registers a custom panic hook, replacing the previously registered hook.
diff --git a/library/std/src/sys_common/process.rs b/library/std/src/sys_common/process.rs
index 5333ee146f7..9f61d69d858 100644
--- a/library/std/src/sys_common/process.rs
+++ b/library/std/src/sys_common/process.rs
@@ -8,19 +8,13 @@ use crate::sys::process::{EnvKey, ExitStatus, Process, StdioPipes};
 use crate::{env, fmt, io};
 
 // Stores a set of changes to an environment
-#[derive(Clone)]
+#[derive(Clone, Default)]
 pub struct CommandEnv {
     clear: bool,
     saw_path: bool,
     vars: BTreeMap<EnvKey, Option<OsString>>,
 }
 
-impl Default for CommandEnv {
-    fn default() -> Self {
-        CommandEnv { clear: false, saw_path: false, vars: Default::default() }
-    }
-}
-
 impl fmt::Debug for CommandEnv {
     fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
         let mut debug_command_env = f.debug_struct("CommandEnv");
diff --git a/src/ci/docker/README.md b/src/ci/docker/README.md
index 876787c30e5..2f35e605026 100644
--- a/src/ci/docker/README.md
+++ b/src/ci/docker/README.md
@@ -26,6 +26,10 @@ DEPLOY=1 ./src/ci/docker/run.sh x86_64-gnu
 while locally, to the `obj/$image_name` directory. This is primarily to prevent
 strange linker errors when using multiple Docker images.
 
+## Local Development
+
+Refer to the [dev guide](https://rustc-dev-guide.rust-lang.org/tests/docker.html) for more information on testing locally.
+
 ## Filesystem layout
 
 - Each host architecture has its own `host-{arch}` directory, and those
diff --git a/src/tools/opt-dist/src/tests.rs b/src/tools/opt-dist/src/tests.rs
index 887055798e0..06ed076a864 100644
--- a/src/tools/opt-dist/src/tests.rs
+++ b/src/tools/opt-dist/src/tests.rs
@@ -25,6 +25,8 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
     let host_triple = env.host_tuple();
     let version = find_dist_version(&dist_dir)?;
 
+    let channel = version_to_channel(&version);
+
     // Extract rustc, libstd, cargo and src archives to create the optimized sysroot
     let rustc_dir = extract_dist_dir(&format!("rustc-{version}-{host_triple}"))?.join("rustc");
     let libstd_dir = extract_dist_dir(&format!("rust-std-{version}-{host_triple}"))?
@@ -61,9 +63,13 @@ pub fn run_tests(env: &Environment) -> anyhow::Result<()> {
     assert!(llvm_config.is_file());
 
     let config_content = format!(
-        r#"profile = "user"
+        r#"
+profile = "user"
 change-id = 115898
 
+[rust]
+channel = "{channel}"
+
 [build]
 rustc = "{rustc}"
 cargo = "{cargo}"
@@ -116,3 +122,13 @@ fn find_dist_version(directory: &Utf8Path) -> anyhow::Result<String> {
         archive.strip_prefix("reproducible-artifacts-").unwrap().split_once('-').unwrap();
     Ok(version.to_string())
 }
+
+/// Roughly convert a version string (`nightly`, `beta`, or `1.XY.Z`) to channel string (`nightly`,
+/// `beta` or `stable`).
+fn version_to_channel(version_str: &str) -> &'static str {
+    match version_str {
+        "nightly" => "nightly",
+        "beta" => "beta",
+        _ => "stable",
+    }
+}
diff --git a/tests/coverage/attr/trait-impl-inherit.cov-map b/tests/coverage/attr/trait-impl-inherit.cov-map
new file mode 100644
index 00000000000..eab9f926bb7
--- /dev/null
+++ b/tests/coverage/attr/trait-impl-inherit.cov-map
@@ -0,0 +1,9 @@
+Function name: <trait_impl_inherit::S as trait_impl_inherit::T>::f
+Raw bytes (9): 0x[01, 01, 00, 01, 01, 11, 05, 02, 06]
+Number of files: 1
+- file 0 => global file 1
+Number of expressions: 0
+Number of file 0 mappings: 1
+- Code(Counter(0)) at (prev + 17, 5) to (start + 2, 6)
+Highest counter ID seen: c0
+
diff --git a/tests/coverage/attr/trait-impl-inherit.coverage b/tests/coverage/attr/trait-impl-inherit.coverage
new file mode 100644
index 00000000000..b92d82aefbc
--- /dev/null
+++ b/tests/coverage/attr/trait-impl-inherit.coverage
@@ -0,0 +1,26 @@
+   LL|       |#![feature(coverage_attribute)]
+   LL|       |// Checks that `#[coverage(..)]` in a trait method is not inherited in an
+   LL|       |// implementation.
+   LL|       |//@ edition: 2021
+   LL|       |//@ reference: attributes.coverage.trait-impl-inherit
+   LL|       |
+   LL|       |trait T {
+   LL|       |    #[coverage(off)]
+   LL|       |    fn f(&self) {
+   LL|       |        println!("default");
+   LL|       |    }
+   LL|       |}
+   LL|       |
+   LL|       |struct S;
+   LL|       |
+   LL|       |impl T for S {
+   LL|      1|    fn f(&self) {
+   LL|      1|        println!("impl S");
+   LL|      1|    }
+   LL|       |}
+   LL|       |
+   LL|       |#[coverage(off)]
+   LL|       |fn main() {
+   LL|       |    S.f();
+   LL|       |}
+
diff --git a/tests/coverage/attr/trait-impl-inherit.rs b/tests/coverage/attr/trait-impl-inherit.rs
new file mode 100644
index 00000000000..951fecce90a
--- /dev/null
+++ b/tests/coverage/attr/trait-impl-inherit.rs
@@ -0,0 +1,25 @@
+#![feature(coverage_attribute)]
+// Checks that `#[coverage(..)]` in a trait method is not inherited in an
+// implementation.
+//@ edition: 2021
+//@ reference: attributes.coverage.trait-impl-inherit
+
+trait T {
+    #[coverage(off)]
+    fn f(&self) {
+        println!("default");
+    }
+}
+
+struct S;
+
+impl T for S {
+    fn f(&self) {
+        println!("impl S");
+    }
+}
+
+#[coverage(off)]
+fn main() {
+    S.f();
+}
diff --git a/tests/run-make/dump-ice-to-disk/rmake.rs b/tests/run-make/dump-ice-to-disk/rmake.rs
index 15f35eb2d3d..a7a98d31f50 100644
--- a/tests/run-make/dump-ice-to-disk/rmake.rs
+++ b/tests/run-make/dump-ice-to-disk/rmake.rs
@@ -83,7 +83,7 @@ fn extract_exactly_one_ice_file<P: AsRef<Path>>(name: &'static str, dir: P) -> I
 
 fn main() {
     // Establish baseline ICE message.
-    let mut default_ice_dump = OnceCell::new();
+    let default_ice_dump = OnceCell::new();
     run_in_tmpdir(|| {
         rustc().env("RUSTC_ICE", cwd()).input("lib.rs").arg("-Ztreat-err-as-bug=1").run_fail();
         let dump = extract_exactly_one_ice_file("baseline", cwd());
diff --git a/tests/run-make/embed-source-dwarf/rmake.rs b/tests/run-make/embed-source-dwarf/rmake.rs
index c7106967a85..0aae07ff2e6 100644
--- a/tests/run-make/embed-source-dwarf/rmake.rs
+++ b/tests/run-make/embed-source-dwarf/rmake.rs
@@ -10,7 +10,7 @@ use std::collections::HashMap;
 use std::path::PathBuf;
 use std::rc::Rc;
 
-use gimli::{AttributeValue, EndianRcSlice, Reader, RunTimeEndian};
+use gimli::{EndianRcSlice, Reader, RunTimeEndian};
 use object::{Object, ObjectSection};
 use run_make_support::{gimli, object, rfs, rustc};
 
diff --git a/tests/run-make/import-macro-verbatim/verbatim.rs b/tests/run-make/import-macro-verbatim/verbatim.rs
index 56a83673c1f..0123a4a7e22 100644
--- a/tests/run-make/import-macro-verbatim/verbatim.rs
+++ b/tests/run-make/import-macro-verbatim/verbatim.rs
@@ -1,4 +1,4 @@
-//! Include a file by concating the verbatim path using `/` instead of `\`
+//! Include a file by concatenating the verbatim path using `/` instead of `\`
 
 include!(concat!(env!("VERBATIM_DIR"), "/include/include.txt"));
 fn main() {
diff --git a/tests/run-make/libstd-no-protected/rmake.rs b/tests/run-make/libstd-no-protected/rmake.rs
index 3bba59a8f4d..4091406d46e 100644
--- a/tests/run-make/libstd-no-protected/rmake.rs
+++ b/tests/run-make/libstd-no-protected/rmake.rs
@@ -7,7 +7,7 @@
 use run_make_support::object::Endianness;
 use run_make_support::object::read::archive::ArchiveFile;
 use run_make_support::object::read::elf::{FileHeader as _, SectionHeader as _};
-use run_make_support::rfs::{read, read_dir};
+use run_make_support::rfs::read;
 use run_make_support::{has_prefix, has_suffix, object, path, rustc, shallow_find_files, target};
 
 type FileHeader = run_make_support::object::elf::FileHeader64<Endianness>;
diff --git a/tests/run-make/libtest-thread-limit/rmake.rs b/tests/run-make/libtest-thread-limit/rmake.rs
index fe14d2c046c..817328cd3c3 100644
--- a/tests/run-make/libtest-thread-limit/rmake.rs
+++ b/tests/run-make/libtest-thread-limit/rmake.rs
@@ -15,10 +15,7 @@
 // Reason: this should be ignored in cg_clif (Cranelift) CI and anywhere
 // else that uses panic=abort.
 
-use std::ffi::{self, CStr, CString};
-use std::path::PathBuf;
-
-use run_make_support::{libc, run, rustc};
+use run_make_support::{libc, rustc};
 
 fn main() {
     rustc().input("test.rs").arg("--test").run();
diff --git a/tests/run-make/llvm-outputs/rmake.rs b/tests/run-make/llvm-outputs/rmake.rs
index 632e9a09ba5..2ce31b260a1 100644
--- a/tests/run-make/llvm-outputs/rmake.rs
+++ b/tests/run-make/llvm-outputs/rmake.rs
@@ -9,8 +9,8 @@ fn main() {
     let mut path_ir = PathBuf::new();
     run_in_tmpdir(|| {
         let p = cwd();
-        path_bc = p.join("nonexistant_dir_bc");
-        path_ir = p.join("nonexistant_dir_ir");
+        path_bc = p.join("nonexistent_dir_bc");
+        path_ir = p.join("nonexistent_dir_ir");
         rustc().input("-").stdin_buf("fn main() {}").out_dir(&path_bc).emit("llvm-bc").run();
         rustc().input("-").stdin_buf("fn main() {}").out_dir(&path_ir).emit("llvm-ir").run();
         assert!(path_bc.exists());
diff --git a/tests/run-make/missing-unstable-trait-bound/rmake.rs b/tests/run-make/missing-unstable-trait-bound/rmake.rs
index 20f77f7c9aa..3f76c65247d 100644
--- a/tests/run-make/missing-unstable-trait-bound/rmake.rs
+++ b/tests/run-make/missing-unstable-trait-bound/rmake.rs
@@ -6,7 +6,7 @@
 // Ensure that on stable we don't suggest restricting with an unsafe trait and we continue
 // mentioning the rest of the obligation chain.
 
-use run_make_support::{diff, rust_lib_name, rustc};
+use run_make_support::{diff, rustc};
 
 fn main() {
     let out = rustc()
diff --git a/tests/run-make/musl-default-linking/rmake.rs b/tests/run-make/musl-default-linking/rmake.rs
index b6d428d3f27..d203595a447 100644
--- a/tests/run-make/musl-default-linking/rmake.rs
+++ b/tests/run-make/musl-default-linking/rmake.rs
@@ -48,7 +48,7 @@ fn main() {
         let default = &target_spec["crt-static-default"];
 
         // If the value is `null`, then the default to dynamically link from
-        // musl_base was not overriden.
+        // musl_base was not overridden.
         if default.is_null() {
             continue;
         }
diff --git a/tests/run-make/no-alloc-shim/rmake.rs b/tests/run-make/no-alloc-shim/rmake.rs
index c398a3177df..d61ef5de8c5 100644
--- a/tests/run-make/no-alloc-shim/rmake.rs
+++ b/tests/run-make/no-alloc-shim/rmake.rs
@@ -13,7 +13,7 @@
 // Tracking issue: https://github.com/rust-lang/rust/issues/128602
 // Discussion: https://github.com/rust-lang/rust/pull/128407#discussion_r1702439172
 
-use run_make_support::{cc, cwd, has_extension, has_prefix, run, rustc, shallow_find_files};
+use run_make_support::{cc, has_extension, has_prefix, run, rustc, shallow_find_files};
 
 fn main() {
     rustc().input("foo.rs").crate_type("bin").emit("obj").panic("abort").run();
diff --git a/tests/run-make/no-builtins-lto/rmake.rs b/tests/run-make/no-builtins-lto/rmake.rs
index 8e0c3a63649..56fdfde42f0 100644
--- a/tests/run-make/no-builtins-lto/rmake.rs
+++ b/tests/run-make/no-builtins-lto/rmake.rs
@@ -1,4 +1,4 @@
-// The rlib produced by a no_builtins crate should be explicitely linked
+// The rlib produced by a no_builtins crate should be explicitly linked
 // during compilation, and as a result be present in the linker arguments.
 // See the comments inside this file for more details.
 // See https://github.com/rust-lang/rust/pull/35637
diff --git a/tests/run-make/remove-dir-all-race/rmake.rs b/tests/run-make/remove-dir-all-race/rmake.rs
index 03c94b76127..32abca92424 100644
--- a/tests/run-make/remove-dir-all-race/rmake.rs
+++ b/tests/run-make/remove-dir-all-race/rmake.rs
@@ -1,13 +1,13 @@
 //@ ignore-windows
 
 // This test attempts to make sure that running `remove_dir_all`
-// doesn't result in a NotFound error one of the files it
+// doesn't result in a NotFound error if one of the files it
 // is deleting is deleted concurrently.
 //
 // The windows implementation for `remove_dir_all` is significantly
 // more complicated, and has not yet been brought up to par with
 // the implementation on other platforms, so this test is marked as
-// `ignore-windows` until someone more expirenced with windows can
+// `ignore-windows` until someone more experienced with windows can
 // sort that out.
 
 use std::fs::remove_dir_all;
@@ -27,13 +27,12 @@ fn main() {
             write("outer/inner.txt", b"sometext");
 
             thread::scope(|scope| {
-                let t1 = scope.spawn(|| {
+                scope.spawn(|| {
                     thread::sleep(Duration::from_nanos(i));
                     remove_dir_all("outer").unwrap();
                 });
 
-                let race_happened_ref = &race_happened;
-                let t2 = scope.spawn(|| {
+                scope.spawn(|| {
                     let r1 = remove_dir_all("outer/inner");
                     let r2 = remove_dir_all("outer/inner.txt");
                     if r1.is_ok() && r2.is_err() {
@@ -44,10 +43,10 @@ fn main() {
 
             assert!(!Path::new("outer").exists());
 
-            // trying to remove a nonexistant top-level directory should
+            // trying to remove a nonexistent top-level directory should
             // still result in an error.
             let Err(err) = remove_dir_all("outer") else {
-                panic!("removing nonexistant dir did not result in an error");
+                panic!("removing nonexistent dir did not result in an error");
             };
             assert_eq!(err.kind(), std::io::ErrorKind::NotFound);
         }
diff --git a/tests/run-make/rustdoc-map-file/rmake.rs b/tests/run-make/rustdoc-map-file/rmake.rs
index d7e3510fe31..50dcc603c02 100644
--- a/tests/run-make/rustdoc-map-file/rmake.rs
+++ b/tests/run-make/rustdoc-map-file/rmake.rs
@@ -1,8 +1,6 @@
 // This test ensures that all items from `foo` are correctly generated into the `redirect-map.json`
 // file with `--generate-redirect-map` rustdoc option.
 
-use std::path::Path;
-
 use run_make_support::rfs::read_to_string;
 use run_make_support::{path, rustdoc, serde_json};
 
diff --git a/tests/run-make/rustdoc-output-stdout/rmake.rs b/tests/run-make/rustdoc-output-stdout/rmake.rs
index bcf5e4d9723..d2fd0451163 100644
--- a/tests/run-make/rustdoc-output-stdout/rmake.rs
+++ b/tests/run-make/rustdoc-output-stdout/rmake.rs
@@ -1,8 +1,6 @@
 // This test verifies that rustdoc `-o -` prints JSON on stdout and doesn't generate
 // a JSON file.
 
-use std::path::PathBuf;
-
 use run_make_support::path_helpers::{cwd, has_extension, read_dir_entries_recursive};
 use run_make_support::{rustdoc, serde_json};
 
diff --git a/tests/run-make/symbol-visibility/rmake.rs b/tests/run-make/symbol-visibility/rmake.rs
index f84e63ef74e..ec936bc3b07 100644
--- a/tests/run-make/symbol-visibility/rmake.rs
+++ b/tests/run-make/symbol-visibility/rmake.rs
@@ -1,7 +1,7 @@
 // Dynamic libraries on Rust used to export a very high amount of symbols,
 // going as far as filling the output with mangled names and generic function
 // names. After the rework of #38117, this test checks that no mangled Rust symbols
-// are exported, and that generics are only shown if explicitely requested.
+// are exported, and that generics are only shown if explicitly requested.
 // See https://github.com/rust-lang/rust/issues/37530
 
 use run_make_support::object::read::Object;
diff --git a/tests/ui/bootstrap/rustc_bootstap.force_stable.stderr b/tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr
index f378f3c70dd..f378f3c70dd 100644
--- a/tests/ui/bootstrap/rustc_bootstap.force_stable.stderr
+++ b/tests/ui/bootstrap/rustc_bootstrap.force_stable.stderr
diff --git a/tests/ui/bootstrap/rustc_bootstap.rs b/tests/ui/bootstrap/rustc_bootstrap.rs
index 3d792ef4be4..daa28e0cdf2 100644
--- a/tests/ui/bootstrap/rustc_bootstap.rs
+++ b/tests/ui/bootstrap/rustc_bootstrap.rs
@@ -1,5 +1,5 @@
-//! Check `RUSTC_BOOTSTRAP`'s behavior in relation to feature stability and what rustc considers
-//! itself to be (stable vs non-stable ).
+//! Check the compiler's behavior when the perma-unstable env var `RUSTC_BOOTSTRAP` is set in the
+//! environment in relation to feature stability and which channel rustc considers itself to be.
 //!
 //! `RUSTC_BOOTSTRAP` accepts:
 //!
diff --git a/tests/ui/coverage-attr/no-coverage.rs b/tests/ui/coverage-attr/no-coverage.rs
index d715ec8a302..c386f25816e 100644
--- a/tests/ui/coverage-attr/no-coverage.rs
+++ b/tests/ui/coverage-attr/no-coverage.rs
@@ -15,6 +15,12 @@ trait Trait {
     type T;
 
     type U;
+
+    #[coverage(off)] //~ ERROR attribute should be applied to a function definition or closure
+    fn f(&self);
+
+    #[coverage(off)] //~ ERROR attribute should be applied to a function definition or closure
+    fn g();
 }
 
 #[coverage(off)]
@@ -26,6 +32,9 @@ impl Trait for () {
 
     #[coverage(off)] //~ ERROR attribute should be applied to a function definition or closure
     type U = impl Trait; //~ ERROR unconstrained opaque type
+
+    fn f(&self) {}
+    fn g() {}
 }
 
 extern "C" {
diff --git a/tests/ui/coverage-attr/no-coverage.stderr b/tests/ui/coverage-attr/no-coverage.stderr
index 1412b54b8d7..f5a44ecec74 100644
--- a/tests/ui/coverage-attr/no-coverage.stderr
+++ b/tests/ui/coverage-attr/no-coverage.stderr
@@ -7,12 +7,12 @@ LL | / trait Trait {
 LL | |     #[coverage(off)]
 LL | |     const X: u32;
 ...  |
-LL | |     type U;
+LL | |     fn g();
 LL | | }
    | |_- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:41:5
+  --> $DIR/no-coverage.rs:50:5
    |
 LL |     #[coverage(off)]
    |     ^^^^^^^^^^^^^^^^
@@ -20,7 +20,7 @@ LL |     let _ = ();
    |     ----------- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:45:9
+  --> $DIR/no-coverage.rs:54:9
    |
 LL |         #[coverage(off)]
    |         ^^^^^^^^^^^^^^^^
@@ -28,7 +28,7 @@ LL |         () => (),
    |         -------- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:49:5
+  --> $DIR/no-coverage.rs:58:5
    |
 LL |     #[coverage(off)]
    |     ^^^^^^^^^^^^^^^^
@@ -52,7 +52,23 @@ LL |     type T;
    |     ------- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:24:5
+  --> $DIR/no-coverage.rs:19:5
+   |
+LL |     #[coverage(off)]
+   |     ^^^^^^^^^^^^^^^^
+LL |     fn f(&self);
+   |     ------------ not a function or closure
+
+error[E0788]: attribute should be applied to a function definition or closure
+  --> $DIR/no-coverage.rs:22:5
+   |
+LL |     #[coverage(off)]
+   |     ^^^^^^^^^^^^^^^^
+LL |     fn g();
+   |     ------- not a function or closure
+
+error[E0788]: attribute should be applied to a function definition or closure
+  --> $DIR/no-coverage.rs:30:5
    |
 LL |     #[coverage(off)]
    |     ^^^^^^^^^^^^^^^^
@@ -60,7 +76,7 @@ LL |     type T = Self;
    |     -------------- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:27:5
+  --> $DIR/no-coverage.rs:33:5
    |
 LL |     #[coverage(off)]
    |     ^^^^^^^^^^^^^^^^
@@ -68,7 +84,7 @@ LL |     type U = impl Trait;
    |     -------------------- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:32:5
+  --> $DIR/no-coverage.rs:41:5
    |
 LL |     #[coverage(off)]
    |     ^^^^^^^^^^^^^^^^
@@ -76,7 +92,7 @@ LL |     static X: u32;
    |     -------------- not a function or closure
 
 error[E0788]: attribute should be applied to a function definition or closure
-  --> $DIR/no-coverage.rs:35:5
+  --> $DIR/no-coverage.rs:44:5
    |
 LL |     #[coverage(off)]
    |     ^^^^^^^^^^^^^^^^
@@ -84,13 +100,13 @@ LL |     type T;
    |     ------- not a function or closure
 
 error: unconstrained opaque type
-  --> $DIR/no-coverage.rs:28:14
+  --> $DIR/no-coverage.rs:34:14
    |
 LL |     type U = impl Trait;
    |              ^^^^^^^^^^
    |
    = note: `U` must be used in combination with a concrete type within the same impl
 
-error: aborting due to 11 previous errors
+error: aborting due to 13 previous errors
 
 For more information about this error, try `rustc --explain E0788`.