2022-07-08 16:08:32 +00:00
|
|
|
//@normalize-stderr-test: "\| +\^+" -> "| ^"
|
2020-08-17 17:09:09 +02:00
|
|
|
|
2016-07-06 11:19:24 +02:00
|
|
|
fn main() {
|
2020-08-18 10:11:54 +02:00
|
|
|
// No retry needed, this fails reliably.
|
|
|
|
|
2016-07-06 11:19:24 +02:00
|
|
|
let mut x = [0u8; 20];
|
2020-04-13 17:51:22 +02:00
|
|
|
let x_ptr: *mut u8 = x.as_mut_ptr();
|
2022-06-21 16:30:45 +00:00
|
|
|
#[rustfmt::skip]
|
2016-07-06 11:19:24 +02:00
|
|
|
unsafe {
|
2022-06-21 16:30:45 +00:00
|
|
|
// At least one of these is definitely unaligned.
|
|
|
|
*(x_ptr as *mut u32) = 42; *(x_ptr.add(1) as *mut u32) = 42;
|
|
|
|
//~^ ERROR: but alignment 4 is required
|
|
|
|
};
|
2016-07-06 11:19:24 +02:00
|
|
|
}
|