@@ -462,19 +462,13 @@ fn opt_normalize_projection_type<'a, 'b, 'gcx, 'tcx>(
462
462
selcx. infcx ( ) . report_overflow_error ( & obligation, false ) ;
463
463
}
464
464
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).
474
468
debug ! ( "opt_normalize_projection_type: \
475
469
found normalized ty `{:?}`",
476
470
ty) ;
477
- return Some ( ty ) ;
471
+ return Some ( NormalizedTy { value : ty , obligations : vec ! [ ] } ) ;
478
472
}
479
473
Err ( ProjectionCacheEntry :: Error ) => {
480
474
debug ! ( "opt_normalize_projection_type: \
@@ -1342,7 +1336,7 @@ enum ProjectionCacheEntry<'tcx> {
1342
1336
InProgress ,
1343
1337
Ambiguous ,
1344
1338
Error ,
1345
- NormalizedTy ( NormalizedTy < ' tcx > ) ,
1339
+ NormalizedTy ( Ty < ' tcx > ) ,
1346
1340
}
1347
1341
1348
1342
// NB: intentionally not Clone
@@ -1395,7 +1389,7 @@ impl<'tcx> ProjectionCache<'tcx> {
1395
1389
let fresh_key = if cacheable {
1396
1390
debug ! ( "ProjectionCacheEntry::complete: adding cache entry: key={:?}, value={:?}" ,
1397
1391
key, value) ;
1398
- self . map . insert ( key, ProjectionCacheEntry :: NormalizedTy ( value. clone ( ) ) )
1392
+ self . map . insert ( key, ProjectionCacheEntry :: NormalizedTy ( value. value ) )
1399
1393
} else {
1400
1394
debug ! ( "ProjectionCacheEntry::complete: cannot cache: key={:?}, value={:?}" ,
1401
1395
key, value) ;
0 commit comments