Skip to content

Commit 6fbc75b

Browse files
committed
Stop ignoring Span field when hashing some Idents
This causes us to miss legitimate evaluatiosn (e.g. an upstream `ExpnId` no longer exists), leading to ICEs when decoding stale values from the incremental cache.
1 parent e100ec5 commit 6fbc75b

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 8 deletions
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
}

compiler/rustc_middle/src/ty/assoc.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ impl AssocItemContainer {
4343
#[derive(Copy, Clone, Debug, PartialEq, HashStable, Eq, Hash)]
4444
pub struct AssocItem {
4545
pub def_id: DefId,
46-
#[stable_hasher(project(name))]
4746
pub ident: Ident,
4847
pub kind: AssocKind,
4948
pub vis: Visibility,

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,6 @@ pub struct VariantDef {
15021502
/// If this variant is a struct variant, then this is `None`.
15031503
pub ctor_def_id: Option<DefId>,
15041504
/// Variant or struct name.
1505-
#[stable_hasher(project(name))]
15061505
pub ident: Ident,
15071506
/// Discriminant of this variant.
15081507
pub discr: VariantDiscr,
@@ -1598,7 +1597,6 @@ pub enum VariantDiscr {
15981597
#[derive(Debug, HashStable, TyEncodable, TyDecodable)]
15991598
pub struct FieldDef {
16001599
pub did: DefId,
1601-
#[stable_hasher(project(name))]
16021600
pub ident: Ident,
16031601
pub vis: Visibility,
16041602
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
macro_rules! make_struct {
2+
() => {
3+
pub struct Foo;
4+
}
5+
}
6+
7+
8+
#[cfg(rpass1)]
9+
make_struct!();
10+
11+
#[cfg(rpass2)]
12+
make_struct!();
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// aux-build:upstream.rs
2+
// revisions: rpass1 rpass2
3+
4+
extern crate upstream;
5+
6+
struct Wrapper;
7+
8+
impl Wrapper {
9+
fn bar() {
10+
let val: upstream::Foo;
11+
}
12+
}
13+
14+
fn main() {}

0 commit comments

Comments
 (0)