mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-10 23:24:24 +00:00
ee9b47dae6
add stuff on pointer::cast` to the document for `cast_ptr_alignment` and fix line numbers in the test.
28 lines
1,003 B
Text
28 lines
1,003 B
Text
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`) (1 < 2 bytes)
|
|
--> $DIR/cast_alignment.rs:12:5
|
|
|
|
|
LL | (&1u8 as *const u8) as *const u16;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
|
= note: `-D clippy::cast-ptr-alignment` implied by `-D warnings`
|
|
|
|
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) (1 < 2 bytes)
|
|
--> $DIR/cast_alignment.rs:13:5
|
|
|
|
|
LL | (&mut 1u8 as *mut u8) as *mut u16;
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`) (1 < 2 bytes)
|
|
--> $DIR/cast_alignment.rs:16:5
|
|
|
|
|
LL | (&1u8 as *const u8).cast::<u16>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) (1 < 2 bytes)
|
|
--> $DIR/cast_alignment.rs:17:5
|
|
|
|
|
LL | (&mut 1u8 as *mut u8).cast::<u16>();
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
error: aborting due to 4 previous errors
|
|
|