@@ -119,11 +119,8 @@ impl<'tcx> Queries<'tcx> {
119119
120120 pub fn dep_graph_future ( & self ) -> Result < & Query < Option < DepGraphFuture > > > {
121121 self . dep_graph_future . compute ( || {
122- Ok ( self
123- . session ( )
124- . opts
125- . build_dep_graph ( )
126- . then ( || rustc_incremental:: load_dep_graph ( self . session ( ) ) ) )
122+ let sess = self . session ( ) ;
123+ Ok ( sess. opts . build_dep_graph ( ) . then ( || rustc_incremental:: load_dep_graph ( sess) ) )
127124 } )
128125 }
129126
@@ -195,27 +192,17 @@ impl<'tcx> Queries<'tcx> {
195192
196193 pub fn dep_graph ( & self ) -> Result < & Query < DepGraph > > {
197194 self . dep_graph . compute ( || {
198- Ok ( match self . dep_graph_future ( ) ?. take ( ) {
199- None => DepGraph :: new_disabled ( ) ,
200- Some ( future) => {
195+ let sess = self . session ( ) ;
196+ let future_opt = self . dep_graph_future ( ) ?. take ( ) ;
197+ let dep_graph = future_opt
198+ . and_then ( |future| {
201199 let ( prev_graph, prev_work_products) =
202- self . session ( ) . time ( "blocked_on_dep_graph_loading" , || {
203- future
204- . open ( )
205- . unwrap_or_else ( |e| rustc_incremental:: LoadResult :: Error {
206- message : format ! ( "could not decode incremental cache: {:?}" , e) ,
207- } )
208- . open ( self . session ( ) )
209- } ) ;
210-
211- rustc_incremental:: build_dep_graph (
212- self . session ( ) ,
213- prev_graph,
214- prev_work_products,
215- )
216- . unwrap_or_else ( DepGraph :: new_disabled)
217- }
218- } )
200+ sess. time ( "blocked_on_dep_graph_loading" , || future. open ( ) . open ( sess) ) ;
201+
202+ rustc_incremental:: build_dep_graph ( sess, prev_graph, prev_work_products)
203+ } )
204+ . unwrap_or_else ( DepGraph :: new_disabled) ;
205+ Ok ( dep_graph)
219206 } )
220207 }
221208
0 commit comments