1use std::cell::Cell;
6use std::fmt::Debug;
7use std::hash::Hash;
8use std::mem;
9
10use hashbrown::hash_table::Entry;
11use rustc_data_structures::fingerprint::Fingerprint;
12use rustc_data_structures::sharded::{self, Sharded};
13use rustc_data_structures::stack::ensure_sufficient_stack;
14use rustc_data_structures::{outline, sync};
15use rustc_errors::{Diag, FatalError, StashKey};
16use rustc_span::{DUMMY_SP, Span};
17use tracing::instrument;
18
19use super::{QueryConfig, QueryStackFrameExtra};
20use crate::HandleCycleError;
21use crate::dep_graph::{DepContext, DepGraphData, DepNode, DepNodeIndex, DepNodeParams};
22use crate::ich::StableHashingContext;
23use crate::query::caches::QueryCache;
24use crate::query::job::{QueryInfo, QueryJob, QueryJobId, QueryJobInfo, QueryLatch, report_cycle};
25use crate::query::{QueryContext, QueryMap, QueryStackFrame, SerializedDepNodeIndex};
26
27#[inline]
28fn equivalent_key<K: Eq, V>(k: &K) -> impl Fn(&(K, V)) -> bool + '_ {
29    move |x| x.0 == *k
30}
31
32pub struct QueryState<K, I> {
33    active: Sharded<hashbrown::HashTable<(K, QueryResult<I>)>>,
34}
35
36enum QueryResult<I> {
38    Started(QueryJob<I>),
40
41    Poisoned,
44}
45
46impl<I> QueryResult<I> {
47    fn expect_job(self) -> QueryJob<I> {
49        match self {
50            Self::Started(job) => job,
51            Self::Poisoned => {
52                panic!("job for query failed to start and was poisoned")
53            }
54        }
55    }
56}
57
58impl<K, I> QueryState<K, I>
59where
60    K: Eq + Hash + Copy + Debug,
61{
62    pub fn all_inactive(&self) -> bool {
63        self.active.lock_shards().all(|shard| shard.is_empty())
64    }
65
66    pub fn try_collect_active_jobs<Qcx: Copy>(
67        &self,
68        qcx: Qcx,
69        make_query: fn(Qcx, K) -> QueryStackFrame<I>,
70        jobs: &mut QueryMap<I>,
71    ) -> Option<()> {
72        let mut active = Vec::new();
73
74        for shard in self.active.try_lock_shards() {
77            for (k, v) in shard?.iter() {
78                if let QueryResult::Started(ref job) = *v {
79                    active.push((*k, (*job).clone()));
80                }
81            }
82        }
83
84        for (key, job) in active {
87            let query = make_query(qcx, key);
88            jobs.insert(job.id, QueryJobInfo { query, job });
89        }
90
91        Some(())
92    }
93}
94
95impl<K, I> Default for QueryState<K, I> {
96    fn default() -> QueryState<K, I> {
97        QueryState { active: Default::default() }
98    }
99}
100
101struct JobOwner<'tcx, K, I>
104where
105    K: Eq + Hash + Copy,
106{
107    state: &'tcx QueryState<K, I>,
108    key: K,
109}
110
111#[cold]
112#[inline(never)]
113fn mk_cycle<Q, Qcx>(query: Q, qcx: Qcx, cycle_error: CycleError) -> Q::Value
114where
115    Q: QueryConfig<Qcx>,
116    Qcx: QueryContext,
117{
118    let error = report_cycle(qcx.dep_context().sess(), &cycle_error);
119    handle_cycle_error(query, qcx, &cycle_error, error)
120}
121
122fn handle_cycle_error<Q, Qcx>(
123    query: Q,
124    qcx: Qcx,
125    cycle_error: &CycleError,
126    error: Diag<'_>,
127) -> Q::Value
128where
129    Q: QueryConfig<Qcx>,
130    Qcx: QueryContext,
131{
132    use HandleCycleError::*;
133    match query.handle_cycle_error() {
134        Error => {
135            let guar = error.emit();
136            query.value_from_cycle_error(*qcx.dep_context(), cycle_error, guar)
137        }
138        Fatal => {
139            error.emit();
140            qcx.dep_context().sess().dcx().abort_if_errors();
141            unreachable!()
142        }
143        DelayBug => {
144            let guar = error.delay_as_bug();
145            query.value_from_cycle_error(*qcx.dep_context(), cycle_error, guar)
146        }
147        Stash => {
148            let guar = if let Some(root) = cycle_error.cycle.first()
149                && let Some(span) = root.query.info.span
150            {
151                error.stash(span, StashKey::Cycle).unwrap()
152            } else {
153                error.emit()
154            };
155            query.value_from_cycle_error(*qcx.dep_context(), cycle_error, guar)
156        }
157    }
158}
159
160impl<'tcx, K, I> JobOwner<'tcx, K, I>
161where
162    K: Eq + Hash + Copy,
163{
164    fn complete<C>(self, cache: &C, key_hash: u64, result: C::Value, dep_node_index: DepNodeIndex)
167    where
168        C: QueryCache<Key = K>,
169    {
170        let key = self.key;
171        let state = self.state;
172
173        mem::forget(self);
175
176        cache.complete(key, result, dep_node_index);
179
180        let job = {
181            let mut shard = state.active.lock_shard_by_hash(key_hash);
186            match shard.find_entry(key_hash, equivalent_key(&key)) {
187                Err(_) => None,
188                Ok(occupied) => Some(occupied.remove().0.1),
189            }
190        };
191        let job = job.expect("active query job entry").expect_job();
192
193        job.signal_complete();
194    }
195}
196
197impl<'tcx, K, I> Drop for JobOwner<'tcx, K, I>
198where
199    K: Eq + Hash + Copy,
200{
201    #[inline(never)]
202    #[cold]
203    fn drop(&mut self) {
204        let state = self.state;
206        let job = {
207            let key_hash = sharded::make_hash(&self.key);
208            let mut shard = state.active.lock_shard_by_hash(key_hash);
209            match shard.find_entry(key_hash, equivalent_key(&self.key)) {
210                Err(_) => panic!(),
211                Ok(occupied) => {
212                    let ((key, value), vacant) = occupied.remove();
213                    vacant.insert((key, QueryResult::Poisoned));
214                    value.expect_job()
215                }
216            }
217        };
218        job.signal_complete();
221    }
222}
223
224#[derive(Clone, Debug)]
225pub struct CycleError<I = QueryStackFrameExtra> {
226    pub usage: Option<(Span, QueryStackFrame<I>)>,
228    pub cycle: Vec<QueryInfo<I>>,
229}
230
231impl<I> CycleError<I> {
232    fn lift<Qcx: QueryContext<QueryInfo = I>>(&self, qcx: Qcx) -> CycleError<QueryStackFrameExtra> {
233        CycleError {
234            usage: self.usage.as_ref().map(|(span, frame)| (*span, frame.lift(qcx))),
235            cycle: self.cycle.iter().map(|info| info.lift(qcx)).collect(),
236        }
237    }
238}
239
240#[inline(always)]
245pub fn try_get_cached<Tcx, C>(tcx: Tcx, cache: &C, key: &C::Key) -> Option<C::Value>
246where
247    C: QueryCache,
248    Tcx: DepContext,
249{
250    match cache.lookup(key) {
251        Some((value, index)) => {
252            tcx.profiler().query_cache_hit(index.into());
253            tcx.dep_graph().read_index(index);
254            Some(value)
255        }
256        None => None,
257    }
258}
259
260#[cold]
261#[inline(never)]
262fn cycle_error<Q, Qcx>(
263    query: Q,
264    qcx: Qcx,
265    try_execute: QueryJobId,
266    span: Span,
267) -> (Q::Value, Option<DepNodeIndex>)
268where
269    Q: QueryConfig<Qcx>,
270    Qcx: QueryContext,
271{
272    let query_map = qcx.collect_active_jobs().ok().expect("failed to collect active queries");
275
276    let error = try_execute.find_cycle_in_stack(query_map, &qcx.current_query_job(), span);
277    (mk_cycle(query, qcx, error.lift(qcx)), None)
278}
279
280#[inline(always)]
281fn wait_for_query<Q, Qcx>(
282    query: Q,
283    qcx: Qcx,
284    span: Span,
285    key: Q::Key,
286    latch: QueryLatch<Qcx::QueryInfo>,
287    current: Option<QueryJobId>,
288) -> (Q::Value, Option<DepNodeIndex>)
289where
290    Q: QueryConfig<Qcx>,
291    Qcx: QueryContext,
292{
293    let query_blocked_prof_timer = qcx.dep_context().profiler().query_blocked();
297
298    let result = latch.wait_on(qcx, current, span);
301
302    match result {
303        Ok(()) => {
304            let Some((v, index)) = query.query_cache(qcx).lookup(&key) else {
305                outline(|| {
306                    let key_hash = sharded::make_hash(&key);
309                    let shard = query.query_state(qcx).active.lock_shard_by_hash(key_hash);
310                    match shard.find(key_hash, equivalent_key(&key)) {
311                        Some((_, QueryResult::Poisoned)) => FatalError.raise(),
313                        _ => panic!(
314                            "query '{}' result must be in the cache or the query must be poisoned after a wait",
315                            query.name()
316                        ),
317                    }
318                })
319            };
320
321            qcx.dep_context().profiler().query_cache_hit(index.into());
322            query_blocked_prof_timer.finish_with_query_invocation_id(index.into());
323
324            (v, Some(index))
325        }
326        Err(cycle) => (mk_cycle(query, qcx, cycle.lift(qcx)), None),
327    }
328}
329
330#[inline(never)]
331fn try_execute_query<Q, Qcx, const INCR: bool>(
332    query: Q,
333    qcx: Qcx,
334    span: Span,
335    key: Q::Key,
336    dep_node: Option<DepNode>,
337) -> (Q::Value, Option<DepNodeIndex>)
338where
339    Q: QueryConfig<Qcx>,
340    Qcx: QueryContext,
341{
342    let state = query.query_state(qcx);
343    let key_hash = sharded::make_hash(&key);
344    let mut state_lock = state.active.lock_shard_by_hash(key_hash);
345
346    if qcx.dep_context().sess().threads() > 1 {
353        if let Some((value, index)) = query.query_cache(qcx).lookup(&key) {
354            qcx.dep_context().profiler().query_cache_hit(index.into());
355            return (value, Some(index));
356        }
357    }
358
359    let current_job_id = qcx.current_query_job();
360
361    match state_lock.entry(key_hash, equivalent_key(&key), |(k, _)| sharded::make_hash(k)) {
362        Entry::Vacant(entry) => {
363            let id = qcx.next_job_id();
366            let job = QueryJob::new(id, span, current_job_id);
367            entry.insert((key, QueryResult::Started(job)));
368
369            drop(state_lock);
371
372            execute_job::<_, _, INCR>(query, qcx, state, key, key_hash, id, dep_node)
373        }
374        Entry::Occupied(mut entry) => {
375            match &mut entry.get_mut().1 {
376                QueryResult::Started(job) => {
377                    if sync::is_dyn_thread_safe() {
378                        let latch = job.latch();
380                        drop(state_lock);
381
382                        return wait_for_query(query, qcx, span, key, latch, current_job_id);
385                    }
386
387                    let id = job.id;
388                    drop(state_lock);
389
390                    cycle_error(query, qcx, id, span)
393                }
394                QueryResult::Poisoned => FatalError.raise(),
395            }
396        }
397    }
398}
399
400#[inline(always)]
401fn execute_job<Q, Qcx, const INCR: bool>(
402    query: Q,
403    qcx: Qcx,
404    state: &QueryState<Q::Key, Qcx::QueryInfo>,
405    key: Q::Key,
406    key_hash: u64,
407    id: QueryJobId,
408    dep_node: Option<DepNode>,
409) -> (Q::Value, Option<DepNodeIndex>)
410where
411    Q: QueryConfig<Qcx>,
412    Qcx: QueryContext,
413{
414    let job_owner = JobOwner { state, key };
416
417    debug_assert_eq!(qcx.dep_context().dep_graph().is_fully_enabled(), INCR);
418
419    let (result, dep_node_index) = if INCR {
420        execute_job_incr(
421            query,
422            qcx,
423            qcx.dep_context().dep_graph().data().unwrap(),
424            key,
425            dep_node,
426            id,
427        )
428    } else {
429        execute_job_non_incr(query, qcx, key, id)
430    };
431
432    let cache = query.query_cache(qcx);
433    if query.feedable() {
434        if let Some((cached_result, _)) = cache.lookup(&key) {
439            let Some(hasher) = query.hash_result() else {
440                panic!(
441                    "no_hash fed query later has its value computed.\n\
442                    Remove `no_hash` modifier to allow recomputation.\n\
443                    The already cached value: {}",
444                    (query.format_value())(&cached_result)
445                );
446            };
447
448            let (old_hash, new_hash) = qcx.dep_context().with_stable_hashing_context(|mut hcx| {
449                (hasher(&mut hcx, &cached_result), hasher(&mut hcx, &result))
450            });
451            let formatter = query.format_value();
452            if old_hash != new_hash {
453                assert!(
456                    qcx.dep_context().sess().dcx().has_errors().is_some(),
457                    "Computed query value for {:?}({:?}) is inconsistent with fed value,\n\
458                        computed={:#?}\nfed={:#?}",
459                    query.dep_kind(),
460                    key,
461                    formatter(&result),
462                    formatter(&cached_result),
463                );
464            }
465        }
466    }
467    job_owner.complete(cache, key_hash, result, dep_node_index);
468
469    (result, Some(dep_node_index))
470}
471
472#[inline(always)]
474fn execute_job_non_incr<Q, Qcx>(
475    query: Q,
476    qcx: Qcx,
477    key: Q::Key,
478    job_id: QueryJobId,
479) -> (Q::Value, DepNodeIndex)
480where
481    Q: QueryConfig<Qcx>,
482    Qcx: QueryContext,
483{
484    debug_assert!(!qcx.dep_context().dep_graph().is_fully_enabled());
485
486    if cfg!(debug_assertions) {
489        let _ = key.to_fingerprint(*qcx.dep_context());
490    }
491
492    let prof_timer = qcx.dep_context().profiler().query_provider();
493    let result = qcx.start_query(job_id, query.depth_limit(), || query.compute(qcx, key));
494    let dep_node_index = qcx.dep_context().dep_graph().next_virtual_depnode_index();
495    prof_timer.finish_with_query_invocation_id(dep_node_index.into());
496
497    if cfg!(debug_assertions)
500        && let Some(hash_result) = query.hash_result()
501    {
502        qcx.dep_context().with_stable_hashing_context(|mut hcx| {
503            hash_result(&mut hcx, &result);
504        });
505    }
506
507    (result, dep_node_index)
508}
509
510#[inline(always)]
511fn execute_job_incr<Q, Qcx>(
512    query: Q,
513    qcx: Qcx,
514    dep_graph_data: &DepGraphData<Qcx::Deps>,
515    key: Q::Key,
516    mut dep_node_opt: Option<DepNode>,
517    job_id: QueryJobId,
518) -> (Q::Value, DepNodeIndex)
519where
520    Q: QueryConfig<Qcx>,
521    Qcx: QueryContext,
522{
523    if !query.anon() && !query.eval_always() {
524        let dep_node =
526            dep_node_opt.get_or_insert_with(|| query.construct_dep_node(*qcx.dep_context(), &key));
527
528        if let Some(ret) = qcx.start_query(job_id, false, || {
531            try_load_from_disk_and_cache_in_memory(query, dep_graph_data, qcx, &key, dep_node)
532        }) {
533            return ret;
534        }
535    }
536
537    let prof_timer = qcx.dep_context().profiler().query_provider();
538
539    let (result, dep_node_index) = qcx.start_query(job_id, query.depth_limit(), || {
540        if query.anon() {
541            return dep_graph_data.with_anon_task_inner(
542                *qcx.dep_context(),
543                query.dep_kind(),
544                || query.compute(qcx, key),
545            );
546        }
547
548        let dep_node =
550            dep_node_opt.unwrap_or_else(|| query.construct_dep_node(*qcx.dep_context(), &key));
551
552        dep_graph_data.with_task(
553            dep_node,
554            (qcx, query),
555            key,
556            |(qcx, query), key| query.compute(qcx, key),
557            query.hash_result(),
558        )
559    });
560
561    prof_timer.finish_with_query_invocation_id(dep_node_index.into());
562
563    (result, dep_node_index)
564}
565
566#[inline(always)]
567fn try_load_from_disk_and_cache_in_memory<Q, Qcx>(
568    query: Q,
569    dep_graph_data: &DepGraphData<Qcx::Deps>,
570    qcx: Qcx,
571    key: &Q::Key,
572    dep_node: &DepNode,
573) -> Option<(Q::Value, DepNodeIndex)>
574where
575    Q: QueryConfig<Qcx>,
576    Qcx: QueryContext,
577{
578    let (prev_dep_node_index, dep_node_index) = dep_graph_data.try_mark_green(qcx, dep_node)?;
582
583    debug_assert!(dep_graph_data.is_index_green(prev_dep_node_index));
584
585    if let Some(result) = query.try_load_from_disk(qcx, key, prev_dep_node_index, dep_node_index) {
588        if std::intrinsics::unlikely(qcx.dep_context().sess().opts.unstable_opts.query_dep_graph) {
589            dep_graph_data.mark_debug_loaded_from_disk(*dep_node)
590        }
591
592        let prev_fingerprint = dep_graph_data.prev_fingerprint_of(prev_dep_node_index);
593        let try_verify = prev_fingerprint.split().1.as_u64().is_multiple_of(32);
601        if std::intrinsics::unlikely(
602            try_verify || qcx.dep_context().sess().opts.unstable_opts.incremental_verify_ich,
603        ) {
604            incremental_verify_ich(
605                *qcx.dep_context(),
606                dep_graph_data,
607                &result,
608                prev_dep_node_index,
609                query.hash_result(),
610                query.format_value(),
611            );
612        }
613
614        return Some((result, dep_node_index));
615    }
616
617    debug_assert!(
620        !query.cache_on_disk(*qcx.dep_context(), key)
621            || !qcx.dep_context().fingerprint_style(dep_node.kind).reconstructible(),
622        "missing on-disk cache entry for {dep_node:?}"
623    );
624
625    debug_assert!(
628        !query.loadable_from_disk(qcx, key, prev_dep_node_index),
629        "missing on-disk cache entry for loadable {dep_node:?}"
630    );
631
632    let prof_timer = qcx.dep_context().profiler().query_provider();
635
636    let result = qcx.dep_context().dep_graph().with_ignore(|| query.compute(qcx, *key));
638
639    prof_timer.finish_with_query_invocation_id(dep_node_index.into());
640
641    incremental_verify_ich(
651        *qcx.dep_context(),
652        dep_graph_data,
653        &result,
654        prev_dep_node_index,
655        query.hash_result(),
656        query.format_value(),
657    );
658
659    Some((result, dep_node_index))
660}
661
662#[inline]
663#[instrument(skip(tcx, dep_graph_data, result, hash_result, format_value), level = "debug")]
664pub(crate) fn incremental_verify_ich<Tcx, V>(
665    tcx: Tcx,
666    dep_graph_data: &DepGraphData<Tcx::Deps>,
667    result: &V,
668    prev_index: SerializedDepNodeIndex,
669    hash_result: Option<fn(&mut StableHashingContext<'_>, &V) -> Fingerprint>,
670    format_value: fn(&V) -> String,
671) where
672    Tcx: DepContext,
673{
674    if !dep_graph_data.is_index_green(prev_index) {
675        incremental_verify_ich_not_green(tcx, prev_index)
676    }
677
678    let new_hash = hash_result.map_or(Fingerprint::ZERO, |f| {
679        tcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result))
680    });
681
682    let old_hash = dep_graph_data.prev_fingerprint_of(prev_index);
683
684    if new_hash != old_hash {
685        incremental_verify_ich_failed(tcx, prev_index, &|| format_value(result));
686    }
687}
688
689#[cold]
690#[inline(never)]
691fn incremental_verify_ich_not_green<Tcx>(tcx: Tcx, prev_index: SerializedDepNodeIndex)
692where
693    Tcx: DepContext,
694{
695    panic!(
696        "fingerprint for green query instance not loaded from cache: {:?}",
697        tcx.dep_graph().data().unwrap().prev_node_of(prev_index)
698    )
699}
700
701#[cold]
705#[inline(never)]
706fn incremental_verify_ich_failed<Tcx>(
707    tcx: Tcx,
708    prev_index: SerializedDepNodeIndex,
709    result: &dyn Fn() -> String,
710) where
711    Tcx: DepContext,
712{
713    thread_local! {
720        static INSIDE_VERIFY_PANIC: Cell<bool> = const { Cell::new(false) };
721    };
722
723    let old_in_panic = INSIDE_VERIFY_PANIC.replace(true);
724
725    if old_in_panic {
726        tcx.sess().dcx().emit_err(crate::error::Reentrant);
727    } else {
728        let run_cmd = if let Some(crate_name) = &tcx.sess().opts.crate_name {
729            format!("`cargo clean -p {crate_name}` or `cargo clean`")
730        } else {
731            "`cargo clean`".to_string()
732        };
733
734        let dep_node = tcx.dep_graph().data().unwrap().prev_node_of(prev_index);
735        tcx.sess().dcx().emit_err(crate::error::IncrementCompilation {
736            run_cmd,
737            dep_node: format!("{dep_node:?}"),
738        });
739        panic!("Found unstable fingerprints for {dep_node:?}: {}", result());
740    }
741
742    INSIDE_VERIFY_PANIC.set(old_in_panic);
743}
744
745#[inline(never)]
754fn ensure_must_run<Q, Qcx>(
755    query: Q,
756    qcx: Qcx,
757    key: &Q::Key,
758    check_cache: bool,
759) -> (bool, Option<DepNode>)
760where
761    Q: QueryConfig<Qcx>,
762    Qcx: QueryContext,
763{
764    if query.eval_always() {
765        return (true, None);
766    }
767
768    assert!(!query.anon());
770
771    let dep_node = query.construct_dep_node(*qcx.dep_context(), key);
772
773    let dep_graph = qcx.dep_context().dep_graph();
774    let serialized_dep_node_index = match dep_graph.try_mark_green(qcx, &dep_node) {
775        None => {
776            return (true, Some(dep_node));
783        }
784        Some((serialized_dep_node_index, dep_node_index)) => {
785            dep_graph.read_index(dep_node_index);
786            qcx.dep_context().profiler().query_cache_hit(dep_node_index.into());
787            serialized_dep_node_index
788        }
789    };
790
791    if !check_cache {
793        return (false, None);
794    }
795
796    let loadable = query.loadable_from_disk(qcx, key, serialized_dep_node_index);
797    (!loadable, Some(dep_node))
798}
799
800#[derive(Debug)]
801pub enum QueryMode {
802    Get,
803    Ensure { check_cache: bool },
804}
805
806#[inline(always)]
807pub fn get_query_non_incr<Q, Qcx>(query: Q, qcx: Qcx, span: Span, key: Q::Key) -> Q::Value
808where
809    Q: QueryConfig<Qcx>,
810    Qcx: QueryContext,
811{
812    debug_assert!(!qcx.dep_context().dep_graph().is_fully_enabled());
813
814    ensure_sufficient_stack(|| try_execute_query::<Q, Qcx, false>(query, qcx, span, key, None).0)
815}
816
817#[inline(always)]
818pub fn get_query_incr<Q, Qcx>(
819    query: Q,
820    qcx: Qcx,
821    span: Span,
822    key: Q::Key,
823    mode: QueryMode,
824) -> Option<Q::Value>
825where
826    Q: QueryConfig<Qcx>,
827    Qcx: QueryContext,
828{
829    debug_assert!(qcx.dep_context().dep_graph().is_fully_enabled());
830
831    let dep_node = if let QueryMode::Ensure { check_cache } = mode {
832        let (must_run, dep_node) = ensure_must_run(query, qcx, &key, check_cache);
833        if !must_run {
834            return None;
835        }
836        dep_node
837    } else {
838        None
839    };
840
841    let (result, dep_node_index) = ensure_sufficient_stack(|| {
842        try_execute_query::<_, _, true>(query, qcx, span, key, dep_node)
843    });
844    if let Some(dep_node_index) = dep_node_index {
845        qcx.dep_context().dep_graph().read_index(dep_node_index)
846    }
847    Some(result)
848}
849
850pub fn force_query<Q, Qcx>(query: Q, qcx: Qcx, key: Q::Key, dep_node: DepNode)
851where
852    Q: QueryConfig<Qcx>,
853    Qcx: QueryContext,
854{
855    if let Some((_, index)) = query.query_cache(qcx).lookup(&key) {
858        qcx.dep_context().profiler().query_cache_hit(index.into());
859        return;
860    }
861
862    debug_assert!(!query.anon());
863
864    ensure_sufficient_stack(|| {
865        try_execute_query::<_, _, true>(query, qcx, DUMMY_SP, key, Some(dep_node))
866    });
867}