Skip to content

Commit 1c36e8b

Browse files
committed
Sync from rust fa3155a644dd62e865825087b403646be01d4cef
2 parents 6b3ada0 + 46ce2bf commit 1c36e8b

File tree

10 files changed

+27
-17
lines changed

10 files changed

+27
-17
lines changed

src/abi/comments.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ pub(super) fn add_local_place_comments<'tcx>(
8989
format!("{:?}", local),
9090
format!("{:?}", ty),
9191
size.bytes(),
92-
align.abi.bytes(),
92+
align.bytes(),
9393
if extra.is_empty() { "" } else { " " },
9494
extra,
9595
));

src/abi/pass_mode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ pub(super) fn from_casted_value<'tcx>(
233233
// It may also be smaller for example when the type is a wrapper around an integer with a
234234
// larger alignment than the integer.
235235
std::cmp::max(abi_param_size, layout_size),
236-
u32::try_from(layout.align.abi.bytes()).unwrap(),
236+
u32::try_from(layout.align.bytes()).unwrap(),
237237
);
238238
let mut block_params_iter = block_params.iter().copied();
239239
for (offset, _) in abi_params {

src/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
870870
let layout = fx.layout_of(fx.monomorphize(ty));
871871
let val = match null_op {
872872
NullOp::SizeOf => layout.size.bytes(),
873-
NullOp::AlignOf => layout.align.abi.bytes(),
873+
NullOp::AlignOf => layout.align.bytes(),
874874
NullOp::OffsetOf(fields) => fx
875875
.tcx
876876
.offset_of_subfield(

src/common.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,10 @@ pub(crate) struct FullyMonomorphizedLayoutCx<'tcx>(pub(crate) TyCtxt<'tcx>);
429429
impl<'tcx> LayoutOfHelpers<'tcx> for FullyMonomorphizedLayoutCx<'tcx> {
430430
#[inline]
431431
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
432-
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
432+
if let LayoutError::SizeOverflow(_)
433+
| LayoutError::InvalidSimd { .. }
434+
| LayoutError::ReferencesError(_) = err
435+
{
433436
self.0.sess.dcx().span_fatal(span, err.to_string())
434437
} else {
435438
self.0
@@ -448,7 +451,9 @@ impl<'tcx> FnAbiOfHelpers<'tcx> for FullyMonomorphizedLayoutCx<'tcx> {
448451
span: Span,
449452
fn_abi_request: FnAbiRequest<'tcx>,
450453
) -> ! {
451-
if let FnAbiError::Layout(LayoutError::SizeOverflow(_)) = err {
454+
if let FnAbiError::Layout(LayoutError::SizeOverflow(_) | LayoutError::InvalidSimd { .. }) =
455+
err
456+
{
452457
self.0.sess.dcx().emit_fatal(Spanned { span, node: err })
453458
} else {
454459
match fn_abi_request {

src/debuginfo/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ impl DebugContext {
327327
entry.set(gimli::DW_AT_decl_file, AttributeValue::FileIndex(Some(file_id)));
328328
entry.set(gimli::DW_AT_decl_line, AttributeValue::Udata(line));
329329

330-
entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(static_layout.align.abi.bytes()));
330+
entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(static_layout.align.bytes()));
331331

332332
let mut expr = Expression::new();
333333
expr.op_addr(address_for_data(data_id));

src/debuginfo/types.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ impl DebugContext {
166166
let tuple_entry = self.dwarf.unit.get_mut(tuple_type_id);
167167
tuple_entry.set(gimli::DW_AT_name, AttributeValue::StringRef(self.dwarf.strings.add(name)));
168168
tuple_entry.set(gimli::DW_AT_byte_size, AttributeValue::Udata(layout.size.bytes()));
169-
tuple_entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(layout.align.abi.bytes()));
169+
tuple_entry.set(gimli::DW_AT_alignment, AttributeValue::Udata(layout.align.bytes()));
170170

171171
for (i, (ty, dw_ty)) in components.into_iter().enumerate() {
172172
let member_id = self.dwarf.unit.add(tuple_type_id, gimli::DW_TAG_member);
@@ -178,9 +178,7 @@ impl DebugContext {
178178
member_entry.set(gimli::DW_AT_type, AttributeValue::UnitRef(dw_ty));
179179
member_entry.set(
180180
gimli::DW_AT_alignment,
181-
AttributeValue::Udata(
182-
FullyMonomorphizedLayoutCx(tcx).layout_of(ty).align.abi.bytes(),
183-
),
181+
AttributeValue::Udata(FullyMonomorphizedLayoutCx(tcx).layout_of(ty).align.bytes()),
184182
);
185183
member_entry.set(
186184
gimli::DW_AT_data_member_location,

src/global_asm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,10 @@ impl<'tcx> AsmCodegenMethods<'tcx> for GlobalAsmContext<'_, 'tcx> {
4242
impl<'tcx> LayoutOfHelpers<'tcx> for GlobalAsmContext<'_, 'tcx> {
4343
#[inline]
4444
fn handle_layout_err(&self, err: LayoutError<'tcx>, span: Span, ty: Ty<'tcx>) -> ! {
45-
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
45+
if let LayoutError::SizeOverflow(_)
46+
| LayoutError::InvalidSimd { .. }
47+
| LayoutError::ReferencesError(_) = err
48+
{
4649
self.tcx.sess.dcx().span_fatal(span, err.to_string())
4750
} else {
4851
self.tcx

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ impl CodegenBackend for CraneliftCodegenBackend {
133133
""
134134
}
135135

136+
fn name(&self) -> &'static str {
137+
"cranelift"
138+
}
139+
136140
fn init(&self, sess: &Session) {
137141
use rustc_session::config::{InstrumentCoverage, Lto};
138142
match sess.lto() {

src/unsize.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub(crate) fn size_and_align_of<'tcx>(
167167
if layout.is_sized() {
168168
return (
169169
fx.bcx.ins().iconst(fx.pointer_type, layout.size.bytes() as i64),
170-
fx.bcx.ins().iconst(fx.pointer_type, layout.align.abi.bytes() as i64),
170+
fx.bcx.ins().iconst(fx.pointer_type, layout.align.bytes() as i64),
171171
);
172172
}
173173

@@ -186,7 +186,7 @@ pub(crate) fn size_and_align_of<'tcx>(
186186
// times the unit size.
187187
(
188188
fx.bcx.ins().imul_imm(info.unwrap(), unit.size.bytes() as i64),
189-
fx.bcx.ins().iconst(fx.pointer_type, unit.align.abi.bytes() as i64),
189+
fx.bcx.ins().iconst(fx.pointer_type, unit.align.bytes() as i64),
190190
)
191191
}
192192
ty::Foreign(_) => {
@@ -224,7 +224,7 @@ pub(crate) fn size_and_align_of<'tcx>(
224224
let unsized_offset_unadjusted = layout.fields.offset(i).bytes();
225225
let unsized_offset_unadjusted =
226226
fx.bcx.ins().iconst(fx.pointer_type, unsized_offset_unadjusted as i64);
227-
let sized_align = layout.align.abi.bytes();
227+
let sized_align = layout.align.bytes();
228228
let sized_align = fx.bcx.ins().iconst(fx.pointer_type, sized_align as i64);
229229

230230
// Recurse to get the size of the dynamically sized field (must be

src/value_and_place.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ impl<'tcx> CPlace<'tcx> {
383383

384384
let stack_slot = fx.create_stack_slot(
385385
u32::try_from(layout.size.bytes()).unwrap(),
386-
u32::try_from(layout.align.abi.bytes()).unwrap(),
386+
u32::try_from(layout.align.bytes()).unwrap(),
387387
);
388388
CPlace { inner: CPlaceInner::Addr(stack_slot, None), layout }
389389
}
@@ -634,8 +634,8 @@ impl<'tcx> CPlace<'tcx> {
634634
let size = dst_layout.size.bytes();
635635
// `emit_small_memory_copy` uses `u8` for alignments, just use the maximum
636636
// alignment that fits in a `u8` if the actual alignment is larger.
637-
let src_align = src_layout.align.abi.bytes().try_into().unwrap_or(128);
638-
let dst_align = dst_layout.align.abi.bytes().try_into().unwrap_or(128);
637+
let src_align = src_layout.align.bytes().try_into().unwrap_or(128);
638+
let dst_align = dst_layout.align.bytes().try_into().unwrap_or(128);
639639
fx.bcx.emit_small_memory_copy(
640640
fx.target_config,
641641
to_addr,

0 commit comments

Comments
 (0)