resolve: Do not suggest imports from the same module in which we are resolving
This commit is contained in:
parent
52f1847bca
commit
21fca7aae7
|
@ -629,7 +629,7 @@ impl<'a> Resolver<'a> {
|
|||
&mut self,
|
||||
lookup_ident: Ident,
|
||||
namespace: Namespace,
|
||||
_parent_scope: &ParentScope<'a>,
|
||||
parent_scope: &ParentScope<'a>,
|
||||
start_module: Module<'a>,
|
||||
crate_name: Ident,
|
||||
filter_fn: FilterFn,
|
||||
|
@ -656,7 +656,11 @@ impl<'a> Resolver<'a> {
|
|||
}
|
||||
|
||||
// collect results based on the filter function
|
||||
if ident.name == lookup_ident.name && ns == namespace {
|
||||
// avoid suggesting anything from the same module in which we are resolving
|
||||
if ident.name == lookup_ident.name
|
||||
&& ns == namespace
|
||||
&& !ptr::eq(in_module, parent_scope.module)
|
||||
{
|
||||
let res = name_binding.res();
|
||||
if filter_fn(res) {
|
||||
// create the path
|
||||
|
|
|
@ -3,11 +3,6 @@ error[E0574]: expected struct, variant or union type, found type parameter `T`
|
|||
|
|
||||
LL | let t = T { i: 0 };
|
||||
| ^ not a struct, variant or union type
|
||||
|
|
||||
help: consider importing this struct instead
|
||||
|
|
||||
LL | use T;
|
||||
|
|
||||
|
||||
error[E0599]: no function or associated item named `f` found for type parameter `Foo` in the current scope
|
||||
--> $DIR/lexical-scopes.rs:10:10
|
||||
|
|
|
@ -27,10 +27,6 @@ LL | pass_dollar_crate!();
|
|||
| ^^^^^^^^^^^^^^^^^^^^^ not found in `$crate`
|
||||
|
|
||||
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider importing this struct
|
||||
|
|
||||
LL | use ItemUse;
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
|
Loading…
Reference in New Issue