Deduce that a name resolution fails (as opposed to being indeterminte) in more cases.

This commit is contained in:
Jeffrey Seyfried 2016-03-07 10:00:22 +00:00
parent 61f1f4d21e
commit a0efd7ebdb

View File

@ -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),