Repository: rust-analyzer/rust-analyzer
Pull request #11940 (2022-04-08 22:14:34)

minor: bump lsp-server version
bors r+


Patch:
diff --git a/Cargo.lock b/Cargo.lock
index 55cf7d638f..aeea1d9efa 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -869,9 +869,9 @@ dependencies = [
 
 [[package]]
 name = "lsp-server"
-version = "0.5.2"
+version = "0.6.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c351c75989da23b355226dc188dc2b52538a7f4f218d70fd7393c6b62b110444"
+checksum = "f70570c1c29cf6654029b8fe201a5507c153f0d85be6f234d471d756bc36775a"
 dependencies = [
  "crossbeam-channel",
  "log",
diff --git a/crates/hir_ty/src/lower.rs b/crates/hir_ty/src/lower.rs
index 24eff4cc9a..ca6241c5d1 100644
--- a/crates/hir_ty/src/lower.rs
+++ b/crates/hir_ty/src/lower.rs
@@ -14,7 +14,6 @@ use chalk_ir::interner::HasInterner;
 use chalk_ir::{cast::Cast, fold::Shift, Mutability, Safety};
 use hir_def::generics::TypeOrConstParamData;
 use hir_def::intern::Interned;
-use hir_def::lang_item::lang_attr;
 use hir_def::path::{ModPath, PathKind};
 use hir_def::type_ref::ConstScalarOrPath;
 use hir_def::{
@@ -864,23 +863,7 @@ impl<'a> TyLoweringContext<'a> {
         let trait_ref = match bound {
             TypeBound::Path(path, TraitBoundModifier::None) => {
                 bindings = self.lower_trait_ref_from_path(path, Some(self_ty));
-                bindings
-                    .clone()
-                    .filter(|tr| {
-                        // ignore `T: Drop` or `T: Destruct` bounds.
-                        // - `T: ~const Drop` has a special meaning in Rust 1.61 that we don't implement.
-                        //   (So ideally, we'd only ignore `~const Drop` here)
-                        // - `Destruct` impls are built-in in 1.62 (current nightlies as of 08-04-2022), so until
-                        //   the builtin impls are supported by Chalk, we ignore them here.
-                        if let Some(lang) = lang_attr(self.db.upcast(), tr.hir_trait_id()) {
-                            if lang == "drop" || lang == "destruct" {
-                                return false;
-                            }
-                        }
-                        true
-                    })
-                    .map(WhereClause::Implemented)
-                    .map(crate::wrap_empty_binders)
+                bindings.clone().map(WhereClause::Implemented).map(crate::wrap_empty_binders)
             }
             TypeBound::Path(path, TraitBoundModifier::Maybe) => {
                 let sized_trait = self
diff --git a/crates/ide_completion/src/completions/flyimport.rs b/crates/ide_completion/src/completions/flyimport.rs
index fb857aeccd..2154a1b3cb 100644
--- a/crates/ide_completion/src/completions/flyimport.rs
+++ b/crates/ide_completion/src/completions/flyimport.rs
@@ -1,5 +1,5 @@
 //! See [`import_on_the_fly`].
-use hir::{ItemInNs, ModuleDef};
+use hir::ItemInNs;
 use ide_db::imports::{
     import_assets::{ImportAssets, ImportCandidate, LocatedImport},
     insert_use::ImportScope,
@@ -9,7 +9,6 @@ use syntax::{AstNode, SyntaxNode, T};
 
 use crate::{
     context::{CompletionContext, PathKind},
-    patterns::ImmediateLocation,
     render::{render_resolution_with_import, RenderContext},
 };
 
@@ -171,13 +170,7 @@ pub(crate) fn import_on_the_fly(acc: &mut Completions, ctx: &CompletionContext)
             (PathKind::Pat, ItemInNs::Types(_)) => true,
             (PathKind::Pat, ItemInNs::Values(def)) => matches!(def, hir::ModuleDef::Const(_)),
 
-            (PathKind::Type, ItemInNs::Types(ty)) => {
-                if matches!(ctx.completion_location, Some(ImmediateLocation::TypeBound)) {
-                    matches!(ty, ModuleDef::Trait(_))
-                } else {
-                    true
-                }
-            }
+            (PathKind::Type, ItemInNs::Types(_)) => true,
             (PathKind::Type, ItemInNs::Values(_)) => false,
 
             (PathKind::Attr { .. }, ItemInNs::Macros(mac)) => mac.is_attr(ctx.db),
diff --git a/crates/ide_completion/src/completions/trait_impl.rs b/crates/ide_completion/src/completions/trait_impl.rs
index 13e05049e2..9c557aa524 100644
--- a/crates/ide_completion/src/completions/trait_impl.rs
+++ b/crates/ide_completion/src/completions/trait_impl.rs
@@ -36,13 +36,11 @@ use ide_db::{path_transform::PathTransform, traits::get_missing_assoc_items, Sym
 use syntax::{
     ast::{self, edit_in_place::AttrsOwnerEdit},
     display::function_declaration,
-    AstNode, SyntaxElement, SyntaxKind, SyntaxNode, TextRange, T,
+    AstNode, SyntaxElement, SyntaxKind, SyntaxNode, SyntaxToken, TextRange, T,
 };
 use text_edit::TextEdit;
 
-use crate::{
-    CompletionContext, CompletionItem, CompletionItemKind, CompletionRelevance, Completions,
-};
+use crate::{CompletionContext, CompletionItem, CompletionItemKind, Completions};
 
 #[derive(Copy, Clone, Debug, PartialEq, Eq)]
 enum ImplCompletionKind {
@@ -53,22 +51,22 @@ enum ImplCompletionKind {
 }
 
 pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext) {
-    if let Some((kind, replacement_range, impl_def)) = completion_match(ctx) {
+    if let Some((kind, trigger, impl_def)) = completion_match(ctx.token.clone()) {
         if let Some(hir_impl) = ctx.sema.to_def(&impl_def) {
             get_missing_assoc_items(&ctx.sema, &impl_def).into_iter().for_each(|item| {
                 match (item, kind) {
                     (
                         hir::AssocItem::Function(fn_item),
                         ImplCompletionKind::All | ImplCompletionKind::Fn,
-                    ) => add_function_impl(acc, ctx, replacement_range, fn_item, hir_impl),
+                    ) => add_function_impl(acc, ctx, &trigger, fn_item, hir_impl),
                     (
                         hir::AssocItem::TypeAlias(type_item),
                         ImplCompletionKind::All | ImplCompletionKind::TypeAlias,
-                    ) => add_type_alias_impl(acc, ctx, replacement_range, type_item),
+                    ) => add_type_alias_impl(acc, ctx, &trigger, type_item),
                     (
                         hir::AssocItem::Const(const_item),
                         ImplCompletionKind::All | ImplCompletionKind::Const,
-                    ) => add_const_impl(acc, ctx, replacement_range, const_item, hir_impl),
+                    ) => add_const_impl(acc, ctx, &trigger, const_item, hir_impl),
                     _ => {}
                 }
             });
@@ -76,79 +74,61 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext
     }
 }
 
-fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, TextRange, ast::Impl)> {
-    let token = ctx.token.clone();
-
+fn completion_match(mut token: SyntaxToken) -> Option<(ImplCompletionKind, SyntaxNode, ast::Impl)> {
     // For keyword without name like `impl .. { fn $0 }`, the current position is inside
     // the whitespace token, which is outside `FN` syntax node.
     // We need to follow the previous token in this case.
-    let mut token_before_ws = token.clone();
     if token.kind() == SyntaxKind::WHITESPACE {
-        token_before_ws = token.prev_token()?;
+        token = token.prev_token()?;
     }
 
-    let parent_kind = token_before_ws.parent().map_or(SyntaxKind::EOF, |it| it.kind());
-    if token.parent().map(|n| n.kind()) == Some(SyntaxKind::ASSOC_ITEM_LIST)
-        && matches!(
-            token_before_ws.kind(),
-            SyntaxKind::SEMICOLON | SyntaxKind::R_CURLY | SyntaxKind::L_CURLY
-        )
-    {
-        let impl_def = ast::Impl::cast(token.parent()?.parent()?)?;
-        let kind = ImplCompletionKind::All;
-        let replacement_range = TextRange::empty(ctx.position.offset);
-        Some((kind, replacement_range, impl_def))
-    } else {
-        let impl_item_offset = match token_before_ws.kind() {
-            // `impl .. { const $0 }`
-            // ERROR      0
-            //   CONST_KW <- *
-            T![const] => 0,
-            // `impl .. { fn/type $0 }`
-            // FN/TYPE_ALIAS  0
-            //   FN_KW        <- *
-            T![fn] | T![type] => 0,
-            // `impl .. { fn/type/const foo$0 }`
-            // FN/TYPE_ALIAS/CONST  1
-            //  NAME                0
-            //    IDENT             <- *
-            SyntaxKind::IDENT if parent_kind == SyntaxKind::NAME => 1,
-            // `impl .. { foo$0 }`
-            // MACRO_CALL       3
-            //  PATH            2
-            //    PATH_SEGMENT  1
-            //      NAME_REF    0
-            //        IDENT     <- *
-            SyntaxKind::IDENT if parent_kind == SyntaxKind::NAME_REF => 3,
-            _ => return None,
-        };
-
-        let impl_item = token_before_ws.ancestors().nth(impl_item_offset)?;
-        // Must directly belong to an impl block.
-        // IMPL
-        //   ASSOC_ITEM_LIST
-        //     <item>
-        let impl_def = ast::Impl::cast(impl_item.parent()?.parent()?)?;
-        let kind = match impl_item.kind() {
-            // `impl ... { const $0 fn/type/const }`
-            _ if token_before_ws.kind() == T![const] => ImplCompletionKind::Const,
-            SyntaxKind::CONST | SyntaxKind::ERROR => ImplCompletionKind::Const,
-            SyntaxKind::TYPE_ALIAS => ImplCompletionKind::TypeAlias,
-            SyntaxKind::FN => ImplCompletionKind::Fn,
-            SyntaxKind::MACRO_CALL => ImplCompletionKind::All,
-            _ => return None,
-        };
-
-        let replacement_range = replacement_range(ctx, &impl_item);
+    let parent_kind = token.parent().map_or(SyntaxKind::EOF, |it| it.kind());
+    let impl_item_offset = match token.kind() {
+        // `impl .. { const $0 }`
+        // ERROR      0
+        //   CONST_KW <- *
+        T![const] => 0,
+        // `impl .. { fn/type $0 }`
+        // FN/TYPE_ALIAS  0
+        //   FN_KW        <- *
+        T![fn] | T![type] => 0,
+        // `impl .. { fn/type/const foo$0 }`
+        // FN/TYPE_ALIAS/CONST  1
+        //  NAME                0
+        //    IDENT             <- *
+        SyntaxKind::IDENT if parent_kind == SyntaxKind::NAME => 1,
+        // `impl .. { foo$0 }`
+        // MACRO_CALL       3
+        //  PATH            2
+        //    PATH_SEGMENT  1
+        //      NAME_REF    0
+        //        IDENT     <- *
+        SyntaxKind::IDENT if parent_kind == SyntaxKind::NAME_REF => 3,
+        _ => return None,
+    };
 
-        Some((kind, replacement_range, impl_def))
-    }
+    let impl_item = token.ancestors().nth(impl_item_offset)?;
+    // Must directly belong to an impl block.
+    // IMPL
+    //   ASSOC_ITEM_LIST
+    //     <item>
+    let impl_def = ast::Impl::cast(impl_item.parent()?.parent()?)?;
+    let kind = match impl_item.kind() {
+        // `impl ... { const $0 fn/type/const }`
+        _ if token.kind() == T![const] => ImplCompletionKind::Const,
+        SyntaxKind::CONST | SyntaxKind::ERROR => ImplCompletionKind::Const,
+        SyntaxKind::TYPE_ALIAS => ImplCompletionKind::TypeAlias,
+        SyntaxKind::FN => ImplCompletionKind::Fn,
+        SyntaxKind::MACRO_CALL => ImplCompletionKind::All,
+        _ => return None,
+    };
+    Some((kind, impl_item, impl_def))
 }
 
 fn add_function_impl(
     acc: &mut Completions,
     ctx: &CompletionContext,
-    replacement_range: TextRange,
+    fn_def_node: &SyntaxNode,
     func: hir::Function,
     impl_def: hir::Impl,
 ) {
@@ -166,10 +146,9 @@ fn add_function_impl(
         CompletionItemKind::SymbolKind(SymbolKind::Function)
     };
 
-    let mut item = CompletionItem::new(completion_kind, replacement_range, label);
-    item.lookup_by(fn_name)
-        .set_documentation(func.docs(ctx.db))
-        .set_relevance(CompletionRelevance { is_item_from_trait: true, ..Default::default() });
+    let range = replacement_range(ctx, fn_def_node);
+    let mut item = CompletionItem::new(completion_kind, range, label);
+    item.lookup_by(fn_name).set_documentation(func.docs(ctx.db));
 
     if let Some(source) = ctx.sema.source(func) {
         let assoc_item = ast::AssocItem::Fn(source.value);
@@ -183,11 +162,11 @@ fn add_function_impl(
             match ctx.config.snippet_cap {
                 Some(cap) => {
                     let snippet = format!("{} {{\n    $0\n}}", function_decl);
-                    item.snippet_edit(cap, TextEdit::replace(replacement_range, snippet));
+                    item.snippet_edit(cap, TextEdit::replace(range, snippet));
                 }
                 None => {
                     let header = format!("{} {{", function_decl);
-                    item.text_edit(TextEdit::replace(replacement_range, header));
+                    item.text_edit(TextEdit::replace(range, header));
                 }
             };
             item.add_to(acc);
@@ -222,26 +201,25 @@ fn get_transformed_assoc_item(
 fn add_type_alias_impl(
     acc: &mut Completions,
     ctx: &CompletionContext,
-    replacement_range: TextRange,
+    type_def_node: &SyntaxNode,
     type_alias: hir::TypeAlias,
 ) {
     let alias_name = type_alias.name(ctx.db).to_smol_str();
 
-    let label = format!("type {} =", alias_name);
     let snippet = format!("type {} = ", alias_name);
 
-    let mut item = CompletionItem::new(SymbolKind::TypeAlias, replacement_range, label);
-    item.text_edit(TextEdit::replace(replacement_range, snippet))
+    let range = replacement_range(ctx, type_def_node);
+    let mut item = CompletionItem::new(SymbolKind::TypeAlias, range, &snippet);
+    item.text_edit(TextEdit::replace(range, snippet))
         .lookup_by(alias_name)
-        .set_documentation(type_alias.docs(ctx.db))
-        .set_relevance(CompletionRelevance { is_item_from_trait: true, ..Default::default() });
+        .set_documentation(type_alias.docs(ctx.db));
     item.add_to(acc);
 }
 
 fn add_const_impl(
     acc: &mut Completions,
     ctx: &CompletionContext,
-    replacement_range: TextRange,
+    const_def_node: &SyntaxNode,
     const_: hir::Const,
     impl_def: hir::Impl,
 ) {
@@ -256,17 +234,13 @@ fn add_const_impl(
                     _ => unreachable!(),
                 };
 
-                let label = make_const_compl_syntax(&transformed_const);
-                let snippet = format!("{} ", label);
+                let snippet = make_const_compl_syntax(&transformed_const);
 
-                let mut item = CompletionItem::new(SymbolKind::Const, replacement_range, label);
-                item.text_edit(TextEdit::replace(replacement_range, snippet))
+                let range = replacement_range(ctx, const_def_node);
+                let mut item = CompletionItem::new(SymbolKind::Const, range, &snippet);
+                item.text_edit(TextEdit::replace(range, snippet))
                     .lookup_by(const_name)
-                    .set_documentation(const_.docs(ctx.db))
-                    .set_relevance(CompletionRelevance {
-                        is_item_from_trait: true,
-                        ..Default::default()
-                    });
+                    .set_documentation(const_.docs(ctx.db));
                 item.add_to(acc);
             }
         }
@@ -293,7 +267,7 @@ fn make_const_compl_syntax(const_: &ast::Const) -> String {
 
     let syntax = const_.syntax().text().slice(range).to_string();
 
-    format!("{} =", syntax.trim_end())
+    format!("{} = ", syntax.trim_end())
 }
 
 fn replacement_range(ctx: &CompletionContext, item: &SyntaxNode) -> TextRange {
@@ -1013,38 +987,4 @@ where Self: SomeTrait<u32> {
 "#,
         )
     }
-
-    #[test]
-    fn works_directly_in_impl() {
-        check(
-            r#"
-trait Tr {
-    fn required();
-}
-
-impl Tr for () {
-    $0
-}
-"#,
-            expect![[r#"
-            fn fn required()
-        "#]],
-        );
-        check(
-            r#"
-trait Tr {
-    fn provided() {}
-    fn required();
-}
-
-impl Tr for () {
-    fn provided() {}
-    $0
-}
-"#,
-            expect![[r#"
-            fn fn required()
-        "#]],
-        );
-    }
 }
diff --git a/crates/ide_completion/src/item.rs b/crates/ide_completion/src/item.rs
index 2fa8f77264..8c73bcaab2 100644
--- a/crates/ide_completion/src/item.rs
+++ b/crates/ide_completion/src/item.rs
@@ -132,8 +132,6 @@ pub struct CompletionRelevance {
     /// }
     /// ```
     pub is_local: bool,
-    /// This is set when trait items are completed in an impl of that trait.
-    pub is_item_from_trait: bool,
     /// Set for method completions of the `core::ops` and `core::cmp` family.
     pub is_op_method: bool,
     /// Set for item completions that are private but in the workspace.
@@ -199,7 +197,6 @@ impl CompletionRelevance {
             exact_name_match,
             type_match,
             is_local,
-            is_item_from_trait,
             is_op_method,
             is_private_editable,
             postfix_match,
@@ -231,9 +228,6 @@ impl CompletionRelevance {
         if is_local {
             score += 1;
         }
-        if is_item_from_trait {
-            score += 1;
-        }
         if is_definite {
             score += 10;
         }
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index 5b0257f6b4..70ae6399f4 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -624,7 +624,6 @@ fn main() { let _: m::Spam = S$0 }
                                 Exact,
                             ),
                             is_local: false,
-                            is_item_from_trait: false,
                             is_op_method: false,
                             is_private_editable: false,
                             postfix_match: None,
@@ -647,7 +646,6 @@ fn main() { let _: m::Spam = S$0 }
                                 Exact,
                             ),
                             is_local: false,
-                            is_item_from_trait: false,
                             is_op_method: false,
                             is_private_editable: false,
                             postfix_match: None,
@@ -736,7 +734,6 @@ fn foo() { A { the$0 } }
                                 CouldUnify,
                             ),
                             is_local: false,
-                            is_item_from_trait: false,
                             is_op_method: false,
                             is_private_editable: false,
                             postfix_match: None,
diff --git a/crates/ide_db/src/traits.rs b/crates/ide_db/src/traits.rs
index 0fbfd86992..c8cb1a26a8 100644
--- a/crates/ide_db/src/traits.rs
+++ b/crates/ide_db/src/traits.rs
@@ -3,7 +3,10 @@
 use crate::RootDatabase;
 use hir::Semantics;
 use rustc_hash::FxHashSet;
-use syntax::{ast, AstNode};
+use syntax::{
+    ast::{self, HasName},
+    AstNode,
+};
 
 /// Given the `impl` block, attempts to find the trait this `impl` corresponds to.
 pub fn resolve_target_trait(
@@ -25,28 +28,32 @@ pub fn get_missing_assoc_items(
     sema: &Semantics<RootDatabase>,
     impl_def: &ast::Impl,
 ) -> Vec<hir::AssocItem> {
-    let imp = match sema.to_def(impl_def) {
-        Some(it) => it,
-        None => return vec![],
-    };
-
     // Names must be unique between constants and functions. However, type aliases
     // may share the same name as a function or constant.
     let mut impl_fns_consts = FxHashSet::default();
     let mut impl_type = FxHashSet::default();
 
-    for item in imp.items(sema.db) {
-        match item {
-            hir::AssocItem::Function(it) => {
-                impl_fns_consts.insert(it.name(sema.db).to_string());
-            }
-            hir::AssocItem::Const(it) => {
-                if let Some(name) = it.name(sema.db) {
-                    impl_fns_consts.insert(name.to_string());
+    if let Some(item_list) = impl_def.assoc_item_list() {
+        for item in item_list.assoc_items() {
+            match item {
+                ast::AssocItem::Fn(f) => {
+                    if let Some(n) = f.name() {
+                        impl_fns_consts.insert(n.syntax().to_string());
+                    }
                 }
-            }
-            hir::AssocItem::TypeAlias(it) => {
-                impl_type.insert(it.name(sema.db).to_string());
+
+                ast::AssocItem::TypeAlias(t) => {
+                    if let Some(n) = t.name() {
+                        impl_type.insert(n.syntax().to_string());
+                    }
+                }
+
+                ast::AssocItem::Const(c) => {
+                    if let Some(n) = c.name() {
+                        impl_fns_consts.insert(n.syntax().to_string());
+                    }
+                }
+                ast::AssocItem::MacroCall(_) => (),
             }
         }
     }
@@ -212,22 +219,5 @@ impl Foo {
 }"#,
             expect![[r#""#]],
         );
-
-        check_missing_assoc(
-            r#"
-trait Tr {
-    fn required();
-}
-macro_rules! m {
-    () => { fn required() {} };
-}
-impl Tr for () {
-    m!();
-    $0
-}
-
-            "#,
-            expect![[r#""#]],
-        );
     }
 }
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 87b4203e51..b193c4bae2 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -33,7 +33,7 @@ threadpool = "1.8.1"
 rayon = "1.5.1"
 num_cpus = "1.13.1"
 mimalloc = { version = "0.1.28", default-features = false, optional = true }
-lsp-server = "0.5.2"
+lsp-server = "0.6.0"
 tracing = "0.1.32"
 tracing-subscriber = { version = "0.3.9", default-features = false, features = [
     "env-filter",
diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs
index 8a7ee7e9c2..9f09af1ff7 100644
--- a/crates/rust-analyzer/src/dispatch.rs
+++ b/crates/rust-analyzer/src/dispatch.rs
@@ -1,6 +1,7 @@
 //! See [RequestDispatcher].
 use std::{fmt, panic, thread};
 
+use lsp_server::ExtractError;
 use serde::{de::DeserializeOwned, Serialize};
 
 use crate::{
@@ -234,7 +235,10 @@ impl<'a> NotificationDispatcher<'a> {
         };
         let params = match not.extract::<N::Params>(N::METHOD) {
             Ok(it) => it,
-            Err(not) => {
+            Err(ExtractError::JsonError { method, error }) => {
+                panic!("Invalid request\nMethod: {method}\n error: {error}",)
+            }
+            Err(ExtractError::MethodMismatch(not)) => {
                 self.not = Some(not);
                 return Ok(self);
             }
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 9b4f8b4333..02482d5889 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -256,7 +256,11 @@ impl GlobalState {
         self.send(request.into());
     }
     pub(crate) fn complete_request(&mut self, response: lsp_server::Response) {
-        let handler = self.req_queue.outgoing.complete(response.id.clone());
+        let handler = self
+            .req_queue
+            .outgoing
+            .complete(response.id.clone())
+            .expect("received response for unknown request");
         handler(self, response)
     }
 


Test patch:
diff --git a/crates/hir_ty/src/tests/regression.rs b/crates/hir_ty/src/tests/regression.rs
index a02ec6f85c..37f321a0f0 100644
--- a/crates/hir_ty/src/tests/regression.rs
+++ b/crates/hir_ty/src/tests/regression.rs
@@ -1505,82 +1505,3 @@ fn f(s: S) {
 "#,
     );
 }
-
-#[test]
-fn rust_161_option_clone() {
-    check_types(
-        r#"
-//- minicore: option, drop
-
-fn test(o: &Option<i32>) {
-    o.my_clone();
-  //^^^^^^^^^^^^ Option<i32>
-}
-
-pub trait MyClone: Sized {
-    fn my_clone(&self) -> Self;
-}
-
-impl<T> const MyClone for Option<T>
-where
-    T: ~const MyClone + ~const Drop + ~const Destruct,
-{
-    fn my_clone(&self) -> Self {
-        match self {
-            Some(x) => Some(x.my_clone()),
-            None => None,
-        }
-    }
-}
-
-impl const MyClone for i32 {
-    fn my_clone(&self) -> Self {
-        *self
-    }
-}
-
-pub trait Destruct {}
-
-impl<T: ?Sized> const Destruct for T {}
-"#,
-    );
-}
-
-#[test]
-fn rust_162_option_clone() {
-    check_types(
-        r#"
-//- minicore: option, drop
-
-fn test(o: &Option<i32>) {
-    o.my_clone();
-  //^^^^^^^^^^^^ Option<i32>
-}
-
-pub trait MyClone: Sized {
-    fn my_clone(&self) -> Self;
-}
-
-impl<T> const MyClone for Option<T>
-where
-    T: ~const MyClone + ~const Destruct,
-{
-    fn my_clone(&self) -> Self {
-        match self {
-            Some(x) => Some(x.my_clone()),
-            None => None,
-        }
-    }
-}
-
-impl const MyClone for i32 {
-    fn my_clone(&self) -> Self {
-        *self
-    }
-}
-
-#[lang = "destruct"]
-pub trait Destruct {}
-"#,
-    );
-}
diff --git a/crates/ide_completion/src/tests/flyimport.rs b/crates/ide_completion/src/tests/flyimport.rs
index 41e6cf7aee..b47a710006 100644
--- a/crates/ide_completion/src/tests/flyimport.rs
+++ b/crates/ide_completion/src/tests/flyimport.rs
@@ -1170,22 +1170,3 @@ struct Foo;
 "#,
     );
 }
-
-#[test]
-fn flyimport_in_type_bound_omits_types() {
-    check(
-        r#"
-mod module {
-    pub struct CompletemeStruct;
-    pub type CompletemeType = ();
-    pub enum CompletemeEnum {}
-    pub trait CompletemeTrait {}
-}
-
-fn f<T>() where T: Comp$0
-"#,
-        expect![[r#"
-            tt CompletemeTrait (use module::CompletemeTrait)
-        "#]],
-    );
-}
diff --git a/crates/ide_completion/src/tests/item_list.rs b/crates/ide_completion/src/tests/item_list.rs
index 0e60f74879..82824fd393 100644
--- a/crates/ide_completion/src/tests/item_list.rs
+++ b/crates/ide_completion/src/tests/item_list.rs
@@ -241,14 +241,11 @@ impl Test for () {
             kw fn
             kw const
             kw type
-            ta type Type1 =
-            ct const CONST1: () =
-            fn fn function1()
             kw self
             kw super
             kw crate
             md module
-            ma makro!(…)          macro_rules! makro
+            ma makro!(…)  macro_rules! makro
         "#]],
     );
 }