Skip to content

Commit

Permalink
Do not forget capacity when collecting def path hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
petrochenkov committed Aug 22, 2020
1 parent df57e28 commit 15643d5
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/librustc_metadata/rmeta/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1863,14 +1863,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
}

fn all_def_path_hashes_and_def_ids(&self) -> Vec<(DefPathHash, DefId)> {
let mut result = Vec::new();
let mut def_path_hashes = self.def_path_hash_cache.lock();
for index in 0..self.num_def_ids() {
let index = DefIndex::from_usize(index);
let def_path_hash = self.def_path_hash_unlocked(index, &mut def_path_hashes);
result.push((def_path_hash, self.local_def_id(index)));
}
result
(0..self.num_def_ids())
.map(|index| {
let index = DefIndex::from_usize(index);
(self.def_path_hash_unlocked(index, &mut def_path_hashes), self.local_def_id(index))
})
.collect()
}

/// Get the `DepNodeIndex` corresponding this crate. The result of this
Expand Down

0 comments on commit 15643d5

Please sign in to comment.