Skip to content

Commit

Permalink
Auto merge of #92534 - Aaron1011:hash-hir, r=petrochenkov
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Jan 9, 2022
2 parents f7bb8e3 + 467b726 commit 092e1c9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
8 changes: 0 additions & 8 deletions compiler/rustc_hir/src/hir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ impl Path<'_> {
#[derive(Debug, HashStable_Generic)]
pub struct PathSegment<'hir> {
/// The identifier portion of this path segment.
#[stable_hasher(project(name))]
pub ident: Ident,
// `id` and `res` are optional. We currently only use these in save-analysis,
// any path segments without these will not have save-analysis info and
Expand Down Expand Up @@ -850,7 +849,6 @@ pub struct PatField<'hir> {
#[stable_hasher(ignore)]
pub hir_id: HirId,
/// The identifier for the field.
#[stable_hasher(project(name))]
pub ident: Ident,
/// The pattern the field is destructured to.
pub pat: &'hir Pat<'hir>,
Expand Down Expand Up @@ -2127,7 +2125,6 @@ pub const FN_OUTPUT_NAME: Symbol = sym::Output;
#[derive(Debug, HashStable_Generic)]
pub struct TypeBinding<'hir> {
pub hir_id: HirId,
#[stable_hasher(project(name))]
pub ident: Ident,
pub gen_args: &'hir GenericArgs<'hir>,
pub kind: TypeBindingKind<'hir>,
Expand Down Expand Up @@ -2515,7 +2512,6 @@ pub struct EnumDef<'hir> {
#[derive(Debug, HashStable_Generic)]
pub struct Variant<'hir> {
/// Name of the variant.
#[stable_hasher(project(name))]
pub ident: Ident,
/// Id of the variant (not the constructor, see `VariantData::ctor_hir_id()`).
pub id: HirId,
Expand Down Expand Up @@ -2605,7 +2601,6 @@ impl VisibilityKind<'_> {
#[derive(Debug, HashStable_Generic)]
pub struct FieldDef<'hir> {
pub span: Span,
#[stable_hasher(project(name))]
pub ident: Ident,
pub vis: Visibility<'hir>,
pub hir_id: HirId,
Expand Down Expand Up @@ -2864,7 +2859,6 @@ impl ItemKind<'_> {
#[derive(Encodable, Debug, HashStable_Generic)]
pub struct TraitItemRef {
pub id: TraitItemId,
#[stable_hasher(project(name))]
pub ident: Ident,
pub kind: AssocItemKind,
pub span: Span,
Expand All @@ -2880,7 +2874,6 @@ pub struct TraitItemRef {
#[derive(Debug, HashStable_Generic)]
pub struct ImplItemRef {
pub id: ImplItemId,
#[stable_hasher(project(name))]
pub ident: Ident,
pub kind: AssocItemKind,
pub span: Span,
Expand Down Expand Up @@ -2919,7 +2912,6 @@ impl ForeignItemId {
#[derive(Debug, HashStable_Generic)]
pub struct ForeignItemRef {
pub id: ForeignItemId,
#[stable_hasher(project(name))]
pub ident: Ident,
pub span: Span,
}
Expand Down
4 changes: 2 additions & 2 deletions src/test/incremental/hashes/trait_defs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ trait TraitAddUnsafeModifier {
#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(except="hir_owner", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
trait TraitAddUnsafeModifier {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
Expand All @@ -425,7 +425,7 @@ trait TraitAddExternModifier {
#[cfg(not(any(cfail1,cfail4)))]
#[rustc_clean(cfg="cfail2")]
#[rustc_clean(cfg="cfail3")]
#[rustc_clean(cfg="cfail5")]
#[rustc_clean(except="hir_owner", cfg="cfail5")]
#[rustc_clean(cfg="cfail6")]
trait TraitAddExternModifier {
#[rustc_clean(except="hir_owner,fn_sig", cfg="cfail2")]
Expand Down

0 comments on commit 092e1c9

Please sign in to comment.