Skip to content

Commit 8f889f8

Browse files
committed
Sync from rust 4b27a04
2 parents 814ef9f + 112e5e8 commit 8f889f8

File tree

2 files changed

+27
-30
lines changed

2 files changed

+27
-30
lines changed

build_system/utils.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,11 +213,13 @@ pub(crate) fn copy_dir_recursively(from: &Path, to: &Path) {
213213
if filename == "." || filename == ".." {
214214
continue;
215215
}
216+
let src = from.join(&filename);
217+
let dst = to.join(&filename);
216218
if entry.metadata().unwrap().is_dir() {
217-
fs::create_dir(to.join(&filename)).unwrap();
218-
copy_dir_recursively(&from.join(&filename), &to.join(&filename));
219+
fs::create_dir(&dst).unwrap_or_else(|e| panic!("failed to create {dst:?}: {e}"));
220+
copy_dir_recursively(&src, &dst);
219221
} else {
220-
fs::copy(from.join(&filename), to.join(&filename)).unwrap();
222+
fs::copy(&src, &dst).unwrap_or_else(|e| panic!("failed to copy {src:?}->{dst:?}: {e}"));
221223
}
222224
}
223225
}

src/abi/mod.rs

Lines changed: 22 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::mem;
1010
use cranelift_codegen::ir::{ArgumentPurpose, SigRef};
1111
use cranelift_codegen::isa::CallConv;
1212
use cranelift_module::ModuleError;
13-
use rustc_abi::ExternAbi;
13+
use rustc_abi::{CanonAbi, ExternAbi, X86Call};
1414
use rustc_codegen_ssa::base::is_call_from_compiler_builtins_to_upstream_monomorphization;
1515
use rustc_codegen_ssa::errors::CompilerBuiltinsCannotCall;
1616
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
@@ -19,7 +19,7 @@ use rustc_middle::ty::layout::FnAbiOf;
1919
use rustc_middle::ty::print::with_no_trimmed_paths;
2020
use rustc_session::Session;
2121
use rustc_span::source_map::Spanned;
22-
use rustc_target::callconv::{Conv, FnAbi, PassMode};
22+
use rustc_target::callconv::{FnAbi, PassMode};
2323
use smallvec::SmallVec;
2424

2525
use self::pass_mode::*;
@@ -42,32 +42,27 @@ fn clif_sig_from_fn_abi<'tcx>(
4242
Signature { params, returns, call_conv }
4343
}
4444

45-
pub(crate) fn conv_to_call_conv(sess: &Session, c: Conv, default_call_conv: CallConv) -> CallConv {
45+
pub(crate) fn conv_to_call_conv(
46+
sess: &Session,
47+
c: CanonAbi,
48+
default_call_conv: CallConv,
49+
) -> CallConv {
4650
match c {
47-
Conv::Rust | Conv::C => default_call_conv,
48-
Conv::Cold | Conv::PreserveMost | Conv::PreserveAll => CallConv::Cold,
49-
Conv::X86_64SysV => CallConv::SystemV,
50-
Conv::X86_64Win64 => CallConv::WindowsFastcall,
51-
52-
// Should already get a back compat warning
53-
Conv::X86Fastcall | Conv::X86Stdcall | Conv::X86ThisCall | Conv::X86VectorCall => {
54-
default_call_conv
55-
}
56-
57-
Conv::X86Intr | Conv::RiscvInterrupt { .. } => {
58-
sess.dcx().fatal(format!("interrupt call conv {c:?} not yet implemented"))
51+
CanonAbi::Rust | CanonAbi::C => default_call_conv,
52+
CanonAbi::RustCold => CallConv::Cold,
53+
54+
CanonAbi::X86(x86_call) => match x86_call {
55+
X86Call::SysV64 => CallConv::SystemV,
56+
X86Call::Win64 => CallConv::WindowsFastcall,
57+
// Should already get a back compat warning
58+
_ => default_call_conv,
59+
},
60+
61+
CanonAbi::Interrupt(_) | CanonAbi::Arm(_) => {
62+
sess.dcx().fatal("call conv {c:?} is not yet implemented")
5963
}
60-
61-
Conv::ArmAapcs => sess.dcx().fatal("aapcs call conv not yet implemented"),
62-
Conv::CCmseNonSecureCall => {
63-
sess.dcx().fatal("C-cmse-nonsecure-call call conv is not yet implemented");
64-
}
65-
Conv::CCmseNonSecureEntry => {
66-
sess.dcx().fatal("C-cmse-nonsecure-entry call conv is not yet implemented");
67-
}
68-
69-
Conv::Msp430Intr | Conv::GpuKernel | Conv::AvrInterrupt | Conv::AvrNonBlockingInterrupt => {
70-
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target");
64+
CanonAbi::GpuKernel => {
65+
unreachable!("tried to use {c:?} call conv which only exists on an unsupported target")
7166
}
7267
}
7368
}
@@ -610,7 +605,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
610605
target: CallTarget,
611606
call_args: &mut Vec<Value>,
612607
) {
613-
if fn_abi.conv != Conv::C {
608+
if fn_abi.conv != CanonAbi::C {
614609
fx.tcx.dcx().span_fatal(
615610
source_info.span,
616611
format!("Variadic call for non-C abi {:?}", fn_abi.conv),

0 commit comments

Comments
 (0)