@@ -486,7 +486,7 @@ struct Generalizer<'cx, 'tcx> {
486486
487487 param_env : ty:: ParamEnv < ' tcx > ,
488488
489- cache : SsoHashMap < Ty < ' tcx > , RelateResult < ' tcx , Ty < ' tcx > > > ,
489+ cache : SsoHashMap < Ty < ' tcx > , Ty < ' tcx > > ,
490490}
491491
492492/// Result from a generalization operation. This includes
@@ -593,8 +593,8 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
593593 fn tys ( & mut self , t : Ty < ' tcx > , t2 : Ty < ' tcx > ) -> RelateResult < ' tcx , Ty < ' tcx > > {
594594 assert_eq ! ( t, t2) ; // we are abusing TypeRelation here; both LHS and RHS ought to be ==
595595
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 ) ;
598598 }
599599 debug ! ( "generalize: t={:?}" , t) ;
600600
@@ -664,10 +664,10 @@ impl<'tcx> TypeRelation<'tcx> for Generalizer<'_, 'tcx> {
664664 Ok ( t)
665665 }
666666 _ => relate:: super_relate_tys ( self , t, t) ,
667- } ;
667+ } ? ;
668668
669- self . cache . insert ( t, result. clone ( ) ) ;
670- return result;
669+ self . cache . insert ( t, result) ;
670+ Ok ( result)
671671 }
672672
673673 fn regions (
0 commit comments