Skip to content

Commit

Permalink
In resolve3, error on non-existent imports
Browse files Browse the repository at this point in the history
Closes #2937
  • Loading branch information
catamorphism committed Jul 19, 2012
1 parent de5d5e6 commit 3119afc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/rustc/middle/resolve3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1904,6 +1904,16 @@ class Resolver {
}
}

let i = import_resolution;
alt (i.module_target, i.value_target, i.type_target, i.impl_target) {
/*
If this name wasn't found in any of the four namespaces, it's
definitely unresolved
*/
(none, none, none, v) if v.len() == 0 { ret Failed; }
_ {}
}

assert import_resolution.outstanding_references >= 1u;
import_resolution.outstanding_references -= 1u;

Expand Down
10 changes: 10 additions & 0 deletions src/test/compile-fail/issue-2937.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// error-pattern:failed to resolve imports
// n.b. Can't use a //~ ERROR because there's a non-spanned error
// message.
import x = m::f;

mod m {
}

fn main() {
}

0 comments on commit 3119afc

Please sign in to comment.