diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2021-10-21 23:08:57 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2021-10-21 23:08:57 +0200 |
| commit | 6f6fa8b9546e0b1005732caa774c39944325a63f (patch) | |
| tree | 946a09673616a259c9db9da45f4dc10e6fd295ef /compiler/rustc_query_system/src | |
| parent | e015ef5b2633960e7653b744d7a1c3d1d336313a (diff) | |
| download | rust-6f6fa8b9546e0b1005732caa774c39944325a63f.tar.gz rust-6f6fa8b9546e0b1005732caa774c39944325a63f.zip | |
Use SortedMap in HIR.
Diffstat (limited to 'compiler/rustc_query_system/src')
| -rw-r--r-- | compiler/rustc_query_system/src/ich/hcx.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_query_system/src/ich/impls_hir.rs | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/compiler/rustc_query_system/src/ich/hcx.rs b/compiler/rustc_query_system/src/ich/hcx.rs index cfef2073373..5f31fa04b8a 100644 --- a/compiler/rustc_query_system/src/ich/hcx.rs +++ b/compiler/rustc_query_system/src/ich/hcx.rs @@ -1,12 +1,12 @@ use crate::ich; use rustc_ast as ast; use rustc_data_structures::fx::FxHashSet; +use rustc_data_structures::sorted_map::SortedMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; use rustc_hir::definitions::{DefPathHash, Definitions}; -use rustc_index::vec::IndexVec; use rustc_session::cstore::CrateStore; use rustc_session::Session; use rustc_span::source_map::SourceMap; @@ -51,7 +51,7 @@ pub(super) enum BodyResolver<'tcx> { Traverse { hash_bodies: bool, owner: LocalDefId, - bodies: &'tcx IndexVec<hir::ItemLocalId, Option<&'tcx hir::Body<'tcx>>>, + bodies: &'tcx SortedMap<hir::ItemLocalId, &'tcx hir::Body<'tcx>>, }, } @@ -122,7 +122,7 @@ impl<'a> StableHashingContext<'a> { &mut self, hash_bodies: bool, owner: LocalDefId, - bodies: &'a IndexVec<hir::ItemLocalId, Option<&'a hir::Body<'a>>>, + bodies: &'a SortedMap<hir::ItemLocalId, &'a hir::Body<'a>>, f: impl FnOnce(&mut Self), ) { let prev = self.body_resolver; diff --git a/compiler/rustc_query_system/src/ich/impls_hir.rs b/compiler/rustc_query_system/src/ich/impls_hir.rs index 24f3a2e7de0..3a0aab81fdb 100644 --- a/compiler/rustc_query_system/src/ich/impls_hir.rs +++ b/compiler/rustc_query_system/src/ich/impls_hir.rs @@ -33,7 +33,7 @@ impl<'ctx> rustc_hir::HashStableContext for StableHashingContext<'ctx> { BodyResolver::Traverse { hash_bodies: false, .. } => {} BodyResolver::Traverse { hash_bodies: true, owner, bodies } => { assert_eq!(id.hir_id.owner, owner); - bodies[id.hir_id.local_id].unwrap().hash_stable(hcx, hasher); + bodies[&id.hir_id.local_id].hash_stable(hcx, hasher); } } } |
