diff options
Diffstat (limited to 'tests/ui/cast_alignment.rs')
| -rw-r--r-- | tests/ui/cast_alignment.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/ui/cast_alignment.rs b/tests/ui/cast_alignment.rs index 95bb883df1b..98ef5e36f94 100644 --- a/tests/ui/cast_alignment.rs +++ b/tests/ui/cast_alignment.rs @@ -17,11 +17,16 @@ fn main() { // cast to more-strictly-aligned type (&1u8 as *const u8) as *const u16; + //~^ ERROR: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`) + //~| NOTE: `-D clippy::cast-ptr-alignment` implied by `-D warnings` (&mut 1u8 as *mut u8) as *mut u16; + //~^ ERROR: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) (1 // cast to more-strictly-aligned type, but with the `pointer::cast` function. (&1u8 as *const u8).cast::<u16>(); + //~^ ERROR: casting from `*const u8` to a more-strictly-aligned pointer (`*const u16`) (&mut 1u8 as *mut u8).cast::<u16>(); + //~^ ERROR: casting from `*mut u8` to a more-strictly-aligned pointer (`*mut u16`) (1 /* These should be ok */ |
