Merge branch 'master' into drop
This commit is contained in:
commit
fad1bc8b20
2 changed files with 15 additions and 0 deletions
|
|
@ -1176,6 +1176,11 @@ impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
|
|||
packed: false,
|
||||
}),
|
||||
|
||||
ty::TyClosure(def_id, ref closure_substs) => Ok(TyAndPacked {
|
||||
ty: closure_substs.upvar_tys(def_id, self.tcx).nth(field_index).unwrap(),
|
||||
packed: false,
|
||||
}),
|
||||
|
||||
_ => {
|
||||
err!(Unimplemented(
|
||||
format!("can't handle type: {:?}, {:?}", ty, ty.sty),
|
||||
|
|
|
|||
10
tests/run-pass/closure-field-ty.rs
Normal file
10
tests/run-pass/closure-field-ty.rs
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
// 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue