Skip to content

Commit 092e1c9

Browse files
committed
Auto merge of #92534 - Aaron1011:hash-hir, r=petrochenkov
Hash `Ident` spans in all HIR structures This PR removes all of the `#[stable_hasher(project(name))]` attributes used in HIR structs. While these attributes are not known to be causing any issues in practice, we need to hash these in order for the incremental system to work correctly - a query could be otherwise be incorrectly marked green when a change occures in one of the `Span`s that it uses.
2 parents f7bb8e3 + 467b726 commit 092e1c9

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

compiler/rustc_hir/src/hir.rs

-8
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,6 @@ impl Path<'_> {
205205
#[derive(Debug, HashStable_Generic)]
206206
pub struct PathSegment<'hir> {
207207
/// The identifier portion of this path segment.
208-
#[stable_hasher(project(name))]
209208
pub ident: Ident,
210209
// `id` and `res` are optional. We currently only use these in save-analysis,
211210
// any path segments without these will not have save-analysis info and
@@ -850,7 +849,6 @@ pub struct PatField<'hir> {
850849
#[stable_hasher(ignore)]
851850
pub hir_id: HirId,
852851
/// The identifier for the field.
853-
#[stable_hasher(project(name))]
854852
pub ident: Ident,
855853
/// The pattern the field is destructured to.
856854
pub pat: &'hir Pat<'hir>,
@@ -2127,7 +2125,6 @@ pub const FN_OUTPUT_NAME: Symbol = sym::Output;
21272125
#[derive(Debug, HashStable_Generic)]
21282126
pub struct TypeBinding<'hir> {
21292127
pub hir_id: HirId,
2130-
#[stable_hasher(project(name))]
21312128
pub ident: Ident,
21322129
pub gen_args: &'hir GenericArgs<'hir>,
21332130
pub kind: TypeBindingKind<'hir>,
@@ -2515,7 +2512,6 @@ pub struct EnumDef<'hir> {
25152512
#[derive(Debug, HashStable_Generic)]
25162513
pub struct Variant<'hir> {
25172514
/// Name of the variant.
2518-
#[stable_hasher(project(name))]
25192515
pub ident: Ident,
25202516
/// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`).
25212517
pub id: HirId,
@@ -2605,7 +2601,6 @@ impl VisibilityKind<'_> {
26052601
#[derive(Debug, HashStable_Generic)]
26062602
pub struct FieldDef<'hir> {
26072603
pub span: Span,
2608-
#[stable_hasher(project(name))]
26092604
pub ident: Ident,
26102605
pub vis: Visibility<'hir>,
26112606
pub hir_id: HirId,
@@ -2864,7 +2859,6 @@ impl ItemKind<'_> {
28642859
#[derive(Encodable, Debug, HashStable_Generic)]
28652860
pub struct TraitItemRef {
28662861
pub id: TraitItemId,
2867-
#[stable_hasher(project(name))]
28682862
pub ident: Ident,
28692863
pub kind: AssocItemKind,
28702864
pub span: Span,
@@ -2880,7 +2874,6 @@ pub struct TraitItemRef {
28802874
#[derive(Debug, HashStable_Generic)]
28812875
pub struct ImplItemRef {
28822876
pub id: ImplItemId,
2883-
#[stable_hasher(project(name))]
28842877
pub ident: Ident,
28852878
pub kind: AssocItemKind,
28862879
pub span: Span,
@@ -2919,7 +2912,6 @@ impl ForeignItemId {
29192912
#[derive(Debug, HashStable_Generic)]
29202913
pub struct ForeignItemRef {
29212914
pub id: ForeignItemId,
2922-
#[stable_hasher(project(name))]
29232915
pub ident: Ident,
29242916
pub span: Span,
29252917
}

src/test/incremental/hashes/trait_defs.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ trait TraitAddUnsafeModifier {
400400
#[cfg(not(any(cfail1,cfail4)))]
401401
#[rustc_clean(cfg="cfail2")]
402402
#[rustc_clean(cfg="cfail3")]
403-
#[rustc_clean(cfg="cfail5")]
403+
#[rustc_clean(except="hir_owner", cfg="cfail5")]
404404
#[rustc_clean(cfg="cfail6")]
405405
trait TraitAddUnsafeModifier {
406406
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
@@ -425,7 +425,7 @@ trait TraitAddExternModifier {
425425
#[cfg(not(any(cfail1,cfail4)))]
426426
#[rustc_clean(cfg="cfail2")]
427427
#[rustc_clean(cfg="cfail3")]
428-
#[rustc_clean(cfg="cfail5")]
428+
#[rustc_clean(except="hir_owner", cfg="cfail5")]
429429
#[rustc_clean(cfg="cfail6")]
430430
trait TraitAddExternModifier {
431431
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]

0 commit comments

Comments
 (0)