Unnamed repository; edit this file 'description' to name the repository.
-rw-r--r--crates/hir-ty/src/method_resolution/probe.rs5
-rw-r--r--crates/ide-completion/src/completions/dot.rs26
-rw-r--r--crates/ide-completion/src/tests/flyimport.rs2
3 files changed, 29 insertions, 4 deletions
diff --git a/crates/hir-ty/src/method_resolution/probe.rs b/crates/hir-ty/src/method_resolution/probe.rs
index 4b2f0cfd70..60344490d5 100644
--- a/crates/hir-ty/src/method_resolution/probe.rs
+++ b/crates/hir-ty/src/method_resolution/probe.rs
@@ -3,6 +3,7 @@
use std::{cell::RefCell, convert::Infallible, ops::ControlFlow};
+use base_db::FxIndexMap;
use hir_def::{
AssocItemId, FunctionId, GenericParamId, ImplId, ItemContainerId, TraitId,
hir::generics::GenericParams,
@@ -10,7 +11,7 @@ use hir_def::{
};
use hir_expand::name::Name;
use rustc_ast_ir::Mutability;
-use rustc_hash::{FxHashMap, FxHashSet};
+use rustc_hash::FxHashSet;
use rustc_type_ir::{
InferTy, TypeVisitableExt, Upcast, Variance,
elaborate::{self, supertrait_def_ids},
@@ -719,7 +720,7 @@ impl<'db> ProbeChoice<'db> for ProbeForNameChoice<'db> {
#[derive(Debug)]
struct ProbeAllChoice<'db> {
- candidates: RefCell<FxHashMap<CandidateId, CandidateWithPrivate<'db>>>,
+ candidates: RefCell<FxIndexMap<CandidateId, CandidateWithPrivate<'db>>>,
considering_visible_candidates: bool,
}
diff --git a/crates/ide-completion/src/completions/dot.rs b/crates/ide-completion/src/completions/dot.rs
index cc6df718ce..59c6c55c22 100644
--- a/crates/ide-completion/src/completions/dot.rs
+++ b/crates/ide-completion/src/completions/dot.rs
@@ -263,8 +263,8 @@ fn complete_methods(
}
}
};
- same_name.insert_entry(func);
if do_complete {
+ same_name.insert_entry(func);
(self.f)(func);
}
}
@@ -924,15 +924,39 @@ fn test(a: A) {
//- /dep.rs crate:dep
pub struct A {}
pub struct B {}
+pub struct C {}
+pub struct D {}
+pub struct E {}
+pub struct F {}
impl core::ops::Deref for A {
type Target = B;
fn deref(&self) -> &Self::Target { loop {} }
}
+impl core::ops::Deref for B {
+ type Target = C;
+ fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for C {
+ type Target = D;
+ fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for D {
+ type Target = E;
+ fn deref(&self) -> &Self::Target { loop {} }
+}
+impl core::ops::Deref for E {
+ type Target = F;
+ fn deref(&self) -> &Self::Target { loop {} }
+}
pub trait Foo { fn foo(&self) -> u32 {} }
impl Foo for A {}
impl Foo for B {}
impl A { fn foo(&self) -> u8 {} }
impl B { pub fn foo(&self) -> u16 {} }
+impl C { fn foo(&self) -> i8 {} }
+impl D { fn foo(&self) -> i16 {} }
+impl E { pub fn foo(&self) -> i32 {} }
+impl F { pub fn foo(&self) -> f32 {} }
//- /main.rs crate:main deps:dep
use dep::*;
fn test(a: A) {
diff --git a/crates/ide-completion/src/tests/flyimport.rs b/crates/ide-completion/src/tests/flyimport.rs
index 231623a42f..45db8ecfc6 100644
--- a/crates/ide-completion/src/tests/flyimport.rs
+++ b/crates/ide-completion/src/tests/flyimport.rs
@@ -781,9 +781,9 @@ fn main() {
}
"#,
expect![[r#"
- me random_method(…) (use dep::test_mod::TestTrait) fn(&self) DEPRECATED
ct SPECIAL_CONST (use dep::test_mod::TestTrait) u8 DEPRECATED
fn weird_function() (use dep::test_mod::TestTrait) fn() DEPRECATED
+ me random_method(…) (use dep::test_mod::TestTrait) fn(&self) DEPRECATED
"#]],
);
}