Skip to content
Merged
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
41 changes: 0 additions & 41 deletions compiler/rustc_middle/src/ich/impls_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@

use rustc_ast as ast;
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_hir as hir;
use rustc_span::{Symbol, sym};
use smallvec::SmallVec;

use super::StableHashingContext;

Expand All @@ -16,44 +13,6 @@ impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
}
}

impl<'a> HashStable<StableHashingContext<'a>> for [hir::Attribute] {
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
if self.is_empty() {
self.len().hash_stable(hcx, hasher);
return;
}

// Some attributes are always ignored during hashing.
let filtered: SmallVec<[&hir::Attribute; 8]> = self
.iter()
.filter(|attr| {
attr.is_doc_comment().is_none()
// FIXME(jdonszelmann) have a better way to handle ignored attrs
&& !attr.name().is_some_and(|ident| is_ignored_attr(ident))
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer Apr 7, 2026

Choose a reason for hiding this comment

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

In fact attr.name() is not implemented for parsed attributes, so this check is always false.
Since other than cfg_trace all the attributes are only used for incremental tests, and the incremental tests still pass, I don't think this check is useful

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(attr.name() will be removed in the near future, as a follow-up of #154808)

})
.collect();

filtered.len().hash_stable(hcx, hasher);
for attr in filtered {
attr.hash_stable(hcx, hasher);
}
}
}

#[inline]
fn is_ignored_attr(name: Symbol) -> bool {
const IGNORED_ATTRIBUTES: &[Symbol] = &[
sym::cfg_trace, // FIXME(#138844) should this really be ignored?
sym::rustc_if_this_changed,
sym::rustc_then_this_would_need,
sym::rustc_clean,
sym::rustc_partition_reused,
sym::rustc_partition_codegened,
sym::rustc_expected_cgu_reuse,
];
IGNORED_ATTRIBUTES.contains(&name)
}

impl<'tcx> HashStable<StableHashingContext<'tcx>> for rustc_feature::Features {
fn hash_stable(&self, hcx: &mut StableHashingContext<'tcx>, hasher: &mut StableHasher) {
// Unfortunately we cannot exhaustively list fields here, since the
Expand Down
Loading