From 1fbe9e3460d3d306d1662590111949731244080d Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 24 Apr 2025 09:55:06 +0200 Subject: [PATCH] Arena allocate `LifetimeRef`s --- .../crates/hir-def/src/expr_store.rs | 26 +++++++++- .../crates/hir-def/src/expr_store/lower.rs | 52 +++++++++++++------ .../hir-def/src/expr_store/lower/generics.rs | 16 +++--- .../crates/hir-def/src/expr_store/path.rs | 4 +- .../crates/hir-def/src/expr_store/pretty.rs | 24 +++++---- .../crates/hir-def/src/hir/generics.rs | 4 +- .../crates/hir-def/src/hir/type_ref.rs | 19 ++++--- .../crates/hir-def/src/resolver.rs | 3 ++ .../crates/hir-ty/src/display.rs | 18 +++++-- .../rust-analyzer/crates/hir-ty/src/infer.rs | 4 +- .../crates/hir-ty/src/infer/expr.rs | 2 +- .../rust-analyzer/crates/hir-ty/src/lower.rs | 12 ++--- .../crates/hir-ty/src/lower/path.rs | 2 +- 13 files changed, 126 insertions(+), 60 deletions(-) diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs index 3141fceeb0ff..e3775c4931ae 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store.rs @@ -31,7 +31,7 @@ use crate::{ PatId, RecordFieldPat, Statement, }, nameres::DefMap, - type_ref::{PathId, TypeRef, TypeRefId}, + type_ref::{LifetimeRef, LifetimeRefId, PathId, TypeRef, TypeRefId}, }; pub use self::body::{Body, BodySourceMap}; @@ -87,6 +87,9 @@ pub type MacroCallPtr = AstPtr; pub type TypePtr = AstPtr; pub type TypeSource = InFile; +pub type LifetimePtr = AstPtr; +pub type LifetimeSource = InFile; + #[derive(Debug, Eq, PartialEq)] pub struct ExpressionStore { pub exprs: Arena, @@ -94,6 +97,7 @@ pub struct ExpressionStore { pub bindings: Arena, pub labels: Arena