diff options
Diffstat (limited to 'crates/hir_def/src/item_tree')
-rw-r--r-- | crates/hir_def/src/item_tree/lower.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crates/hir_def/src/item_tree/lower.rs b/crates/hir_def/src/item_tree/lower.rs index ab7ad8310..45b099cf3 100644 --- a/crates/hir_def/src/item_tree/lower.rs +++ b/crates/hir_def/src/item_tree/lower.rs | |||
@@ -189,7 +189,7 @@ impl Ctx { | |||
189 | block_stack.push(self.source_ast_id_map.ast_id(&block)); | 189 | block_stack.push(self.source_ast_id_map.ast_id(&block)); |
190 | }, | 190 | }, |
191 | ast::Item(item) => { | 191 | ast::Item(item) => { |
192 | // FIXME: This triggers for macro calls in expression position | 192 | // FIXME: This triggers for macro calls in expression/pattern/type position |
193 | let mod_items = self.lower_mod_item(&item, true); | 193 | let mod_items = self.lower_mod_item(&item, true); |
194 | let current_block = block_stack.last(); | 194 | let current_block = block_stack.last(); |
195 | if let (Some(mod_items), Some(block)) = (mod_items, current_block) { | 195 | if let (Some(mod_items), Some(block)) = (mod_items, current_block) { |
@@ -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 { |
@@ -739,7 +739,8 @@ impl Ctx { | |||
739 | } | 739 | } |
740 | } | 740 | } |
741 | 741 | ||
742 | self.data().generics.alloc(generics) | 742 | generics.shrink_to_fit(); |
743 | Interned::new(generics) | ||
743 | } | 744 | } |
744 | 745 | ||
745 | 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> { |