Use Hcx/hcx consistently for StableHashingContext.#154634
Open
nnethercote wants to merge 1 commit intorust-lang:mainfrom
Open
Use Hcx/hcx consistently for StableHashingContext.#154634nnethercote wants to merge 1 commit intorust-lang:mainfrom
Hcx/hcx consistently for StableHashingContext.#154634nnethercote wants to merge 1 commit intorust-lang:mainfrom
Conversation
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.
Collaborator
|
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 |
Contributor
|
@bors r+ |
Contributor
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
HashStableandToStableHashKeytraits both have a type parameter that is sometimes calledCTXand sometimes calledHCX. (In practice this type parameter is always instantiated asStableHashingContext.) Similarly, variables with these types are sometimes calledctxand sometimes calledhcx. This inconsistency has bugged me for some time.The
HCX/hcxform is more informative (theH/hindicates what type of context it is) and it matches other cases liketcx,dcx,icx.Also, RFC 430 says that type parameters should have names that are "concise UpperCamelCase, usually single uppercase letter: T". In this case
Hfeels insufficient, andHcxfeels better.Therefore, this commit changes the code to use
Hcx/hcxeverywhere.r? @petrochenkov