]> git.lizzy.rs Git - rust.git/commitdiff
Auto merge of #107644 - Zoxc:query-cache-tweak, r=cjgillot
authorbors <bors@rust-lang.org>
Wed, 8 Feb 2023 16:59:18 +0000 (16:59 +0000)
committerbors <bors@rust-lang.org>
Wed, 8 Feb 2023 16:59:18 +0000 (16:59 +0000)
Remove QueryStorage::store_nocache

This method was added in https://github.com/rust-lang/rust/pull/70674 but it doesn't seem to serve any purpose.

1  2 
compiler/rustc_query_system/src/query/plumbing.rs

index f59d71124ecbf4452d6ada8139d557ac3cfd2c10,638336224ef1a0c703e5ccda6ad47b6b76c8ff8b..ed66d1929c5e78d1843c78fe756f057ce4bf8096
@@@ -121,20 -121,17 +121,17 @@@ wher
  
  #[cold]
  #[inline(never)]
- fn mk_cycle<Qcx, V, R, D: DepKind>(
+ fn mk_cycle<Qcx, R, D: DepKind>(
      qcx: Qcx,
      cycle_error: CycleError<D>,
      handler: HandleCycleError,
-     cache: &dyn crate::query::QueryStorage<Value = V, Stored = R>,
  ) -> R
  where
      Qcx: QueryContext + crate::query::HasDepContext<DepKind = D>,
-     V: std::fmt::Debug + Value<Qcx::DepContext, Qcx::DepKind>,
-     R: Copy,
+     R: std::fmt::Debug + Value<Qcx::DepContext, Qcx::DepKind>,
  {
      let error = report_cycle(qcx.dep_context().sess(), &cycle_error);
-     let value = handle_cycle_error(*qcx.dep_context(), &cycle_error, error, handler);
-     cache.store_nocache(value)
+     handle_cycle_error(*qcx.dep_context(), &cycle_error, error, handler)
  }
  
  fn handle_cycle_error<Tcx, V>(
@@@ -346,7 -343,9 +343,7 @@@ wher
  {
      match cache.lookup(&key) {
          Some((value, index)) => {
 -            if std::intrinsics::unlikely(tcx.profiler().enabled()) {
 -                tcx.profiler().query_cache_hit(index.into());
 -            }
 +            tcx.profiler().query_cache_hit(index.into());
              tcx.dep_graph().read_index(index);
              Some(value)
          }
@@@ -397,7 -396,7 +394,7 @@@ wher
              (result, Some(dep_node_index))
          }
          TryGetJob::Cycle(error) => {
-             let result = mk_cycle(qcx, error, Q::HANDLE_CYCLE_ERROR, cache);
+             let result = mk_cycle(qcx, error, Q::HANDLE_CYCLE_ERROR);
              (result, None)
          }
          #[cfg(parallel_compiler)]
                  panic!("value must be in cache after waiting")
              };
  
 -            if std::intrinsics::unlikely(qcx.dep_context().profiler().enabled()) {
 -                qcx.dep_context().profiler().query_cache_hit(index.into());
 -            }
 +            qcx.dep_context().profiler().query_cache_hit(index.into());
              query_blocked_prof_timer.finish_with_query_invocation_id(index.into());
  
              (v, Some(index))
@@@ -772,7 -773,9 +769,7 @@@ wher
      // Ensure that only one of them runs the query.
      let cache = Q::query_cache(qcx);
      if let Some((_, index)) = cache.lookup(&key) {
 -        if std::intrinsics::unlikely(qcx.dep_context().profiler().enabled()) {
 -            qcx.dep_context().profiler().query_cache_hit(index.into());
 -        }
 +        qcx.dep_context().profiler().query_cache_hit(index.into());
          return;
      }