Skip to content

Commit 39aa5ab

Browse files
committed
Merge from rustc
2 parents 2d86e5d + f73bcd1 commit 39aa5ab

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

crates/hir-ty/src/diagnostics/match_check/pat_analysis.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,11 @@ impl PatCx for MatchCheckCtx<'_> {
361361
}
362362
}
363363

364-
fn ctor_sub_tys<'a>(
365-
&'a self,
366-
ctor: &'a rustc_pattern_analysis::constructor::Constructor<Self>,
367-
ty: &'a Self::Ty,
368-
) -> impl ExactSizeIterator<Item = (Self::Ty, PrivateUninhabitedField)> + Captures<'a> {
364+
fn ctor_sub_tys(
365+
&self,
366+
ctor: &rustc_pattern_analysis::constructor::Constructor<Self>,
367+
ty: &Self::Ty,
368+
) -> impl ExactSizeIterator<Item = (Self::Ty, PrivateUninhabitedField)> {
369369
let single = |ty| smallvec![(ty, PrivateUninhabitedField(false))];
370370
let tys: SmallVec<[_; 2]> = match ctor {
371371
Struct | Variant(_) | UnionField => match ty.kind(Interner) {

crates/hir-ty/src/layout.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ fn layout_of_simd_ty(
179179
.size
180180
.checked_mul(e_len, dl)
181181
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
182-
let align = dl.vector_align(size);
182+
let align = dl.llvmlike_vector_align(size);
183183
let size = size.align_to(align.abi);
184184

185185
// Compute the placement of the vector fields:
@@ -194,6 +194,7 @@ fn layout_of_simd_ty(
194194
fields,
195195
backend_repr: BackendRepr::Vector { element: e_abi, count: e_len },
196196
largest_niche: e_ly.largest_niche,
197+
uninhabited: false,
197198
size,
198199
align,
199200
max_repr_align: None,
@@ -297,20 +298,17 @@ pub fn layout_of_ty_query(
297298
.checked_mul(count, dl)
298299
.ok_or(LayoutError::BadCalc(LayoutCalculatorError::SizeOverflow))?;
299300

300-
let backend_repr =
301-
if count != 0 && matches!(element.backend_repr, BackendRepr::Uninhabited) {
302-
BackendRepr::Uninhabited
303-
} else {
304-
BackendRepr::Memory { sized: true }
305-
};
301+
let backend_repr = BackendRepr::Memory { sized: true };
306302

307303
let largest_niche = if count != 0 { element.largest_niche } else { None };
304+
let uninhabited = if count != 0 { element.uninhabited } else { false };
308305

309306
Layout {
310307
variants: Variants::Single { index: struct_variant_idx() },
311308
fields: FieldsShape::Array { stride: element.size, count },
312309
backend_repr,
313310
largest_niche,
311+
uninhabited,
314312
align: element.align,
315313
size,
316314
max_repr_align: None,
@@ -325,6 +323,7 @@ pub fn layout_of_ty_query(
325323
fields: FieldsShape::Array { stride: element.size, count: 0 },
326324
backend_repr: BackendRepr::Memory { sized: false },
327325
largest_niche: None,
326+
uninhabited: false,
328327
align: element.align,
329328
size: Size::ZERO,
330329
max_repr_align: None,
@@ -337,6 +336,7 @@ pub fn layout_of_ty_query(
337336
fields: FieldsShape::Array { stride: Size::from_bytes(1), count: 0 },
338337
backend_repr: BackendRepr::Memory { sized: false },
339338
largest_niche: None,
339+
uninhabited: false,
340340
align: dl.i8_align,
341341
size: Size::ZERO,
342342
max_repr_align: None,

0 commit comments

Comments
 (0)