Skip to content

Commit 6f5a198

Browse files
committed
Auto merge of #85382 - Aaron1011:project-eval, r=nikomatsakis
Always produce sub-obligations when using cached projection result See #85360 When we skip adding the sub-obligations to the `obligation` list, we can affect whether or not the final result is `EvaluatedToOk` or `EvaluatedToOkModuloObligations`. This creates problems for incremental compilation, since the projection cache is untracked shared state. To solve this issue, we unconditionally process the sub-obligations. Surprisingly, this is a slight performance *win* in many cases.
2 parents 746ac21 + 8657bb2 commit 6f5a198

File tree

1 file changed

+1
-9
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+1
-9
lines changed

compiler/rustc_trait_selection/src/traits/project.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -529,15 +529,7 @@ fn opt_normalize_projection_type<'a, 'b, 'tcx>(
529529
// evaluation this is not the case, and dropping the trait
530530
// evaluations can causes ICEs (e.g., #43132).
531531
debug!(?ty, "found normalized ty");
532-
533-
// Once we have inferred everything we need to know, we
534-
// can ignore the `obligations` from that point on.
535-
if infcx.unresolved_type_vars(&ty.value).is_none() {
536-
infcx.inner.borrow_mut().projection_cache().complete_normalized(cache_key, &ty);
537-
// No need to extend `obligations`.
538-
} else {
539-
obligations.extend(ty.obligations);
540-
}
532+
obligations.extend(ty.obligations);
541533
return Ok(Some(ty.value));
542534
}
543535
Err(ProjectionCacheEntry::Error) => {

0 commit comments

Comments
 (0)