|
3 | 3 | //! manage the caches, and so forth. |
4 | 4 |
|
5 | 5 | use crate::dep_graph::{DepContext, DepNode, DepNodeIndex, DepNodeParams}; |
| 6 | +use crate::ich::StableHashingContext; |
6 | 7 | use crate::query::caches::QueryCache; |
7 | 8 | use crate::query::config::QueryVTable; |
8 | 9 | use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo}; |
@@ -525,7 +526,7 @@ where |
525 | 526 | if std::intrinsics::unlikely( |
526 | 527 | try_verify || qcx.dep_context().sess().opts.unstable_opts.incremental_verify_ich, |
527 | 528 | ) { |
528 | | - incremental_verify_ich(*qcx.dep_context(), &result, dep_node, query); |
| 529 | + incremental_verify_ich(*qcx.dep_context(), &result, dep_node, query.hash_result); |
529 | 530 | } |
530 | 531 |
|
531 | 532 | return Some((result, dep_node_index)); |
@@ -558,39 +559,42 @@ where |
558 | 559 | // |
559 | 560 | // See issue #82920 for an example of a miscompilation that would get turned into |
560 | 561 | // an ICE by this check |
561 | | - incremental_verify_ich(*qcx.dep_context(), &result, dep_node, query); |
| 562 | + incremental_verify_ich(*qcx.dep_context(), &result, dep_node, query.hash_result); |
562 | 563 |
|
563 | 564 | Some((result, dep_node_index)) |
564 | 565 | } |
565 | 566 |
|
566 | | -#[instrument(skip(qcx, result, query), level = "debug")] |
567 | | -fn incremental_verify_ich<Qcx, K, V: Debug>( |
568 | | - qcx: Qcx::DepContext, |
| 567 | +#[instrument(skip(tcx, result, hash_result), level = "debug")] |
| 568 | +pub(crate) fn incremental_verify_ich<Tcx, V: Debug>( |
| 569 | + tcx: Tcx, |
569 | 570 | result: &V, |
570 | | - dep_node: &DepNode<Qcx::DepKind>, |
571 | | - query: &QueryVTable<Qcx, K, V>, |
572 | | -) where |
573 | | - Qcx: QueryContext, |
| 571 | + dep_node: &DepNode<Tcx::DepKind>, |
| 572 | + hash_result: Option<fn(&mut StableHashingContext<'_>, &V) -> Fingerprint>, |
| 573 | +) -> Fingerprint |
| 574 | +where |
| 575 | + Tcx: DepContext, |
574 | 576 | { |
575 | 577 | assert!( |
576 | | - qcx.dep_graph().is_green(dep_node), |
| 578 | + tcx.dep_graph().is_green(dep_node), |
577 | 579 | "fingerprint for green query instance not loaded from cache: {:?}", |
578 | 580 | dep_node, |
579 | 581 | ); |
580 | 582 |
|
581 | | - let new_hash = query.hash_result.map_or(Fingerprint::ZERO, |f| { |
582 | | - qcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result)) |
| 583 | + let new_hash = hash_result.map_or(Fingerprint::ZERO, |f| { |
| 584 | + tcx.with_stable_hashing_context(|mut hcx| f(&mut hcx, result)) |
583 | 585 | }); |
584 | 586 |
|
585 | | - let old_hash = qcx.dep_graph().prev_fingerprint_of(dep_node); |
| 587 | + let old_hash = tcx.dep_graph().prev_fingerprint_of(dep_node); |
586 | 588 |
|
587 | 589 | if Some(new_hash) != old_hash { |
588 | 590 | incremental_verify_ich_failed( |
589 | | - qcx.sess(), |
| 591 | + tcx.sess(), |
590 | 592 | DebugArg::from(&dep_node), |
591 | 593 | DebugArg::from(&result), |
592 | 594 | ); |
593 | 595 | } |
| 596 | + |
| 597 | + new_hash |
594 | 598 | } |
595 | 599 |
|
596 | 600 | // This DebugArg business is largely a mirror of std::fmt::ArgumentV1, which is |
|
0 commit comments