include ParamEnv in projection cache key

This commit is contained in:
Lukas Markeffsky 2024-04-20 16:42:18 +02:00
parent 584f183dc0
commit 88b10c1162
4 changed files with 19 additions and 13 deletions

View file

@ -815,7 +815,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
// `EvaluatedToOkModuloRegions`), and skip re-evaluating the
// sub-obligations.
if let Some(key) =
ProjectionCacheKey::from_poly_projection_predicate(self, data)
ProjectionCacheKey::from_poly_projection_obligation(
self,
&project_obligation,
)
{
if let Some(cached_res) = self
.infcx
@ -844,8 +847,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
&& (eval_rslt == EvaluatedToOk
|| eval_rslt == EvaluatedToOkModuloRegions)
&& let Some(key) =
ProjectionCacheKey::from_poly_projection_predicate(
self, data,
ProjectionCacheKey::from_poly_projection_obligation(
self,
&project_obligation,
)
{
// If the result is something that we can cache, then mark this