@@ -486,7 +486,7 @@ struct Generalizer<'cx, 'tcx> {
486
486
487
487
param_env : ty:: ParamEnv < ' tcx > ,
488
488
489
- cache : SsoHashMap < Ty < ' tcx > , RelateResult < ' tcx , Ty < ' tcx > > > ,
489
+ cache : SsoHashMap < Ty < ' tcx > , Ty < ' tcx > > ,
490
490
}
491
491
492
492
/// Result from a generalization operation. This includes
@@ -593,8 +593,8 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
593
593
fn tys ( & mut self , t : Ty < ' tcx > , t2 : Ty < ' tcx > ) -> RelateResult < ' tcx , Ty < ' tcx > > {
594
594
assert_eq ! ( t, t2) ; // we are abusing TypeRelation here; both LHS and RHS ought to be ==
595
595
596
- if let Some ( result) = self . cache . get ( & t) {
597
- return result . clone ( ) ;
596
+ if let Some ( & result) = self . cache . get ( & t) {
597
+ return Ok ( result ) ;
598
598
}
599
599
debug ! ( "generalize: t={:?}" , t) ;
600
600
@@ -664,10 +664,10 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
664
664
Ok ( t)
665
665
}
666
666
_ => relate:: super_relate_tys ( self , t, t) ,
667
- } ;
667
+ } ? ;
668
668
669
- self . cache . insert ( t, result. clone ( ) ) ;
670
- return result;
669
+ self . cache . insert ( t, result) ;
670
+ Ok ( result)
671
671
}
672
672
673
673
fn regions (
0 commit comments