File tree Expand file tree Collapse file tree 1 file changed +18
-24
lines changed Expand file tree Collapse file tree 1 file changed +18
-24
lines changed Original file line number Diff line number Diff line change @@ -5643,32 +5643,26 @@ pub fn closure_upvars<'tcx>(typer: &mc::Typer<'tcx>,
5643
5643
closure_expr_id : closure_id. node
5644
5644
} ;
5645
5645
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
+ } ;
5659
5660
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,
5665
5665
}
5666
- } ;
5667
-
5668
- Some ( ClosureUpvar {
5669
- def : freevar. def ,
5670
- span : freevar. span ,
5671
- ty : captured_freevar_ty,
5672
5666
} )
5673
5667
} )
5674
5668
. collect ( )
You can’t perform that action at this time.
0 commit comments