Auto merge of #95524 - oli-obk:cached_stable_hash_cleanups, r=nnethercote
Cached stable hash cleanups r? `@nnethercote` Add a sanity assertion in debug mode to check that the cached hashes are actually the ones we get if we compute the hash each time. Add a new data structure that bundles all the hash-caching work to make it easier to re-use it for different interned data structures
This commit is contained in:
commit
e980c62955
13 changed files with 275 additions and 222 deletions
|
@ -8,7 +8,6 @@
|
|||
//! In this case we try to build an abstract representation of this constant using
|
||||
//! `thir_abstract_const` which can then be checked for structural equality with other
|
||||
//! generic constants mentioned in the `caller_bounds` of the current environment.
|
||||
use rustc_data_structures::intern::Interned;
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_index::vec::IndexVec;
|
||||
|
@ -414,14 +413,12 @@ impl<'a, 'tcx> AbstractConstBuilder<'a, 'tcx> {
|
|||
self.recurse_build(self.body_id)?;
|
||||
|
||||
for n in self.nodes.iter() {
|
||||
if let Node::Leaf(ty::Const(Interned(
|
||||
ty::ConstS { val: ty::ConstKind::Unevaluated(ct), ty: _ },
|
||||
_,
|
||||
))) = n
|
||||
{
|
||||
// `AbstractConst`s should not contain any promoteds as they require references which
|
||||
// are not allowed.
|
||||
assert_eq!(ct.promoted, None);
|
||||
if let Node::Leaf(ct) = n {
|
||||
if let ty::ConstKind::Unevaluated(ct) = ct.val() {
|
||||
// `AbstractConst`s should not contain any promoteds as they require references which
|
||||
// are not allowed.
|
||||
assert_eq!(ct.promoted, None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue