Skip to content

Remove Clone impl for StableHashingContext.#154744

Draft
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rm-Clone-for-StableHashingContext
Draft

Remove Clone impl for StableHashingContext.#154744
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:rm-Clone-for-StableHashingContext

Conversation

@nnethercote
Copy link
Copy Markdown
Contributor

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.

`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.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 3, 2026
@nnethercote
Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer
Copy link
Copy Markdown
Collaborator

Awaiting bors try build completion.

@rustbot label: +S-waiting-on-perf

@rust-bors

This comment has been minimized.

rust-bors bot pushed a commit that referenced this pull request Apr 3, 2026
…, r=<try>

Remove `Clone` impl for `StableHashingContext`.
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 3, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 3, 2026

☀️ Try build successful (CI)
Build commit: b67d172 (b67d172374c3229c5c67970f61c951ccc3d2641b, parent: 55e86c996809902e8bbad512cfb4d2c18be446d9)

@rust-timer
Copy link
Copy Markdown
Collaborator

Queued b67d172 with parent 55e86c9, future comparison URL.
There are currently 0 preceding artifacts in the queue.
It will probably take at least ~1.0 hours until the benchmark run finishes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-perf Status: Waiting on a perf run to be completed. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants