diff options
author | Jonas Schievink <[email protected]> | 2021-04-05 02:50:10 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2021-04-05 02:50:10 +0100 |
commit | 7c0c713a102ee86ee32af115acba63a5c3b3a657 (patch) | |
tree | efa1f5aee1521d720bc6e83db26b53f00d7562a0 /crates/hir_def/src/item_tree | |
parent | adcf18e27dc04b60fede859f3d6c22b99d4fd513 (diff) |
Intern `GenericParams`
Also share the same instance between `ItemTree` and `generic_params`
query.
Diffstat (limited to 'crates/hir_def/src/item_tree')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index 0c8112dda..c5629af24 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs | |||
@@ -434,7 +434,7 @@ impl Ctx { | |||
434 | let mut res = Function { | 434 | let mut res = Function { |
435 | name, | 435 | name, |
436 | visibility, | 436 | visibility, |
437 | generic_params: GenericParamsId::EMPTY, | 437 | generic_params: Interned::new(GenericParams::default()), |
438 | abi, | 438 | abi, |
439 | params, | 439 | params, |
440 | ret_type: Interned::new(ret_type), | 440 | ret_type: Interned::new(ret_type), |
@@ -682,7 +682,7 @@ impl Ctx { | |||
682 | &mut self, | 682 | &mut self, |
683 | owner: GenericsOwner<'_>, | 683 | owner: GenericsOwner<'_>, |
684 | node: &impl ast::GenericParamsOwner, | 684 | node: &impl ast::GenericParamsOwner, |
685 | ) -> GenericParamsId { | 685 | ) -> Interned<GenericParams> { |
686 | // Generics are part of item headers and may contain inner items we need to collect. | 686 | // Generics are part of item headers and may contain inner items we need to collect. |
687 | if let Some(params) = node.generic_param_list() { | 687 | if let Some(params) = node.generic_param_list() { |
688 | self.collect_inner_items(params.syntax()); | 688 | self.collect_inner_items(params.syntax()); |
@@ -698,7 +698,7 @@ impl Ctx { | |||
698 | &mut self, | 698 | &mut self, |
699 | owner: GenericsOwner<'_>, | 699 | owner: GenericsOwner<'_>, |
700 | node: &impl ast::GenericParamsOwner, | 700 | node: &impl ast::GenericParamsOwner, |
701 | ) -> GenericParamsId { | 701 | ) -> Interned<GenericParams> { |
702 | let mut sm = &mut Default::default(); | 702 | let mut sm = &mut Default::default(); |
703 | let mut generics = GenericParams::default(); | 703 | let mut generics = GenericParams::default(); |
704 | match owner { | 704 | match owner { |
@@ -740,7 +740,7 @@ impl Ctx { | |||
740 | } | 740 | } |
741 | 741 | ||
742 | generics.shrink_to_fit(); | 742 | generics.shrink_to_fit(); |
743 | self.data().generics.alloc(generics) | 743 | Interned::new(generics) |
744 | } | 744 | } |
745 | 745 | ||
746 | fn lower_type_bounds(&mut self, node: &impl ast::TypeBoundsOwner) -> Vec<TypeBound> { | 746 | fn lower_type_bounds(&mut self, node: &impl ast::TypeBoundsOwner) -> Vec<TypeBound> { |