ScalarPair for two element tuples was treated wrongly in closure calls

This commit is contained in:
Oliver Schneider 2018-05-30 15:41:43 +02:00
parent 823013349f
commit 03474943ec
2 changed files with 25 additions and 13 deletions

View File

@ -291,10 +291,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
// and need to pack arguments
Abi::Rust => {
trace!(
"arg_locals: {:?}",
"arg_locals: {:#?}",
self.frame().mir.args_iter().collect::<Vec<_>>()
);
trace!("args: {:?}", args);
trace!("args: {:#?}", args);
let local = arg_locals.nth(1).unwrap();
for (i, &valty) in args.into_iter().enumerate() {
let dest = self.eval_place(&mir::Place::Local(local).field(
@ -321,10 +321,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
let mut arg_locals = self.frame().mir.args_iter();
trace!("ABI: {:?}", sig.abi);
trace!(
"arg_locals: {:?}",
"arg_locals: {:#?}",
self.frame().mir.args_iter().collect::<Vec<_>>()
);
trace!("args: {:?}", args);
trace!("args: {:#?}", args);
match sig.abi {
Abi::RustCall => {
assert_eq!(args.len(), 2);
@ -376,14 +376,26 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
}
break;
}
let dest = self.eval_place(&mir::Place::Local(
arg_locals.next().unwrap(),
))?;
let valty = ValTy {
value: other,
ty: layout.ty,
};
self.write_value(valty, dest)?;
{
let mut write_next = |value| {
let dest = self.eval_place(&mir::Place::Local(
arg_locals.next().unwrap(),
))?;
let valty = ValTy {
value: Value::Scalar(value),
ty: layout.ty,
};
self.write_value(valty, dest)
};
match other {
Value::Scalar(value) | Value::ScalarPair(value, _) => write_next(value)?,
_ => unreachable!(),
}
if let Value::ScalarPair(_, value) = other {
write_next(value)?;
}
}
assert!(arg_locals.next().is_none());
}
}
} else {

@ -1 +1 @@
Subproject commit 49ca1746482e3c8221d8e8c7161b7d92ae076c8f
Subproject commit ac667d372f4094debfb9b7e29041f9e4a874fa6c