Skip to content

Commit 6c439cd

Browse files
committed
---
yaml --- r: 273547 b: refs/heads/beta c: de970b1 h: refs/heads/master i: 273545: 2cdb9f2 273543: 36f99e3
1 parent 762d37d commit 6c439cd

File tree

2 files changed

+11
-17
lines changed

2 files changed

+11
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: 5a8845e40b6c973f9834dc6462bde7b8d3c03829
26+
refs/heads/beta: de970b1dff21f3e1913374d0794bf85511668667
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: e06d2ad9fcd5027bcaac5b08fc9aa39a49d0ecd3
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/librustc_resolve/resolve_imports.rs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,26 +141,20 @@ impl<'a> NameResolution<'a> {
141141
Ok(())
142142
}
143143

144-
// Returns the resolution of the name assuming no more globs will define it.
145-
fn result(&self, allow_private_imports: bool) -> ResolveResult<&'a NameBinding<'a>> {
146-
match self.binding {
147-
Some(binding) if !binding.defined_with(DefModifiers::GLOB_IMPORTED) => Success(binding),
148-
// If we don't allow private imports and no public imports can define the name, fail.
149-
_ if !allow_private_imports && self.pub_outstanding_references == 0 &&
150-
!self.binding.map(NameBinding::is_public).unwrap_or(false) => Failed(None),
151-
_ if self.outstanding_references > 0 => Indeterminate,
152-
Some(binding) => Success(binding),
153-
None => Failed(None),
154-
}
155-
}
156-
157144
// Returns Some(the resolution of the name), or None if the resolution depends
158145
// on whether more globs can define the name.
159146
fn try_result(&self, allow_private_imports: bool)
160147
-> Option<ResolveResult<&'a NameBinding<'a>>> {
161-
match self.result(allow_private_imports) {
162-
Failed(_) => None,
163-
result @ _ => Some(result),
148+
match self.binding {
149+
Some(binding) if !binding.defined_with(DefModifiers::GLOB_IMPORTED) =>
150+
Some(Success(binding)),
151+
// If (1) we don't allow private imports, (2) no public single import can define the
152+
// name, and (3) no public glob has defined the name, the resolution depends on globs.
153+
_ if !allow_private_imports && self.pub_outstanding_references == 0 &&
154+
!self.binding.map(NameBinding::is_public).unwrap_or(false) => None,
155+
_ if self.outstanding_references > 0 => Some(Indeterminate),
156+
Some(binding) => Some(Success(binding)),
157+
None => None,
164158
}
165159
}
166160

0 commit comments

Comments
 (0)