Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r--crates/ide/src/hover.rs14
1 files changed, 13 insertions, 1 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs
index 6b461a6268..87f666fa40 100644
--- a/crates/ide/src/hover.rs
+++ b/crates/ide/src/hover.rs
@@ -559,8 +559,20 @@ fn goto_type_action_for_def(
.for_each(|it| push_new_def(it.into()));
} else if let Definition::Function(function) = def {
walk_and_push_ty(db, &function.ret_type(db), &mut push_new_def);
+
+ let krate = function.module(db).krate();
+ let sized_trait =
+ db.lang_item(krate.into(), LangItem::Sized).and_then(|lang_item| lang_item.as_trait());
for param in function.params_without_self(db) {
- walk_and_push_ty(db, param.ty(), &mut push_new_def);
+ if let Some(type_param) = param.ty().as_type_param(db) {
+ type_param
+ .trait_bounds(db)
+ .into_iter()
+ .filter(|&it| Some(it.into()) != sized_trait)
+ .for_each(|it| push_new_def(it.into()));
+ } else {
+ walk_and_push_ty(db, param.ty(), &mut push_new_def);
+ }
}
} else {
let ty = match def {