Skip to content

Commit 9999d76

Browse files
committed
Only inherit local hash for paths.
1 parent 027fa9e commit 9999d76

File tree

6 files changed

+21
-11
lines changed

6 files changed

+21
-11
lines changed

compiler/rustc_hir/src/definitions.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,9 @@ impl DefKey {
124124
pub(crate) fn compute_stable_hash(&self, parent: DefPathHash) -> DefPathHash {
125125
let mut hasher = StableHasher::new();
126126

127-
parent.hash(&mut hasher);
127+
// The new path is in the same crate as `parent`, and will contain the stable_crate_id.
128+
// Therefore, we only need to include information of the parent's local hash.
129+
parent.local_hash().hash(&mut hasher);
128130

129131
let DisambiguatedDefPathData { ref data, disambiguator } = self.disambiguated_data;
130132

tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-abort.diff

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
+ scope 1 (inlined <C as Call>::call) {
88
+ scope 2 (inlined <B<A> as Call>::call) {
99
+ scope 3 (inlined <A as Call>::call) {
10+
+ scope 4 (inlined <B<C> as Call>::call) {
11+
+ scope 5 (inlined <C as Call>::call) {
12+
+ }
13+
+ }
1014
+ }
1115
+ }
1216
+ }
1317

1418
bb0: {
1519
StorageLive(_1);
1620
- _1 = <C as Call>::call() -> [return: bb1, unwind unreachable];
17-
+ _1 = <B<C> as Call>::call() -> [return: bb1, unwind unreachable];
21+
+ _1 = <B<A> as Call>::call() -> [return: bb1, unwind unreachable];
1822
}
1923

2024
bb1: {

tests/mir-opt/inline/inline_cycle_generic.main.Inline.panic-unwind.diff

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@
77
+ scope 1 (inlined <C as Call>::call) {
88
+ scope 2 (inlined <B<A> as Call>::call) {
99
+ scope 3 (inlined <A as Call>::call) {
10+
+ scope 4 (inlined <B<C> as Call>::call) {
11+
+ scope 5 (inlined <C as Call>::call) {
12+
+ }
13+
+ }
1014
+ }
1115
+ }
1216
+ }
1317

1418
bb0: {
1519
StorageLive(_1);
1620
- _1 = <C as Call>::call() -> [return: bb1, unwind continue];
17-
+ _1 = <B<C> as Call>::call() -> [return: bb1, unwind continue];
21+
+ _1 = <B<A> as Call>::call() -> [return: bb1, unwind continue];
1822
}
1923

2024
bb1: {

tests/ui/symbol-names/basic.legacy.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: symbol-name(_ZN5basic4main17h9308686d0228fa1dE)
1+
error: symbol-name(_ZN5basic4main17hb18c7b259a12d985E)
22
--> $DIR/basic.rs:8:1
33
|
44
LL | #[rustc_symbol_name]
55
| ^^^^^^^^^^^^^^^^^^^^
66

7-
error: demangling(basic::main::h9308686d0228fa1d)
7+
error: demangling(basic::main::hb18c7b259a12d985)
88
--> $DIR/basic.rs:8:1
99
|
1010
LL | #[rustc_symbol_name]

tests/ui/symbol-names/issue-60925.legacy.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17h84ab5dafbd2a1508E)
1+
error: symbol-name(_ZN11issue_609253foo37Foo$LT$issue_60925..llv$u6d$..Foo$GT$3foo17hfe2c573d66599a45E)
22
--> $DIR/issue-60925.rs:21:9
33
|
44
LL | #[rustc_symbol_name]
55
| ^^^^^^^^^^^^^^^^^^^^
66

7-
error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::h84ab5dafbd2a1508)
7+
error: demangling(issue_60925::foo::Foo<issue_60925::llvm::Foo>::foo::hfe2c573d66599a45)
88
--> $DIR/issue-60925.rs:21:9
99
|
1010
LL | #[rustc_symbol_name]

tests/ui/thir-print/thir-tree-match.stdout

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ body:
9595
did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo)
9696
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
9797
flags: IS_ENUM
98-
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
98+
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 7476286994801853334 }
9999
args: []
100100
variant_index: 0
101101
subpatterns: [
@@ -109,7 +109,7 @@ body:
109109
did: DefId(0:3 ~ thir_tree_match[fcf8]::Bar)
110110
variants: [VariantDef { def_id: DefId(0:4 ~ thir_tree_match[fcf8]::Bar::First), ctor: Some((Const, DefId(0:5 ~ thir_tree_match[fcf8]::Bar::First::{constructor#0}))), name: "First", discr: Relative(0), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:6 ~ thir_tree_match[fcf8]::Bar::Second), ctor: Some((Const, DefId(0:7 ~ thir_tree_match[fcf8]::Bar::Second::{constructor#0}))), name: "Second", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:8 ~ thir_tree_match[fcf8]::Bar::Third), ctor: Some((Const, DefId(0:9 ~ thir_tree_match[fcf8]::Bar::Third::{constructor#0}))), name: "Third", discr: Relative(2), fields: [], flags: NO_VARIANT_FLAGS }]
111111
flags: IS_ENUM
112-
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 10333377570083945360 }
112+
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 6890530437387591414 }
113113
args: []
114114
variant_index: 0
115115
subpatterns: []
@@ -157,7 +157,7 @@ body:
157157
did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo)
158158
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
159159
flags: IS_ENUM
160-
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
160+
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 7476286994801853334 }
161161
args: []
162162
variant_index: 0
163163
subpatterns: [
@@ -209,7 +209,7 @@ body:
209209
did: DefId(0:10 ~ thir_tree_match[fcf8]::Foo)
210210
variants: [VariantDef { def_id: DefId(0:11 ~ thir_tree_match[fcf8]::Foo::FooOne), ctor: Some((Fn, DefId(0:12 ~ thir_tree_match[fcf8]::Foo::FooOne::{constructor#0}))), name: "FooOne", discr: Relative(0), fields: [FieldDef { did: DefId(0:13 ~ thir_tree_match[fcf8]::Foo::FooOne::0), name: "0", vis: Restricted(DefId(0:0 ~ thir_tree_match[fcf8])) }], flags: NO_VARIANT_FLAGS }, VariantDef { def_id: DefId(0:14 ~ thir_tree_match[fcf8]::Foo::FooTwo), ctor: Some((Const, DefId(0:15 ~ thir_tree_match[fcf8]::Foo::FooTwo::{constructor#0}))), name: "FooTwo", discr: Relative(1), fields: [], flags: NO_VARIANT_FLAGS }]
211211
flags: IS_ENUM
212-
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 3477539199540094892 }
212+
repr: ReprOptions { int: None, align: None, pack: None, flags: (empty), field_shuffle_seed: 7476286994801853334 }
213213
args: []
214214
variant_index: 1
215215
subpatterns: []

0 commit comments

Comments
 (0)