Skip to content

Make stable hashing names consistent (part 1)#156030

Merged
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
nnethercote:StableHash-renamings
May 2, 2026
Merged

Make stable hashing names consistent (part 1)#156030
rust-bors[bot] merged 4 commits intorust-lang:mainfrom
nnethercote:StableHash-renamings

Conversation

@nnethercote
Copy link
Copy Markdown
Contributor

This PR starts the implementation of MCP 893. It renames the things that appear in the HashStable trait, changing this:

pub trait HashStable {
    fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}

to this:

pub trait StableHash {
    fn stable_hash<Hcx: StableHashCtxt>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}

Details in individual commits.

This is the biggest part of the renaming. A follow-up PR will rename the remaining things.

r? @jieyouxu

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 1, 2026

Some changes occurred in compiler/rustc_ast/src/expand/autodiff_attrs.rs

cc @ZuseZ4

Some changes occurred to diagnostic attributes.

cc @mejrs

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in abstract_const.rs

cc @BoxyUwU

The Cranelift subtree was changed

cc @bjorn3

rust-analyzer is developed in its own repository. If possible, consider making this change to rust-lang/rust-analyzer instead.

cc @rust-lang/rust-analyzer

Some changes occurred in coverage instrumentation.

cc @Zalathar

rustc_error_messages was changed

cc @TaKO8Ki

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @tshepang

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri, @RalfJung, @oli-obk, @lcnr

These commits modify compiler targets.
(See the Target Tier Policy.)

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @vakaras

Some changes occurred in compiler/rustc_ast/src/expand/typetree.rs

cc @ZuseZ4

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic F-autodiff `#![feature(autodiff)]` 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels May 1, 2026
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JonathanBrouwer JonathanBrouwer added S-blocked Status: Blocked on something else such as an RFC or other implementation work. needs-mcp This change is large enough that it needs a major change proposal before starting work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 1, 2026
@rust-bors

This comment has been minimized.

@JonathanBrouwer JonathanBrouwer removed the S-blocked Status: Blocked on something else such as an RFC or other implementation work. label May 2, 2026
@JonathanBrouwer JonathanBrouwer force-pushed the StableHash-renamings branch from 3e181f9 to 36b9dd7 Compare May 2, 2026 07:31
@rustbot

This comment has been minimized.

@JonathanBrouwer
Copy link
Copy Markdown
Contributor

JonathanBrouwer commented May 2, 2026

^ Solved conflicts
@bors r+ rollup p=1
p=1 because this is quite brittle

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 2, 2026

📌 Commit 36b9dd7 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@rust-bors rust-bors Bot added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 2, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request May 2, 2026
…r=JonathanBrouwer

Make stable hashing names consistent (part 1)

This PR starts the implementation of MCP 893. It renames the things that appear in the `HashStable` trait, changing this:
```
pub trait HashStable {
    fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}
```
to this:
```
pub trait StableHash {
    fn stable_hash<Hcx: StableHashCtxt>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}
```
Details in individual commits.

This is the biggest part of the renaming. A follow-up PR will rename the remaining things.

r? @jieyouxu
Specifically:
- `HashStable` -> `StableHash` (trait)
- `HashStable` -> `StableHash` (derive)
- `HashStable_NoContext` -> `StableHash_NoContext` (derive)

Note: there are some names in `compiler/rustc_macros/src/hash_stable.rs`
that are still to be renamed, e.g. `HashStableMode`.

Part of MCP 983.
@JonathanBrouwer JonathanBrouwer force-pushed the StableHash-renamings branch from 36b9dd7 to e7d28d3 Compare May 2, 2026 08:18
@rust-bors rust-bors Bot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 2, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 2, 2026

⚠️ A new commit e7d28d3e9b6daaec005e0a56ca8998af10fe6fc3 was pushed.

This pull request was unapproved.

@rust-bors rust-bors Bot removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label May 2, 2026
@JonathanBrouwer
Copy link
Copy Markdown
Contributor

^ Rebased to solve a soft conflict
@bors r+

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented May 2, 2026

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors Bot commented May 2, 2026

📌 Commit e7d28d3 has been approved by JonathanBrouwer

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 2, 2026
rust-bors Bot pushed a commit that referenced this pull request May 2, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - #156030 (Make stable hashing names consistent (part 1))
 - #156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - #156021 (Clean up some traits)
 - #156028 (Add a `Local::arg(i)` helper constructor)
 - #156037 (Add AcceptContext::expect_no_args)
 - #156040 (Add missing alias to mailmap)
 - #156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - #156053 (Reuse CTFE MIR for constructors.)
 - #156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - #155940 (refactor rustc_on_unimplemented's filtering)
 - #156065 (Remove unused spans from AttributeKind)
@rust-bors rust-bors Bot merged commit 52b4eb2 into rust-lang:main May 2, 2026
11 checks passed
@rustbot rustbot added this to the 1.97.0 milestone May 2, 2026
rust-timer added a commit that referenced this pull request May 2, 2026
Rollup merge of #156030 - nnethercote:StableHash-renamings, r=JonathanBrouwer

Make stable hashing names consistent (part 1)

This PR starts the implementation of MCP 893. It renames the things that appear in the `HashStable` trait, changing this:
```
pub trait HashStable {
    fn hash_stable<Hcx: HashStableContext>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}
```
to this:
```
pub trait StableHash {
    fn stable_hash<Hcx: StableHashCtxt>(&self, hcx: &mut Hcx, hasher: &mut StableHasher);
}
```
Details in individual commits.

This is the biggest part of the renaming. A follow-up PR will rename the remaining things.

r? @jieyouxu
github-actions Bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request May 4, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#156030 (Make stable hashing names consistent (part 1))
 - rust-lang/rust#156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - rust-lang/rust#156021 (Clean up some traits)
 - rust-lang/rust#156028 (Add a `Local::arg(i)` helper constructor)
 - rust-lang/rust#156037 (Add AcceptContext::expect_no_args)
 - rust-lang/rust#156040 (Add missing alias to mailmap)
 - rust-lang/rust#156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - rust-lang/rust#156053 (Reuse CTFE MIR for constructors.)
 - rust-lang/rust#156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - rust-lang/rust#155940 (refactor rustc_on_unimplemented's filtering)
 - rust-lang/rust#156065 (Remove unused spans from AttributeKind)
pull Bot pushed a commit to Kokoro2336/rust-analyzer that referenced this pull request May 4, 2026
…uwer

Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#156030 (Make stable hashing names consistent (part 1))
 - rust-lang/rust#156020 (Improve source code for `librustdoc/visit_ast.rs`)
 - rust-lang/rust#156021 (Clean up some traits)
 - rust-lang/rust#156028 (Add a `Local::arg(i)` helper constructor)
 - rust-lang/rust#156037 (Add AcceptContext::expect_no_args)
 - rust-lang/rust#156040 (Add missing alias to mailmap)
 - rust-lang/rust#156048 (Make `diverging_type_vars` a vec of `TyVid`)
 - rust-lang/rust#156053 (Reuse CTFE MIR for constructors.)
 - rust-lang/rust#156059 (compiler: Print valid `-Zmir-enable-passes` names if invalid name is used)

Failed merges:

 - rust-lang/rust#155940 (refactor rustc_on_unimplemented's filtering)
 - rust-lang/rust#156065 (Remove unused spans from AttributeKind)
copybara-service Bot pushed a commit to google/crubit that referenced this pull request May 4, 2026
1. The `HashStable` trait was renamed to `StableHash`, and its method was also renamed to match.

    rust-lang/rust#156030

2. `rustc_hir::attrs::AttributeKind::NoStd` is now fieldless.

    rust-lang/rust#156065

PiperOrigin-RevId: 910142545
copybara-service Bot pushed a commit to google/crubit that referenced this pull request May 4, 2026
1. The `HashStable` trait was renamed to `StableHash`, and its method was also renamed to match.

    rust-lang/rust#156030

2. `rustc_hir::attrs::AttributeKind::NoStd` is now fieldless.

    rust-lang/rust#156065

PiperOrigin-RevId: 910142545
copybara-service Bot pushed a commit to google/crubit that referenced this pull request May 4, 2026
1. The `HashStable` trait was renamed to `StableHash`, and its method was also renamed to match.

    rust-lang/rust#156030

2. `rustc_hir::attrs::AttributeKind::NoStd` is now fieldless.

    rust-lang/rust#156065

PiperOrigin-RevId: 910142545
copybara-service Bot pushed a commit to google/crubit that referenced this pull request May 4, 2026
1. The `HashStable` trait was renamed to `StableHash`, and its method was also renamed to match.

    rust-lang/rust#156030

2. `rustc_hir::attrs::AttributeKind::{NoStd, NoCore}` are now fieldless.

    rust-lang/rust#156065

PiperOrigin-RevId: 910142545
copybara-service Bot pushed a commit to google/crubit that referenced this pull request May 4, 2026
1. The `HashStable` trait was renamed to `StableHash`, and its method was also renamed to match.

    rust-lang/rust#156030

2. `rustc_hir::attrs::AttributeKind::{NoStd, NoCore}` are now fieldless.

    rust-lang/rust#156065

PiperOrigin-RevId: 910142545
copybara-service Bot pushed a commit to google/crubit that referenced this pull request May 4, 2026
1. The `HashStable` trait was renamed to `StableHash`, and its method was also renamed to match.

    rust-lang/rust#156030

2. `rustc_hir::attrs::AttributeKind::{NoStd, NoCore}` are now fieldless.

    rust-lang/rust#156065

PiperOrigin-RevId: 910219736
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-rustc-dev-guide Area: rustc-dev-guide A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic F-autodiff `#![feature(autodiff)]` needs-mcp This change is large enough that it needs a major change proposal before starting work. 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. T-rust-analyzer Relevant to the rust-analyzer team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants