blob: 8f4f46237884878292e96999cfb245f0cd13a0ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#![deny(renamed_and_removed_lints)]
#![deny(safe_packed_borrows)] //~ ERROR has been renamed to `unaligned_references`
#![allow(unaligned_references)]
// This lint was removed in https://github.com/rust-lang/rust/pull/82525 (nightly-2021-03-28).
// Refs:
// - https://github.com/rust-lang/rust/pull/82525
// - https://github.com/rust-lang/rust/issues/46043
#[repr(packed)]
struct Packed {
f: u32,
}
#[repr(packed(2))]
struct PackedN {
f: u32,
}
fn main() {
let a = Packed { f: 1 };
&a.f;
let _ = &a.f;
let b = PackedN { f: 1 };
&b.f;
let _ = &b.f;
}
|