Skip to content

Remove last vestiges of skippng ident span hashing #96016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/rustc_ast/src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ impl PartialEq<Symbol> for Path {
}
}

impl<CTX> HashStable<CTX> for Path {
impl<CTX: rustc_span::HashStableContext> HashStable<CTX> for Path {
Copy link
Contributor

Choose a reason for hiding this comment

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

Where is this impl used?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is needed to be able to call ident.hash_stable

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean the impl for Path.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's used by AttrItem and other AST structs

fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
self.segments.len().hash_stable(hcx, hasher);
for segment in &self.segments {
segment.ident.name.hash_stable(hcx, hasher);
segment.ident.hash_stable(hcx, hasher);
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions compiler/rustc_span/src/hygiene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@ impl !PartialOrd for LocalExpnId {}
/// of `HashingControls` settings.
fn assert_default_hashing_controls<CTX: HashStableContext>(ctx: &CTX, msg: &str) {
match ctx.hashing_controls() {
// Ideally, we would also check that `node_id_hashing_mode` was always
// `NodeIdHashingMode::HashDefPath`. However, we currently end up hashing
// `Span`s in this mode, and there's not an easy way to change that.
// All of the span-related data that we hash is pretty self-contained
// (in particular, we don't hash any `HirId`s), so this shouldn't result
// in any caching problems.
// FIXME: Enforce that we don't end up transitively hashing any `HirId`s,
// or ensure that this method is always invoked with the same
// `NodeIdHashingMode`
//
// Note that we require that `hash_spans` be set according to the global
// `-Z incremental-ignore-spans` option. Normally, this option is disabled,
// which will cause us to require that this method always be called with `Span` hashing
Expand Down