Skip to main content
Sign in
Snippets Groups Projects
Commit 16ac4266 authored by David Renshaw's avatar David Renshaw
Browse files

pull in fix for miri issue 304

parent 97bfd9b9
No related branches found
No related tags found
No related merge requests found
......@@ -836,6 +836,10 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
ty::TyRef(_, ref tam) |
ty::TyRawPtr(ref tam) => self.get_fat_field(tam.ty, field_index),
ty::TyClosure(def_id, ref closure_substs) =>
Ok(closure_substs.upvar_tys(def_id, self.tcx).nth(field_index).unwrap()),
_ => Err(EvalError::Unimplemented(format!("can't handle type: {:?}, {:?}", ty, ty.sty))),
}
}
......
......
// miri issue #304
fn main() {
let mut y = 0;
{
let mut box_maybe_closure = Box::new(None);
*box_maybe_closure = Some(|| { y += 1; });
(box_maybe_closure.unwrap())();
}
assert_eq!(y, 1);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment