]> git.lizzy.rs Git - rust.git/commit
Use a `ParamEnvAnd<Predicate>` for caching in `ObligationForest`
authorAaron Hill <aa1ronham@gmail.com>
Thu, 23 Jan 2020 00:23:37 +0000 (19:23 -0500)
committerAaron Hill <aa1ronham@gmail.com>
Thu, 23 Jan 2020 03:20:18 +0000 (22:20 -0500)
commit90afc0765e5e536af6307b63e1655a38df06e235
tree95edd24b57381a4113c04a5fd747d52dadd97076
parentd1e594f4029c6ac8feb7c2acf9f9e04c1b9c493c
Use a `ParamEnvAnd<Predicate>` for caching in `ObligationForest`

Previously, we used a plain `Predicate` to cache results (e.g. successes
and failures) in ObligationForest. However, fulfillment depends on the
precise `ParamEnv` used, so this is unsound in general.

This commit changes the impl of `ForestObligation` for
`PendingPredicateObligation` to use `ParamEnvAnd<Predicate>` instead of
`Predicate` for the associated type. The associated type and method are
renamed from 'predicate' to 'cache_key' to reflect the fact that type is
no longer just a predicate.
src/librustc/traits/fulfill.rs
src/librustc_data_structures/obligation_forest/graphviz.rs
src/librustc_data_structures/obligation_forest/mod.rs
src/librustc_data_structures/obligation_forest/tests.rs