diff options
| author | Ralf Jung <post@ralfj.de> | 2023-08-25 23:01:06 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2023-08-27 11:55:49 +0200 |
| commit | abe2148aeef3a1ee4622ae8df43370aa749c7b4e (patch) | |
| tree | 9cb6b60774af1263f69faf31bd2d736e7dd49c3d /compiler/rustc_passes/src/layout_test.rs | |
| parent | b60f7b51a27dfd9cbc5ecaa56ee679cd1b67f4c4 (diff) | |
| download | rust-abe2148aeef3a1ee4622ae8df43370aa749c7b4e.tar.gz rust-abe2148aeef3a1ee4622ae8df43370aa749c7b4e.zip | |
add rustc_abi debugging attribute
Diffstat (limited to 'compiler/rustc_passes/src/layout_test.rs')
| -rw-r--r-- | compiler/rustc_passes/src/layout_test.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/compiler/rustc_passes/src/layout_test.rs b/compiler/rustc_passes/src/layout_test.rs index a7a8af864ac..d839fee07a6 100644 --- a/compiler/rustc_passes/src/layout_test.rs +++ b/compiler/rustc_passes/src/layout_test.rs @@ -11,16 +11,17 @@ use rustc_target::abi::{HasDataLayout, TargetDataLayout}; use crate::errors::{Abi, Align, HomogeneousAggregate, LayoutOf, Size, UnrecognizedField}; pub fn test_layout(tcx: TyCtxt<'_>) { - if tcx.features().rustc_attrs { + if !tcx.features().rustc_attrs { // if the `rustc_attrs` feature is not enabled, don't bother testing layout - for id in tcx.hir().items() { - if matches!( - tcx.def_kind(id.owner_id), - DefKind::TyAlias { .. } | DefKind::Enum | DefKind::Struct | DefKind::Union - ) { - for attr in tcx.get_attrs(id.owner_id, sym::rustc_layout) { - dump_layout_of(tcx, id.owner_id.def_id, attr); - } + return; + } + for id in tcx.hir().items() { + if matches!( + tcx.def_kind(id.owner_id), + DefKind::TyAlias { .. } | DefKind::Enum | DefKind::Struct | DefKind::Union + ) { + for attr in tcx.get_attrs(id.owner_id, sym::rustc_layout) { + dump_layout_of(tcx, id.owner_id.def_id, attr); } } } |
