about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2025-04-24 09:22:41 +0200
committerLukas Wirth <lukastw97@gmail.com>2025-04-24 09:23:00 +0200
commitd1deab56d17e3fdf07bfb09b0a4322155d364430 (patch)
treec05d65ea09bd82b8be5feaa75090f458cbef6546
parentc5ea5bf182a328e2ab9e093ad9b29799417e7858 (diff)
downloadrust-d1deab56d17e3fdf07bfb09b0a4322155d364430.tar.gz
rust-d1deab56d17e3fdf07bfb09b0a4322155d364430.zip
Shrink `WherePredicate` by 8 bytes
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs2
-rw-r--r--src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs3
2 files changed, 3 insertions, 2 deletions
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs
index 004bbe949f2..5cea8a24350 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs
@@ -227,7 +227,7 @@ impl GenericParamsCollector {
             (_, TypeBound::Error | TypeBound::Use(_)) => return,
             (Either::Left(type_ref), bound) => match hrtb_lifetimes {
                 Some(hrtb_lifetimes) => WherePredicate::ForLifetime {
-                    lifetimes: hrtb_lifetimes.to_vec().into_boxed_slice(),
+                    lifetimes: ThinVec::from_iter(hrtb_lifetimes.iter().cloned()),
                     target: type_ref,
                     bound,
                 },
diff --git a/src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs b/src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs
index 685847c9fdd..1bb9e48d559 100644
--- a/src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs
+++ b/src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs
@@ -4,6 +4,7 @@ use std::{ops, sync::LazyLock};
 use hir_expand::name::Name;
 use la_arena::{Arena, Idx, RawIdx};
 use stdx::impl_from;
+use thin_vec::ThinVec;
 use triomphe::Arc;
 
 use crate::{
@@ -171,7 +172,7 @@ impl ops::Index<LocalLifetimeParamId> for GenericParams {
 pub enum WherePredicate {
     TypeBound { target: TypeRefId, bound: TypeBound },
     Lifetime { target: LifetimeRef, bound: LifetimeRef },
-    ForLifetime { lifetimes: Box<[Name]>, target: TypeRefId, bound: TypeBound },
+    ForLifetime { lifetimes: ThinVec<Name>, target: TypeRefId, bound: TypeBound },
 }
 
 static EMPTY: LazyLock<Arc<GenericParams>> = LazyLock::new(|| {