Merge pull request #20219 from ChayimFriedman2/expr-store-mem
Some checks are pending
metrics / build_metrics (push) Waiting to run
metrics / generate_final_metrics (push) Blocked by required conditions
metrics / other_metrics (diesel-1.4.8) (push) Blocked by required conditions
metrics / other_metrics (hyper-0.14.18) (push) Blocked by required conditions
metrics / other_metrics (ripgrep-13.0.0) (push) Blocked by required conditions
metrics / other_metrics (self) (push) Blocked by required conditions
metrics / other_metrics (webrender-2022) (push) Blocked by required conditions
rustdoc / rustdoc (push) Waiting to run

perf: Put the expression stuff in the expression store behind an `Option<Box>`
This commit is contained in:
Chayim Refael Friedman 2025-07-11 14:25:39 +00:00 committed by GitHub
commit 4b29a9d6ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 456 additions and 308 deletions

View file

@ -242,11 +242,7 @@ impl<'db> SourceAnalyzer<'db> {
fn binding_id_of_pat(&self, pat: &ast::IdentPat) -> Option<BindingId> {
let pat_id = self.pat_id(&pat.clone().into())?;
if let Pat::Bind { id, .. } = self.store()?.pats[pat_id.as_pat()?] {
Some(id)
} else {
None
}
if let Pat::Bind { id, .. } = self.store()?[pat_id.as_pat()?] { Some(id) } else { None }
}
pub(crate) fn expr_adjustments(&self, expr: &ast::Expr) -> Option<&[Adjustment]> {
@ -995,7 +991,7 @@ impl<'db> SourceAnalyzer<'db> {
let parent_hir_path = path
.parent_path()
.and_then(|p| collector.lower_path(p, &mut ExprCollector::impl_trait_error_allocator));
let store = collector.store.finish();
let (store, _) = collector.store.finish();
// Case where path is a qualifier of a use tree, e.g. foo::bar::{Baz, Qux} where we are
// trying to resolve foo::bar.
@ -1204,7 +1200,7 @@ impl<'db> SourceAnalyzer<'db> {
let mut collector = ExprCollector::new(db, self.resolver.module(), self.file_id);
let hir_path =
collector.lower_path(path.clone(), &mut ExprCollector::impl_trait_error_allocator)?;
let store = collector.store.finish();
let (store, _) = collector.store.finish();
Some(resolve_hir_path_(
db,
&self.resolver,