From dc216123830d75cffcb20f2b1350145b05409c4d Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Wed, 22 Jul 2020 15:11:25 -0400 Subject: [PATCH] Ignore `orig_id` for stable hashing This does not affect semantic equality, and was causing an enormous number of Span hash invalidations. --- src/librustc_span/hygiene.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/librustc_span/hygiene.rs b/src/librustc_span/hygiene.rs index c5ba42c57282..2bc38eab92a2 100644 --- a/src/librustc_span/hygiene.rs +++ b/src/librustc_span/hygiene.rs @@ -711,9 +711,16 @@ pub struct ExpnData { /// The raw that this `ExpnData` had in its original crate. /// An `ExpnData` can be created before being assigned an `ExpnId`, /// so this might be `None` until `set_expn_data` is called + // This is used only for serialization/deserialization purposes: + // two `ExpnData`s that differ only in their `orig_id` should + // be considered equivalent. + #[stable_hasher(ignore)] pub orig_id: Option, } +// This would require special handling of `orig_id` and `parent` +impl !PartialEq for ExpnData {} + impl ExpnData { /// Constructs expansion data with default properties. pub fn default(