Fix a bug

This commit is contained in:
bjorn3 2018-07-19 19:42:07 +02:00
parent bf2c35f05d
commit 12e129579d
2 changed files with 4 additions and 2 deletions

View File

@ -108,9 +108,8 @@ pub fn codegen_call<'a, 'tcx: 'a>(
args
.into_iter()
.map(|arg| {
let ty = arg.ty(&fx.mir.local_decls, fx.tcx);
let arg = ::base::trans_operand(fx, arg);
if let Some(_) = fx.cton_type(ty) {
if let Some(_) = fx.cton_type(arg.layout().ty) {
arg.load_value(fx)
} else {
arg.force_stack(fx)

View File

@ -185,6 +185,7 @@ fn trans_stmt<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, stmt: &Statement<'tcx
match layout.variants {
layout::Variants::Single { index } => {
assert_eq!(index, *variant_index);
fx.bcx.ins().nop();
}
layout::Variants::Tagged { .. } => {
let ptr = place.place_field(fx, mir::Field::new(0));
@ -212,6 +213,8 @@ fn trans_stmt<'a, 'tcx: 'a>(fx: &mut FunctionCx<'a, 'tcx>, stmt: &Statement<'tcx
CValue::const_val(fx, niche.layout().ty, niche_value as u64 as i64)
};
niche.write_cvalue(fx, niche_llval);
} else {
fx.bcx.ins().nop();
}
}
}