Skip to content
Snippets Groups Projects
Commit a071e1c6 authored by David Renshaw's avatar David Renshaw
Browse files

fix argument unpacking issue and add a test that exercises the problem

parent 8e2c8593
No related branches found
No related tags found
No related merge requests found
...@@ -440,12 +440,16 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> { ...@@ -440,12 +440,16 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
Value::ByVal(PrimVal::Undef) => {} Value::ByVal(PrimVal::Undef) => {}
other => { other => {
let mut layout = layout; let mut layout = layout;
let mut skip_arg_locals = true;
'outer: loop { 'outer: loop {
for i in 0..layout.fields.count() { for i in 0..layout.fields.count() {
let field = layout.field(&self, i)?; let field = layout.field(&self, i)?;
if layout.fields.offset(i).bytes() == 0 && layout.size == field.size { if layout.fields.offset(i).bytes() == 0 && layout.size == field.size {
layout = field; layout = field;
skip_arg_locals = false;
continue 'outer; continue 'outer;
} else if skip_arg_locals {
arg_locals.next().unwrap();
} }
} }
break; break;
......
pub fn main() {
let g = |(), x: &u8| { 10u8 == *x };
g((), &1u8);
let f = |x: &u8| { 10u8 == *x };
f(&1u8);
[1, 2, 3u8].into_iter().any(|elt| 10 == *elt);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment