nnethercote · GitHub

added 3 commits

August 7, 2026 13:25
Currently it is modified with the very clunky
`canonical_param_env_cache_get_or_insert` method, which takes two
closures.
This commit replaces that with `with_canonical_param_env_cache` a
simpler accessor that is very similar to the nearby `with_global_cache`.
This lets `canonicalize_param_env` use normal hash map operations.
The commit also:
- Introduces a dedicated `CanonicalParamEnvCache` newtype.
- Adds a helpful comment to `CanonicalizeParamEnvCacheEntry::param_env`.
I now understand what is happening here.
It avoids some repetition.

rust-bors Bot pushed a commit that referenced this pull request

Aug 7, 2026
…, r=<try>
Improve `canonical_param_env_cache`

lcnr

There are two canonicalization steps done by `canonicalize_input` and
`canonicalize_param_env`: `env` (possible cached) and `rest`.
`canonicalize_param_env` does the `env` step. It returns several pieces
of a canonicalizer (either from the cache or by constructing a
canonicalizer) and then `canonicalize_input` uses those parts to
construct a second canonicalizer, which it uses for `rest`.
This commit changes things so that `canonicalize_param_env` does the
`env` part (if necessary) and then returns a canonicalizer that can do
the `rest` part. I find this easier to read. In particular, we no longer
construct an `env` canonicalizer when it's not necessary, we immediately
construct the `rest` canonicalizer.

@nnethercote

@rust-bors rust-bors Bot added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Aug 7, 2026

jhpratt added a commit to jhpratt/rust that referenced this pull request

Aug 7, 2026
…m-env-cache, r=lcnr
Improve `canonical_param_env_cache`
This function is messy and has been bothering me. Several cleanups, details in individual commits.
r? @lcnr

Closed

Merged

rust-bors Bot pushed a commit that referenced this pull request

Aug 7, 2026
…uwer
Rollup of 28 pull requests
Successful merges:
 - #159784 (Hint that memchr returns an in-bounds index)
 - #160673 (Improve `canonical_param_env_cache`)
 - #150885 (Revive L4Re target)
 - #159643 (Add support for splatted function pointers)
 - #160433 (delegation: add support for wrapping of the return value with `From::from`)
 - #160530 (refactor handling of target features in Session)
 - #160606 (bootstrap: Store and use an explicit CheckKind in `check::Rustc`)
 - #160628 (fix ICE in `suggest_add_reference_to_arg` for non-callable items)
 - #160683 (Add regression test for unknown feaeture name reported with other errors)
 - #157641 (Do not promote extern statics)
 - #158904 (Fix FutureDropPoll shim for by-move async closures)
 - #159816 (added note/help about iterator invalidation when mutating a collection inside a for loop)
 - #160103 (Add regression test for GAT bound mismatched type error)
 - #160335 (dlopen offload)
 - #160445 (codegen: classify localized MSVC linker progress as linker_info)
 - #160499 (rustc_resolve: move diagnostic attribute linting to attr parsing)
 - #160504 (cleanup borrowck, improve c-variadic handling)
 - #160577 (expand: Feature gate AST-based attribute macros on expressions and statements)
 - #160587 (Add regression test for associated type outlives bound at call site)
 - #160625 (platform-support/netbsd.md: No longer mention 8.x, due to EoL.)
 - #160633 (delegation: fix determining wrong `FnKind` when delegation is inside const arg)
 - #160636 (derive(Diagnostic): link to proper docs)
 - #160644 (Clean up some manual debug impls)
 - #160649 (move naked function ui tests)
 - #160672 (Improve `MaybeLiveLocals`)
 - #160693 (Add branch config for perf. unrolling in bors)
 - #160696 (rustc_codegen_llvm: handle sm_101* features being an alias)
 - #160706 (renovate: clarify that vulnerability PRs are opened automatically)

@rust-bors

pull Bot pushed a commit to LeeeeeeM/miri that referenced this pull request

Aug 8, 2026

@nnethercote

@lcnr lcnr mentioned this pull request

Aug 13, 2026

Open

8 tasks

Read the original on github.com ↗