diff options
| author | Michael Goulet <michael@errs.io> | 2023-01-31 20:37:52 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-01-31 20:43:29 +0000 |
| commit | bbf33836b9adfe4328aefa108c421e670a3923b7 (patch) | |
| tree | 5f473f694ac359d2fa00140daa8320a8c07ee41f /compiler/rustc_query_system | |
| parent | f361413cbf44ce2f144df59fc440cd484af4a56e (diff) | |
| download | rust-bbf33836b9adfe4328aefa108c421e670a3923b7.tar.gz rust-bbf33836b9adfe4328aefa108c421e670a3923b7.zip | |
Fingerprint even when incr comp is disabled in debug mode
Diffstat (limited to 'compiler/rustc_query_system')
| -rw-r--r-- | compiler/rustc_query_system/src/lib.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/query/plumbing.rs | 19 |
2 files changed, 19 insertions, 1 deletions
diff --git a/compiler/rustc_query_system/src/lib.rs b/compiler/rustc_query_system/src/lib.rs index f47760e9ae6..623be668464 100644 --- a/compiler/rustc_query_system/src/lib.rs +++ b/compiler/rustc_query_system/src/lib.rs @@ -3,6 +3,7 @@ #![feature(hash_raw_entry)] #![feature(min_specialization)] #![feature(extern_types)] +#![feature(let_chains)] #![allow(rustc::potential_query_instability)] #![deny(rustc::untranslatable_diagnostic)] #![deny(rustc::diagnostic_outside_of_impl)] diff --git a/compiler/rustc_query_system/src/query/plumbing.rs b/compiler/rustc_query_system/src/query/plumbing.rs index b3b939eae88..1f1bb36aace 100644 --- a/compiler/rustc_query_system/src/query/plumbing.rs +++ b/compiler/rustc_query_system/src/query/plumbing.rs @@ -2,7 +2,7 @@ //! generate the actual methods on tcx which find and execute the provider, //! manage the caches, and so forth. -use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex}; +use crate::dep_graph::{DepContext, DepKind, DepNode, DepNodeIndex, DepNodeParams}; use crate::ich::StableHashingContext; use crate::query::caches::QueryCache; use crate::query::job::{report_cycle, QueryInfo, QueryJob, QueryJobId, QueryJobInfo}; @@ -428,12 +428,29 @@ where // Fast path for when incr. comp. is off. if !dep_graph.is_fully_enabled() { + // Fingerprint the key, just to assert that it doesn't + // have anything we don't consider hashable + if cfg!(debug_assertions) { + let _ = key.to_fingerprint(*qcx.dep_context()); + } + let prof_timer = qcx.dep_context().profiler().query_provider(); let result = qcx.start_query(job_id, Q::DEPTH_LIMIT, None, || { Q::compute(qcx, &key)(*qcx.dep_context(), key) }); let dep_node_index = dep_graph.next_virtual_depnode_index(); prof_timer.finish_with_query_invocation_id(dep_node_index.into()); + + // Similarly, fingerprint the result to assert that + // it doesn't have anything not considered hashable. + if cfg!(debug_assertions) + && let Some(hash_result) = Q::HASH_RESULT + { + qcx.dep_context().with_stable_hashing_context(|mut hcx| { + hash_result(&mut hcx, &result); + }); + } + return (result, dep_node_index); } |
