Skip to content

Use Hcx/hcx consistently for StableHashingContext.#154634

Open
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:hcx
Open

Use Hcx/hcx consistently for StableHashingContext.#154634
nnethercote wants to merge 1 commit intorust-lang:mainfrom
nnethercote:hcx

Conversation

@nnethercote
Copy link
Copy Markdown
Contributor

The HashStable and ToStableHashKey traits both have a type parameter that is sometimes called CTX and sometimes called HCX. (In practice this type parameter is always instantiated as StableHashingContext.) Similarly, variables with these types are sometimes called ctx and sometimes called hcx. This inconsistency has bugged me for some time.

The HCX/hcx form is more informative (the H/h indicates what type of context it is) and it matches other cases like tcx, dcx, icx.

Also, RFC 430 says that type parameters should have names that are "concise UpperCamelCase, usually single uppercase letter: T". In this case H feels insufficient, and Hcx feels better.

Therefore, this commit changes the code to use Hcx/hcx everywhere.

r? @petrochenkov

The `HashStable` and `ToStableHashKey` traits both have a type parameter
that is sometimes called `CTX` and sometimes called `HCX`. (In practice
this type parameter is always instantiated as `StableHashingContext`.)
Similarly, variables with these types are sometimes called `ctx` and
sometimes called `hcx`. This inconsistency has bugged me for some time.

The `HCX`/`hcx` form is more informative (the `H`/`h` indicates what
type of context it is) and it matches other cases like `tcx`, `dcx`,
`icx`.

Also, RFC 430 says that type parameters should have names that are
"concise UpperCamelCase, usually single uppercase letter: T". In this
case `H` feels insufficient, and `Hcx` feels better.

Therefore, this commit changes the code to use `Hcx`/`hcx` everywhere.
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 31, 2026

Some changes occurred in compiler/rustc_codegen_cranelift

cc @bjorn3

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 31, 2026
@petrochenkov
Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 31, 2026

📌 Commit ccc3c01 has been approved by petrochenkov

It is now in the queue for this repository.

@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 Mar 31, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Mar 31, 2026
Use `Hcx`/`hcx` consistently for `StableHashingContext`.

The `HashStable` and `ToStableHashKey` traits both have a type parameter that is sometimes called `CTX` and sometimes called `HCX`. (In practice this type parameter is always instantiated as `StableHashingContext`.) Similarly, variables with these types are sometimes called `ctx` and sometimes called `hcx`. This inconsistency has bugged me for some time.

The `HCX`/`hcx` form is more informative (the `H`/`h` indicates what type of context it is) and it matches other cases like `tcx`, `dcx`, `icx`.

Also, RFC 430 says that type parameters should have names that are "concise UpperCamelCase, usually single uppercase letter: T". In this case `H` feels insufficient, and `Hcx` feels better.

Therefore, this commit changes the code to use `Hcx`/`hcx` everywhere.

r? @petrochenkov
rust-bors bot pushed a commit that referenced this pull request Mar 31, 2026
…uwer

Rollup of 4 pull requests

Successful merges:

 - #150752 (Update libc to v0.2.183)
 - #152432 (add rustc option -Zpacked-stack)
 - #154634 (Use `Hcx`/`hcx` consistently for `StableHashingContext`.)
 - #154635 (./x run miri: default to edition 2021)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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