Skip to content

Commit a966fd3

Browse files
committed
---
yaml --- r: 273661 b: refs/heads/beta c: 8988c45 h: refs/heads/master i: 273659: bb7633f
1 parent a926868 commit a966fd3

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-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: 43dffc329402d99a93e224bba1a30f587c70dc7d
26+
refs/heads/beta: 8988c4538e30bce6985cc0b8458521d9a4a87277
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: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
397397
::std::mem::swap(&mut imports, &mut unresolved_imports);
398398

399399
for import_directive in imports {
400-
match self.resolve_import_for_module(&import_directive) {
400+
match self.resolve_import(&import_directive) {
401401
Failed(err) => {
402402
let (span, help) = match err {
403403
Some((span, msg)) => (span, format!(". {}", msg)),
@@ -411,7 +411,11 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
411411
});
412412
}
413413
Indeterminate => unresolved_imports.push(import_directive),
414-
Success(()) => {}
414+
Success(()) => {
415+
// Decrement the count of unresolved imports.
416+
assert!(self.resolver.unresolved_imports >= 1);
417+
self.resolver.unresolved_imports -= 1;
418+
}
415419
}
416420
}
417421
}
@@ -421,25 +425,19 @@ impl<'a, 'b:'a, 'tcx:'b> ImportResolver<'a, 'b, 'tcx> {
421425
/// don't know whether the name exists at the moment due to other
422426
/// currently-unresolved imports, or success if we know the name exists.
423427
/// If successful, the resolved bindings are written into the module.
424-
fn resolve_import_for_module(&mut self, directive: &'b ImportDirective) -> ResolveResult<()> {
428+
fn resolve_import(&mut self, directive: &'b ImportDirective) -> ResolveResult<()> {
425429
debug!("(resolving import for module) resolving import `{}::...` in `{}`",
426430
names_to_string(&directive.module_path),
427431
module_to_string(self.resolver.current_module));
428432

429-
self.resolver
430-
.resolve_module_path(&directive.module_path, DontUseLexicalScope, directive.span)
431-
// Once we have the module that contains the target, we can resolve the import.
432-
.and_then(|containing_module| self.resolve_import(containing_module, directive))
433-
.and_then(|()| {
434-
// Decrement the count of unresolved imports.
435-
assert!(self.resolver.unresolved_imports >= 1);
436-
self.resolver.unresolved_imports -= 1;
437-
Success(())
438-
})
439-
}
433+
let target_module = match self.resolver.resolve_module_path(&directive.module_path,
434+
DontUseLexicalScope,
435+
directive.span) {
436+
Success(module) => module,
437+
Indeterminate => return Indeterminate,
438+
Failed(err) => return Failed(err),
439+
};
440440

441-
fn resolve_import(&mut self, target_module: Module<'b>, directive: &'b ImportDirective)
442-
-> ResolveResult<()> {
443441
let (source, target, value_determined, type_determined) = match directive.subclass {
444442
SingleImport { source, target, ref value_determined, ref type_determined } =>
445443
(source, target, value_determined, type_determined),

0 commit comments

Comments
 (0)