diff options
| author | bors <bors@rust-lang.org> | 2022-11-27 10:35:00 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-11-27 10:35:00 +0000 |
| commit | df04d28163cc42e2c5b1072abe68460f904e42be (patch) | |
| tree | 332ecf0df1e53bf06a2b9fe766dfa952f88fb828 /compiler/rustc_ty_utils/src | |
| parent | 5ac7e08aaf10d2882c6addcf220872c9390ed91e (diff) | |
| parent | 208bb933e7a6d8820646e3e367e2bf188d85e485 (diff) | |
| download | rust-df04d28163cc42e2c5b1072abe68460f904e42be.tar.gz rust-df04d28163cc42e2c5b1072abe68460f904e42be.zip | |
Auto merge of #103917 - oli-obk:layout_math, r=RalfJung,lcnr
Various cleanups around scalar layout restrictions Pulled out of https://github.com/rust-lang/rust/pull/103724
Diffstat (limited to 'compiler/rustc_ty_utils/src')
| -rw-r--r-- | compiler/rustc_ty_utils/src/layout.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/compiler/rustc_ty_utils/src/layout.rs b/compiler/rustc_ty_utils/src/layout.rs index 7a1cc1e9e6d..fbc055b5d23 100644 --- a/compiler/rustc_ty_utils/src/layout.rs +++ b/compiler/rustc_ty_utils/src/layout.rs @@ -325,8 +325,8 @@ fn layout_of_uncached<'tcx>( // Extract the number of elements from the layout of the array field: let FieldsShape::Array { count, .. } = cx.layout_of(f0_ty)?.layout.fields() else { - return Err(LayoutError::Unknown(ty)); - }; + return Err(LayoutError::Unknown(ty)); + }; (*e_ty, *count, true) } else { @@ -351,14 +351,14 @@ fn layout_of_uncached<'tcx>( // Compute the ABI of the element type: let e_ly = cx.layout_of(e_ty)?; let Abi::Scalar(e_abi) = e_ly.abi else { - // This error isn't caught in typeck, e.g., if - // the element type of the vector is generic. - tcx.sess.fatal(&format!( - "monomorphising SIMD type `{}` with a non-primitive-scalar \ - (integer/float/pointer) element type `{}`", - ty, e_ty - )) - }; + // This error isn't caught in typeck, e.g., if + // the element type of the vector is generic. + tcx.sess.fatal(&format!( + "monomorphising SIMD type `{}` with a non-primitive-scalar \ + (integer/float/pointer) element type `{}`", + ty, e_ty + )) + }; // Compute the size and alignment of the vector: let size = e_ly.size.checked_mul(e_len, dl).ok_or(LayoutError::SizeOverflow(ty))?; @@ -597,8 +597,8 @@ fn generator_layout<'tcx>( let subst_field = |ty: Ty<'tcx>| EarlyBinder(ty).subst(tcx, substs); let Some(info) = tcx.generator_layout(def_id) else { - return Err(LayoutError::Unknown(ty)); - }; + return Err(LayoutError::Unknown(ty)); + }; let (ineligible_locals, assignments) = generator_saved_local_eligibility(&info); // Build a prefix layout, including "promoting" all ineligible @@ -701,8 +701,8 @@ fn generator_layout<'tcx>( variant.variants = Variants::Single { index }; let FieldsShape::Arbitrary { offsets, memory_index } = variant.fields else { - bug!(); - }; + bug!(); + }; // Now, stitch the promoted and variant-only fields back together in // the order they are mentioned by our GeneratorLayout. |
