about summary refs log tree commit diff
path: root/tests/ui/lint/reference_casting.stderr
diff options
context:
space:
mode:
authorUrgau <urgau@numericable.fr>2023-07-14 22:10:14 +0200
committerUrgau <urgau@numericable.fr>2023-07-29 12:20:59 +0200
commitf3dafe91ff753e3a801aa336d41be9eca75925bc (patch)
tree444329e39fb2eb6e114c43593d2d6815acb0841e /tests/ui/lint/reference_casting.stderr
parent345d6b816b8b131bc592f2aa532e1b3aeef23d0b (diff)
downloadrust-f3dafe91ff753e3a801aa336d41be9eca75925bc.tar.gz
rust-f3dafe91ff753e3a801aa336d41be9eca75925bc.zip
Add support for deferred casting for the invalid_reference_casting lint
Diffstat (limited to 'tests/ui/lint/reference_casting.stderr')
-rw-r--r--tests/ui/lint/reference_casting.stderr10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/ui/lint/reference_casting.stderr b/tests/ui/lint/reference_casting.stderr
index d1dd1b32ff4..d9ce4b38387 100644
--- a/tests/ui/lint/reference_casting.stderr
+++ b/tests/ui/lint/reference_casting.stderr
@@ -60,5 +60,13 @@ error: casting `&T` to `&mut T` is undefined behavior, even if the reference is
 LL |         *(std::ptr::from_ref({ num }) as *mut i32) += 1;
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 10 previous errors
+error: casting `&T` to `&mut T` is undefined behavior, even if the reference is unused, consider instead using an `UnsafeCell`
+  --> $DIR/reference_casting.rs:40:9
+   |
+LL |         let value = num as *const i32 as *mut i32;
+   |                     ----------------------------- casting happend here
+LL |         *value = 1;
+   |         ^^^^^^
+
+error: aborting due to 11 previous errors