]> git.proxmox.com Git - rustc.git/blame - src/test/ui/issues/issue-27060-rpass.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-27060-rpass.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26 2#![allow(dead_code)]
ff7c6d11
XL
3#[repr(packed)]
4pub struct Good {
5 data: &'static u32,
6 data2: [&'static u32; 2],
7 aligned: [u8; 32],
8}
9
ff7c6d11 10// kill this test when that turns to a hard error
cdc7bbd5 11#[allow(unaligned_references)]
ff7c6d11 12fn main() {
f9f354fc 13 let good = Good { data: &0, data2: [&0, &0], aligned: [0; 32] };
ff7c6d11 14
cdc7bbd5
XL
15 let _ = &good.data; // ok
16 let _ = &good.data2[0]; // ok
ff7c6d11
XL
17
18 let _ = &good.data;
19 let _ = &good.data2[0];
20 let _ = &*good.data; // ok, behind a pointer
21 let _ = &good.aligned; // ok, has align 1
22 let _ = &good.aligned[2]; // ok, has align 1
23}