Skip to content

Commit a0efd7e

Browse files
committed
Deduce that a name resolution fails (as opposed to being indeterminte) in more cases.
1 parent 61f1f4d commit a0efd7e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/librustc_resolve/resolve_imports.rs

+3
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ impl<'a> NameResolution<'a> {
155155
fn result(&self, allow_private_imports: bool) -> ResolveResult<&'a NameBinding<'a>> {
156156
match self.binding {
157157
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),
158161
_ if self.outstanding_references > 0 => Indeterminate,
159162
Some(binding) => Success(binding),
160163
None => Failed(None),

0 commit comments

Comments
 (0)