rust-clippy/tests/ui/cast_ref_to_mut.stderr
Konrad Borowski 6faf1330aa Move a hint to an error message in cast_ref_to_mut lint
This matches mem::transmute::<&T, &mut T> lint in rustc.
2019-01-07 14:37:28 +01:00

22 lines
848 B
Text

error: casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell
--> $DIR/cast_ref_to_mut.rs:18: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 behaviour, consider instead using an UnsafeCell
--> $DIR/cast_ref_to_mut.rs:19:9
|
LL | *(a as *const _ as *mut _) = String::from("Replaced");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: casting &T to &mut T may cause undefined behaviour, consider instead using an UnsafeCell
--> $DIR/cast_ref_to_mut.rs:20:9
|
LL | *(a as *const _ as *mut String) += " world";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 3 previous errors