Remove redundancy in cache key
This commit is contained in:
parent
f583513dc2
commit
3ccb1c37e6
@ -500,7 +500,7 @@ struct Generalizer<'cx, 'tcx> {
|
||||
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
|
||||
cache: MiniMap<(Ty<'tcx>, Ty<'tcx>), RelateResult<'tcx, Ty<'tcx>>>,
|
||||
cache: MiniMap<Ty<'tcx>, RelateResult<'tcx, Ty<'tcx>>>,
|
||||
}
|
||||
|
||||
/// Result from a generalization operation. This includes
|
||||
@ -598,8 +598,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
||||
fn tys(&mut self, t: Ty<'tcx>, t2: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
|
||||
assert_eq!(t, t2); // we are abusing TypeRelation here; both LHS and RHS ought to be ==
|
||||
|
||||
let cache_key = (t, t2);
|
||||
if let Some(result) = self.cache.get(&cache_key) {
|
||||
if let Some(result) = self.cache.get(&t) {
|
||||
return result.clone();
|
||||
}
|
||||
debug!("generalize: t={:?}", t);
|
||||
@ -667,7 +666,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
|
||||
_ => relate::super_relate_tys(self, t, t),
|
||||
};
|
||||
|
||||
self.cache.insert(cache_key, result.clone());
|
||||
self.cache.insert(t, result.clone());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ pub trait Printer<'tcx>: Sized {
|
||||
/// type. It's just a heuristic so it makes some questionable
|
||||
/// decisions and we may want to adjust it later.
|
||||
///
|
||||
/// Visited set is needed in to avoid full iteration over
|
||||
/// Visited set is needed to avoid full iteration over
|
||||
/// deeply nested tuples that have no DefId.
|
||||
fn characteristic_def_id_of_type_cached<'a>(
|
||||
ty: Ty<'a>,
|
||||
|
Loading…
Reference in New Issue
Block a user