Auto merge of #107542 - compiler-errors:param-envs-with-inference-vars-are-cursed, r=jackh726
Don't call `with_reveal_all_normalized` in const-eval when `param_env` has inference vars in it **what:** This slightly shifts the order of operations from an existing hack:5b6ed253c4/compiler/rustc_middle/src/ty/consts/kind.rs (L225-L230)
in order to avoid calling a tcx query (`TyCtxt::reveal_opaque_types_in_bounds`, via `ParamEnv::with_reveal_all_normalized`) when a param-env has inference variables in it. **why:** This allows us to enable fingerprinting of query keys/values outside of incr-comp in deubg mode, to make sure we catch other places where we're passing infer vars and other bad things into query keys. Currently that (bbf33836b9
) crashes because we introduce inference vars into a param-env in the blanket-impl finder in rustdoc 😓5b6ed253c4/src/librustdoc/clean/blanket_impl.rs (L43)
See the CI failure here: https://github.com/rust-lang/rust/actions/runs/4058194838/jobs/6984834619
This commit is contained in:
commit
f77f4d55bd
3 changed files with 23 additions and 7 deletions
|
@ -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};
|
||||
|
@ -408,10 +408,27 @@ 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));
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue