Skip to content

Commit 15643d5

Browse files
committed
Do not forget capacity when collecting def path hashes
1 parent df57e28 commit 15643d5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/librustc_metadata/rmeta/decoder.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -1863,14 +1863,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
18631863
}
18641864

18651865
fn all_def_path_hashes_and_def_ids(&self) -> Vec<(DefPathHash, DefId)> {
1866-
let mut result = Vec::new();
18671866
let mut def_path_hashes = self.def_path_hash_cache.lock();
1868-
for index in 0..self.num_def_ids() {
1869-
let index = DefIndex::from_usize(index);
1870-
let def_path_hash = self.def_path_hash_unlocked(index, &mut def_path_hashes);
1871-
result.push((def_path_hash, self.local_def_id(index)));
1872-
}
1873-
result
1867+
(0..self.num_def_ids())
1868+
.map(|index| {
1869+
let index = DefIndex::from_usize(index);
1870+
(self.def_path_hash_unlocked(index, &mut def_path_hashes), self.local_def_id(index))
1871+
})
1872+
.collect()
18741873
}
18751874

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

0 commit comments

Comments
 (0)