rust-clippy/tests/ui/cast_ref_to_mut.stderr
Takayuki Nakata 0e803417f9 Add rustfmt::skip as a work around
because comments are checked and removed by rustfmt for some reason
2020-11-16 12:32:16 +09:00

22 lines
863 B
Text

error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:22:9
|
LL | (*(a as *const _ as *mut String)).push_str(" world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cast-ref-to-mut` implied by `-D warnings`
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:23:9
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:24:9
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors