From 3132a9e7fc5ec94e649b7a53ac8d10b2f0ec91cd Mon Sep 17 00:00:00 2001 From: Jake Heinz Date: Tue, 2 May 2023 08:19:59 +0000 Subject: [PATCH] fix: ide: exclude sized in go-to actions --- crates/hir/src/lib.rs | 3 ++- crates/ide/src/hover.rs | 11 +++++++++-- crates/ide/src/hover/tests.rs | 13 +++++++++++++ 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 145506a89df..4b1a716a228 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs @@ -44,7 +44,7 @@ generics::{LifetimeParamData, TypeOrConstParamData, TypeParamProvenance}, hir::{BindingAnnotation, BindingId, ExprOrPatId, LabelId, Pat}, item_tree::ItemTreeNode, - lang_item::{LangItem, LangItemTarget}, + lang_item::LangItemTarget, layout::ReprOptions, macro_id_to_def_id, nameres::{self, diagnostics::DefDiagnostic, ModuleOrigin}, @@ -114,6 +114,7 @@ data::adt::StructKind, find_path::PrefixKind, import_map, + lang_item::LangItem, nameres::ModuleSource, path::{ModPath, PathKind}, type_ref::{Mutability, TypeRef}, diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index 8e0aa9df147..c47f85b7bf9 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs @@ -6,7 +6,7 @@ use std::iter; use either::Either; -use hir::{HasSource, Semantics}; +use hir::{db::DefDatabase, HasSource, LangItem, Semantics}; use ide_db::{ base_db::FileRange, defs::{Definition, IdentClass, OperatorClass}, @@ -353,7 +353,14 @@ fn goto_type_action_for_def(db: &RootDatabase, def: Definition) -> Option it.ty(db), diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs index 082e5372d42..64df511e46e 100644 --- a/crates/ide/src/hover/tests.rs +++ b/crates/ide/src/hover/tests.rs @@ -2098,6 +2098,19 @@ struct S{ f1: T } ); } +#[test] +fn test_hover_generic_excludes_sized_go_to_action() { + check_actions( + r#" +//- minicore: sized +struct S(T); + "#, + expect![[r#" + [] + "#]], + ); +} + #[test] fn test_hover_generic_struct_has_flattened_goto_type_actions() { check_actions(