Skip to content

Commit

Permalink
Auto merge of #16139 - jimmyhmiller:master, r=Veykril
Browse files Browse the repository at this point in the history
Make functions in impl have a container name

fixes #16015
  • Loading branch information
bors committed Jan 2, 2024
2 parents 7040cef + b67b352 commit df94a87
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 44 deletions.
11 changes: 7 additions & 4 deletions crates/hir/src/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use hir_def::{
TraitId,
};
use hir_expand::{HirFileId, InFile};
use hir_ty::db::HirDatabase;
use hir_ty::{db::HirDatabase, display::HirDisplay};
use syntax::{ast::HasName, AstNode, AstPtr, SmolStr, SyntaxNode, SyntaxNodePtr};

use crate::{Module, ModuleDef, Semantics};
Expand Down Expand Up @@ -231,9 +231,12 @@ impl<'a> SymbolCollector<'a> {

fn collect_from_impl(&mut self, impl_id: ImplId) {
let impl_data = self.db.impl_data(impl_id);
for &assoc_item_id in &impl_data.items {
self.push_assoc_item(assoc_item_id)
}
let impl_name = Some(SmolStr::new(impl_data.self_ty.display(self.db).to_string()));
self.with_container_name(impl_name, |s| {
for &assoc_item_id in &impl_data.items {
s.push_assoc_item(assoc_item_id)
}
})
}

fn collect_from_trait(&mut self, trait_id: TraitId) {
Expand Down
6 changes: 6 additions & 0 deletions crates/ide-db/src/symbol_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,12 @@ impl Struct {
fn impl_fn() {}
}
struct StructT<T>;
impl <T> StructT<T> {
fn generic_impl_fn() {}
}
trait Trait {
fn trait_fn(&self);
}
Expand Down

0 comments on commit df94a87

Please sign in to comment.