Remove Clone impl for StableHashingContext.

`HashStable::hash_stable` takes a `&mut Hcx`. In contrast,
`ToStableHashKey::to_stable_hash_key` takes a `&Hcx`. But there are
some places where the latter calls the former, and due to the mismatch a
`clone` call is required to get a mutable `StableHashingContext`.

This commit changes `to_stable_hash_key` to instead take a `&mut Hcx`.
This eliminates the mismatch, the need for the clones, and the need for
the `Clone` impls.
This commit is contained in:
Nicholas Nethercote
2026-04-02 16:06:59 +11:00
parent 55e86c9968
commit ff1795fe49
21 changed files with 59 additions and 59 deletions
@@ -175,8 +175,8 @@ fn exported_non_generic_symbols_provider_local<'tcx>(
// FIXME: Sorting this is unnecessary since we are sorting later anyway.
// Can we skip the later sorting?
let sorted = tcx.with_stable_hashing_context(|hcx| {
tcx.reachable_non_generics(LOCAL_CRATE).to_sorted(&hcx, true)
let sorted = tcx.with_stable_hashing_context(|mut hcx| {
tcx.reachable_non_generics(LOCAL_CRATE).to_sorted(&mut hcx, true)
});
let mut symbols: Vec<_> =