Skip to content

Commit 86ae9ce

Browse files
committed
---
yaml --- r: 178619 b: refs/heads/snap-stage3 c: f5281e2 h: refs/heads/master i: 178617: f99d740 178615: 626b6c4 v: v3
1 parent 0fafb19 commit 86ae9ce

File tree

2 files changed

+19
-25
lines changed

2 files changed

+19
-25
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 3d072a193bfcb76206aab576049e696d6d8db25d
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: bc41cc0ec9fbe395598fde5ef22b3e95582a5236
4+
refs/heads/snap-stage3: f5281e2bb56fa9ef4debf04e6141d2ad3650ca61
55
refs/heads/try: ccf8fedf1cffcb8f6f3581d53d220039e192fe77
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5643,32 +5643,26 @@ pub fn closure_upvars<'tcx>(typer: &mc::Typer<'tcx>,
56435643
closure_expr_id: closure_id.node
56445644
};
56455645

5646-
let captured_freevar_ty = match typer.upvar_capture(upvar_id) {
5647-
Some(UpvarCapture::ByValue) => {
5648-
freevar_ty
5649-
}
5650-
5651-
Some(UpvarCapture::ByRef(borrow)) => {
5652-
mk_rptr(tcx,
5653-
tcx.mk_region(borrow.region),
5654-
ty::mt {
5655-
ty: freevar_ty,
5656-
mutbl: borrow.kind.to_mutbl_lossy(),
5657-
})
5658-
}
5646+
typer.upvar_capture(upvar_id).map(|capture| {
5647+
let freevar_ref_ty = match capture {
5648+
UpvarCapture::ByValue => {
5649+
freevar_ty
5650+
}
5651+
UpvarCapture::ByRef(borrow) => {
5652+
mk_rptr(tcx,
5653+
tcx.mk_region(borrow.region),
5654+
ty::mt {
5655+
ty: freevar_ty,
5656+
mutbl: borrow.kind.to_mutbl_lossy(),
5657+
})
5658+
}
5659+
};
56595660

5660-
None => {
5661-
// FIXME(#16640) we should really return None here;
5662-
// but that requires better inference integration,
5663-
// for now gin up something.
5664-
freevar_ty
5661+
ClosureUpvar {
5662+
def: freevar.def,
5663+
span: freevar.span,
5664+
ty: freevar_ref_ty,
56655665
}
5666-
};
5667-
5668-
Some(ClosureUpvar {
5669-
def: freevar.def,
5670-
span: freevar.span,
5671-
ty: captured_freevar_ty,
56725666
})
56735667
})
56745668
.collect()

0 commit comments

Comments
 (0)