smart_resolve_partial_mod_path_errors should not suggest parent

This commit is contained in:
yukang 2023-07-07 09:49:39 +08:00
parent 6f53e61887
commit 9763472e2b
4 changed files with 4 additions and 18 deletions

View file

@ -350,9 +350,10 @@ impl<'a: 'ast, 'ast, 'tcx> LateResolutionVisitor<'a, '_, 'ast, 'tcx> {
.filter(|candidate| {
if let Some(def_id) = candidate.did &&
let Some(module) = self.r.get_module(def_id) {
self.r.resolutions(module).borrow().iter().any(|(key, _r)| {
key.ident.name == following_seg.ident.name
})
Some(def_id) != self.parent_scope.module.opt_def_id() &&
self.r.resolutions(module).borrow().iter().any(|(key, _r)| {
key.ident.name == following_seg.ident.name
})
} else {
false
}

View file

@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo`
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
|
help: consider importing this module
|
LL + use crate::foo;
|
error: aborting due to previous error

View file

@ -3,11 +3,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `foo`
|
LL | pub fn bar() { foo::baz(); }
| ^^^ use of undeclared crate or module `foo`
|
help: consider importing this module
|
LL + use foo;
|
error: aborting due to previous error

View file

@ -36,11 +36,6 @@ error[E0433]: failed to resolve: use of undeclared crate or module `bar`
|
LL | pub fn bar() { bar::baz(); }
| ^^^ use of undeclared crate or module `bar`
|
help: consider importing this module
|
LL + use crate::bar;
|
error: aborting due to 4 previous errors