From a0efd7ebdbeefc16e58674afc83189ec0a550c2c Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Mon, 7 Mar 2016 10:00:22 +0000 Subject: [PATCH] Deduce that a name resolution fails (as opposed to being indeterminte) in more cases. --- src/librustc_resolve/resolve_imports.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index a3076edef0f1..b5e5114d895e 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -155,6 +155,9 @@ impl<'a> NameResolution<'a> { fn result(&self, allow_private_imports: bool) -> ResolveResult<&'a NameBinding<'a>> { match self.binding { Some(binding) if !binding.defined_with(DefModifiers::GLOB_IMPORTED) => Success(binding), + // If we don't allow private imports and no public imports can define the name, fail. + _ if !allow_private_imports && self.pub_outstanding_references == 0 && + !self.binding.map(NameBinding::is_public).unwrap_or(false) => Failed(None), _ if self.outstanding_references > 0 => Indeterminate, Some(binding) => Success(binding), None => Failed(None),