Skip to content

Commit 824b687

Browse files
compiler: Add LayoutS::is_uninhabited
This reduces the need of the compiler to peek on the fields of LayoutS.
1 parent 5f5c243 commit 824b687

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1652,6 +1652,11 @@ impl<FieldIdx: Idx, VariantIdx: Idx> LayoutS<FieldIdx, VariantIdx> {
16521652
}
16531653
}
16541654

1655+
/// Returns `true` if this is sized
1656+
pub fn is_uninhabited(&self) -> bool {
1657+
self.ir_form.is_uninhabited()
1658+
}
1659+
16551660
pub fn scalar<C: HasDataLayout>(cx: &C, scalar: Scalar) -> Self {
16561661
let largest_niche = Niche::from_scalar(cx, Size::ZERO, scalar);
16571662
let size = scalar.size(cx);

0 commit comments

Comments
 (0)