From 408eeae59d35cbcaab2cfb345d24373954e74fc5 Mon Sep 17 00:00:00 2001
From: Obei Sideg <obei.sideg@gmail.com>
Date: Sat, 17 Feb 2024 22:01:56 +0300
Subject: [PATCH] Improve wording of static_mut_ref

Rename `static_mut_ref` lint to `static_mut_refs`.
---
 .../example/mini_core_hello_world.rs          |  4 +-
 .../example/mini_core_hello_world.rs          |  4 +-
 .../src/error_codes/E0796.md                  | 26 +++---
 compiler/rustc_hir_analysis/messages.ftl      | 29 +++---
 compiler/rustc_hir_analysis/src/check/errs.rs | 28 ++----
 compiler/rustc_hir_analysis/src/errors.rs     | 28 ++----
 compiler/rustc_lint/src/lib.rs                |  1 +
 compiler/rustc_lint_defs/src/builtin.rs       |  8 +-
 library/panic_unwind/src/seh.rs               | 10 +-
 library/std/src/panicking.rs                  |  5 +-
 .../sys/pal/common/thread_local/fast_local.rs |  5 +-
 .../pal/common/thread_local/static_local.rs   |  5 +-
 library/std/src/thread/local.rs               |  4 +-
 .../miri/tests/fail/tls/tls_static_dealloc.rs |  4 +-
 src/tools/miri/tests/pass/static_mut.rs       |  4 +-
 src/tools/miri/tests/pass/tls/tls_static.rs   |  4 +-
 tests/ui/abi/statics/static-mut-foreign.rs    |  4 +-
 .../ui/abi/statics/static-mut-foreign.stderr  | 22 ++---
 .../borrowck/borrowck-access-permissions.rs   |  2 +-
 .../borrowck-access-permissions.stderr        | 12 +--
 .../borrowck-unsafe-static-mutable-borrows.rs |  2 +-
 ...rowck-unsafe-static-mutable-borrows.stderr | 12 +--
 tests/ui/borrowck/issue-20801.rs              |  2 +-
 tests/ui/borrowck/issue-20801.stderr          | 12 +--
 ...ue-55492-borrowck-migrate-scans-parents.rs |  6 +-
 ...5492-borrowck-migrate-scans-parents.stderr | 32 +++----
 tests/ui/consts/const_let_assign2.rs          |  2 +-
 tests/ui/consts/const_let_assign2.stderr      | 12 +--
 .../const_refs_to_static_fail_invalid.rs      |  6 +-
 .../const_refs_to_static_fail_invalid.stderr  |  2 +-
 .../ui/consts/issue-17718-const-bad-values.rs |  2 +-
 .../const_refers_to_static_cross_crate.rs     |  2 +-
 .../ui/consts/miri_unleashed/extern-static.rs |  2 +-
 .../mutable_references_err.32bit.stderr       | 62 ++++++-------
 .../mutable_references_err.64bit.stderr       | 62 ++++++-------
 .../miri_unleashed/mutable_references_err.rs  | 13 ++-
 .../static-promoted-to-mutable-static.rs      | 21 ++---
 .../consts/static_mut_containing_mut_ref.rs   |  2 +-
 .../consts/static_mut_containing_mut_ref2.rs  |  2 +-
 .../issue-23338-ensure-param-drop-order.rs    |  2 +-
 ...issue-23338-ensure-param-drop-order.stderr | 12 +--
 tests/ui/error-codes/E0017.rs                 |  2 +-
 tests/ui/error-codes/E0017.stderr             | 12 +--
 .../issues/issue-23611-enum-swap-in-drop.rs   |  2 +-
 .../issue-23611-enum-swap-in-drop.stderr      | 12 +--
 tests/ui/issues/issue-54410.rs                |  2 +-
 tests/ui/issues/issue-54410.stderr            | 12 +--
 ...ead-local-static-mut-borrow-outlives-fn.rs |  2 +-
 ...local-static-mut-borrow-outlives-fn.stderr | 12 +--
 .../reference-of-mut-static-safe.e2021.stderr | 26 ------
 .../reference-of-mut-static-safe.e2024.stderr | 15 ---
 .../reference-of-mut-static-unsafe-fn.rs      | 15 +--
 .../reference-of-mut-static-unsafe-fn.stderr  | 70 ++++++++------
 .../reference-of-mut-static.e2021.stderr      | 64 ++++++-------
 .../reference-of-mut-static.e2024.stderr      | 48 +++++-----
 tests/ui/static/reference-of-mut-static.rs    | 26 +++---
 .../reference-to-mut-static-safe.e2021.stderr | 26 ++++++
 .../reference-to-mut-static-safe.e2024.stderr | 15 +++
 ...afe.rs => reference-to-mut-static-safe.rs} |  4 +-
 .../reference-to-mut-static-unsafe-fn.rs      | 26 ++++++
 .../reference-to-mut-static-unsafe-fn.stderr  | 75 +++++++++++++++
 .../reference-to-mut-static.e2021.stderr      | 91 +++++++++++++++++++
 .../reference-to-mut-static.e2024.stderr      | 75 +++++++++++++++
 tests/ui/static/reference-to-mut-static.rs    | 50 ++++++++++
 tests/ui/static/safe-extern-statics-mut.rs    |  4 +-
 .../ui/static/safe-extern-statics-mut.stderr  | 22 ++---
 tests/ui/statics/issue-15261.rs               |  2 +-
 tests/ui/statics/issue-15261.stderr           | 12 +--
 tests/ui/statics/static-mut-xc.rs             |  4 +-
 tests/ui/statics/static-mut-xc.stderr         | 22 ++---
 tests/ui/statics/static-recursive.rs          |  2 +-
 tests/ui/statics/static-recursive.stderr      | 12 +--
 tests/ui/thread-local/thread-local-static.rs  |  2 +-
 73 files changed, 783 insertions(+), 460 deletions(-)
 delete mode 100644 tests/ui/static/reference-of-mut-static-safe.e2021.stderr
 delete mode 100644 tests/ui/static/reference-of-mut-static-safe.e2024.stderr
 create mode 100644 tests/ui/static/reference-to-mut-static-safe.e2021.stderr
 create mode 100644 tests/ui/static/reference-to-mut-static-safe.e2024.stderr
 rename tests/ui/static/{reference-of-mut-static-safe.rs => reference-to-mut-static-safe.rs} (63%)
 create mode 100644 tests/ui/static/reference-to-mut-static-unsafe-fn.rs
 create mode 100644 tests/ui/static/reference-to-mut-static-unsafe-fn.stderr
 create mode 100644 tests/ui/static/reference-to-mut-static.e2021.stderr
 create mode 100644 tests/ui/static/reference-to-mut-static.e2024.stderr
 create mode 100644 tests/ui/static/reference-to-mut-static.rs

diff --git a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs
index 2a7b1107ffc..8b0b9123ac7 100644
--- a/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs
+++ b/compiler/rustc_codegen_cranelift/example/mini_core_hello_world.rs
@@ -112,8 +112,8 @@ fn start<T: Termination + 'static>(
 
 static mut NUM: u8 = 6 * 7;
 
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[allow(static_mut_refs)]
 static NUM_REF: &'static u8 = unsafe { &NUM };
 
 unsafe fn zeroed<T>() -> T {
diff --git a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs
index 9827e299f2a..add77880716 100644
--- a/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs
+++ b/compiler/rustc_codegen_gcc/example/mini_core_hello_world.rs
@@ -99,8 +99,8 @@ fn start<T: Termination + 'static>(
 
 static mut NUM: u8 = 6 * 7;
 
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[allow(static_mut_refs)]
 static NUM_REF: &'static u8 = unsafe { &NUM };
 
 macro_rules! assert {
diff --git a/compiler/rustc_error_codes/src/error_codes/E0796.md b/compiler/rustc_error_codes/src/error_codes/E0796.md
index cea18f8db85..7ac429e5215 100644
--- a/compiler/rustc_error_codes/src/error_codes/E0796.md
+++ b/compiler/rustc_error_codes/src/error_codes/E0796.md
@@ -1,22 +1,26 @@
-Reference of mutable static.
+You have created a reference to a mutable static.
 
 Erroneous code example:
 
 ```compile_fail,edition2024,E0796
 static mut X: i32 = 23;
-static mut Y: i32 = 24;
 
-unsafe {
-  let y = &X;
-  let ref x = X;
-  let (x, y) = (&X, &Y);
-  foo(&X);
+fn work() {
+  let _val = unsafe { X };
 }
 
-fn foo<'a>(_x: &'a i32) {}
+let x_ref = unsafe { &mut X };
+work();
+// The next line has Undefined Behavior!
+// `x_ref` is a mutable reference and allows no aliases,
+// but `work` has been reading the reference between
+// the moment `x_ref` was created and when it was used.
+// This violates the uniqueness of `x_ref`.
+*x_ref = 42;
 ```
 
-Mutable statics can be written to by multiple threads: aliasing violations or
-data races will cause undefined behavior.
+A reference to a mutable static has lifetime `'static`. This is very dangerous
+as it is easy to accidentally overlap the lifetime of that reference with
+other, conflicting accesses to the same static.
 
-Reference of mutable static is a hard error from 2024 edition.
+References to mutable statics are a hard error in the 2024 edition.
diff --git a/compiler/rustc_hir_analysis/messages.ftl b/compiler/rustc_hir_analysis/messages.ftl
index a61cfd0e4ce..202c5ba989a 100644
--- a/compiler/rustc_hir_analysis/messages.ftl
+++ b/compiler/rustc_hir_analysis/messages.ftl
@@ -373,19 +373,24 @@ hir_analysis_start_not_target_feature = `#[start]` function is not allowed to ha
 hir_analysis_start_not_track_caller = `#[start]` function is not allowed to be `#[track_caller]`
     .label = `#[start]` function is not allowed to be `#[track_caller]`
 
-hir_analysis_static_mut_ref = reference of mutable static is disallowed
-    .label = reference of mutable static
-    .note = mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-    .suggestion = shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
-    .suggestion_mut = mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+hir_analysis_static_mut_ref = creating a {$shared} reference to a mutable static
+    .label = {$shared} reference to mutable static
+    .note = {$shared ->
+        [shared] this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+        *[mutable] this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+    }
+    .suggestion = use `addr_of!` instead to create a raw pointer
+    .suggestion_mut = use `addr_of_mut!` instead to create a raw pointer
 
-hir_analysis_static_mut_ref_lint = {$shared}reference of mutable static is discouraged
-    .label = shared reference of mutable static
-    .label_mut = mutable reference of mutable static
-    .suggestion = shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
-    .suggestion_mut = mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
-    .note = reference of mutable static is a hard error from 2024 edition
-    .why_note = mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
+hir_analysis_static_mut_refs_lint = creating a {$shared} reference to mutable static is discouraged
+    .label = {$shared} reference to mutable static
+    .suggestion = use `addr_of!` instead to create a raw pointer
+    .suggestion_mut = use `addr_of_mut!` instead to create a raw pointer
+    .note = this will be a hard error in the 2024 edition
+    .why_note = {$shared ->
+        [shared] this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+        *[mutable] this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+    }
 
 hir_analysis_static_specialize = cannot specialize on `'static` lifetime
 
diff --git a/compiler/rustc_hir_analysis/src/check/errs.rs b/compiler/rustc_hir_analysis/src/check/errs.rs
index 87a1f3d3425..4a7ace274c5 100644
--- a/compiler/rustc_hir_analysis/src/check/errs.rs
+++ b/compiler/rustc_hir_analysis/src/check/errs.rs
@@ -1,6 +1,6 @@
 use rustc_hir as hir;
 use rustc_hir_pretty::qpath_to_string;
-use rustc_lint_defs::builtin::STATIC_MUT_REF;
+use rustc_lint_defs::builtin::STATIC_MUT_REFS;
 use rustc_middle::ty::TyCtxt;
 use rustc_span::Span;
 use rustc_type_ir::Mutability;
@@ -66,32 +66,24 @@ fn handle_static_mut_ref(
     hir_id: hir::HirId,
 ) {
     if e2024 {
-        let sugg = if mutable {
-            errors::StaticMutRefSugg::Mut { span, var }
+        let (sugg, shared) = if mutable {
+            (errors::StaticMutRefSugg::Mut { span, var }, "mutable")
         } else {
-            errors::StaticMutRefSugg::Shared { span, var }
+            (errors::StaticMutRefSugg::Shared { span, var }, "shared")
         };
-        tcx.sess.parse_sess.dcx.emit_err(errors::StaticMutRef { span, sugg });
+        tcx.sess.parse_sess.dcx.emit_err(errors::StaticMutRef { span, sugg, shared });
         return;
     }
 
-    let (label, sugg, shared) = if mutable {
-        (
-            errors::RefOfMutStaticLabel::Mut { span },
-            errors::RefOfMutStaticSugg::Mut { span, var },
-            "mutable ",
-        )
+    let (sugg, shared) = if mutable {
+        (errors::RefOfMutStaticSugg::Mut { span, var }, "mutable")
     } else {
-        (
-            errors::RefOfMutStaticLabel::Shared { span },
-            errors::RefOfMutStaticSugg::Shared { span, var },
-            "shared ",
-        )
+        (errors::RefOfMutStaticSugg::Shared { span, var }, "shared")
     };
     tcx.emit_node_span_lint(
-        STATIC_MUT_REF,
+        STATIC_MUT_REFS,
         hir_id,
         span,
-        errors::RefOfMutStatic { shared, why_note: (), label, sugg },
+        errors::RefOfMutStatic { span, sugg, shared },
     );
 }
diff --git a/compiler/rustc_hir_analysis/src/errors.rs b/compiler/rustc_hir_analysis/src/errors.rs
index 6a505b96197..a8fd311df43 100644
--- a/compiler/rustc_hir_analysis/src/errors.rs
+++ b/compiler/rustc_hir_analysis/src/errors.rs
@@ -1455,12 +1455,13 @@ pub struct OnlyCurrentTraitsPointerSugg<'a> {
 #[derive(Diagnostic)]
 #[diag(hir_analysis_static_mut_ref, code = E0796)]
 #[note]
-pub struct StaticMutRef {
+pub struct StaticMutRef<'a> {
     #[primary_span]
     #[label]
     pub span: Span,
     #[subdiagnostic]
     pub sugg: StaticMutRefSugg,
+    pub shared: &'a str,
 }
 
 #[derive(Subdiagnostic)]
@@ -1491,30 +1492,15 @@ pub enum StaticMutRefSugg {
 
 // STATIC_MUT_REF lint
 #[derive(LintDiagnostic)]
-#[diag(hir_analysis_static_mut_ref_lint)]
+#[diag(hir_analysis_static_mut_refs_lint)]
 #[note]
+#[note(hir_analysis_why_note)]
 pub struct RefOfMutStatic<'a> {
-    pub shared: &'a str,
-    #[note(hir_analysis_why_note)]
-    pub why_note: (),
-    #[subdiagnostic]
-    pub label: RefOfMutStaticLabel,
+    #[label]
+    pub span: Span,
     #[subdiagnostic]
     pub sugg: RefOfMutStaticSugg,
-}
-
-#[derive(Subdiagnostic)]
-pub enum RefOfMutStaticLabel {
-    #[label(hir_analysis_label)]
-    Shared {
-        #[primary_span]
-        span: Span,
-    },
-    #[label(hir_analysis_label_mut)]
-    Mut {
-        #[primary_span]
-        span: Span,
-    },
+    pub shared: &'a str,
 }
 
 #[derive(Subdiagnostic)]
diff --git a/compiler/rustc_lint/src/lib.rs b/compiler/rustc_lint/src/lib.rs
index 85f9d3bd63e..e50f4ca338b 100644
--- a/compiler/rustc_lint/src/lib.rs
+++ b/compiler/rustc_lint/src/lib.rs
@@ -325,6 +325,7 @@ fn register_builtins(store: &mut LintStore) {
     store.register_renamed("or_patterns_back_compat", "rust_2021_incompatible_or_patterns");
     store.register_renamed("non_fmt_panic", "non_fmt_panics");
     store.register_renamed("unused_tuple_struct_fields", "dead_code");
+    store.register_renamed("static_mut_ref", "static_mut_refs");
 
     // These were moved to tool lints, but rustc still sees them when compiling normally, before
     // tool lints are registered, so `check_tool_name_for_backwards_compat` doesn't work. Use
diff --git a/compiler/rustc_lint_defs/src/builtin.rs b/compiler/rustc_lint_defs/src/builtin.rs
index 6a2a2c1e48e..3f5d3c25971 100644
--- a/compiler/rustc_lint_defs/src/builtin.rs
+++ b/compiler/rustc_lint_defs/src/builtin.rs
@@ -89,7 +89,7 @@ declare_lint_pass! {
         SINGLE_USE_LIFETIMES,
         SOFT_UNSTABLE,
         STABLE_FEATURES,
-        STATIC_MUT_REF,
+        STATIC_MUT_REFS,
         SUSPICIOUS_AUTO_TRAIT_IMPLS,
         TEST_UNSTABLE_LINT,
         TEXT_DIRECTION_CODEPOINT_IN_COMMENT,
@@ -1769,7 +1769,7 @@ declare_lint! {
 }
 
 declare_lint! {
-    /// The `static_mut_ref` lint checks for shared or mutable references
+    /// The `static_mut_refs` lint checks for shared or mutable references
     /// of mutable static inside `unsafe` blocks and `unsafe` functions.
     ///
     /// ### Example
@@ -1807,9 +1807,9 @@ declare_lint! {
     /// Shared or mutable references of mutable static are almost always a mistake and
     /// can lead to undefined behavior and various other problems in your code.
     ///
-    /// This lint is "warn" by default on editions up to 2021, from 2024 there is
+    /// This lint is "warn" by default on editions up to 2021, in 2024 there is
     /// a hard error instead.
-    pub STATIC_MUT_REF,
+    pub STATIC_MUT_REFS,
     Warn,
     "shared references or mutable references of mutable static is discouraged",
     @future_incompatible = FutureIncompatibleInfo {
diff --git a/library/panic_unwind/src/seh.rs b/library/panic_unwind/src/seh.rs
index d3ba546d730..c4f4d2fbec9 100644
--- a/library/panic_unwind/src/seh.rs
+++ b/library/panic_unwind/src/seh.rs
@@ -261,8 +261,9 @@ cfg_if::cfg_if! {
    }
 }
 
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[cfg_attr(bootstrap, allow(static_mut_ref))]
+#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
 pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
     use core::intrinsics::atomic_store_seqcst;
 
@@ -324,8 +325,9 @@ pub unsafe fn panic(data: Box<dyn Any + Send>) -> u32 {
     _CxxThrowException(throw_ptr, &mut THROW_INFO as *mut _ as *mut _);
 }
 
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[cfg_attr(bootstrap, allow(static_mut_ref))]
+#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
 pub unsafe fn cleanup(payload: *mut u8) -> Box<dyn Any + Send> {
     // A null payload here means that we got here from the catch (...) of
     // __rust_try. This happens when a non-Rust foreign exception is caught.
diff --git a/library/std/src/panicking.rs b/library/std/src/panicking.rs
index 8294160b72c..c8306c1b597 100644
--- a/library/std/src/panicking.rs
+++ b/library/std/src/panicking.rs
@@ -337,8 +337,9 @@ pub mod panic_count {
 #[doc(hidden)]
 #[cfg(not(feature = "panic_immediate_abort"))]
 #[unstable(feature = "update_panic_count", issue = "none")]
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[cfg_attr(bootstrap, allow(static_mut_ref))]
+#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
 pub mod panic_count {
     use crate::cell::Cell;
     use crate::sync::atomic::{AtomicUsize, Ordering};
diff --git a/library/std/src/sys/pal/common/thread_local/fast_local.rs b/library/std/src/sys/pal/common/thread_local/fast_local.rs
index 04c0dd6f750..646dcd7f3a3 100644
--- a/library/std/src/sys/pal/common/thread_local/fast_local.rs
+++ b/library/std/src/sys/pal/common/thread_local/fast_local.rs
@@ -13,8 +13,9 @@ pub macro thread_local_inner {
     (@key $t:ty, const $init:expr) => {{
         #[inline]
         #[deny(unsafe_op_in_unsafe_fn)]
-        // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-        #[allow(static_mut_ref)]
+        // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+        #[cfg_attr(bootstrap, allow(static_mut_ref))]
+        #[cfg_attr(not(bootstrap), allow(static_mut_refs))]
         unsafe fn __getit(
             _init: $crate::option::Option<&mut $crate::option::Option<$t>>,
         ) -> $crate::option::Option<&'static $t> {
diff --git a/library/std/src/sys/pal/common/thread_local/static_local.rs b/library/std/src/sys/pal/common/thread_local/static_local.rs
index 0dde78b14db..4f2b6868962 100644
--- a/library/std/src/sys/pal/common/thread_local/static_local.rs
+++ b/library/std/src/sys/pal/common/thread_local/static_local.rs
@@ -11,8 +11,9 @@ pub macro thread_local_inner {
     (@key $t:ty, const $init:expr) => {{
         #[inline] // see comments below
         #[deny(unsafe_op_in_unsafe_fn)]
-        // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-        #[allow(static_mut_ref)]
+        // FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+        #[cfg_attr(bootstrap, allow(static_mut_ref))]
+        #[cfg_attr(not(bootstrap), allow(static_mut_refs))]
         unsafe fn __getit(
             _init: $crate::option::Option<&mut $crate::option::Option<$t>>,
         ) -> $crate::option::Option<&'static $t> {
diff --git a/library/std/src/thread/local.rs b/library/std/src/thread/local.rs
index 83d5d63556f..d1213e2f166 100644
--- a/library/std/src/thread/local.rs
+++ b/library/std/src/thread/local.rs
@@ -180,8 +180,8 @@ impl<T: 'static> fmt::Debug for LocalKey<T> {
 #[stable(feature = "rust1", since = "1.0.0")]
 #[cfg_attr(not(test), rustc_diagnostic_item = "thread_local_macro")]
 #[allow_internal_unstable(thread_local_internals)]
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[cfg_attr(not(bootstrap), allow(static_mut_refs))]
 macro_rules! thread_local {
     // empty (base case for the recursion)
     () => {};
diff --git a/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs b/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs
index 762a8d85314..d47a05d8475 100644
--- a/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs
+++ b/src/tools/miri/tests/fail/tls/tls_static_dealloc.rs
@@ -1,8 +1,8 @@
 //! Ensure that thread-local statics get deallocated when the thread dies.
 
 #![feature(thread_local)]
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#![allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#![allow(static_mut_refs)]
 
 #[thread_local]
 static mut TLS: u8 = 0;
diff --git a/src/tools/miri/tests/pass/static_mut.rs b/src/tools/miri/tests/pass/static_mut.rs
index c1e58b70adb..6b0c0297726 100644
--- a/src/tools/miri/tests/pass/static_mut.rs
+++ b/src/tools/miri/tests/pass/static_mut.rs
@@ -1,7 +1,7 @@
 static mut FOO: i32 = 42;
 
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#[allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#[allow(static_mut_refs)]
 static BAR: Foo = Foo(unsafe { &FOO as *const _ });
 
 #[allow(dead_code)]
diff --git a/src/tools/miri/tests/pass/tls/tls_static.rs b/src/tools/miri/tests/pass/tls/tls_static.rs
index 9be00af47aa..fea5bb1db5e 100644
--- a/src/tools/miri/tests/pass/tls/tls_static.rs
+++ b/src/tools/miri/tests/pass/tls/tls_static.rs
@@ -8,8 +8,8 @@
 //! test, we also check that thread-locals act as per-thread statics.
 
 #![feature(thread_local)]
-// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_ref` lint
-#![allow(static_mut_ref)]
+// FIXME: Use `SyncUnsafeCell` instead of allowing `static_mut_refs` lint
+#![allow(static_mut_refs)]
 
 use std::thread;
 
diff --git a/tests/ui/abi/statics/static-mut-foreign.rs b/tests/ui/abi/statics/static-mut-foreign.rs
index fdd775da578..f32ce8cf085 100644
--- a/tests/ui/abi/statics/static-mut-foreign.rs
+++ b/tests/ui/abi/statics/static-mut-foreign.rs
@@ -33,9 +33,9 @@ unsafe fn run() {
     rust_dbg_static_mut = -3;
     assert_eq!(rust_dbg_static_mut, -3);
     static_bound(&rust_dbg_static_mut);
-    //~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
     static_bound_set(&mut rust_dbg_static_mut);
-    //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
 }
 
 pub fn main() {
diff --git a/tests/ui/abi/statics/static-mut-foreign.stderr b/tests/ui/abi/statics/static-mut-foreign.stderr
index 144ac056f87..f393088ff9f 100644
--- a/tests/ui/abi/statics/static-mut-foreign.stderr
+++ b/tests/ui/abi/statics/static-mut-foreign.stderr
@@ -1,28 +1,28 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/static-mut-foreign.rs:35:18
    |
 LL |     static_bound(&rust_dbg_static_mut);
-   |                  ^^^^^^^^^^^^^^^^^^^^ shared reference of mutable static
+   |                  ^^^^^^^^^^^^^^^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     static_bound(addr_of!(rust_dbg_static_mut));
    |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/static-mut-foreign.rs:37:22
    |
 LL |     static_bound_set(&mut rust_dbg_static_mut);
-   |                      ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |     static_bound_set(addr_of_mut!(rust_dbg_static_mut));
    |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/borrowck/borrowck-access-permissions.rs b/tests/ui/borrowck/borrowck-access-permissions.rs
index 1638644103b..be11286a523 100644
--- a/tests/ui/borrowck/borrowck-access-permissions.rs
+++ b/tests/ui/borrowck/borrowck-access-permissions.rs
@@ -16,7 +16,7 @@ fn main() {
         let _y1 = &mut static_x; //~ ERROR [E0596]
         unsafe {
             let _y2 = &mut static_x_mut;
-            //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+            //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
         }
     }
 
diff --git a/tests/ui/borrowck/borrowck-access-permissions.stderr b/tests/ui/borrowck/borrowck-access-permissions.stderr
index 93d92295dd9..11e2b63bd6c 100644
--- a/tests/ui/borrowck/borrowck-access-permissions.stderr
+++ b/tests/ui/borrowck/borrowck-access-permissions.stderr
@@ -1,14 +1,14 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/borrowck-access-permissions.rs:18:23
    |
 LL |             let _y2 = &mut static_x_mut;
-   |                       ^^^^^^^^^^^^^^^^^ mutable reference of mutable static
+   |                       ^^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |             let _y2 = addr_of_mut!(static_x_mut);
    |                       ~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs
index a89cad20f97..b09c96ada8a 100644
--- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs
+++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs
@@ -17,7 +17,7 @@ impl Foo {
 fn main() {
     unsafe {
         let sfoo: *mut Foo = &mut SFOO;
-        //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+        //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
         let x = (*sfoo).x();
         (*sfoo).x[1] += 1;
         *x += 1;
diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
index 7a3824f79a4..354d70eb1ad 100644
--- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
+++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
@@ -1,14 +1,14 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/borrowck-unsafe-static-mutable-borrows.rs:19:30
    |
 LL |         let sfoo: *mut Foo = &mut SFOO;
-   |                              ^^^^^^^^^ mutable reference of mutable static
+   |                              ^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |         let sfoo: *mut Foo = addr_of_mut!(SFOO);
    |                              ~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/borrowck/issue-20801.rs b/tests/ui/borrowck/issue-20801.rs
index ec83af5d5df..7e3d3703dc7 100644
--- a/tests/ui/borrowck/issue-20801.rs
+++ b/tests/ui/borrowck/issue-20801.rs
@@ -12,7 +12,7 @@ fn imm_ref() -> &'static T {
 
 fn mut_ref() -> &'static mut T {
     unsafe { &mut GLOBAL_MUT_T }
-    //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
 }
 
 fn mut_ptr() -> *mut T {
diff --git a/tests/ui/borrowck/issue-20801.stderr b/tests/ui/borrowck/issue-20801.stderr
index b2bee2d8803..97294afd3df 100644
--- a/tests/ui/borrowck/issue-20801.stderr
+++ b/tests/ui/borrowck/issue-20801.stderr
@@ -1,14 +1,14 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/issue-20801.rs:14:14
    |
 LL |     unsafe { &mut GLOBAL_MUT_T }
-   |              ^^^^^^^^^^^^^^^^^ mutable reference of mutable static
+   |              ^^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |     unsafe { addr_of_mut!(GLOBAL_MUT_T) }
    |              ~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs b/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
index 9b172b41319..c3909d05963 100644
--- a/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
+++ b/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.rs
@@ -10,7 +10,7 @@ mod borrowck_closures_unique {
         //~^ ERROR is not declared as mutable
         unsafe {
             c1(&mut Y);
-            //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+            //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
         }
     }
 }
@@ -25,7 +25,7 @@ mod borrowck_closures_unique_grandparent {
         };
         unsafe {
             c1(&mut Z);
-            //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+            //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
         }
     }
 }
@@ -62,7 +62,7 @@ fn main() {
     static mut X: isize = 2;
     unsafe {
         borrowck_closures_unique::e(&mut X);
-        //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+        //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
     }
 
     mutability_errors::capture_assign_whole((1000,));
diff --git a/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.stderr b/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.stderr
index e4e4947fce1..098a2964e9f 100644
--- a/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.stderr
+++ b/tests/ui/borrowck/issue-55492-borrowck-migrate-scans-parents.stderr
@@ -1,42 +1,42 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:12:16
    |
 LL |             c1(&mut Y);
-   |                ^^^^^^ mutable reference of mutable static
+   |                ^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |             c1(addr_of_mut!(Y));
    |                ~~~~~~~~~~~~~~~
 
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:27:16
    |
 LL |             c1(&mut Z);
-   |                ^^^^^^ mutable reference of mutable static
+   |                ^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |             c1(addr_of_mut!(Z));
    |                ~~~~~~~~~~~~~~~
 
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/issue-55492-borrowck-migrate-scans-parents.rs:64:37
    |
 LL |         borrowck_closures_unique::e(&mut X);
-   |                                     ^^^^^^ mutable reference of mutable static
+   |                                     ^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |         borrowck_closures_unique::e(addr_of_mut!(X));
    |                                     ~~~~~~~~~~~~~~~
diff --git a/tests/ui/consts/const_let_assign2.rs b/tests/ui/consts/const_let_assign2.rs
index f239507d245..e8ebba7b208 100644
--- a/tests/ui/consts/const_let_assign2.rs
+++ b/tests/ui/consts/const_let_assign2.rs
@@ -16,7 +16,7 @@ static mut BB: AA = AA::new();
 
 fn main() {
     let ptr = unsafe { &mut BB };
-    //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
     for a in ptr.data.iter() {
         println!("{}", a);
     }
diff --git a/tests/ui/consts/const_let_assign2.stderr b/tests/ui/consts/const_let_assign2.stderr
index 2764153a8a5..5ae8fd353dd 100644
--- a/tests/ui/consts/const_let_assign2.stderr
+++ b/tests/ui/consts/const_let_assign2.stderr
@@ -1,14 +1,14 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/const_let_assign2.rs:18:24
    |
 LL |     let ptr = unsafe { &mut BB };
-   |                        ^^^^^^^ mutable reference of mutable static
+   |                        ^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |     let ptr = unsafe { addr_of_mut!(BB) };
    |                        ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.rs b/tests/ui/consts/const_refs_to_static_fail_invalid.rs
index 363a6da0901..be1574af588 100644
--- a/tests/ui/consts/const_refs_to_static_fail_invalid.rs
+++ b/tests/ui/consts/const_refs_to_static_fail_invalid.rs
@@ -1,7 +1,7 @@
 //@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
 //@ normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
 #![feature(const_refs_to_static)]
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 
 fn invalid() {
     static S: i8 = 10;
@@ -43,8 +43,8 @@ fn mutable() {
     // This *must not build*, the constant we are matching against
     // could change its value!
     match &42 {
-        C => {}, //~ERROR: could not evaluate constant pattern
-        _ => {},
+        C => {} //~ERROR: could not evaluate constant pattern
+        _ => {}
     }
 }
 
diff --git a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr
index 082f8532444..4ff15f0c28b 100644
--- a/tests/ui/consts/const_refs_to_static_fail_invalid.stderr
+++ b/tests/ui/consts/const_refs_to_static_fail_invalid.stderr
@@ -46,7 +46,7 @@ LL |     const C: &i32 = unsafe { &S_MUT };
 error: could not evaluate constant pattern
   --> $DIR/const_refs_to_static_fail_invalid.rs:46:9
    |
-LL |         C => {},
+LL |         C => {}
    |         ^
 
 error: aborting due to 6 previous errors
diff --git a/tests/ui/consts/issue-17718-const-bad-values.rs b/tests/ui/consts/issue-17718-const-bad-values.rs
index e112a346b65..33347d8df62 100644
--- a/tests/ui/consts/issue-17718-const-bad-values.rs
+++ b/tests/ui/consts/issue-17718-const-bad-values.rs
@@ -1,4 +1,4 @@
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 
 const C1: &'static mut [usize] = &mut [];
 //~^ ERROR: mutable references are not allowed
diff --git a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
index 6ec44aab2c1..5e7845e4e82 100644
--- a/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
+++ b/tests/ui/consts/miri_unleashed/const_refers_to_static_cross_crate.rs
@@ -3,7 +3,7 @@
 //@ normalize-stderr-test "(the raw bytes of the constant) \(size: [0-9]*, align: [0-9]*\)" -> "$1 (size: $$SIZE, align: $$ALIGN)"
 //@ normalize-stderr-test "([0-9a-f][0-9a-f] |╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼ )+ *│.*" -> "HEX_DUMP"
 #![feature(exclusive_range_pattern, half_open_range_patterns_in_slices)]
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 
 extern crate static_cross_crate;
 
diff --git a/tests/ui/consts/miri_unleashed/extern-static.rs b/tests/ui/consts/miri_unleashed/extern-static.rs
index 1a523cc8e31..c9d9397518e 100644
--- a/tests/ui/consts/miri_unleashed/extern-static.rs
+++ b/tests/ui/consts/miri_unleashed/extern-static.rs
@@ -1,6 +1,6 @@
 //@ compile-flags: -Zunleash-the-miri-inside-of-you
 #![feature(thread_local)]
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 
 extern "C" {
     static mut DATA: u8;
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
index 82739c08cf1..ea7573bf217 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.32bit.stderr
@@ -5,13 +5,13 @@ LL | const MUH: Meh = Meh {
    | ^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:27:1
+  --> $DIR/mutable_references_err.rs:28:1
    |
 LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/mutable_references_err.rs:32:1
+  --> $DIR/mutable_references_err.rs:33:1
    |
 LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` or `static`
@@ -22,13 +22,13 @@ LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
            }
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:35:1
+  --> $DIR/mutable_references_err.rs:36:1
    |
 LL | const BLUNT: &mut i32 = &mut 42;
    | ^^^^^^^^^^^^^^^^^^^^^
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/mutable_references_err.rs:40:1
+  --> $DIR/mutable_references_err.rs:41:1
    |
 LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
@@ -39,7 +39,7 @@ LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/mutable_references_err.rs:47:1
+  --> $DIR/mutable_references_err.rs:48:1
    |
 LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
@@ -50,49 +50,49 @@ LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
            }
 
 note: erroneous constant encountered
-  --> $DIR/mutable_references_err.rs:49:34
+  --> $DIR/mutable_references_err.rs:50:34
    |
 LL | const READS_FROM_MUTABLE: i32 = *POINTS_TO_MUTABLE1;
    |                                  ^^^^^^^^^^^^^^^^^^
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/mutable_references_err.rs:51:43
+  --> $DIR/mutable_references_err.rs:52:43
    |
 LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF };
    |                                           ^^^^^^^^^^^^^ constant accesses mutable global memory
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:55:1
+  --> $DIR/mutable_references_err.rs:56:1
    |
 LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:57:1
+  --> $DIR/mutable_references_err.rs:58:1
    |
 LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:59:1
+  --> $DIR/mutable_references_err.rs:60:1
    |
 LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:69:1
+  --> $DIR/mutable_references_err.rs:72:1
    |
 LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:71:1
+  --> $DIR/mutable_references_err.rs:74:1
    |
-LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
+LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:73:1
+  --> $DIR/mutable_references_err.rs:76:1
    |
 LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -100,77 +100,77 @@ LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
 warning: skipping const checks
    |
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:18:8
+  --> $DIR/mutable_references_err.rs:19:8
    |
 LL |     x: &UnsafeCell::new(42),
    |        ^^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:27:27
+  --> $DIR/mutable_references_err.rs:28:27
    |
 LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: skipping check for `const_refs_to_static` feature
-  --> $DIR/mutable_references_err.rs:32:40
+  --> $DIR/mutable_references_err.rs:33:40
    |
 LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
    |                                        ^^^
 help: skipping check for `const_mut_refs` feature
-  --> $DIR/mutable_references_err.rs:32:35
+  --> $DIR/mutable_references_err.rs:33:35
    |
 LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
    |                                   ^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:35:25
+  --> $DIR/mutable_references_err.rs:36:25
    |
 LL | const BLUNT: &mut i32 = &mut 42;
    |                         ^^^^^^^
 help: skipping check for `const_mut_refs` feature
-  --> $DIR/mutable_references_err.rs:40:49
+  --> $DIR/mutable_references_err.rs:41:49
    |
 LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: skipping check for `const_mut_refs` feature
-  --> $DIR/mutable_references_err.rs:40:49
+  --> $DIR/mutable_references_err.rs:41:49
    |
 LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: skipping check for `const_refs_to_static` feature
-  --> $DIR/mutable_references_err.rs:47:44
+  --> $DIR/mutable_references_err.rs:48:44
    |
 LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
    |                                            ^^^^^^^
 help: skipping check for `const_refs_to_static` feature
-  --> $DIR/mutable_references_err.rs:51:45
+  --> $DIR/mutable_references_err.rs:52:45
    |
 LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF };
    |                                             ^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:55:45
+  --> $DIR/mutable_references_err.rs:56:45
    |
 LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
    |                                             ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:57:46
+  --> $DIR/mutable_references_err.rs:58:46
    |
 LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
    |                                              ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:59:47
+  --> $DIR/mutable_references_err.rs:60:47
    |
 LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
    |                                               ^^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:69:51
+  --> $DIR/mutable_references_err.rs:72:51
    |
 LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
    |                                                   ^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:71:50
+  --> $DIR/mutable_references_err.rs:74:49
    |
-LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
-   |                                                  ^^^^^^^
+LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
+   |                                                 ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:73:51
+  --> $DIR/mutable_references_err.rs:76:51
    |
 LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
    |                                                   ^^^^^^
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
index 844483d88e9..2b5e8643f3b 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.64bit.stderr
@@ -5,13 +5,13 @@ LL | const MUH: Meh = Meh {
    | ^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:27:1
+  --> $DIR/mutable_references_err.rs:28:1
    |
 LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/mutable_references_err.rs:32:1
+  --> $DIR/mutable_references_err.rs:33:1
    |
 LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
    | ^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference in a `const` or `static`
@@ -22,13 +22,13 @@ LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
            }
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:35:1
+  --> $DIR/mutable_references_err.rs:36:1
    |
 LL | const BLUNT: &mut i32 = &mut 42;
    | ^^^^^^^^^^^^^^^^^^^^^
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/mutable_references_err.rs:40:1
+  --> $DIR/mutable_references_err.rs:41:1
    |
 LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered mutable reference or box pointing to read-only memory
@@ -39,7 +39,7 @@ LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const
            }
 
 error[E0080]: it is undefined behavior to use this value
-  --> $DIR/mutable_references_err.rs:47:1
+  --> $DIR/mutable_references_err.rs:48:1
    |
 LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value: encountered reference to mutable memory in `const`
@@ -50,49 +50,49 @@ LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
            }
 
 note: erroneous constant encountered
-  --> $DIR/mutable_references_err.rs:49:34
+  --> $DIR/mutable_references_err.rs:50:34
    |
 LL | const READS_FROM_MUTABLE: i32 = *POINTS_TO_MUTABLE1;
    |                                  ^^^^^^^^^^^^^^^^^^
 
 error[E0080]: evaluation of constant value failed
-  --> $DIR/mutable_references_err.rs:51:43
+  --> $DIR/mutable_references_err.rs:52:43
    |
 LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF };
    |                                           ^^^^^^^^^^^^^ constant accesses mutable global memory
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:55:1
+  --> $DIR/mutable_references_err.rs:56:1
    |
 LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:57:1
+  --> $DIR/mutable_references_err.rs:58:1
    |
 LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:59:1
+  --> $DIR/mutable_references_err.rs:60:1
    |
 LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:69:1
+  --> $DIR/mutable_references_err.rs:72:1
    |
 LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:71:1
+  --> $DIR/mutable_references_err.rs:74:1
    |
-LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
+LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 error: encountered mutable pointer in final value of constant
-  --> $DIR/mutable_references_err.rs:73:1
+  --> $DIR/mutable_references_err.rs:76:1
    |
 LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -100,77 +100,77 @@ LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
 warning: skipping const checks
    |
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:18:8
+  --> $DIR/mutable_references_err.rs:19:8
    |
 LL |     x: &UnsafeCell::new(42),
    |        ^^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:27:27
+  --> $DIR/mutable_references_err.rs:28:27
    |
 LL | const SNEAKY: &dyn Sync = &Synced { x: UnsafeCell::new(42) };
    |                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: skipping check for `const_refs_to_static` feature
-  --> $DIR/mutable_references_err.rs:32:40
+  --> $DIR/mutable_references_err.rs:33:40
    |
 LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
    |                                        ^^^
 help: skipping check for `const_mut_refs` feature
-  --> $DIR/mutable_references_err.rs:32:35
+  --> $DIR/mutable_references_err.rs:33:35
    |
 LL | const SUBTLE: &mut i32 = unsafe { &mut FOO };
    |                                   ^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:35:25
+  --> $DIR/mutable_references_err.rs:36:25
    |
 LL | const BLUNT: &mut i32 = &mut 42;
    |                         ^^^^^^^
 help: skipping check for `const_mut_refs` feature
-  --> $DIR/mutable_references_err.rs:40:49
+  --> $DIR/mutable_references_err.rs:41:49
    |
 LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: skipping check for `const_mut_refs` feature
-  --> $DIR/mutable_references_err.rs:40:49
+  --> $DIR/mutable_references_err.rs:41:49
    |
 LL | static mut MUT_TO_READONLY: &mut i32 = unsafe { &mut *(&READONLY as *const _ as *mut _) };
    |                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 help: skipping check for `const_refs_to_static` feature
-  --> $DIR/mutable_references_err.rs:47:44
+  --> $DIR/mutable_references_err.rs:48:44
    |
 LL | const POINTS_TO_MUTABLE1: &i32 = unsafe { &MUTABLE };
    |                                            ^^^^^^^
 help: skipping check for `const_refs_to_static` feature
-  --> $DIR/mutable_references_err.rs:51:45
+  --> $DIR/mutable_references_err.rs:52:45
    |
 LL | const POINTS_TO_MUTABLE2: &i32 = unsafe { &*MUTABLE_REF };
    |                                             ^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:55:45
+  --> $DIR/mutable_references_err.rs:56:45
    |
 LL | const POINTS_TO_MUTABLE_INNER: *const i32 = &mut 42 as *mut _ as *const _;
    |                                             ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:57:46
+  --> $DIR/mutable_references_err.rs:58:46
    |
 LL | const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
    |                                              ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:59:47
+  --> $DIR/mutable_references_err.rs:60:47
    |
 LL | const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
    |                                               ^^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:69:51
+  --> $DIR/mutable_references_err.rs:72:51
    |
 LL | const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
    |                                                   ^^^^^^^^^^^^^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:71:50
+  --> $DIR/mutable_references_err.rs:74:49
    |
-LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
-   |                                                  ^^^^^^^
+LL | const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
+   |                                                 ^^^^^^^
 help: skipping check that does not even have a feature gate
-  --> $DIR/mutable_references_err.rs:73:51
+  --> $DIR/mutable_references_err.rs:76:51
    |
 LL | const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
    |                                                   ^^^^^^
diff --git a/tests/ui/consts/miri_unleashed/mutable_references_err.rs b/tests/ui/consts/miri_unleashed/mutable_references_err.rs
index 2075adad6f7..feb2c825380 100644
--- a/tests/ui/consts/miri_unleashed/mutable_references_err.rs
+++ b/tests/ui/consts/miri_unleashed/mutable_references_err.rs
@@ -1,9 +1,9 @@
 //@ stderr-per-bitwidth
 //@ compile-flags: -Zunleash-the-miri-inside-of-you
-#![allow(invalid_reference_casting, static_mut_ref)]
+#![allow(invalid_reference_casting, static_mut_refs)]
 
-use std::sync::atomic::*;
 use std::cell::UnsafeCell;
+use std::sync::atomic::*;
 
 // this test ensures that our mutability story is sound
 
@@ -14,7 +14,8 @@ unsafe impl Sync for Meh {}
 
 // the following will never be ok! no interior mut behind consts, because
 // all allocs interned here will be marked immutable.
-const MUH: Meh = Meh { //~ ERROR: mutable pointer in final value
+const MUH: Meh = Meh {
+    //~^ ERROR encountered mutable pointer in final value of constant
     x: &UnsafeCell::new(42),
 };
 
@@ -59,7 +60,9 @@ const POINTS_TO_MUTABLE_INNER2: *const i32 = &mut 42 as *const _;
 const INTERIOR_MUTABLE_BEHIND_RAW: *mut i32 = &UnsafeCell::new(42) as *const _ as *mut _;
 //~^ ERROR: mutable pointer in final value
 
-struct SyncPtr<T> { x : *const T }
+struct SyncPtr<T> {
+    x: *const T,
+}
 unsafe impl<T> Sync for SyncPtr<T> {}
 
 // These pass the lifetime checks because of the "tail expression" / "outer scope" rule.
@@ -68,7 +71,7 @@ unsafe impl<T> Sync for SyncPtr<T> {}
 // (Also see `static-no-inner-mut` for similar tests on `static`.)
 const RAW_SYNC: SyncPtr<AtomicI32> = SyncPtr { x: &AtomicI32::new(42) };
 //~^ ERROR mutable pointer in final value
-const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x : &mut 42 as *mut _ as *const _ };
+const RAW_MUT_CAST: SyncPtr<i32> = SyncPtr { x: &mut 42 as *mut _ as *const _ };
 //~^ ERROR mutable pointer in final value
 const RAW_MUT_COERCE: SyncPtr<i32> = SyncPtr { x: &mut 0 };
 //~^ ERROR mutable pointer in final value
diff --git a/tests/ui/consts/static-promoted-to-mutable-static.rs b/tests/ui/consts/static-promoted-to-mutable-static.rs
index 1cf72781e45..9eb9e1b8dfb 100644
--- a/tests/ui/consts/static-promoted-to-mutable-static.rs
+++ b/tests/ui/consts/static-promoted-to-mutable-static.rs
@@ -1,8 +1,9 @@
 //@ check-pass
-#![allow(non_camel_case_types, non_upper_case_globals, static_mut_ref)]
+
+#![allow(non_camel_case_types, non_upper_case_globals, static_mut_refs)]
 
 pub struct wl_interface {
-    pub version: i32
+    pub version: i32,
 }
 
 pub struct Interface {
@@ -10,20 +11,14 @@ pub struct Interface {
     pub c_ptr: Option<&'static wl_interface>,
 }
 
-pub static mut wl_callback_interface: wl_interface = wl_interface {
-    version: 0,
-};
+pub static mut wl_callback_interface: wl_interface = wl_interface { version: 0 };
 
-pub static WL_CALLBACK_INTERFACE: Interface = Interface {
-    other_interfaces: &[],
-    c_ptr: Some(unsafe { &wl_callback_interface }),
-};
+pub static WL_CALLBACK_INTERFACE: Interface =
+    Interface { other_interfaces: &[], c_ptr: Some(unsafe { &wl_callback_interface }) };
 
 // This static contains a promoted that points to a static that points to a mutable static.
-pub static WL_SURFACE_INTERFACE: Interface = Interface {
-    other_interfaces: &[&WL_CALLBACK_INTERFACE],
-    c_ptr: None,
-};
+pub static WL_SURFACE_INTERFACE: Interface =
+    Interface { other_interfaces: &[&WL_CALLBACK_INTERFACE], c_ptr: None };
 
 // And another variant of the same thing, this time with interior mutability.
 use std::sync::OnceLock;
diff --git a/tests/ui/consts/static_mut_containing_mut_ref.rs b/tests/ui/consts/static_mut_containing_mut_ref.rs
index 710328d6aa7..874a047d807 100644
--- a/tests/ui/consts/static_mut_containing_mut_ref.rs
+++ b/tests/ui/consts/static_mut_containing_mut_ref.rs
@@ -1,5 +1,5 @@
 //@ build-pass (FIXME(62277): could be check-pass?)
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 
 static mut STDERR_BUFFER_SPACE: [u8; 42] = [0u8; 42];
 
diff --git a/tests/ui/consts/static_mut_containing_mut_ref2.rs b/tests/ui/consts/static_mut_containing_mut_ref2.rs
index b5110623606..547f6449f13 100644
--- a/tests/ui/consts/static_mut_containing_mut_ref2.rs
+++ b/tests/ui/consts/static_mut_containing_mut_ref2.rs
@@ -1,5 +1,5 @@
 //@ revisions: stock mut_refs
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 #![cfg_attr(mut_refs, feature(const_mut_refs))]
 
 static mut STDERR_BUFFER_SPACE: u8 = 0;
diff --git a/tests/ui/drop/issue-23338-ensure-param-drop-order.rs b/tests/ui/drop/issue-23338-ensure-param-drop-order.rs
index f283b33f645..1fa68a2e738 100644
--- a/tests/ui/drop/issue-23338-ensure-param-drop-order.rs
+++ b/tests/ui/drop/issue-23338-ensure-param-drop-order.rs
@@ -91,7 +91,7 @@ pub mod d {
     pub fn max_width() -> u32 {
         unsafe {
             (mem::size_of_val(&trails) * 8) as u32
-            //~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+            //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
         }
     }
 
diff --git a/tests/ui/drop/issue-23338-ensure-param-drop-order.stderr b/tests/ui/drop/issue-23338-ensure-param-drop-order.stderr
index fd36ccbcbee..de1194e74b4 100644
--- a/tests/ui/drop/issue-23338-ensure-param-drop-order.stderr
+++ b/tests/ui/drop/issue-23338-ensure-param-drop-order.stderr
@@ -1,14 +1,14 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/issue-23338-ensure-param-drop-order.rs:93:31
    |
 LL |             (mem::size_of_val(&trails) * 8) as u32
-   |                               ^^^^^^^ shared reference of mutable static
+   |                               ^^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |             (mem::size_of_val(addr_of!(trails)) * 8) as u32
    |                               ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/error-codes/E0017.rs b/tests/ui/error-codes/E0017.rs
index c128c2779e2..144340b3512 100644
--- a/tests/ui/error-codes/E0017.rs
+++ b/tests/ui/error-codes/E0017.rs
@@ -13,6 +13,6 @@ static CONST_REF: &'static mut i32 = &mut C; //~ ERROR mutable references are no
 //~| WARN taking a mutable
 
 static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
-//~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+//~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
 
 fn main() {}
diff --git a/tests/ui/error-codes/E0017.stderr b/tests/ui/error-codes/E0017.stderr
index eb626a7fe3a..982ce52764e 100644
--- a/tests/ui/error-codes/E0017.stderr
+++ b/tests/ui/error-codes/E0017.stderr
@@ -1,14 +1,14 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/E0017.rs:15:52
    |
 LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
-   |                                                    ^^^^^^ mutable reference of mutable static
+   |                                                    ^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { addr_of_mut!(M) };
    |                                                    ~~~~~~~~~~~~~~~
diff --git a/tests/ui/issues/issue-23611-enum-swap-in-drop.rs b/tests/ui/issues/issue-23611-enum-swap-in-drop.rs
index 980a2c01f23..1afaff0f735 100644
--- a/tests/ui/issues/issue-23611-enum-swap-in-drop.rs
+++ b/tests/ui/issues/issue-23611-enum-swap-in-drop.rs
@@ -187,7 +187,7 @@ pub mod d {
     pub fn max_width() -> u32 {
         unsafe {
             (mem::size_of_val(&trails) * 8) as u32
-            //~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+            //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
         }
     }
 
diff --git a/tests/ui/issues/issue-23611-enum-swap-in-drop.stderr b/tests/ui/issues/issue-23611-enum-swap-in-drop.stderr
index 14a986a3332..bdf46abea8a 100644
--- a/tests/ui/issues/issue-23611-enum-swap-in-drop.stderr
+++ b/tests/ui/issues/issue-23611-enum-swap-in-drop.stderr
@@ -1,14 +1,14 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/issue-23611-enum-swap-in-drop.rs:189:31
    |
 LL |             (mem::size_of_val(&trails) * 8) as u32
-   |                               ^^^^^^^ shared reference of mutable static
+   |                               ^^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |             (mem::size_of_val(addr_of!(trails)) * 8) as u32
    |                               ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/issues/issue-54410.rs b/tests/ui/issues/issue-54410.rs
index 51eea3ad9ac..208be6f221c 100644
--- a/tests/ui/issues/issue-54410.rs
+++ b/tests/ui/issues/issue-54410.rs
@@ -5,5 +5,5 @@ extern "C" {
 
 fn main() {
     println!("{:p}", unsafe { &symbol });
-    //~^ WARN: shared reference of mutable static is discouraged
+    //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
 }
diff --git a/tests/ui/issues/issue-54410.stderr b/tests/ui/issues/issue-54410.stderr
index 941c1be3eab..7cc67ab72c3 100644
--- a/tests/ui/issues/issue-54410.stderr
+++ b/tests/ui/issues/issue-54410.stderr
@@ -6,17 +6,17 @@ LL |     pub static mut symbol: [i8];
    |
    = help: the trait `Sized` is not implemented for `[i8]`
 
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/issue-54410.rs:7:31
    |
 LL |     println!("{:p}", unsafe { &symbol });
-   |                               ^^^^^^^ shared reference of mutable static
+   |                               ^^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     println!("{:p}", unsafe { addr_of!(symbol) });
    |                               ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs
index fd49b232265..be882085c5c 100644
--- a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs
+++ b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs
@@ -15,7 +15,7 @@ struct S1 {
 impl S1 {
     fn new(_x: u64) -> S1 {
         S1 { a: unsafe { &mut X1 } }
-        //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+        //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
     }
 }
 
diff --git a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr
index 17217cd5859..82065cc06ea 100644
--- a/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr
+++ b/tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr
@@ -1,14 +1,14 @@
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/borrowck-thread-local-static-mut-borrow-outlives-fn.rs:17:26
    |
 LL |         S1 { a: unsafe { &mut X1 } }
-   |                          ^^^^^^^ mutable reference of mutable static
+   |                          ^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |         S1 { a: unsafe { addr_of_mut!(X1) } }
    |                          ~~~~~~~~~~~~~~~~
diff --git a/tests/ui/static/reference-of-mut-static-safe.e2021.stderr b/tests/ui/static/reference-of-mut-static-safe.e2021.stderr
deleted file mode 100644
index 16f47ace3a9..00000000000
--- a/tests/ui/static/reference-of-mut-static-safe.e2021.stderr
+++ /dev/null
@@ -1,26 +0,0 @@
-warning: shared reference of mutable static is discouraged
-  --> $DIR/reference-of-mut-static-safe.rs:9:14
-   |
-LL |     let _x = &X;
-   |              ^^ shared reference of mutable static
-   |
-   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
-   |
-LL |     let _x = addr_of!(X);
-   |              ~~~~~~~~~~~
-
-error[E0133]: use of mutable static is unsafe and requires unsafe function or block
-  --> $DIR/reference-of-mut-static-safe.rs:9:15
-   |
-LL |     let _x = &X;
-   |               ^ use of mutable static
-   |
-   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
-
-error: aborting due to 1 previous error; 1 warning emitted
-
-For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/static/reference-of-mut-static-safe.e2024.stderr b/tests/ui/static/reference-of-mut-static-safe.e2024.stderr
deleted file mode 100644
index 53f81179de5..00000000000
--- a/tests/ui/static/reference-of-mut-static-safe.e2024.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0796]: reference of mutable static is disallowed
-  --> $DIR/reference-of-mut-static-safe.rs:9:14
-   |
-LL |     let _x = &X;
-   |              ^^ reference of mutable static
-   |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
-   |
-LL |     let _x = addr_of!(X);
-   |              ~~~~~~~~~~~
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0796`.
diff --git a/tests/ui/static/reference-of-mut-static-unsafe-fn.rs b/tests/ui/static/reference-of-mut-static-unsafe-fn.rs
index 8f3b3eb7745..5652703a271 100644
--- a/tests/ui/static/reference-of-mut-static-unsafe-fn.rs
+++ b/tests/ui/static/reference-of-mut-static-unsafe-fn.rs
@@ -7,17 +7,20 @@ unsafe fn _foo() {
     static mut Y: i32 = 1;
 
     let _y = &X;
-    //~^ ERROR reference of mutable static is disallowed
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
 
     let ref _a = X;
-    //~^ ERROR reference of mutable static is disallowed
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
 
-    let (_b, _c) = (&X, &Y);
-    //~^ ERROR reference of mutable static is disallowed
-    //~^^ ERROR reference of mutable static is disallowed
+    let ref mut _a = X;
+    //~^ ERROR creating a mutable reference to a mutable static [E0796]
+
+    let (_b, _c) = (&X, &mut Y);
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
+    //~^^ ERROR creating a mutable reference to a mutable static [E0796]
 
     foo(&X);
-    //~^ ERROR reference of mutable static is disallowed
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
 }
 
 fn foo<'a>(_x: &'a i32) {}
diff --git a/tests/ui/static/reference-of-mut-static-unsafe-fn.stderr b/tests/ui/static/reference-of-mut-static-unsafe-fn.stderr
index 5c6fdedfa96..5675d313e07 100644
--- a/tests/ui/static/reference-of-mut-static-unsafe-fn.stderr
+++ b/tests/ui/static/reference-of-mut-static-unsafe-fn.stderr
@@ -1,63 +1,75 @@
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static-unsafe-fn.rs:9:14
    |
 LL |     let _y = &X;
-   |              ^^ reference of mutable static
+   |              ^^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     let _y = addr_of!(X);
    |              ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static-unsafe-fn.rs:12:18
    |
 LL |     let ref _a = X;
-   |                  ^ reference of mutable static
+   |                  ^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     let ref _a = addr_of!(X);
    |                  ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
-  --> $DIR/reference-of-mut-static-unsafe-fn.rs:15:21
+error[E0796]: creating a mutable reference to a mutable static
+  --> $DIR/reference-of-mut-static-unsafe-fn.rs:15:22
    |
-LL |     let (_b, _c) = (&X, &Y);
-   |                     ^^ reference of mutable static
+LL |     let ref mut _a = X;
+   |                      ^ mutable reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
-LL |     let (_b, _c) = (addr_of!(X), &Y);
+LL |     let ref mut _a = addr_of_mut!(X);
+   |                      ~~~~~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-of-mut-static-unsafe-fn.rs:18:21
+   |
+LL |     let (_b, _c) = (&X, &mut Y);
+   |                     ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     let (_b, _c) = (addr_of!(X), &mut Y);
    |                     ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
-  --> $DIR/reference-of-mut-static-unsafe-fn.rs:15:25
+error[E0796]: creating a mutable reference to a mutable static
+  --> $DIR/reference-of-mut-static-unsafe-fn.rs:18:25
    |
-LL |     let (_b, _c) = (&X, &Y);
-   |                         ^^ reference of mutable static
+LL |     let (_b, _c) = (&X, &mut Y);
+   |                         ^^^^^^ mutable reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
-LL |     let (_b, _c) = (&X, addr_of!(Y));
-   |                         ~~~~~~~~~~~
+LL |     let (_b, _c) = (&X, addr_of_mut!(Y));
+   |                         ~~~~~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
-  --> $DIR/reference-of-mut-static-unsafe-fn.rs:19:9
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-of-mut-static-unsafe-fn.rs:22:9
    |
 LL |     foo(&X);
-   |         ^^ reference of mutable static
+   |         ^^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     foo(addr_of!(X));
    |         ~~~~~~~~~~~
 
-error: aborting due to 5 previous errors
+error: aborting due to 6 previous errors
 
 For more information about this error, try `rustc --explain E0796`.
diff --git a/tests/ui/static/reference-of-mut-static.e2021.stderr b/tests/ui/static/reference-of-mut-static.e2021.stderr
index 77a6b3d304b..f7ad51b6157 100644
--- a/tests/ui/static/reference-of-mut-static.e2021.stderr
+++ b/tests/ui/static/reference-of-mut-static.e2021.stderr
@@ -1,88 +1,88 @@
-error: shared reference of mutable static is discouraged
+error: creating a shared reference to mutable static is discouraged
   --> $DIR/reference-of-mut-static.rs:16:18
    |
 LL |         let _y = &X;
-   |                  ^^ shared reference of mutable static
+   |                  ^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
 note: the lint level is defined here
   --> $DIR/reference-of-mut-static.rs:6:9
    |
-LL | #![deny(static_mut_ref)]
-   |         ^^^^^^^^^^^^^^
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+LL | #![deny(static_mut_refs)]
+   |         ^^^^^^^^^^^^^^^
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let _y = addr_of!(X);
    |                  ~~~~~~~~~~~
 
-error: mutable reference of mutable static is discouraged
+error: creating a mutable reference to mutable static is discouraged
   --> $DIR/reference-of-mut-static.rs:20:18
    |
 LL |         let _y = &mut X;
-   |                  ^^^^^^ mutable reference of mutable static
+   |                  ^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |         let _y = addr_of_mut!(X);
    |                  ~~~~~~~~~~~~~~~
 
-error: shared reference of mutable static is discouraged
+error: creating a shared reference to mutable static is discouraged
   --> $DIR/reference-of-mut-static.rs:28:22
    |
 LL |         let ref _a = X;
-   |                      ^ shared reference of mutable static
+   |                      ^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let ref _a = addr_of!(X);
    |                      ~~~~~~~~~~~
 
-error: shared reference of mutable static is discouraged
+error: creating a shared reference to mutable static is discouraged
   --> $DIR/reference-of-mut-static.rs:32:25
    |
 LL |         let (_b, _c) = (&X, &Y);
-   |                         ^^ shared reference of mutable static
+   |                         ^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let (_b, _c) = (addr_of!(X), &Y);
    |                         ~~~~~~~~~~~
 
-error: shared reference of mutable static is discouraged
+error: creating a shared reference to mutable static is discouraged
   --> $DIR/reference-of-mut-static.rs:32:29
    |
 LL |         let (_b, _c) = (&X, &Y);
-   |                             ^^ shared reference of mutable static
+   |                             ^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let (_b, _c) = (&X, addr_of!(Y));
    |                             ~~~~~~~~~~~
 
-error: shared reference of mutable static is discouraged
+error: creating a shared reference to mutable static is discouraged
   --> $DIR/reference-of-mut-static.rs:38:13
    |
 LL |         foo(&X);
-   |             ^^ shared reference of mutable static
+   |             ^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         foo(addr_of!(X));
    |             ~~~~~~~~~~~
diff --git a/tests/ui/static/reference-of-mut-static.e2024.stderr b/tests/ui/static/reference-of-mut-static.e2024.stderr
index f445ec65a5d..6205c10ac41 100644
--- a/tests/ui/static/reference-of-mut-static.e2024.stderr
+++ b/tests/ui/static/reference-of-mut-static.e2024.stderr
@@ -1,71 +1,71 @@
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static.rs:16:18
    |
 LL |         let _y = &X;
-   |                  ^^ reference of mutable static
+   |                  ^^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let _y = addr_of!(X);
    |                  ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a mutable reference to a mutable static
   --> $DIR/reference-of-mut-static.rs:20:18
    |
 LL |         let _y = &mut X;
-   |                  ^^^^^^ reference of mutable static
+   |                  ^^^^^^ mutable reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |         let _y = addr_of_mut!(X);
    |                  ~~~~~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static.rs:28:22
    |
 LL |         let ref _a = X;
-   |                      ^ reference of mutable static
+   |                      ^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let ref _a = addr_of!(X);
    |                      ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static.rs:32:25
    |
 LL |         let (_b, _c) = (&X, &Y);
-   |                         ^^ reference of mutable static
+   |                         ^^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let (_b, _c) = (addr_of!(X), &Y);
    |                         ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static.rs:32:29
    |
 LL |         let (_b, _c) = (&X, &Y);
-   |                             ^^ reference of mutable static
+   |                             ^^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         let (_b, _c) = (&X, addr_of!(Y));
    |                             ~~~~~~~~~~~
 
-error[E0796]: reference of mutable static is disallowed
+error[E0796]: creating a shared reference to a mutable static
   --> $DIR/reference-of-mut-static.rs:38:13
    |
 LL |         foo(&X);
-   |             ^^ reference of mutable static
+   |             ^^ shared reference to mutable static
    |
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |         foo(addr_of!(X));
    |             ~~~~~~~~~~~
diff --git a/tests/ui/static/reference-of-mut-static.rs b/tests/ui/static/reference-of-mut-static.rs
index 166303f0257..af2cab7dd87 100644
--- a/tests/ui/static/reference-of-mut-static.rs
+++ b/tests/ui/static/reference-of-mut-static.rs
@@ -3,7 +3,7 @@
 //@ [e2021] edition:2021
 //@ [e2024] compile-flags: --edition 2024 -Z unstable-options
 
-#![deny(static_mut_ref)]
+#![deny(static_mut_refs)]
 
 use std::ptr::{addr_of, addr_of_mut};
 
@@ -14,30 +14,30 @@ fn main() {
 
     unsafe {
         let _y = &X;
-        //[e2024]~^ ERROR reference of mutable static is disallowed
-        //[e2021]~^^ ERROR shared reference of mutable static is discouraged [static_mut_ref]
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
 
         let _y = &mut X;
-        //[e2024]~^ ERROR reference of mutable static is disallowed
-        //[e2021]~^^ ERROR mutable reference of mutable static is discouraged [static_mut_ref]
+        //[e2024]~^ ERROR creating a mutable reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR mutable reference to mutable static is discouraged [static_mut_refs]
 
         let _z = addr_of_mut!(X);
 
         let _p = addr_of!(X);
 
         let ref _a = X;
-        //[e2024]~^ ERROR reference of mutable static is disallowed
-        //[e2021]~^^ ERROR shared reference of mutable static is discouraged [static_mut_ref]
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
 
         let (_b, _c) = (&X, &Y);
-        //[e2024]~^ ERROR reference of mutable static is disallowed
-        //[e2021]~^^ ERROR shared reference of mutable static is discouraged [static_mut_ref]
-        //[e2024]~^^^ ERROR reference of mutable static is disallowed
-        //[e2021]~^^^^ ERROR shared reference of mutable static is discouraged [static_mut_ref]
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2024]~^^^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
 
         foo(&X);
-        //[e2024]~^ ERROR reference of mutable static is disallowed
-        //[e2021]~^^ ERROR shared reference of mutable static is discouraged [static_mut_ref]
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
 
         static mut Z: &[i32; 3] = &[0, 1, 2];
 
diff --git a/tests/ui/static/reference-to-mut-static-safe.e2021.stderr b/tests/ui/static/reference-to-mut-static-safe.e2021.stderr
new file mode 100644
index 00000000000..9ea34290e36
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static-safe.e2021.stderr
@@ -0,0 +1,26 @@
+warning: creating a shared reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static-safe.rs:9:14
+   |
+LL |     let _x = &X;
+   |              ^^ shared reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     let _x = addr_of!(X);
+   |              ~~~~~~~~~~~
+
+error[E0133]: use of mutable static is unsafe and requires unsafe function or block
+  --> $DIR/reference-to-mut-static-safe.rs:9:15
+   |
+LL |     let _x = &X;
+   |               ^ use of mutable static
+   |
+   = note: mutable statics can be mutated by multiple threads: aliasing violations or data races will cause undefined behavior
+
+error: aborting due to 1 previous error; 1 warning emitted
+
+For more information about this error, try `rustc --explain E0133`.
diff --git a/tests/ui/static/reference-to-mut-static-safe.e2024.stderr b/tests/ui/static/reference-to-mut-static-safe.e2024.stderr
new file mode 100644
index 00000000000..607c1bba135
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static-safe.e2024.stderr
@@ -0,0 +1,15 @@
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static-safe.rs:9:14
+   |
+LL |     let _x = &X;
+   |              ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     let _x = addr_of!(X);
+   |              ~~~~~~~~~~~
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0796`.
diff --git a/tests/ui/static/reference-of-mut-static-safe.rs b/tests/ui/static/reference-to-mut-static-safe.rs
similarity index 63%
rename from tests/ui/static/reference-of-mut-static-safe.rs
rename to tests/ui/static/reference-to-mut-static-safe.rs
index d113d0ee48d..de4f4be8f76 100644
--- a/tests/ui/static/reference-of-mut-static-safe.rs
+++ b/tests/ui/static/reference-to-mut-static-safe.rs
@@ -7,7 +7,7 @@ fn main() {
     static mut X: i32 = 1;
 
     let _x = &X;
-    //[e2024]~^ reference of mutable static is disallowed [E0796]
+    //[e2024]~^ creating a shared reference to a mutable static [E0796]
     //[e2021]~^^ use of mutable static is unsafe and requires unsafe function or block [E0133]
-    //[e2021]~^^^ shared reference of mutable static is discouraged [static_mut_ref]
+    //[e2021]~^^^ shared reference to mutable static is discouraged [static_mut_refs]
 }
diff --git a/tests/ui/static/reference-to-mut-static-unsafe-fn.rs b/tests/ui/static/reference-to-mut-static-unsafe-fn.rs
new file mode 100644
index 00000000000..5652703a271
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static-unsafe-fn.rs
@@ -0,0 +1,26 @@
+//@ compile-flags: --edition 2024 -Z unstable-options
+
+fn main() {}
+
+unsafe fn _foo() {
+    static mut X: i32 = 1;
+    static mut Y: i32 = 1;
+
+    let _y = &X;
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
+
+    let ref _a = X;
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
+
+    let ref mut _a = X;
+    //~^ ERROR creating a mutable reference to a mutable static [E0796]
+
+    let (_b, _c) = (&X, &mut Y);
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
+    //~^^ ERROR creating a mutable reference to a mutable static [E0796]
+
+    foo(&X);
+    //~^ ERROR creating a shared reference to a mutable static [E0796]
+}
+
+fn foo<'a>(_x: &'a i32) {}
diff --git a/tests/ui/static/reference-to-mut-static-unsafe-fn.stderr b/tests/ui/static/reference-to-mut-static-unsafe-fn.stderr
new file mode 100644
index 00000000000..77d2aa5d1ae
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static-unsafe-fn.stderr
@@ -0,0 +1,75 @@
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static-unsafe-fn.rs:9:14
+   |
+LL |     let _y = &X;
+   |              ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     let _y = addr_of!(X);
+   |              ~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static-unsafe-fn.rs:12:18
+   |
+LL |     let ref _a = X;
+   |                  ^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     let ref _a = addr_of!(X);
+   |                  ~~~~~~~~~~~
+
+error[E0796]: creating a mutable reference to a mutable static
+  --> $DIR/reference-to-mut-static-unsafe-fn.rs:15:22
+   |
+LL |     let ref mut _a = X;
+   |                      ^ mutable reference to mutable static
+   |
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
+   |
+LL |     let ref mut _a = addr_of_mut!(X);
+   |                      ~~~~~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static-unsafe-fn.rs:18:21
+   |
+LL |     let (_b, _c) = (&X, &mut Y);
+   |                     ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     let (_b, _c) = (addr_of!(X), &mut Y);
+   |                     ~~~~~~~~~~~
+
+error[E0796]: creating a mutable reference to a mutable static
+  --> $DIR/reference-to-mut-static-unsafe-fn.rs:18:25
+   |
+LL |     let (_b, _c) = (&X, &mut Y);
+   |                         ^^^^^^ mutable reference to mutable static
+   |
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
+   |
+LL |     let (_b, _c) = (&X, addr_of_mut!(Y));
+   |                         ~~~~~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static-unsafe-fn.rs:22:9
+   |
+LL |     foo(&X);
+   |         ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |     foo(addr_of!(X));
+   |         ~~~~~~~~~~~
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0796`.
diff --git a/tests/ui/static/reference-to-mut-static.e2021.stderr b/tests/ui/static/reference-to-mut-static.e2021.stderr
new file mode 100644
index 00000000000..f477e5ac6c5
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static.e2021.stderr
@@ -0,0 +1,91 @@
+error: creating a shared reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static.rs:16:18
+   |
+LL |         let _y = &X;
+   |                  ^^ shared reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+note: the lint level is defined here
+  --> $DIR/reference-to-mut-static.rs:6:9
+   |
+LL | #![deny(static_mut_refs)]
+   |         ^^^^^^^^^^^^^^^
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let _y = addr_of!(X);
+   |                  ~~~~~~~~~~~
+
+error: creating a mutable reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static.rs:20:18
+   |
+LL |         let _y = &mut X;
+   |                  ^^^^^^ mutable reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
+   |
+LL |         let _y = addr_of_mut!(X);
+   |                  ~~~~~~~~~~~~~~~
+
+error: creating a shared reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static.rs:28:22
+   |
+LL |         let ref _a = X;
+   |                      ^ shared reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let ref _a = addr_of!(X);
+   |                      ~~~~~~~~~~~
+
+error: creating a shared reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static.rs:32:25
+   |
+LL |         let (_b, _c) = (&X, &Y);
+   |                         ^^ shared reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let (_b, _c) = (addr_of!(X), &Y);
+   |                         ~~~~~~~~~~~
+
+error: creating a shared reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static.rs:32:29
+   |
+LL |         let (_b, _c) = (&X, &Y);
+   |                             ^^ shared reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let (_b, _c) = (&X, addr_of!(Y));
+   |                             ~~~~~~~~~~~
+
+error: creating a shared reference to mutable static is discouraged
+  --> $DIR/reference-to-mut-static.rs:38:13
+   |
+LL |         foo(&X);
+   |             ^^ shared reference to mutable static
+   |
+   = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         foo(addr_of!(X));
+   |             ~~~~~~~~~~~
+
+error: aborting due to 6 previous errors
+
diff --git a/tests/ui/static/reference-to-mut-static.e2024.stderr b/tests/ui/static/reference-to-mut-static.e2024.stderr
new file mode 100644
index 00000000000..b18e214e84f
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static.e2024.stderr
@@ -0,0 +1,75 @@
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static.rs:16:18
+   |
+LL |         let _y = &X;
+   |                  ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let _y = addr_of!(X);
+   |                  ~~~~~~~~~~~
+
+error[E0796]: creating a mutable reference to a mutable static
+  --> $DIR/reference-to-mut-static.rs:20:18
+   |
+LL |         let _y = &mut X;
+   |                  ^^^^^^ mutable reference to mutable static
+   |
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
+   |
+LL |         let _y = addr_of_mut!(X);
+   |                  ~~~~~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static.rs:28:22
+   |
+LL |         let ref _a = X;
+   |                      ^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let ref _a = addr_of!(X);
+   |                      ~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static.rs:32:25
+   |
+LL |         let (_b, _c) = (&X, &Y);
+   |                         ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let (_b, _c) = (addr_of!(X), &Y);
+   |                         ~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static.rs:32:29
+   |
+LL |         let (_b, _c) = (&X, &Y);
+   |                             ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         let (_b, _c) = (&X, addr_of!(Y));
+   |                             ~~~~~~~~~~~
+
+error[E0796]: creating a shared reference to a mutable static
+  --> $DIR/reference-to-mut-static.rs:38:13
+   |
+LL |         foo(&X);
+   |             ^^ shared reference to mutable static
+   |
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
+   |
+LL |         foo(addr_of!(X));
+   |             ~~~~~~~~~~~
+
+error: aborting due to 6 previous errors
+
+For more information about this error, try `rustc --explain E0796`.
diff --git a/tests/ui/static/reference-to-mut-static.rs b/tests/ui/static/reference-to-mut-static.rs
new file mode 100644
index 00000000000..af2cab7dd87
--- /dev/null
+++ b/tests/ui/static/reference-to-mut-static.rs
@@ -0,0 +1,50 @@
+//@ revisions: e2021 e2024
+
+//@ [e2021] edition:2021
+//@ [e2024] compile-flags: --edition 2024 -Z unstable-options
+
+#![deny(static_mut_refs)]
+
+use std::ptr::{addr_of, addr_of_mut};
+
+fn main() {
+    static mut X: i32 = 1;
+
+    static mut Y: i32 = 1;
+
+    unsafe {
+        let _y = &X;
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+
+        let _y = &mut X;
+        //[e2024]~^ ERROR creating a mutable reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR mutable reference to mutable static is discouraged [static_mut_refs]
+
+        let _z = addr_of_mut!(X);
+
+        let _p = addr_of!(X);
+
+        let ref _a = X;
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+
+        let (_b, _c) = (&X, &Y);
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2024]~^^^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+
+        foo(&X);
+        //[e2024]~^ ERROR creating a shared reference to a mutable static [E0796]
+        //[e2021]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+
+        static mut Z: &[i32; 3] = &[0, 1, 2];
+
+        let _ = Z.len();
+        let _ = Z[0];
+        let _ = format!("{:?}", Z);
+    }
+}
+
+fn foo<'a>(_x: &'a i32) {}
diff --git a/tests/ui/static/safe-extern-statics-mut.rs b/tests/ui/static/safe-extern-statics-mut.rs
index 8aa0b47a311..05a1bee8891 100644
--- a/tests/ui/static/safe-extern-statics-mut.rs
+++ b/tests/ui/static/safe-extern-statics-mut.rs
@@ -10,8 +10,8 @@ extern "C" {
 fn main() {
     let b = B; //~ ERROR use of mutable static is unsafe
     let rb = &B; //~ ERROR use of mutable static is unsafe
-    //~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
     let xb = XB; //~ ERROR use of mutable static is unsafe
     let xrb = &XB; //~ ERROR use of mutable static is unsafe
-    //~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
 }
diff --git a/tests/ui/static/safe-extern-statics-mut.stderr b/tests/ui/static/safe-extern-statics-mut.stderr
index eda353ce673..9a4b651405f 100644
--- a/tests/ui/static/safe-extern-statics-mut.stderr
+++ b/tests/ui/static/safe-extern-statics-mut.stderr
@@ -1,28 +1,28 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/safe-extern-statics-mut.rs:12:14
    |
 LL |     let rb = &B;
-   |              ^^ shared reference of mutable static
+   |              ^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     let rb = addr_of!(B);
    |              ~~~~~~~~~~~
 
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/safe-extern-statics-mut.rs:15:15
    |
 LL |     let xrb = &XB;
-   |               ^^^ shared reference of mutable static
+   |               ^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     let xrb = addr_of!(XB);
    |               ~~~~~~~~~~~~
diff --git a/tests/ui/statics/issue-15261.rs b/tests/ui/statics/issue-15261.rs
index 71eeb2a6d26..e168abce078 100644
--- a/tests/ui/statics/issue-15261.rs
+++ b/tests/ui/statics/issue-15261.rs
@@ -7,6 +7,6 @@
 static mut n_mut: usize = 0;
 
 static n: &'static usize = unsafe { &n_mut };
-//~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+//~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
 
 fn main() {}
diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr
index 72d88ce1b38..c31793f3d8f 100644
--- a/tests/ui/statics/issue-15261.stderr
+++ b/tests/ui/statics/issue-15261.stderr
@@ -1,14 +1,14 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/issue-15261.rs:9:37
    |
 LL | static n: &'static usize = unsafe { &n_mut };
-   |                                     ^^^^^^ shared reference of mutable static
+   |                                     ^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL | static n: &'static usize = unsafe { addr_of!(n_mut) };
    |                                     ~~~~~~~~~~~~~~~
diff --git a/tests/ui/statics/static-mut-xc.rs b/tests/ui/statics/static-mut-xc.rs
index 75a4faed83d..a772d4151f7 100644
--- a/tests/ui/statics/static-mut-xc.rs
+++ b/tests/ui/statics/static-mut-xc.rs
@@ -26,9 +26,9 @@ unsafe fn run() {
     static_mut_xc::a = -3;
     assert_eq!(static_mut_xc::a, -3);
     static_bound(&static_mut_xc::a);
-    //~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
     static_bound_set(&mut static_mut_xc::a);
-    //~^ WARN mutable reference of mutable static is discouraged [static_mut_ref]
+    //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
 }
 
 pub fn main() {
diff --git a/tests/ui/statics/static-mut-xc.stderr b/tests/ui/statics/static-mut-xc.stderr
index 37aa336bc50..d381328c071 100644
--- a/tests/ui/statics/static-mut-xc.stderr
+++ b/tests/ui/statics/static-mut-xc.stderr
@@ -1,28 +1,28 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/static-mut-xc.rs:28:18
    |
 LL |     static_bound(&static_mut_xc::a);
-   |                  ^^^^^^^^^^^^^^^^^ shared reference of mutable static
+   |                  ^^^^^^^^^^^^^^^^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL |     static_bound(addr_of!(static_mut_xc::a));
    |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-warning: mutable reference of mutable static is discouraged
+warning: creating a mutable reference to mutable static is discouraged
   --> $DIR/static-mut-xc.rs:30:22
    |
 LL |     static_bound_set(&mut static_mut_xc::a);
-   |                      ^^^^^^^^^^^^^^^^^^^^^ mutable reference of mutable static
+   |                      ^^^^^^^^^^^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-help: mutable references are dangerous since if there's any other pointer or reference used for that static while the reference lives, that's UB; use `addr_of_mut!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this mutable reference has lifetime `'static`, but if the static gets accessed (read or written) by any other means, or any other reference is created, then any further use of this mutable reference is Undefined Behavior
+help: use `addr_of_mut!` instead to create a raw pointer
    |
 LL |     static_bound_set(addr_of_mut!(static_mut_xc::a));
    |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/tests/ui/statics/static-recursive.rs b/tests/ui/statics/static-recursive.rs
index f504e2a79f0..29b80818b7d 100644
--- a/tests/ui/statics/static-recursive.rs
+++ b/tests/ui/statics/static-recursive.rs
@@ -1,7 +1,7 @@
 //@ run-pass
 
 static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 };
-//~^ WARN shared reference of mutable static is discouraged [static_mut_ref]
+//~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
 
 struct StaticDoubleLinked {
     prev: &'static StaticDoubleLinked,
diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr
index 15888e5c68d..cd285c6c2a4 100644
--- a/tests/ui/statics/static-recursive.stderr
+++ b/tests/ui/statics/static-recursive.stderr
@@ -1,14 +1,14 @@
-warning: shared reference of mutable static is discouraged
+warning: creating a shared reference to mutable static is discouraged
   --> $DIR/static-recursive.rs:3:36
    |
 LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 };
-   |                                    ^^ shared reference of mutable static
+   |                                    ^^ shared reference to mutable static
    |
    = note: for more information, see issue #114447 <https://github.com/rust-lang/rust/issues/114447>
-   = note: reference of mutable static is a hard error from 2024 edition
-   = note: mutable statics can be written to by multiple threads: aliasing violations or data races will cause undefined behavior
-   = note: `#[warn(static_mut_ref)]` on by default
-help: shared references are dangerous since if there's any kind of mutation of that static while the reference lives, that's UB; use `addr_of!` instead to create a raw pointer
+   = note: this will be a hard error in the 2024 edition
+   = note: this shared reference has lifetime `'static`, but if the static ever gets mutated, or a mutable reference is created, then any further use of this shared reference is Undefined Behavior
+   = note: `#[warn(static_mut_refs)]` on by default
+help: use `addr_of!` instead to create a raw pointer
    |
 LL | static mut S: *const u8 = unsafe { addr_of!(S) as *const *const u8 as *const u8 };
    |                                    ~~~~~~~~~~~
diff --git a/tests/ui/thread-local/thread-local-static.rs b/tests/ui/thread-local/thread-local-static.rs
index a1b72323f71..05df0471b14 100644
--- a/tests/ui/thread-local/thread-local-static.rs
+++ b/tests/ui/thread-local/thread-local-static.rs
@@ -2,7 +2,7 @@
 
 #![feature(thread_local)]
 #![feature(const_swap)]
-#![allow(static_mut_ref)]
+#![allow(static_mut_refs)]
 
 #[thread_local]
 static mut STATIC_VAR_2: [u32; 8] = [4; 8];