3 This feature has no tracking issue, and is therefore internal to
4 the compiler, not being intended for general use.
6 Note: `rustc_attrs` enables many rustc-internal attributes and this page
7 only discuss a few of them.
9 ------------------------
11 The `rustc_attrs` feature allows debugging rustc type layouts by using
12 `#[rustc_layout(...)]` to debug layout at compile time (it even works
13 with `cargo check`) as an alternative to `rustc -Z print-type-sizes`
14 that is way more verbose.
16 Options provided by `#[rustc_layout(...)]` are `debug`, `size`, `align`,
17 `abi`. Note that it only works on sized types without generics.
22 #![feature(rustc_attrs)]
24 #[rustc_layout(abi, size)]
31 When that is compiled, the compiler will error with something like
34 error: abi: Aggregate { sized: true }
43 error: size: Size { raw: 16 }
52 error: aborting due to 2 previous errors