Skip to content

Investigate usages of #[stable_hasher(project(name))] #91921

Closed

Description

@Aaron1011

In several places, we use #[stable_hasher(project(name))] to skip hashing the Span of an Ident. For example:

#[derive(Debug, HashStable_Generic)]
pub struct PathSegment<'hir> {
/// The identifier portion of this path segment.
#[stable_hasher(project(name))]
pub ident: Ident,

It's not obvious why this is correct. Assuming that this isn't causing any issues with incr comp invalidation, then we should add comments explaining why this is the right thing to do.

Activity

  1. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    A-incr-compArea: Incremental compilation
    on Dec 14, 2021
  2. pierwill commented on Dec 14, 2021

    @pierwill
    Contributor

    @rustbot claim

  3. petrochenkov commented on Dec 15, 2021

    @petrochenkov
    Contributor

    IIRC, it was done purely as a bug-compatibility measure when Idents were introduced to HIR instead of Symbols to support hygiene.
    Hashing spans caused either incremental errors or perf regressions.
    This was long ago, so the issues preventing span hashing may be fixed now, we need to try to remove this annotations and check what happens.

  4. Aaron1011 commented on Dec 22, 2021

    @Aaron1011
    ContributorAuthor

    This is now causing a bug - since we now serialize the full AdtDef to disk, we may try to deserialize a stale ExpnId from a foreign crate, because we will incorrect end up thinking that an AdtDef is unchanged when one of its Span fields changes. See #92192

  5. Aaron1011 commented on Feb 6, 2022

    @Aaron1011
    ContributorAuthor

    This was fixed in #92534, #93095, and #92533

  6. pierwill commented on Feb 6, 2022

    @pierwill
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions