@@ -10,7 +10,7 @@ use rustc::lint::builtin::{MUTABLE_BORROW_RESERVATION_CONFLICT};
1010use rustc:: mir:: { AggregateKind , BasicBlock , BorrowCheckResult , BorrowKind } ;
1111use rustc:: mir:: {
1212 ClearCrossCrate , Local , Location , Body , BodyCache , Mutability , Operand , Place , PlaceBase ,
13- PlaceElem , PlaceRef , ReadOnlyBodyCache , Static , StaticKind
13+ PlaceElem , PlaceRef , ReadOnlyBodyCache , Static , StaticKind , read_only
1414} ;
1515use rustc:: mir:: { Field , ProjectionElem , Promoted , Rvalue , Statement , StatementKind } ;
1616use rustc:: mir:: { Terminator , TerminatorKind } ;
@@ -167,8 +167,8 @@ fn do_mir_borrowck<'a, 'tcx>(
167167 let mut body_cache = BodyCache :: new ( body) ;
168168 let free_regions =
169169 nll:: replace_regions_in_mir ( infcx, def_id, param_env, & mut body_cache, & mut promoted) ;
170- let body_cache = body_cache . read_only ( ) ; // no further changes
171- let promoted: IndexVec < _ , _ > = promoted. iter ( ) . map ( |body_cache| body_cache . read_only ( ) ) . collect ( ) ;
170+ let body_cache = read_only ! ( body_cache ) ; // no further changes
171+ let promoted: IndexVec < _ , _ > = promoted. iter_mut ( ) . map ( |body_cache| read_only ! ( body_cache ) ) . collect ( ) ;
172172
173173 let location_table = & LocationTable :: new ( & body_cache) ;
174174
@@ -492,7 +492,7 @@ impl<'cx, 'tcx> DataflowResultsConsumer<'cx, 'tcx> for MirBorrowckCtxt<'cx, 'tcx
492492 type FlowState = Flows < ' cx , ' tcx > ;
493493
494494 fn body ( & self ) -> & ' cx Body < ' tcx > {
495- & self . body_cache
495+ self . body_cache . body ( )
496496 }
497497
498498 fn visit_block_entry ( & mut self , bb : BasicBlock , flow_state : & Self :: FlowState ) {
0 commit comments