diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-03-07 10:00:22 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-03-07 11:24:23 +0000 |
| commit | a0efd7ebdbeefc16e58674afc83189ec0a550c2c (patch) | |
| tree | 8e105eadc7398cd7e618e88982c3e06f928444b8 /src | |
| parent | 61f1f4d21ec99b12f334490871e244f4f4a4988f (diff) | |
| download | rust-a0efd7ebdbeefc16e58674afc83189ec0a550c2c.tar.gz rust-a0efd7ebdbeefc16e58674afc83189ec0a550c2c.zip | |
Deduce that a name resolution fails (as opposed to being indeterminte) in more cases.
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_resolve/resolve_imports.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index a3076edef0f..b5e5114d895 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), |
