From: Guillaume Gomez Date: Sat, 30 Oct 2021 18:30:27 +0000 (+0200) Subject: Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=1a1f525bb0d9897673b2445122ffd6f7aa265c9e;p=rust.git Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov Improve and test cross-crate hygiene - Decode the parent expansion for traits and enums in `rustc_resolve`, this was already being used for resolution in typeck - Avoid suggesting importing names with def-site hygiene, since it's often not useful - Add more tests r? `@petrochenkov` --- 1a1f525bb0d9897673b2445122ffd6f7aa265c9e diff --cc compiler/rustc_resolve/src/diagnostics.rs index ccfab263bd4,aefb3f2cb9c..163acebccea --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@@ -831,17 -829,9 +831,18 @@@ 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 + // avoid suggesting anything with a hygienic name if ident.name == lookup_ident.name && ns == namespace && !ptr::eq(in_module, parent_scope.module)