Skip to content

Commit 3fee9c9

Browse files
committed
Auto merge of #117749 - aliemjay:perf-canon-cache, r=lcnr
cache param env canonicalization Canonicalize ParamEnv only once and store it. Then whenever we try to canonicalize `ParamEnvAnd<'tcx, T>` we only have to canonicalize `T` and then merge the results. Prelimiary results show ~3-4% savings in diesel and serde benchmarks. Best to review commits individually. Some commits have a short description. Initial implementation had a soundness bug (rust-lang/rust#117749 (comment)) due to cache invalidation: - When canonicalizing `Ty<'?0>` we first try to resolve region variables in the current InferCtxt which may have a constraint `?0 == 'static`. This means that we register `Ty<'?0> => Canonical<Ty<'static>>` in the cache, which is obviously incorrect in another inference context. - This is fixed by not doing region resolution when canonicalizing the query *input* (vs. response), which is the only place where ParamEnv is used, and then in a later commit we *statically* guard against any form of inference variable resolution of the cached canonical ParamEnv's. r? `@ghost`
2 parents 031926a + b57f3b0 commit 3fee9c9

File tree

0 file changed

+0
-0
lines changed

    0 file changed

    +0
    -0
    lines changed

    0 commit comments

    Comments
     (0)