2
0
Fork 0
mirror of https://github.com/rust-lang/rust-clippy synced 2024-12-28 14:03:21 +00:00
rust-clippy/tests/ui/cast_ref_to_mut.stderr

23 lines
863 B
Text
Raw Normal View History

2020-01-06 06:36:33 +00:00
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:18:9
2018-12-29 18:25:27 +00:00
|
LL | (*(a as *const _ as *mut String)).push_str(" world");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `-D clippy::cast-ref-to-mut` implied by `-D warnings`
2020-01-06 06:36:33 +00:00
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:19:9
2018-12-29 18:25:27 +00:00
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
2020-01-06 06:36:33 +00:00
error: casting `&T` to `&mut T` may cause undefined behavior, consider instead using an `UnsafeCell`
--> $DIR/cast_ref_to_mut.rs:20:9
2018-12-29 18:25:27 +00:00
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors