@@ -462,19 +462,13 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
462462 selcx. infcx ( ) . report_overflow_error ( & obligation, false ) ;
463463 }
464464 Err ( ProjectionCacheEntry :: NormalizedTy ( ty) ) => {
465- // If we find the value in the cache, then return it along
466- // with the obligations that went along with it. Note
467- // that, when using a fulfillment context, these
468- // obligations could in principle be ignored: they have
469- // already been registered when the cache entry was
470- // created (and hence the new ones will quickly be
471- // discarded as duplicated). But when doing trait
472- // evaluation this is not the case, and dropping the trait
473- // evaluations can causes ICEs (e.g. #43132).
465+ // If we find the value in the cache, then the obligations
466+ // have already been returned from the previous entry (and
467+ // should therefore have been honored).
474468 debug ! ( "opt_normalize_projection_type: \
475469 found normalized ty `{:?}`",
476470 ty) ;
477- return Some ( ty ) ;
471+ return Some ( NormalizedTy { value : ty , obligations : vec ! [ ] } ) ;
478472 }
479473 Err ( ProjectionCacheEntry :: Error ) => {
480474 debug ! ( "opt_normalize_projection_type: \
@@ -1342,7 +1336,7 @@ enum ProjectionCacheEntry<'tcx> {
13421336 InProgress ,
13431337 Ambiguous ,
13441338 Error ,
1345- NormalizedTy ( NormalizedTy < ' tcx > ) ,
1339+ NormalizedTy ( Ty < ' tcx > ) ,
13461340}
13471341
13481342// NB: intentionally not Clone
@@ -1395,7 +1389,7 @@ impl<'tcx> ProjectionCache<'tcx> {
13951389 let fresh_key = if cacheable {
13961390 debug ! ( "ProjectionCacheEntry::complete: adding cache entry: key={:?}, value={:?}" ,
13971391 key, value) ;
1398- self . map . insert ( key, ProjectionCacheEntry :: NormalizedTy ( value. clone ( ) ) )
1392+ self . map . insert ( key, ProjectionCacheEntry :: NormalizedTy ( value. value ) )
13991393 } else {
14001394 debug ! ( "ProjectionCacheEntry::complete: cannot cache: key={:?}, value={:?}" ,
14011395 key, value) ;
0 commit comments