Skip to content

Commit 8324228

Browse files
committed
Sync from rust 2f5df8a
2 parents 9aa5fbf + 65d75fd commit 8324228

File tree

7 files changed

+19
-14
lines changed

7 files changed

+19
-14
lines changed

src/abi/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn clif_sig_from_fn_abi<'tcx>(
3939
pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: CallConv) -> CallConv {
4040
match c {
4141
Conv::Rust | Conv::C => default_call_conv,
42-
Conv::RustCold => CallConv::Cold,
42+
Conv::Cold | Conv::PreserveMost | Conv::PreserveAll => CallConv::Cold,
4343
Conv::X86_64SysV => CallConv::SystemV,
4444
Conv::X86_64Win64 => CallConv::WindowsFastcall,
4545

@@ -48,7 +48,9 @@ pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: Call
4848
default_call_conv
4949
}
5050

51-
Conv::X86Intr => sess.fatal("x86-interrupt call conv not yet implemented"),
51+
Conv::X86Intr | Conv::RiscvInterrupt { .. } => {
52+
sess.fatal(format!("interrupt call conv {c:?} not yet implemented"))
53+
}
5254

5355
Conv::ArmAapcs => sess.fatal("aapcs call conv not yet implemented"),
5456
Conv::CCmseNonSecureCall => {

src/base.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,10 +474,10 @@ fn codegen_fn_body(fx: &mut FunctionCx<'_, '_, '_>, start_block: Block) {
474474
*destination,
475475
);
476476
}
477-
TerminatorKind::Terminate => {
478-
codegen_panic_cannot_unwind(fx, source_info);
477+
TerminatorKind::UnwindTerminate(reason) => {
478+
codegen_unwind_terminate(fx, source_info, *reason);
479479
}
480-
TerminatorKind::Resume => {
480+
TerminatorKind::UnwindResume => {
481481
// FIXME implement unwinding
482482
fx.bcx.ins().trap(TrapCode::UnreachableCodeReached);
483483
}
@@ -971,13 +971,14 @@ pub(crate) fn codegen_panic_nounwind<'tcx>(
971971
codegen_panic_inner(fx, rustc_hir::LangItem::PanicNounwind, &args, source_info.span);
972972
}
973973

974-
pub(crate) fn codegen_panic_cannot_unwind<'tcx>(
974+
pub(crate) fn codegen_unwind_terminate<'tcx>(
975975
fx: &mut FunctionCx<'_, '_, 'tcx>,
976976
source_info: mir::SourceInfo,
977+
reason: UnwindTerminateReason,
977978
) {
978979
let args = [];
979980

980-
codegen_panic_inner(fx, rustc_hir::LangItem::PanicCannotUnwind, &args, source_info.span);
981+
codegen_panic_inner(fx, reason.lang_item(), &args, source_info.span);
981982
}
982983

983984
fn codegen_panic_inner<'tcx>(

src/common.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ impl<'tcx> LayoutOfHelpers<'tcx> for RevealAllLayoutCx<'tcx> {
480480
if let LayoutError::SizeOverflow(_) | LayoutError::ReferencesError(_) = err {
481481
self.0.sess.span_fatal(span, err.to_string())
482482
} else {
483-
span_bug!(span, "failed to get layout for `{}`: {}", ty, err)
483+
self.0.sess.span_fatal(span, format!("failed to get layout for `{}`: {}", ty, err))
484484
}
485485
}
486486
}

src/constant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,8 +550,8 @@ pub(crate) fn mir_operand_get_const_val<'tcx>(
550550
match &bb_data.terminator().kind {
551551
TerminatorKind::Goto { .. }
552552
| TerminatorKind::SwitchInt { .. }
553-
| TerminatorKind::Resume
554-
| TerminatorKind::Terminate
553+
| TerminatorKind::UnwindResume
554+
| TerminatorKind::UnwindTerminate(_)
555555
| TerminatorKind::Return
556556
| TerminatorKind::Unreachable
557557
| TerminatorKind::Drop { .. }

src/driver/jit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
9898
tcx.sess.fatal("JIT mode doesn't work with `cargo check`");
9999
}
100100

101-
if !tcx.sess.crate_types().contains(&rustc_session::config::CrateType::Executable) {
101+
if !tcx.crate_types().contains(&rustc_session::config::CrateType::Executable) {
102102
tcx.sess.fatal("can't jit non-executable crate");
103103
}
104104

src/unsize.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ fn unsize_ptr<'tcx>(
8888
let src_f = src_layout.field(fx, i);
8989
assert_eq!(src_layout.fields.offset(i).bytes(), 0);
9090
assert_eq!(dst_layout.fields.offset(i).bytes(), 0);
91-
if src_f.is_zst() {
91+
if src_f.is_1zst() {
92+
// We are looking for the one non-1-ZST field; this is not it.
9293
continue;
9394
}
9495
assert_eq!(src_layout.size, src_f.size);
@@ -151,6 +152,7 @@ pub(crate) fn coerce_unsized_into<'tcx>(
151152
let dst_f = dst.place_field(fx, FieldIdx::new(i));
152153

153154
if dst_f.layout().is_zst() {
155+
// No data here, nothing to copy/coerce.
154156
continue;
155157
}
156158

src/vtable.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ pub(crate) fn get_ptr_and_method_ref<'tcx>(
5151
'descend_newtypes: while !arg.layout().ty.is_unsafe_ptr() && !arg.layout().ty.is_ref() {
5252
for i in 0..arg.layout().fields.count() {
5353
let field = arg.value_field(fx, FieldIdx::new(i));
54-
if !field.layout().is_zst() {
55-
// we found the one non-zero-sized field that is allowed
54+
if !field.layout().is_1zst() {
55+
// we found the one non-1-ZST field that is allowed
5656
// now find *its* non-zero-sized field, or stop if it's a
5757
// pointer
5858
arg = field;

0 commit comments

Comments
 (0)