mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 05:57:03 +03:00
Merge branch 'master' into drop
This commit is contained in:
@@ -1176,6 +1176,11 @@ pub fn get_field_ty(
|
||||
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),
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user