aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/generics.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_def/src/generics.rs')
-rw-r--r--crates/hir_def/src/generics.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/hir_def/src/generics.rs b/crates/hir_def/src/generics.rs
index e02ac2c2f..d55c189d4 100644
--- a/crates/hir_def/src/generics.rs
+++ b/crates/hir_def/src/generics.rs
@@ -218,6 +218,7 @@ impl GenericParams {
218 GenericDefId::EnumVariantId(_) | GenericDefId::ConstId(_) => FileId(!0).into(), 218 GenericDefId::EnumVariantId(_) | GenericDefId::ConstId(_) => FileId(!0).into(),
219 }; 219 };
220 220
221 generics.shrink_to_fit();
221 (generics, InFile::new(file_id, sm)) 222 (generics, InFile::new(file_id, sm))
222 } 223 }
223 224
@@ -371,6 +372,14 @@ impl GenericParams {
371 }); 372 });
372 } 373 }
373 374
375 pub(crate) fn shrink_to_fit(&mut self) {
376 let Self { consts, lifetimes, types, where_predicates } = self;
377 consts.shrink_to_fit();
378 lifetimes.shrink_to_fit();
379 types.shrink_to_fit();
380 where_predicates.shrink_to_fit();
381 }
382
374 pub fn find_type_by_name(&self, name: &Name) -> Option<LocalTypeParamId> { 383 pub fn find_type_by_name(&self, name: &Name) -> Option<LocalTypeParamId> {
375 self.types 384 self.types
376 .iter() 385 .iter()