diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-04-05 03:29:09 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2021-04-05 03:29:09 +0100 |
commit | 58924cfae1be231e01736407fa666f31898a699e (patch) | |
tree | b5786d42ad1fa6dd64863079a00150ec7e426fa6 /crates/hir_ty/src/utils.rs | |
parent | 19e09a4a54c75312aeaac04577f2d0e067463ab6 (diff) | |
parent | 6f1ee9a7f4987d5286e6d875f544ce11f02465f3 (diff) |
Merge #8334
8334: Intern and shrink more data to reduce memory usage r=jonas-schievink a=jonas-schievink
bors r+
Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates/hir_ty/src/utils.rs')
-rw-r--r-- | crates/hir_ty/src/utils.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir_ty/src/utils.rs b/crates/hir_ty/src/utils.rs index b23e91b1b..df0ea4368 100644 --- a/crates/hir_ty/src/utils.rs +++ b/crates/hir_ty/src/utils.rs | |||
@@ -9,6 +9,7 @@ use hir_def::{ | |||
9 | generics::{ | 9 | generics::{ |
10 | GenericParams, TypeParamData, TypeParamProvenance, WherePredicate, WherePredicateTypeTarget, | 10 | GenericParams, TypeParamData, TypeParamProvenance, WherePredicate, WherePredicateTypeTarget, |
11 | }, | 11 | }, |
12 | intern::Interned, | ||
12 | path::Path, | 13 | path::Path, |
13 | resolver::{HasResolver, TypeNs}, | 14 | resolver::{HasResolver, TypeNs}, |
14 | type_ref::TypeRef, | 15 | type_ref::TypeRef, |
@@ -32,11 +33,10 @@ fn direct_super_traits(db: &dyn DefDatabase, trait_: TraitId) -> Vec<TraitId> { | |||
32 | .filter_map(|pred| match pred { | 33 | .filter_map(|pred| match pred { |
33 | WherePredicate::ForLifetime { target, bound, .. } | 34 | WherePredicate::ForLifetime { target, bound, .. } |
34 | | WherePredicate::TypeBound { target, bound } => match target { | 35 | | WherePredicate::TypeBound { target, bound } => match target { |
35 | WherePredicateTypeTarget::TypeRef(TypeRef::Path(p)) | 36 | WherePredicateTypeTarget::TypeRef(type_ref) => match &**type_ref { |
36 | if p == &Path::from(name![Self]) => | 37 | TypeRef::Path(p) if p == &Path::from(name![Self]) => bound.as_path(), |
37 | { | 38 | _ => None, |
38 | bound.as_path() | 39 | }, |
39 | } | ||
40 | WherePredicateTypeTarget::TypeParam(local_id) if Some(*local_id) == trait_self => { | 40 | WherePredicateTypeTarget::TypeParam(local_id) if Some(*local_id) == trait_self => { |
41 | bound.as_path() | 41 | bound.as_path() |
42 | } | 42 | } |
@@ -159,7 +159,7 @@ pub(crate) fn generics(db: &dyn DefDatabase, def: GenericDefId) -> Generics { | |||
159 | #[derive(Debug)] | 159 | #[derive(Debug)] |
160 | pub(crate) struct Generics { | 160 | pub(crate) struct Generics { |
161 | def: GenericDefId, | 161 | def: GenericDefId, |
162 | pub(crate) params: Arc<GenericParams>, | 162 | pub(crate) params: Interned<GenericParams>, |
163 | parent_generics: Option<Box<Generics>>, | 163 | parent_generics: Option<Box<Generics>>, |
164 | } | 164 | } |
165 | 165 | ||