Skip to content

Commit d1deab5

Browse files
committed
Shrink WherePredicate by 8 bytes
1 parent c5ea5bf commit d1deab5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/tools/rust-analyzer/crates/hir-def/src/expr_store/lower/generics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ impl GenericParamsCollector {
227227
(_, TypeBound::Error | TypeBound::Use(_)) => return,
228228
(Either::Left(type_ref), bound) => match hrtb_lifetimes {
229229
Some(hrtb_lifetimes) => WherePredicate::ForLifetime {
230-
lifetimes: hrtb_lifetimes.to_vec().into_boxed_slice(),
230+
lifetimes: ThinVec::from_iter(hrtb_lifetimes.iter().cloned()),
231231
target: type_ref,
232232
bound,
233233
},

src/tools/rust-analyzer/crates/hir-def/src/hir/generics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use std::{ops, sync::LazyLock};
44
use hir_expand::name::Name;
55
use la_arena::{Arena, Idx, RawIdx};
66
use stdx::impl_from;
7+
use thin_vec::ThinVec;
78
use triomphe::Arc;
89

910
use crate::{
@@ -171,7 +172,7 @@ impl ops::Index<LocalLifetimeParamId> for GenericParams {
171172
pub enum WherePredicate {
172173
TypeBound { target: TypeRefId, bound: TypeBound },
173174
Lifetime { target: LifetimeRef, bound: LifetimeRef },
174-
ForLifetime { lifetimes: Box<[Name]>, target: TypeRefId, bound: TypeBound },
175+
ForLifetime { lifetimes: ThinVec<Name>, target: TypeRefId, bound: TypeBound },
175176
}
176177

177178
static EMPTY: LazyLock<Arc<GenericParams>> = LazyLock::new(|| {

0 commit comments

Comments
 (0)