Skip to content

Commit b0db534

Browse files
tmandryMark-Simulacrum
authored andcommitted
Remove redundancy in cache key
1 parent 507dd1d commit b0db534

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/librustc_infer/infer/combine.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ struct Generalizer<'cx, 'tcx> {
500500

501501
param_env: ty::ParamEnv<'tcx>,
502502

503-
cache: MiniMap<(Ty<'tcx>, Ty<'tcx>), RelateResult<'tcx, Ty<'tcx>>>,
503+
cache: MiniMap<Ty<'tcx>, RelateResult<'tcx, Ty<'tcx>>>,
504504
}
505505

506506
/// Result from a generalization operation. This includes
@@ -598,8 +598,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
598598
fn tys(&mut self, t: Ty<'tcx>, t2: Ty<'tcx>) -> RelateResult<'tcx, Ty<'tcx>> {
599599
assert_eq!(t, t2); // we are abusing TypeRelation here; both LHS and RHS ought to be ==
600600

601-
let cache_key = (t, t2);
602-
if let Some(result) = self.cache.get(&cache_key) {
601+
if let Some(result) = self.cache.get(&t) {
603602
return result.clone();
604603
}
605604
debug!("generalize: t={:?}", t);
@@ -667,7 +666,7 @@ impl TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
667666
_ => relate::super_relate_tys(self, t, t),
668667
};
669668

670-
self.cache.insert(cache_key, result.clone());
669+
self.cache.insert(t, result.clone());
671670
return result;
672671
}
673672

src/librustc_middle/ty/print/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ pub trait Printer<'tcx>: Sized {
267267
/// type. It's just a heuristic so it makes some questionable
268268
/// decisions and we may want to adjust it later.
269269
///
270-
/// Visited set is needed in to avoid full iteration over
270+
/// Visited set is needed to avoid full iteration over
271271
/// deeply nested tuples that have no DefId.
272272
fn characteristic_def_id_of_type_cached<'a>(
273273
ty: Ty<'a>,

0 commit comments

Comments
 (0)