about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-ui/doctest/auxiliary/macro-after-main.rs1
-rw-r--r--tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs4
-rw-r--r--tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout27
-rw-r--r--tests/rustdoc-ui/doctest/macro-after-main.rs16
-rw-r--r--tests/rustdoc-ui/doctest/macro-after-main.stdout6
-rw-r--r--tests/rustdoc-ui/doctest/test-main-alongside-exprs.rs22
-rw-r--r--tests/rustdoc-ui/doctest/test-main-alongside-exprs.stdout6
-rw-r--r--tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs2
-rw-r--r--tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr2
-rw-r--r--tests/ui/consts/const_let_assign2.rs2
-rw-r--r--tests/ui/consts/const_let_assign2.stderr2
-rw-r--r--tests/ui/issues/issue-39367.rs2
-rw-r--r--tests/ui/issues/issue-39367.stderr2
-rw-r--r--tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs4
-rw-r--r--tests/ui/lint/static-mut-refs.e2021.stderr24
-rw-r--r--tests/ui/lint/static-mut-refs.e2024.stderr24
-rw-r--r--tests/ui/lint/static-mut-refs.rs48
-rw-r--r--tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.rs2
-rw-r--r--tests/ui/nll/borrowck-thread-local-static-mut-borrow-outlives-fn.stderr2
-rw-r--r--tests/ui/statics/issue-15261.rs3
-rw-r--r--tests/ui/statics/issue-15261.stderr4
-rw-r--r--tests/ui/statics/static-mut-shared-parens.rs7
-rw-r--r--tests/ui/statics/static-mut-shared-parens.stderr16
-rw-r--r--tests/ui/statics/static-mut-xc.rs14
-rw-r--r--tests/ui/statics/static-mut-xc.stderr14
-rw-r--r--tests/ui/statics/static-recursive.rs4
-rw-r--r--tests/ui/statics/static-recursive.stderr4
27 files changed, 145 insertions, 119 deletions
diff --git a/tests/rustdoc-ui/doctest/auxiliary/macro-after-main.rs b/tests/rustdoc-ui/doctest/auxiliary/macro-after-main.rs
new file mode 100644
index 00000000000..ed7584b7425
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/auxiliary/macro-after-main.rs
@@ -0,0 +1 @@
+use std::string::String;
diff --git a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs
index 508faadcf67..ca5dd787467 100644
--- a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs
+++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.rs
@@ -4,12 +4,12 @@
 //@ compile-flags:--test
 //@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
 //@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
-//@ failure-status: 101
+//@ check-pass
 
 /// <https://github.com/rust-lang/rust/issues/91014>
 ///
 /// ```rust
-/// struct S {}; // unexpected semicolon after struct def
+/// struct S {};
 ///
 /// fn main() {
 ///    assert_eq!(0, 1);
diff --git a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout
index 9eb8b391e78..1068b98cb0f 100644
--- a/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout
+++ b/tests/rustdoc-ui/doctest/failed-doctest-extra-semicolon-on-item.stdout
@@ -1,29 +1,6 @@
 
 running 1 test
-test $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) ... FAILED
+test $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) ... ok
 
-failures:
-
----- $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11) stdout ----
-error: expected item, found `;`
-  --> $DIR/failed-doctest-extra-semicolon-on-item.rs:12:12
-   |
-LL | struct S {}; // unexpected semicolon after struct def
-   |            ^
-   |
-   = help: braced struct declarations are not followed by a semicolon
-help: remove this semicolon
-   |
-LL - struct S {}; // unexpected semicolon after struct def
-LL + struct S {} // unexpected semicolon after struct def
-   |
-
-error: aborting due to 1 previous error
-
-Couldn't compile the test.
-
-failures:
-    $DIR/failed-doctest-extra-semicolon-on-item.rs - m (line 11)
-
-test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
 
diff --git a/tests/rustdoc-ui/doctest/macro-after-main.rs b/tests/rustdoc-ui/doctest/macro-after-main.rs
new file mode 100644
index 00000000000..0a42343f1c2
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/macro-after-main.rs
@@ -0,0 +1,16 @@
+// This test checks a corner case where the macro calls used to be skipped,
+// making them considered as statement, and therefore some cases where
+// `include!` macro was then put into a function body, making the doctest
+// compilation fail.
+
+//@ compile-flags:--test
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ check-pass
+
+//! ```
+//! include!("./auxiliary/macro-after-main.rs");
+//!
+//! fn main() {}
+//! eprintln!();
+//! ```
diff --git a/tests/rustdoc-ui/doctest/macro-after-main.stdout b/tests/rustdoc-ui/doctest/macro-after-main.stdout
new file mode 100644
index 00000000000..72ffe2b5a27
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/macro-after-main.stdout
@@ -0,0 +1,6 @@
+
+running 1 test
+test $DIR/macro-after-main.rs - (line 11) ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/rustdoc-ui/doctest/test-main-alongside-exprs.rs b/tests/rustdoc-ui/doctest/test-main-alongside-exprs.rs
new file mode 100644
index 00000000000..ee2299c0fd8
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/test-main-alongside-exprs.rs
@@ -0,0 +1,22 @@
+// This test ensures that if there is an expression alongside a `main`
+// function, it will not consider the entire code to be part of the `main`
+// function and will generate its own function to wrap everything.
+//
+// This is a regression test for:
+// * <https://github.com/rust-lang/rust/issues/140162>
+// * <https://github.com/rust-lang/rust/issues/139651>
+//@ compile-flags:--test
+//@ normalize-stdout: "tests/rustdoc-ui/doctest" -> "$$DIR"
+//@ normalize-stdout: "finished in \d+\.\d+s" -> "finished in $$TIME"
+//@ check-pass
+
+#![crate_name = "foo"]
+
+//! ```
+//! # if cfg!(miri) { return; }
+//! use std::ops::Deref;
+//!
+//! fn main() {
+//!     println!("Hi!");
+//! }
+//! ```
diff --git a/tests/rustdoc-ui/doctest/test-main-alongside-exprs.stdout b/tests/rustdoc-ui/doctest/test-main-alongside-exprs.stdout
new file mode 100644
index 00000000000..90d7c3546bf
--- /dev/null
+++ b/tests/rustdoc-ui/doctest/test-main-alongside-exprs.stdout
@@ -0,0 +1,6 @@
+
+running 1 test
+test $DIR/test-main-alongside-exprs.rs - (line 15) ... ok
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in $TIME
+
diff --git a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.rs
index b09c96ada8a..5106ba6c86c 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 to mutable static is discouraged [static_mut_refs]
+        //~^ WARN mutable reference to mutable static [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 a392177ffe2..4e19fd81735 100644
--- a/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
+++ b/tests/ui/borrowck/borrowck-unsafe-static-mutable-borrows.stderr
@@ -1,4 +1,4 @@
-warning: creating a mutable reference to mutable static is discouraged
+warning: creating a mutable reference to mutable static
   --> $DIR/borrowck-unsafe-static-mutable-borrows.rs:19:30
    |
 LL |         let sfoo: *mut Foo = &mut SFOO;
diff --git a/tests/ui/consts/const_let_assign2.rs b/tests/ui/consts/const_let_assign2.rs
index e8ebba7b208..5349ae31bb4 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 to mutable static is discouraged [static_mut_refs]
+    //~^ WARN mutable reference to mutable static [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 0d76f142d17..1bb560437b6 100644
--- a/tests/ui/consts/const_let_assign2.stderr
+++ b/tests/ui/consts/const_let_assign2.stderr
@@ -1,4 +1,4 @@
-warning: creating a mutable reference to mutable static is discouraged
+warning: creating a mutable reference to mutable static
   --> $DIR/const_let_assign2.rs:18:24
    |
 LL |     let ptr = unsafe { &mut BB };
diff --git a/tests/ui/issues/issue-39367.rs b/tests/ui/issues/issue-39367.rs
index 937d6c4b9e0..68b4d28aae3 100644
--- a/tests/ui/issues/issue-39367.rs
+++ b/tests/ui/issues/issue-39367.rs
@@ -20,7 +20,7 @@ fn arena() -> &'static ArenaSet<Vec<u8>> {
 
             static mut ONCE: Once = Once::new();
             ONCE.call_once(|| {
-            //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+            //~^ WARN creating a shared reference to mutable static [static_mut_refs]
                 DATA = transmute
                     ::<Box<ArenaSet<Vec<u8>>>, *const ArenaSet<Vec<u8>>>
                     (Box::new(__static_ref_initialize()));
diff --git a/tests/ui/issues/issue-39367.stderr b/tests/ui/issues/issue-39367.stderr
index 333c9f9634a..df21c09983e 100644
--- a/tests/ui/issues/issue-39367.stderr
+++ b/tests/ui/issues/issue-39367.stderr
@@ -1,4 +1,4 @@
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/issue-39367.rs:22:13
    |
 LL | /             ONCE.call_once(|| {
diff --git a/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs b/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs
index efd77639198..33846987760 100644
--- a/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs
+++ b/tests/ui/lazy-type-alias/extern-crate-has-eager-type-aliases.rs
@@ -9,9 +9,9 @@
 #![allow(incomplete_features)]
 
 // This used to crash when we were computing the variances of `Struct` since we would convert
-// `eager::Alias<T>` to a weak projection due to the presence of `#![feature(lazy_type_alias)]` in
+// `eager::Alias<T>` to a weak alias due to the presence of `#![feature(lazy_type_alias)]` in
 // this (!) crate and subsequently attempt to obtain the variances of the type alias associated with
-// the weak projection which would panic because we don't compute this information for eager type
+// the weak alias which would panic because we don't compute this information for eager type
 // aliases at all.
 struct Struct<T>(eager::Alias<T>);
 
diff --git a/tests/ui/lint/static-mut-refs.e2021.stderr b/tests/ui/lint/static-mut-refs.e2021.stderr
index 00a2ca99f24..320e0cee8e8 100644
--- a/tests/ui/lint/static-mut-refs.e2021.stderr
+++ b/tests/ui/lint/static-mut-refs.e2021.stderr
@@ -1,4 +1,4 @@
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:38:18
    |
 LL |         let _y = &X;
@@ -12,7 +12,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let _y = &raw const X;
    |                   +++++++++
 
-warning: creating a mutable reference to mutable static is discouraged
+warning: creating a mutable reference to mutable static
   --> $DIR/static-mut-refs.rs:42:18
    |
 LL |         let _y = &mut X;
@@ -25,7 +25,7 @@ help: use `&raw mut` instead to create a raw pointer
 LL |         let _y = &raw mut X;
    |                   +++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:50:22
    |
 LL |         let ref _a = X;
@@ -34,7 +34,7 @@ LL |         let ref _a = X;
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:54:25
    |
 LL |         let (_b, _c) = (&X, &Y);
@@ -47,7 +47,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let (_b, _c) = (&raw const X, &Y);
    |                          +++++++++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:54:29
    |
 LL |         let (_b, _c) = (&X, &Y);
@@ -60,7 +60,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let (_b, _c) = (&X, &raw const Y);
    |                              +++++++++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:60:13
    |
 LL |         foo(&X);
@@ -73,7 +73,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         foo(&raw const X);
    |              +++++++++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:66:17
    |
 LL |         let _ = Z.len();
@@ -82,7 +82,7 @@ LL |         let _ = Z.len();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:72:33
    |
 LL |         let _ = format!("{:?}", Z);
@@ -91,7 +91,7 @@ LL |         let _ = format!("{:?}", Z);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:76:18
    |
 LL |         let _v = &A.value;
@@ -104,7 +104,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let _v = &raw const A.value;
    |                   +++++++++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:80:18
    |
 LL |         let _s = &A.s.value;
@@ -117,7 +117,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let _s = &raw const A.s.value;
    |                   +++++++++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:84:22
    |
 LL |         let ref _v = A.value;
@@ -126,7 +126,7 @@ LL |         let ref _v = A.value;
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a mutable reference to mutable static is discouraged
+warning: creating a mutable reference to mutable static
   --> $DIR/static-mut-refs.rs:14:14
    |
 LL |         &mut ($x.0)
diff --git a/tests/ui/lint/static-mut-refs.e2024.stderr b/tests/ui/lint/static-mut-refs.e2024.stderr
index ff41f316250..bf7ffc62ce1 100644
--- a/tests/ui/lint/static-mut-refs.e2024.stderr
+++ b/tests/ui/lint/static-mut-refs.e2024.stderr
@@ -1,4 +1,4 @@
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:38:18
    |
 LL |         let _y = &X;
@@ -12,7 +12,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let _y = &raw const X;
    |                   +++++++++
 
-error: creating a mutable reference to mutable static is discouraged
+error: creating a mutable reference to mutable static
   --> $DIR/static-mut-refs.rs:42:18
    |
 LL |         let _y = &mut X;
@@ -25,7 +25,7 @@ help: use `&raw mut` instead to create a raw pointer
 LL |         let _y = &raw mut X;
    |                   +++
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:50:22
    |
 LL |         let ref _a = X;
@@ -34,7 +34,7 @@ LL |         let ref _a = X;
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:54:25
    |
 LL |         let (_b, _c) = (&X, &Y);
@@ -47,7 +47,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let (_b, _c) = (&raw const X, &Y);
    |                          +++++++++
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:54:29
    |
 LL |         let (_b, _c) = (&X, &Y);
@@ -60,7 +60,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let (_b, _c) = (&X, &raw const Y);
    |                              +++++++++
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:60:13
    |
 LL |         foo(&X);
@@ -73,7 +73,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         foo(&raw const X);
    |              +++++++++
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:66:17
    |
 LL |         let _ = Z.len();
@@ -82,7 +82,7 @@ LL |         let _ = Z.len();
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:72:33
    |
 LL |         let _ = format!("{:?}", Z);
@@ -91,7 +91,7 @@ LL |         let _ = format!("{:?}", Z);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:76:18
    |
 LL |         let _v = &A.value;
@@ -104,7 +104,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let _v = &raw const A.value;
    |                   +++++++++
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:80:18
    |
 LL |         let _s = &A.s.value;
@@ -117,7 +117,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |         let _s = &raw const A.s.value;
    |                   +++++++++
 
-error: creating a shared reference to mutable static is discouraged
+error: creating a shared reference to mutable static
   --> $DIR/static-mut-refs.rs:84:22
    |
 LL |         let ref _v = A.value;
@@ -126,7 +126,7 @@ LL |         let ref _v = A.value;
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-error: creating a mutable reference to mutable static is discouraged
+error: creating a mutable reference to mutable static
   --> $DIR/static-mut-refs.rs:14:14
    |
 LL |         &mut ($x.0)
diff --git a/tests/ui/lint/static-mut-refs.rs b/tests/ui/lint/static-mut-refs.rs
index 1040dfcae7a..d2511fb5b12 100644
--- a/tests/ui/lint/static-mut-refs.rs
+++ b/tests/ui/lint/static-mut-refs.rs
@@ -12,8 +12,8 @@ static mut FOO: (u32, u32) = (1, 2);
 macro_rules! bar {
     ($x:expr) => {
         &mut ($x.0)
-        //[e2021]~^ WARN creating a mutable reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR creating a mutable reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN creating a mutable reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR creating a mutable reference to mutable static [static_mut_refs]
     };
 }
 
@@ -36,54 +36,54 @@ fn main() {
 
     unsafe {
         let _y = &X;
-        //[e2021]~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR shared reference to mutable static [static_mut_refs]
 
         let _y = &mut X;
-        //[e2021]~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR mutable reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN mutable reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR mutable reference to mutable static [static_mut_refs]
 
         let _z = &raw mut X;
 
         let _p = &raw const X;
 
         let ref _a = X;
-        //[e2021]~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR shared reference to mutable static [static_mut_refs]
 
         let (_b, _c) = (&X, &Y);
-        //[e2021]~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2021]~^^^ WARN shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR shared reference to mutable static [static_mut_refs]
+        //[e2021]~^^^ WARN shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^^^ ERROR shared reference to mutable static [static_mut_refs]
 
         foo(&X);
-        //[e2021]~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR shared reference to mutable static [static_mut_refs]
 
         static mut Z: &[i32; 3] = &[0, 1, 2];
 
         let _ = Z.len();
-        //[e2021]~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR creating a shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN creating a shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR creating a shared reference to mutable static [static_mut_refs]
 
         let _ = Z[0];
 
         let _ = format!("{:?}", Z);
-        //[e2021]~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR creating a shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN creating a shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR creating a shared reference to mutable static [static_mut_refs]
 
         let _v = &A.value;
-        //[e2021]~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR creating a shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN creating a shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR creating a shared reference to mutable static [static_mut_refs]
 
         let _s = &A.s.value;
-        //[e2021]~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR creating a shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN creating a shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR creating a shared reference to mutable static [static_mut_refs]
 
         let ref _v = A.value;
-        //[e2021]~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
-        //[e2024]~^^ ERROR creating a shared reference to mutable static is discouraged [static_mut_refs]
+        //[e2021]~^ WARN creating a shared reference to mutable static [static_mut_refs]
+        //[e2024]~^^ ERROR creating a shared reference to mutable static [static_mut_refs]
 
         let _x = bar!(FOO);
 
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 be882085c5c..73597408d10 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 to mutable static is discouraged [static_mut_refs]
+        //~^ WARN mutable reference to mutable static [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 9dbd6769693..8268f5df236 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,4 +1,4 @@
-warning: creating a mutable reference to mutable static is discouraged
+warning: creating a mutable reference to mutable static
   --> $DIR/borrowck-thread-local-static-mut-borrow-outlives-fn.rs:17:26
    |
 LL |         S1 { a: unsafe { &mut X1 } }
diff --git a/tests/ui/statics/issue-15261.rs b/tests/ui/statics/issue-15261.rs
index ed79a201488..f8c5ebaa548 100644
--- a/tests/ui/statics/issue-15261.rs
+++ b/tests/ui/statics/issue-15261.rs
@@ -2,10 +2,9 @@
 #![allow(dead_code)]
 #![allow(non_upper_case_globals)]
 
-
 static mut n_mut: usize = 0;
 
 static n: &'static usize = unsafe { &n_mut };
-//~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
+//~^ WARN shared reference to mutable static [static_mut_refs]
 
 fn main() {}
diff --git a/tests/ui/statics/issue-15261.stderr b/tests/ui/statics/issue-15261.stderr
index 7e6aebcbb1f..d2dd762aa66 100644
--- a/tests/ui/statics/issue-15261.stderr
+++ b/tests/ui/statics/issue-15261.stderr
@@ -1,5 +1,5 @@
-warning: creating a shared reference to mutable static is discouraged
-  --> $DIR/issue-15261.rs:8:37
+warning: creating a shared reference to mutable static
+  --> $DIR/issue-15261.rs:7:37
    |
 LL | static n: &'static usize = unsafe { &n_mut };
    |                                     ^^^^^^ shared reference to mutable static
diff --git a/tests/ui/statics/static-mut-shared-parens.rs b/tests/ui/statics/static-mut-shared-parens.rs
index 8e58152e27a..7eda7d67d92 100644
--- a/tests/ui/statics/static-mut-shared-parens.rs
+++ b/tests/ui/statics/static-mut-shared-parens.rs
@@ -1,13 +1,12 @@
 //Missing paren in diagnostic msg: https://github.com/rust-lang/rust/issues/131977
 //@check-pass
 
-
 static mut TEST: usize = 0;
 
 fn main() {
     let _ = unsafe { (&TEST) as *const usize };
-    //~^WARN creating a shared reference to mutable static is discouraged
+    //~^WARN creating a shared reference to mutable static
 
-    let _ = unsafe { ((&mut TEST)) as *const usize };
-    //~^WARN creating a mutable reference to mutable static is discouraged
+    let _ = unsafe { (&mut TEST) as *const usize };
+    //~^WARN creating a mutable reference to mutable static
 }
diff --git a/tests/ui/statics/static-mut-shared-parens.stderr b/tests/ui/statics/static-mut-shared-parens.stderr
index 30a586c286a..3825e8efc42 100644
--- a/tests/ui/statics/static-mut-shared-parens.stderr
+++ b/tests/ui/statics/static-mut-shared-parens.stderr
@@ -1,5 +1,5 @@
-warning: creating a shared reference to mutable static is discouraged
-  --> $DIR/static-mut-shared-parens.rs:8:22
+warning: creating a shared reference to mutable static
+  --> $DIR/static-mut-shared-parens.rs:7:22
    |
 LL |     let _ = unsafe { (&TEST) as *const usize };
    |                      ^^^^^^^ shared reference to mutable static
@@ -12,18 +12,18 @@ help: use `&raw const` instead to create a raw pointer
 LL |     let _ = unsafe { (&raw const TEST) as *const usize };
    |                        +++++++++
 
-warning: creating a mutable reference to mutable static is discouraged
-  --> $DIR/static-mut-shared-parens.rs:11:22
+warning: creating a mutable reference to mutable static
+  --> $DIR/static-mut-shared-parens.rs:10:22
    |
-LL |     let _ = unsafe { ((&mut TEST)) as *const usize };
-   |                      ^^^^^^^^^^^^^ mutable reference to mutable static
+LL |     let _ = unsafe { (&mut TEST) as *const usize };
+   |                      ^^^^^^^^^^^ mutable reference to mutable static
    |
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: mutable references to mutable statics are dangerous; it's undefined behavior if any other pointer to the static is used or if any other reference is created for the static while the mutable reference lives
 help: use `&raw mut` instead to create a raw pointer
    |
-LL |     let _ = unsafe { ((&raw mut TEST)) as *const usize };
-   |                         +++
+LL |     let _ = unsafe { (&raw mut TEST) as *const usize };
+   |                        +++
 
 warning: 2 warnings emitted
 
diff --git a/tests/ui/statics/static-mut-xc.rs b/tests/ui/statics/static-mut-xc.rs
index c23cc822ce7..878f5a8e0f7 100644
--- a/tests/ui/statics/static-mut-xc.rs
+++ b/tests/ui/statics/static-mut-xc.rs
@@ -17,23 +17,23 @@ fn static_bound_set(a: &'static mut isize) {
 
 unsafe fn run() {
     assert_eq!(static_mut_xc::a, 3);
-    //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN creating a shared reference to mutable static [static_mut_refs]
     static_mut_xc::a = 4;
     assert_eq!(static_mut_xc::a, 4);
-    //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN creating a shared reference to mutable static [static_mut_refs]
     static_mut_xc::a += 1;
     assert_eq!(static_mut_xc::a, 5);
-    //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN creating a shared reference to mutable static [static_mut_refs]
     static_mut_xc::a *= 3;
     assert_eq!(static_mut_xc::a, 15);
-    //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN creating a shared reference to mutable static [static_mut_refs]
     static_mut_xc::a = -3;
     assert_eq!(static_mut_xc::a, -3);
-    //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN creating a shared reference to mutable static [static_mut_refs]
     static_bound(&static_mut_xc::a);
-    //~^ WARN shared reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN shared reference to mutable static [static_mut_refs]
     static_bound_set(&mut static_mut_xc::a);
-    //~^ WARN mutable reference to mutable static is discouraged [static_mut_refs]
+    //~^ WARN mutable reference to mutable static [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 69f334a5636..2d7a0553e92 100644
--- a/tests/ui/statics/static-mut-xc.stderr
+++ b/tests/ui/statics/static-mut-xc.stderr
@@ -1,4 +1,4 @@
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-xc.rs:19:16
    |
 LL |     assert_eq!(static_mut_xc::a, 3);
@@ -8,7 +8,7 @@ LL |     assert_eq!(static_mut_xc::a, 3);
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
    = note: `#[warn(static_mut_refs)]` on by default
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-xc.rs:22:16
    |
 LL |     assert_eq!(static_mut_xc::a, 4);
@@ -17,7 +17,7 @@ LL |     assert_eq!(static_mut_xc::a, 4);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-xc.rs:25:16
    |
 LL |     assert_eq!(static_mut_xc::a, 5);
@@ -26,7 +26,7 @@ LL |     assert_eq!(static_mut_xc::a, 5);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-xc.rs:28:16
    |
 LL |     assert_eq!(static_mut_xc::a, 15);
@@ -35,7 +35,7 @@ LL |     assert_eq!(static_mut_xc::a, 15);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-xc.rs:31:16
    |
 LL |     assert_eq!(static_mut_xc::a, -3);
@@ -44,7 +44,7 @@ LL |     assert_eq!(static_mut_xc::a, -3);
    = note: for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html>
    = note: shared references to mutable statics are dangerous; it's undefined behavior if the static is mutated or if a mutable reference is created for it while the shared reference lives
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-mut-xc.rs:33:18
    |
 LL |     static_bound(&static_mut_xc::a);
@@ -57,7 +57,7 @@ help: use `&raw const` instead to create a raw pointer
 LL |     static_bound(&raw const static_mut_xc::a);
    |                   +++++++++
 
-warning: creating a mutable reference to mutable static is discouraged
+warning: creating a mutable reference to mutable static
   --> $DIR/static-mut-xc.rs:35:22
    |
 LL |     static_bound_set(&mut static_mut_xc::a);
diff --git a/tests/ui/statics/static-recursive.rs b/tests/ui/statics/static-recursive.rs
index da23b54d1fc..dab60dd8641 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 to mutable static is discouraged [static_mut_refs]
+//~^ WARN shared reference to mutable static [static_mut_refs]
 
 struct StaticDoubleLinked {
     prev: &'static StaticDoubleLinked,
@@ -17,7 +17,7 @@ static L3: StaticDoubleLinked = StaticDoubleLinked { prev: &L2, next: &L1, data:
 pub fn main() {
     unsafe {
         assert_eq!(S, *(S as *const *const u8));
-        //~^ WARN creating a shared reference to mutable static is discouraged [static_mut_refs]
+        //~^ WARN creating a shared reference to mutable static [static_mut_refs]
     }
 
     let mut test_vec = Vec::new();
diff --git a/tests/ui/statics/static-recursive.stderr b/tests/ui/statics/static-recursive.stderr
index 039934dfc69..252807e2e5d 100644
--- a/tests/ui/statics/static-recursive.stderr
+++ b/tests/ui/statics/static-recursive.stderr
@@ -1,4 +1,4 @@
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-recursive.rs:3:36
    |
 LL | static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 };
@@ -12,7 +12,7 @@ help: use `&raw const` instead to create a raw pointer
 LL | static mut S: *const u8 = unsafe { &raw const S as *const *const u8 as *const u8 };
    |                                     +++++++++
 
-warning: creating a shared reference to mutable static is discouraged
+warning: creating a shared reference to mutable static
   --> $DIR/static-recursive.rs:19:20
    |
 LL |         assert_eq!(S, *(S as *const *const u8));