Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-ty/src/mir.rs')
-rw-r--r--crates/hir-ty/src/mir.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/crates/hir-ty/src/mir.rs b/crates/hir-ty/src/mir.rs
index 2fa3f5e797..976f88601e 100644
--- a/crates/hir-ty/src/mir.rs
+++ b/crates/hir-ty/src/mir.rs
@@ -15,6 +15,7 @@ use rustc_type_ir::{
CollectAndApply, GenericTypeVisitable,
inherent::{GenericArgs as _, IntoKind, Ty as _},
};
+use salsa::Update;
use smallvec::{SmallVec, smallvec};
use stdx::impl_from;
@@ -318,7 +319,12 @@ impl<'db> PlaceRef<'db> {
pub fn store(&self) -> Place {
Place { local: self.local, projection: self.projection.store() }
}
- pub fn ty(&self, body: &MirBody, infcx: &InferCtxt<'db>, env: ParamEnv<'db>) -> PlaceTy<'db> {
+ pub fn ty(
+ &self,
+ body: &MirBody<'db>,
+ infcx: &InferCtxt<'db>,
+ env: ParamEnv<'db>,
+ ) -> PlaceTy<'db> {
PlaceTy::from_ty(body.locals[self.local].ty.as_ref()).multi_projection_ty(
infcx,
env,
@@ -1059,21 +1065,21 @@ pub struct BasicBlock {
pub is_cleanup: bool,
}
-#[derive(Debug, Clone, PartialEq, Eq)]
-pub struct MirBody {
+#[derive(Debug, Clone, PartialEq, Eq, Update)]
+pub struct MirBody<'db> {
pub basic_blocks: Arena<BasicBlock>,
pub locals: Arena<Local>,
pub start_block: BasicBlockId,
- pub owner: InferBodyId,
+ pub owner: InferBodyId<'db>,
pub binding_locals: ArenaMap<BindingId, LocalId>,
pub upvar_locals: FxHashMap<BindingId, Vec<(LocalId, crate::closure_analysis::Place)>>,
pub param_locals: Vec<LocalId>,
/// This field stores the closures directly owned by this body. It is used
/// in traversing every mir body.
- pub closures: Vec<InternedClosureId>,
+ pub closures: Vec<InternedClosureId<'db>>,
}
-impl MirBody {
+impl MirBody<'_> {
pub fn local_to_binding_map(&self) -> ArenaMap<LocalId, BindingId> {
self.binding_locals.iter().map(|(it, y)| (*y, it)).collect()
}