Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-ty/src/infer.rs10
-rw-r--r--crates/hir/src/semantics.rs4
2 files changed, 7 insertions, 7 deletions
diff --git a/crates/hir-ty/src/infer.rs b/crates/hir-ty/src/infer.rs
index 68938ba804..ab173799bc 100644
--- a/crates/hir-ty/src/infer.rs
+++ b/crates/hir-ty/src/infer.rs
@@ -487,7 +487,8 @@ pub struct InferenceResult<'db> {
/// Whenever a tuple field expression access a tuple field, we allocate a tuple id in
/// [`InferenceContext`] and store the tuples substitution there. This map is the reverse of
/// that which allows us to resolve a [`TupleFieldId`]s type.
- tuple_field_access_types: FxHashMap<TupleId, Tys<'db>>,
+ #[update(unsafe(with(crate::utils::unsafe_update_eq /* thinvec is technically update */)))]
+ tuple_field_access_types: ThinVec<Tys<'db>>,
#[update(unsafe(with(crate::utils::unsafe_update_eq /* expr id is technically update */)))]
pub(crate) type_of_expr: ArenaMap<ExprId, Ty<'db>>,
@@ -685,7 +686,7 @@ impl<'db> InferenceResult<'db> {
}
pub fn tuple_field_access_type(&self, id: TupleId) -> Tys<'db> {
- self.tuple_field_access_types[&id]
+ self.tuple_field_access_types[id.0 as usize]
}
pub fn pat_adjustment(&self, id: PatId) -> Option<&[Ty<'db>]> {
@@ -1148,9 +1149,8 @@ impl<'body, 'db> InferenceContext<'body, 'db> {
pat_adjustments.shrink_to_fit();
result.tuple_field_access_types = tuple_field_accesses_rev
.into_iter()
- .enumerate()
- .map(|(idx, subst)| (TupleId(idx as u32), table.resolve_completely(subst)))
- .inspect(|(_, subst)| {
+ .map(|subst| table.resolve_completely(subst))
+ .inspect(|subst| {
*has_errors = *has_errors || subst.iter().any(|ty| ty.references_non_lt_error());
})
.collect();
diff --git a/crates/hir/src/semantics.rs b/crates/hir/src/semantics.rs
index ceda08a06d..82e60bff5e 100644
--- a/crates/hir/src/semantics.rs
+++ b/crates/hir/src/semantics.rs
@@ -1780,7 +1780,7 @@ impl<'db> SemanticsImpl<'db> {
let (body, source_map) = self.db.body_with_source_map(def);
let infer = InferenceResult::for_body(self.db, def);
let mut res = FxHashSet::default();
- unsafe_operations_for_body(self.db, &infer, def, &body, &mut |node| {
+ unsafe_operations_for_body(self.db, infer, def, &body, &mut |node| {
if let Ok(node) = source_map.expr_or_pat_syntax(node) {
res.insert(node);
}
@@ -1799,7 +1799,7 @@ impl<'db> SemanticsImpl<'db> {
return Vec::new();
};
let mut res = Vec::default();
- unsafe_operations(self.db, &infer, def, &body, block, &mut |node, _| {
+ unsafe_operations(self.db, infer, def, &body, block, &mut |node, _| {
if let Ok(node) = source_map.expr_or_pat_syntax(node) {
res.push(node);
}