1
Fork 0
This commit is contained in:
bjorn3 2021-03-21 10:05:48 +01:00
parent 56fe51cb36
commit 73626efb26
3 changed files with 7 additions and 18 deletions

View file

@ -470,10 +470,7 @@ pub(crate) fn codegen_terminator_call<'tcx>(
// FIXME find a cleaner way to support varargs // FIXME find a cleaner way to support varargs
if fn_sig.c_variadic { if fn_sig.c_variadic {
if !matches!(fn_sig.abi, Abi::C { .. }) { if !matches!(fn_sig.abi, Abi::C { .. }) {
fx.tcx.sess.span_fatal( fx.tcx.sess.span_fatal(span, &format!("Variadic call for non-C abi {:?}", fn_sig.abi));
span,
&format!("Variadic call for non-C abi {:?}", fn_sig.abi),
);
} }
let sig_ref = fx.bcx.func.dfg.call_signature(call_inst).unwrap(); let sig_ref = fx.bcx.func.dfg.call_signature(call_inst).unwrap();
let abi_params = call_args let abi_params = call_args

View file

@ -839,18 +839,15 @@ fn codegen_stmt<'tcx>(
StatementKind::CopyNonOverlapping(inner) => { StatementKind::CopyNonOverlapping(inner) => {
let dst = codegen_operand(fx, &inner.dst); let dst = codegen_operand(fx, &inner.dst);
let pointee = dst let pointee = dst
.layout() .layout()
.pointee_info_at(fx, rustc_target::abi::Size::ZERO) .pointee_info_at(fx, rustc_target::abi::Size::ZERO)
.expect("Expected pointer"); .expect("Expected pointer");
let dst = dst.load_scalar(fx); let dst = dst.load_scalar(fx);
let src = codegen_operand(fx, &inner.src).load_scalar(fx); let src = codegen_operand(fx, &inner.src).load_scalar(fx);
let count = codegen_operand(fx, &inner.count).load_scalar(fx); let count = codegen_operand(fx, &inner.count).load_scalar(fx);
let elem_size: u64 = pointee.size.bytes(); let elem_size: u64 = pointee.size.bytes();
let bytes = if elem_size != 1 { let bytes =
fx.bcx.ins().imul_imm(count, elem_size as i64) if elem_size != 1 { fx.bcx.ins().imul_imm(count, elem_size as i64) } else { count };
} else {
count
};
fx.bcx.call_memcpy(fx.cx.module.target_config(), dst, src, bytes); fx.bcx.call_memcpy(fx.cx.module.target_config(), dst, src, bytes);
} }
} }

View file

@ -1,9 +1,4 @@
#![feature( #![feature(rustc_private, decl_macro, never_type, hash_drain_filter)]
rustc_private,
decl_macro,
never_type,
hash_drain_filter
)]
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![warn(unused_lifetimes)] #![warn(unused_lifetimes)]
#![warn(unreachable_pub)] #![warn(unreachable_pub)]