Skip to content

Commit 467b726

Browse files
committed
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.
1 parent ddabe07 commit 467b726

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>,
@@ -2113,7 +2111,6 @@ pub const FN_OUTPUT_NAME: Symbol = sym::Output;
21132111
#[derive(Debug, HashStable_Generic)]
21142112
pub struct TypeBinding<'hir> {
21152113
pub hir_id: HirId,
2116-
#[stable_hasher(project(name))]
21172114
pub ident: Ident,
21182115
pub gen_args: &'hir GenericArgs<'hir>,
21192116
pub kind: TypeBindingKind<'hir>,
@@ -2501,7 +2498,6 @@ pub struct EnumDef<'hir> {
25012498
#[derive(Debug, HashStable_Generic)]
25022499
pub struct Variant<'hir> {
25032500
/// Name of the variant.
2504-
#[stable_hasher(project(name))]
25052501
pub ident: Ident,
25062502
/// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`).
25072503
pub id: HirId,
@@ -2591,7 +2587,6 @@ impl VisibilityKind<'_> {
25912587
#[derive(Debug, HashStable_Generic)]
25922588
pub struct FieldDef<'hir> {
25932589
pub span: Span,
2594-
#[stable_hasher(project(name))]
25952590
pub ident: Ident,
25962591
pub vis: Visibility<'hir>,
25972592
pub hir_id: HirId,
@@ -2850,7 +2845,6 @@ impl ItemKind<'_> {
28502845
#[derive(Encodable, Debug, HashStable_Generic)]
28512846
pub struct TraitItemRef {
28522847
pub id: TraitItemId,
2853-
#[stable_hasher(project(name))]
28542848
pub ident: Ident,
28552849
pub kind: AssocItemKind,
28562850
pub span: Span,
@@ -2866,7 +2860,6 @@ pub struct TraitItemRef {
28662860
#[derive(Debug, HashStable_Generic)]
28672861
pub struct ImplItemRef {
28682862
pub id: ImplItemId,
2869-
#[stable_hasher(project(name))]
28702863
pub ident: Ident,
28712864
pub kind: AssocItemKind,
28722865
pub span: Span,
@@ -2905,7 +2898,6 @@ impl ForeignItemId {
29052898
#[derive(Debug, HashStable_Generic)]
29062899
pub struct ForeignItemRef {
29072900
pub id: ForeignItemId,
2908-
#[stable_hasher(project(name))]
29092901
pub ident: Ident,
29102902
pub span: Span,
29112903
}

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)