We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 61f1f4d commit a0efd7eCopy full SHA for a0efd7e
src/librustc_resolve/resolve_imports.rs
@@ -155,6 +155,9 @@ impl<'a> NameResolution<'a> {
155
fn result(&self, allow_private_imports: bool) -> ResolveResult<&'a NameBinding<'a>> {
156
match self.binding {
157
Some(binding) if !binding.defined_with(DefModifiers::GLOB_IMPORTED) => Success(binding),
158
+ // If we don't allow private imports and no public imports can define the name, fail.
159
+ _ if !allow_private_imports && self.pub_outstanding_references == 0 &&
160
+ !self.binding.map(NameBinding::is_public).unwrap_or(false) => Failed(None),
161
_ if self.outstanding_references > 0 => Indeterminate,
162
Some(binding) => Success(binding),
163
None => Failed(None),
0 commit comments