|
2 | 2 | //! generate the actual methods on tcx which find and execute the provider, |
3 | 3 | //! manage the caches, and so forth. |
4 | 4 |
|
5 | | -use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex}; |
| 5 | +use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex, DepNodeParams}; |
6 | 6 | use crate::ich::StableHashingContext; |
7 | 7 | use crate::query::caches::QueryCache; |
8 | 8 | use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo}; |
@@ -428,12 +428,29 @@ where |
428 | 428 |
|
429 | 429 | // Fast path for when incr. comp. is off. |
430 | 430 | if !dep_graph.is_fully_enabled() { |
| 431 | + // Fingerprint the key, just to assert that it doesn't |
| 432 | + // have anything we don't consider hashable |
| 433 | + if cfg!(debug_assertions) { |
| 434 | + let _ = key.to_fingerprint(*qcx.dep_context()); |
| 435 | + } |
| 436 | + |
431 | 437 | let prof_timer = qcx.dep_context().profiler().query_provider(); |
432 | 438 | let result = qcx.start_query(job_id, Q::DEPTH_LIMIT, None, || { |
433 | 439 | Q::compute(qcx, &key)(*qcx.dep_context(), key) |
434 | 440 | }); |
435 | 441 | let dep_node_index = dep_graph.next_virtual_depnode_index(); |
436 | 442 | prof_timer.finish_with_query_invocation_id(dep_node_index.into()); |
| 443 | + |
| 444 | + // Similarly, fingerprint the result to assert that |
| 445 | + // it doesn't have anything not considered hashable. |
| 446 | + if cfg!(debug_assertions) |
| 447 | + && let Some(hash_result) = Q::HASH_RESULT |
| 448 | + { |
| 449 | + qcx.dep_context().with_stable_hashing_context(|mut hcx| { |
| 450 | + hash_result(&mut hcx, &result); |
| 451 | + }); |
| 452 | + } |
| 453 | + |
437 | 454 | return (result, dep_node_index); |
438 | 455 | } |
439 | 456 |
|
|
0 commit comments