From f116bc6e27042123ed25a43303615ba7d54a2f8e Mon Sep 17 00:00:00 2001 From: Jubilee Young Date: Sat, 16 Dec 2023 01:43:40 -0800 Subject: [PATCH] Manually inline scalar_unit --- compiler/rustc_abi/src/layout.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/compiler/rustc_abi/src/layout.rs b/compiler/rustc_abi/src/layout.rs index e73170c01f8..9f84c1aeaaf 100644 --- a/compiler/rustc_abi/src/layout.rs +++ b/compiler/rustc_abi/src/layout.rs @@ -180,12 +180,6 @@ fn layout_of_struct_or_enum< let dl = self.current_data_layout(); let dl = dl.borrow(); - let scalar_unit = |value: Primitive| { - let size = value.size(dl); - assert!(size.bits() <= 128); - Scalar::Initialized { value, valid_range: WrappingRange::full(size) } - }; - let (present_first, present_second) = { let mut present_variants = variants .iter_enumerated() @@ -678,7 +672,9 @@ struct TmpLayout { } if let Some((prim, offset)) = common_prim { let prim_scalar = if common_prim_initialized_in_all_variants { - scalar_unit(prim) + let size = prim.size(dl); + assert!(size.bits() <= 128); + Scalar::Initialized { value: prim, valid_range: WrappingRange::full(size) } } else { // Common prim might be uninit. Scalar::Union { value: prim }