about summary refs log tree commit diff
path: root/compiler/rustc_resolve/src
diff options
context:
space:
mode:
authorYuki Okushi <yuki.okushi@huawei.com>2021-10-21 20:23:34 +0900
committerYuki Okushi <yuki.okushi@huawei.com>2021-10-21 20:25:45 +0900
commit3b2dd702fcdd70b81f2e6d217da3c715afc31012 (patch)
tree965018020c73b89f1a828ad98ad64a903fb0b395 /compiler/rustc_resolve/src
parent4626184cafa827e13cc7a71b183a704ee0ec5930 (diff)
downloadrust-3b2dd702fcdd70b81f2e6d217da3c715afc31012.tar.gz
rust-3b2dd702fcdd70b81f2e6d217da3c715afc31012.zip
Do not mention a reexported item if it's private
Diffstat (limited to 'compiler/rustc_resolve/src')
-rw-r--r--compiler/rustc_resolve/src/diagnostics.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs
index 63000a9d13d..e599bf4cab0 100644
--- a/compiler/rustc_resolve/src/diagnostics.rs
+++ b/compiler/rustc_resolve/src/diagnostics.rs
@@ -829,6 +829,15 @@ impl<'a> Resolver<'a> {
                     return;
                 }
 
+                // #90113: Do not count an inaccessible reexported item as a candidate.
+                if let NameBindingKind::Import { binding, .. } = name_binding.kind {
+                    if this.is_accessible_from(binding.vis, parent_scope.module)
+                        && !this.is_accessible_from(name_binding.vis, parent_scope.module)
+                    {
+                        return;
+                    }
+                }
+
                 // collect results based on the filter function
                 // avoid suggesting anything from the same module in which we are resolving
                 if ident.name == lookup_ident.name