Skip to content

Commit 697b4d4

Browse files
Fix instability in SVH and DefPathHash computation.
1 parent a21a50b commit 697b4d4

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/librustc/hir/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl<'a, 'hir> NodeCollector<'a, 'hir> {
142142
});
143143

144144
let mut upstream_crates: Vec<_> = cstore.crates_untracked().iter().map(|&cnum| {
145-
let name = cstore.crate_name_untracked(cnum).as_str();
145+
let name = cstore.crate_name_untracked(cnum).as_str().to_owned();
146146
let disambiguator = cstore.crate_disambiguator_untracked(cnum)
147147
.to_fingerprint();
148148
let hash = cstore.crate_hash_untracked(cnum);

src/librustc/hir/map/definitions.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ impl DefKey {
220220
DefPathData::EnumVariant(name) |
221221
DefPathData::Field(name) |
222222
DefPathData::GlobalMetaData(name) => {
223-
name.hash(&mut hasher);
223+
(&name[..]).hash(&mut hasher);
224224
}
225225

226226
DefPathData::Impl |

src/librustc_trans_utils/symbol_names.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn get_symbol_hash<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
194194
}
195195

196196
if avoid_cross_crate_conflicts {
197-
hasher.hash(tcx.crate_name.as_str());
197+
hasher.hash(&tcx.crate_name.as_str()[..]);
198198
hasher.hash(tcx.sess.local_crate_disambiguator());
199199
}
200200
});

0 commit comments

Comments
 (0)