Skip to content

Avoid stdlib's impl Hash for Path for stable hashing - #164458

Open
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:path-hash
Open

Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:path-hash

Conversation

@Zalathar

@Zalathar Zalathar commented Oct 17, 2026 •

Copy link
Copy Markdown
Member

A subtle consequence of the stage0 redesign is that the compiler must take care to avoid relying on any stdlib-provided Hash impl when computing stable hashes, or at least any such impl that is actually liable to change.

This was noticed when trying to strengthen the provided Hash impl for Path, which triggered baffling CI failures because the stable hashes produced by the stage1 compiler (built against stage0 stdlib) were inconsistent with the ones that would have been produced by the stage2 compiler (built against in-tree stdlib).

This PR aims to unblock changes to impl Hash for Path, by making the compiler not rely on it for stable hashing. It does not attempt to solve the broader problem of the compiler relying on stdlib hash details.

@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 Oct 17, 2026
@rust-log-analyzer

This comment was marked as resolved.

This will make it possible to remove the compiler's Hash impl for FileName.
@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Oct 17, 2026
@Zalathar
Zalathar marked this pull request as ready for review October 17, 2026 11:14
@rustbot

rustbot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

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

cc @rust-lang/clippy

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 17, 2026
@rustbot

rustbot commented Oct 17, 2026

Copy link
Copy Markdown
Collaborator

r? @TaKO8Ki

rustbot has assigned @TaKO8Ki.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 77 candidates
  • Random selection from 20 candidates

A subtle consequence of the stage0 redesign is that the compiler must take care
to avoid relying on any stdlib-provided Hash impl when computing stable hashes,
or at least any such impl that is actually liable to change.

This was noticed when trying to strengthen the provided Hash impl for Path,
which triggered baffling CI failures because the stable hashes produced by the
stage1 compiler (built against stage0 stdlib) were inconsistent with the ones
that would have been produced by the stage2 compiler (built against in-tree
stdlib).

This PR aims to unblock changes to `impl Hash for Path`, by making the compiler
not rely on it for stable hashing. It does not attempt to solve the broader
problem of the compiler relying on stdlib hash details.

This branch has not been deployed

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

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-clippy Relevant to the Clippy team. 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.

4 participants