summary refs log tree commit diff
path: root/tests/ui/error-codes
diff options
context:
space:
mode:
authorObei Sideg <obei.sideg@gmail.com>2024-02-17 22:01:56 +0300
committerObei Sideg <obei.sideg@gmail.com>2024-02-18 06:01:40 +0300
commit408eeae59d35cbcaab2cfb345d24373954e74fc5 (patch)
tree96f35aa95f6fba769db2c292965e8a7ec9c09498 /tests/ui/error-codes
parenteeeb021954e30a6b16fc12cc4b8a1bcf7910a40e (diff)
downloadrust-408eeae59d35cbcaab2cfb345d24373954e74fc5.tar.gz
rust-408eeae59d35cbcaab2cfb345d24373954e74fc5.zip
Improve wording of static_mut_ref
Rename `static_mut_ref` lint to `static_mut_refs`.
Diffstat (limited to 'tests/ui/error-codes')
-rw-r--r--tests/ui/error-codes/E0017.rs2
-rw-r--r--tests/ui/error-codes/E0017.stderr12
2 files changed, 7 insertions, 7 deletions
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) };
    |                                                    ~~~~~~~~~~~~~~~